Mercurial > mm7
annotate Player.cpp @ 857:e4bd2a0bf08b
Слияние
author | Ritor1 |
---|---|
date | Sun, 31 Mar 2013 16:52:23 +0600 |
parents | 4d312db0730d 8fafe3645f36 |
children | f4394e320312 |
rev | line source |
---|---|
187 | 1 #include <assert.h> |
2 | |
0 | 3 #include "OSAPI.h" |
4 #include "Player.h" | |
5 #include "PlayerFrameTable.h" | |
6 #include "Texture.h" | |
7 #include "AudioPlayer.h" | |
8 #include "Party.h" | |
816 | 9 #include "Log.h" |
0 | 10 #include "LOD.h" |
11 #include "Monsters.h" | |
12 #include "GUIWindow.h" | |
13 #include "Viewport.h" | |
14 #include "Actor.h" | |
15 #include "Game.h" | |
16 #include "Mouse.h" | |
17 #include "TurnEngine.h" | |
18 #include "Events.h" | |
19 #include "Events2D.h" | |
20 #include "Outdoor.h" | |
21 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
22 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Awards.h" |
189 | 24 #include "texts.h" |
816 | 25 |
0 | 26 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
27 #include "MM7.h" |
0 | 28 |
29 | |
30 | |
31 | |
32 | |
33 | |
34 /* 381 */ | |
35 #pragma pack(push, 1) | |
290 | 36 struct PlayerCreation_AttributeProps |
0 | 37 { |
38 unsigned __int8 uBaseValue; | |
39 char uMaxValue; | |
40 char uDroppedStep; | |
41 char uBaseStep; | |
42 }; | |
43 #pragma pack(pop) | |
44 | |
45 | |
46 #pragma pack(push, 1) | |
290 | 47 |
48 | |
49 | |
0 | 50 #pragma pack(pop) |
290 | 51 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
52 { | |
53 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
54 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
55 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
56 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 57 }; |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 // available skills per class ( 9 classes X 37 skills ) | |
65 // 0 - not available | |
66 // 1 - available | |
67 // 2 - primary skill | |
68 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
69 { | |
70 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
71 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
72 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
73 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
74 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
75 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
76 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
77 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
78 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
79 }; | |
80 | |
81 | |
82 | |
83 | |
84 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
85 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
86 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
87 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
88 | |
89 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
90 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
91 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
92 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
93 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
94 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
95 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
96 | |
97 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
98 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
99 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
100 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
101 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
102 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
103 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
104 | |
105 unsigned int pAgeingTable[4] = {50, 100, 150, 65535}; | |
106 | |
107 unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; | |
108 | |
94 | 109 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 110 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
94 | 111 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; |
95 | 112 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; |
0 | 113 |
114 | |
115 | |
816 | 116 unsigned short base_recovery_times_per_weapon_type[12] = |
117 { | |
118 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
119 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
120 60, // PLAYER_SKILL_DAGGER | |
121 100, // PLAYER_SKILL_AXE | |
122 80, // PLAYER_SKILL_SPEAR | |
123 100, // PLAYER_SKILL_BOW | |
124 80, // PLAYER_SKILL_MACE | |
125 30, // PLAYER_SKILL_BLASTER | |
126 10, // PLAYER_SKILL_SHIELD | |
127 10, // PLAYER_SKILL_LEATHER | |
128 20, // PLAYER_SKILL_CHAIN | |
129 30 // PLAYER_SKILL_PLATE | |
130 }; | |
131 | |
132 | |
0 | 133 |
134 //----- (00490913) -------------------------------------------------------- | |
135 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
136 { | |
137 signed int v0; // edi@1 | |
138 signed int v1; // esi@1 | |
139 int v2; // ebx@2 | |
140 int v3; // ecx@17 | |
141 signed int v4; // eax@17 | |
142 int v5; // edx@18 | |
143 signed int v6; // ecx@18 | |
144 signed int v8; // [sp+Ch] [bp-8h]@1 | |
145 signed int v9; // [sp+10h] [bp-4h]@2 | |
146 | |
147 v8 = 50; | |
148 v0 = 50; | |
149 v1 = 0; | |
150 do | |
151 { | |
152 v9 = 0; | |
153 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
154 do | |
155 { | |
156 if ( v9 ) | |
157 { | |
158 switch ( v9 ) | |
159 { | |
160 case 1: | |
161 v0 = pParty->pPlayers[v1].uIntelligence; | |
162 break; | |
163 case 2: | |
164 v0 = pParty->pPlayers[v1].uWillpower; | |
165 break; | |
166 case 3: | |
167 v0 = pParty->pPlayers[v1].uEndurance; | |
168 break; | |
169 case 4: | |
170 v0 = pParty->pPlayers[v1].uAccuracy; | |
171 break; | |
172 case 5: | |
173 v0 = pParty->pPlayers[v1].uSpeed; | |
174 break; | |
175 case 6: | |
176 v0 = pParty->pPlayers[v1].uLuck; | |
177 break; | |
178 } | |
179 } | |
180 else | |
181 { | |
182 v0 = pParty->pPlayers[v1].uMight; | |
183 } | |
184 v3 = v2 + v9; | |
290 | 185 v4 = StatTable[0][v3].uBaseValue; |
0 | 186 if ( v0 >= v4 ) |
187 { | |
290 | 188 v5 = StatTable[0][v3].uDroppedStep; |
189 v6 = StatTable[0][v3].uBaseStep; | |
0 | 190 } |
191 else | |
192 { | |
290 | 193 v5 = StatTable[0][v3].uBaseStep; |
194 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 195 } |
196 v8 += v5 * (v4 - v0) / v6; | |
197 ++v9; | |
198 } | |
199 while ( v9 <= 6 ); | |
200 ++v1; | |
201 } | |
202 while ( v1 < 4 ); | |
203 return v8; | |
204 } | |
205 | |
206 | |
207 | |
208 //----- (00427730) -------------------------------------------------------- | |
209 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
210 { | |
488 | 211 if (sMana >= uRequiredMana) |
212 { | |
213 sMana -= uRequiredMana; | |
214 return true; | |
215 } | |
216 | |
217 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
218 return false; | |
0 | 219 } |
220 | |
221 | |
222 //----- (004BE2DD) -------------------------------------------------------- | |
223 void Player::_4BE2DD(unsigned int a2, int a3, int _2devent_idx) | |
224 { | |
225 Player *v4; // edi@1 | |
226 char *v5; // esi@1 | |
227 float v6; // ST04_4@1 | |
228 signed int v7; // eax@1 | |
229 signed int v8; // ebx@1 | |
230 | |
231 auto a4 = _2devent_idx; | |
232 v4 = this; | |
233 v5 = (char *)this + 36 * a3; | |
234 v6 = p2DEvents[a4 - 1].fPriceMultiplier; | |
235 //v6 = p2DEvents_minus1__20[13 * a4]; | |
236 v7 = ((ItemGen *)(v5 + 532))->GetValue(); | |
237 v8 = _4B8102(v7, v6); | |
238 if ( v5[552] & 2 ) | |
239 v8 = 1; | |
240 if ( v8 < 1 ) | |
241 v8 = 1; | |
242 RemoveItemAtInventoryIndex(a2); | |
243 Party::SetGold(pParty->uNumGold + v8); | |
244 } | |
245 | |
246 | |
247 | |
248 //----- (0043EEF3) -------------------------------------------------------- | |
249 bool Player::_43EEF3() | |
250 { | |
251 signed int v1; // esi@1 | |
252 PlayerEquipment *v2; // edx@1 | |
253 bool result; // eax@2 | |
254 | |
255 v1 = 0; | |
256 v2 = &this->pEquipment; | |
257 while ( 1 ) | |
258 { | |
259 result = v2->uOffHand; | |
260 if ( v2->uOffHand ) | |
261 { | |
232 | 262 result = *(int *)&this->pInventoryItems[result-1]; |
0 | 263 if ( result ) |
264 { | |
265 if ( result != 64 && result != 65 ) | |
266 break; | |
267 } | |
268 } | |
269 ++v1; | |
270 v2 = (PlayerEquipment *)((char *)v2 + 4); | |
271 if ( v1 >= 16 ) | |
272 { | |
273 LOBYTE(result) = 1; | |
274 return result; | |
275 } | |
276 } | |
277 LOBYTE(result) = 0; | |
278 return result; | |
279 } | |
280 | |
281 | |
282 | |
283 //----- (004B8040) -------------------------------------------------------- | |
284 int Player::_4B8040_condition_time(unsigned int uCondition) | |
285 { | |
286 return (unsigned int)((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 0x18 % 7 + 1; | |
287 } | |
288 | |
289 //----- (004B807C) -------------------------------------------------------- | |
290 int Player::_4B807C(float a2) | |
291 { | |
292 Player *v2; // edi@1 | |
293 unsigned int v3; // eax@1 | |
294 int v4; // esi@1 | |
295 unsigned int v5; // ebx@7 | |
296 int v6; // eax@8 | |
297 signed __int64 v7; // qax@13 | |
298 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
299 signed int v10; // [sp+8h] [bp-8h]@4 | |
300 int v11; // [sp+Ch] [bp-4h]@6 | |
301 | |
302 v2 = this; | |
303 v3 = GetMajorConditionIdx(); | |
304 v4 = 0; | |
305 if ( (signed int)v3 >= 14 ) | |
306 { | |
307 if ( (signed int)v3 <= 15 ) | |
308 { | |
309 v10 = 5; | |
310 v9 = v3; | |
311 goto LABEL_6; | |
312 } | |
313 if ( v3 == 16 ) | |
314 { | |
315 v10 = 10; | |
316 v9 = 16; | |
317 LABEL_6: | |
318 v11 = _4B8040_condition_time(v9); | |
319 goto LABEL_13; | |
320 } | |
321 } | |
322 v10 = 1; | |
323 v5 = 0; | |
324 do | |
325 { | |
326 v6 = _4B8040_condition_time(v5); | |
327 if ( v6 > v4 ) | |
328 v4 = v6; | |
329 ++v5; | |
330 } | |
331 while ( (signed int)v5 <= 13 ); | |
332 v11 = v4; | |
333 if ( !v4 ) | |
334 v11 = 1; | |
335 LABEL_13: | |
336 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
337 if ( (signed int)v7 < 1 ) | |
338 LODWORD(v7) = 1; | |
339 return v7; | |
340 } | |
341 | |
342 //----- (004B8102) -------------------------------------------------------- | |
343 int Player::_4B8102(int a2, float a3) | |
344 { | |
345 signed int v3; // esi@1 | |
346 signed int result; // eax@3 | |
347 | |
348 v3 = (unsigned __int64)(signed __int64)((double)a2 / (a3 + 2.0)) + a2 * GetMerchant() / 100; | |
349 if ( v3 > a2 ) | |
350 v3 = a2; | |
351 result = 1; | |
352 if ( v3 >= 1 ) | |
353 result = v3; | |
354 return result; | |
355 } | |
356 | |
357 //----- (004B8142) -------------------------------------------------------- | |
749 | 358 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
359 { | |
360 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
361 assert (price > 0); | |
362 | |
363 if (price < uRealValue) | |
364 price = uRealValue; | |
365 return price; | |
0 | 366 } |
367 | |
368 //----- (004B8179) -------------------------------------------------------- | |
369 int Player::_4B8179(float a2) | |
370 { | |
371 signed int v2; // esi@1 | |
372 int v3; // ecx@1 | |
373 signed int result; // eax@3 | |
374 | |
375 v2 = (signed __int64)(a2 * 50.0); | |
376 v3 = v2 * (100 - GetMerchant()) / 100; | |
377 if ( v3 < v2 / 3 ) | |
378 v3 = v2 / 3; | |
379 result = 1; | |
380 if ( v3 >= 1 ) | |
381 result = v3; | |
382 return result; | |
383 } | |
384 | |
385 //----- (004B81C3) -------------------------------------------------------- | |
386 int Player::_4B81C3(int a2, float a3) | |
387 { | |
388 signed int v3; // esi@1 | |
389 int v4; // ecx@1 | |
390 signed int result; // eax@3 | |
391 | |
392 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
393 v4 = v3 * (100 - GetMerchant()) / 100; | |
394 if ( v4 < v3 / 3 ) | |
395 v4 = v3 / 3; | |
396 result = 1; | |
397 if ( v4 >= 1 ) | |
398 result = v4; | |
399 return result; | |
400 } | |
401 | |
402 //----- (004B8213) -------------------------------------------------------- | |
403 int Player::_4B8213(int a2, float a3) | |
404 { | |
405 signed __int64 v3; // qax@1 | |
406 | |
407 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
408 if ( (signed int)v3 < 1 ) | |
409 LODWORD(v3) = 1; | |
410 return v3; | |
411 } | |
412 | |
413 //----- (004B8233) -------------------------------------------------------- | |
414 int Player::_4B8233(int a2, float a3) | |
415 { | |
416 signed __int64 v3; // qax@1 | |
417 | |
418 v3 = (signed __int64)((double)a2 * a3); | |
419 if ( (signed int)v3 < 1 ) | |
420 LODWORD(v3) = 1; | |
421 return v3; | |
422 } | |
423 | |
424 //----- (004B824B) -------------------------------------------------------- | |
425 int Player::_4B824B(float a2) | |
426 { | |
427 signed __int64 v2; // qax@1 | |
428 | |
429 v2 = (signed __int64)(a2 * 50.0); | |
430 if ( (signed int)v2 < 1 ) | |
431 LODWORD(v2) = 1; | |
432 return v2; | |
433 } | |
434 | |
435 //----- (004B8265) -------------------------------------------------------- | |
436 int Player::_4B8265(int a2, float a3) | |
437 { | |
438 signed __int64 v3; // qax@1 | |
439 | |
440 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
441 if ( (signed int)v3 < 1 ) | |
442 LODWORD(v3) = 1; | |
443 return v3; | |
444 } | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 //----- (004B6FF9) -------------------------------------------------------- | |
451 int Player::_4B6FF9() | |
452 { | |
453 Player *v1; // esi@1 | |
454 signed int v2; // eax@1 | |
455 char v3; // zf@4 | |
456 | |
457 v1 = this; | |
336 | 458 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
0 | 459 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) |
460 { | |
461 if ( GetMajorConditionIdx() == 18 ) | |
462 goto LABEL_6; | |
463 v3 = GetMajorConditionIdx() == 17; | |
464 } | |
465 else | |
466 { | |
467 v3 = GetMajorConditionIdx() == 18; | |
468 } | |
469 if ( !v3 ) | |
470 return 1; | |
471 LABEL_6: | |
472 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
473 return 1; | |
474 return 0; | |
475 } | |
476 | |
477 | |
478 | |
479 //----- (00421E75) -------------------------------------------------------- | |
480 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) | |
481 { | |
482 int v2; // eax@1 | |
483 unsigned int result; // eax@3 | |
484 | |
485 v2 = *a2; | |
486 if ( *a2 >= 126 || v2 < 0 ) | |
487 { | |
488 result = 0; | |
489 } | |
490 else | |
491 { | |
492 result = this->pInventoryIndices[v2]; | |
493 if ( (result & 0x80000000u) != 0 ) | |
494 { | |
495 *a2 = -1 - result; | |
496 result = this->pInventoryIndices[-1 - result]; | |
497 } | |
498 } | |
499 return result; | |
500 } | |
501 | |
502 | |
503 | |
504 //----- (004160CA) -------------------------------------------------------- | |
505 char Player::_4160CA(int a2) | |
506 { | |
507 Player *v2; // esi@1 | |
508 signed int v3; // edx@1 | |
509 signed int v4; // ebx@1 | |
510 ItemGen *v5; // eax@1 | |
511 int v6; // edi@2 | |
512 signed int i; // edx@8 | |
513 ItemGen **v8; // ecx@9 | |
514 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 | |
515 __int16 v11; // [sp+11Eh] [bp-6h]@1 | |
516 int v12; // [sp+120h] [bp-4h]@1 | |
517 | |
518 auto a1 = this; | |
519 | |
520 v12 = a2; | |
521 v2 = a1; | |
522 v3 = 0; | |
523 v10[0] = 0; | |
524 v4 = 0; | |
525 memset(&v10[1], 0, 0x110u); | |
526 v11 = 0; | |
527 v5 = a1->pInventoryItems; | |
528 do | |
529 { | |
530 v6 = 0; | |
531 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 ) | |
532 v10[v4++] = v3; | |
533 ++v3; | |
534 ++v5; | |
535 } | |
536 while ( v3 < 138 ); | |
537 if ( v4 ) | |
538 { | |
539 if ( v12 ) | |
540 { | |
541 if ( v12 > 0 ) | |
542 { | |
543 do | |
544 { | |
545 LOWORD(v5) = 9 * v10[v6]; | |
546 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) | |
547 { | |
548 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20); | |
549 v5->uItemID |= 2u; | |
550 } | |
551 ++v6; | |
552 } | |
553 while ( v6 < v12 ); | |
554 } | |
555 } | |
556 else | |
557 { | |
558 for ( i = 0; i < v4; ++i ) | |
559 { | |
560 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; | |
561 v5 = *v8; | |
562 if ( !(BYTE1(v5) & 2) ) | |
563 { | |
564 LOBYTE(v5) = (unsigned __int8)v5 | 2; | |
565 *v8 = v5; | |
566 } | |
567 } | |
568 } | |
569 } | |
570 return (char)v5; | |
571 } | |
572 | |
573 //----- (004948B1) -------------------------------------------------------- | |
187 | 574 void Player::PlaySound(PlayerSpeech speech, int a3) |
575 { | |
576 //Player *pPlayer; // edi@1 | |
577 //int v4; // eax@4 | |
0 | 578 signed int v5; // esi@4 |
203 | 579 unsigned char *v6; // ebx@4 |
0 | 580 signed int v7; // ecx@5 |
581 unsigned __int8 v8; // al@6 | |
582 int v9; // eax@10 | |
187 | 583 //unsigned int pVoiceID; // ecx@10 |
0 | 584 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
585 //signed int v12; // eax@11 |
0 | 586 signed int v13; // esi@12 |
587 int v14; // eax@12 | |
187 | 588 //int v15; // eax@17 |
248 | 589 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 590 signed int v17; // ecx@19 |
591 char *pSoundID; // edi@20 | |
592 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 593 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 594 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
595 int pSoundId; // [sp+30h] [bp+8h]@4 | |
596 | |
187 | 597 //pPlayer = this; |
598 //pPlayer2 = this; | |
599 | |
0 | 600 pPlayerNum = 1; |
187 | 601 for (int i = 0; i < 4; ++i) |
602 if (&pParty->pPlayers[i] == this) | |
603 { | |
604 pPlayerNum = i + 1; | |
0 | 605 break; |
187 | 606 } |
607 | |
608 //v4 = a2;//102 | |
0 | 609 v5 = 0; |
610 pSoundId = 0; | |
203 | 611 v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
612 if (uVoicesVolumeMultiplier) | |
0 | 613 { |
614 v7 = 0; | |
615 do | |
616 { | |
617 v8 = v6[v7]; | |
618 if ( v8 ) | |
619 v20[v5++] = v8; | |
620 ++v7; | |
621 } | |
622 while ( v7 < 2 ); | |
623 if ( v5 ) | |
624 { | |
625 v9 = rand(); | |
187 | 626 //pVoiceID = uVoiceID; |
0 | 627 v11 = v20[v9 % v5]; |
203 | 628 |
629 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
630 { | |
631 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
632 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 633 } |
634 } | |
635 } | |
203 | 636 |
0 | 637 v13 = 0; |
638 v14 = (int)(v6 + 3); | |
639 do | |
640 { | |
641 if ( *(char *)v14 ) | |
642 v20[v13++] = *(char *)v14; | |
643 ++v14; | |
644 } | |
645 while ( -3 - (signed int)v6 + v14 < 5 ); | |
646 if ( v13 ) | |
647 { | |
648 pPlayerNum = 0; | |
248 | 649 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
650 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 651 { |
652 v17 = 0; | |
764 | 653 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 654 { |
655 LABEL_23: | |
656 v17 = 0; | |
657 } | |
658 else | |
659 { | |
660 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
661 while ( *(int *)pSoundID != pSoundId ) | |
662 { | |
663 ++v17; | |
664 pSoundID += 120; | |
764 | 665 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 666 goto LABEL_23; |
667 } | |
668 } | |
669 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
670 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
671 } | |
248 | 672 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 673 } |
674 //return v14; | |
0 | 675 } |
676 // 4948B1: using guessed type int var_1C[5]; | |
677 | |
678 //----- (00494A25) -------------------------------------------------------- | |
187 | 679 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
680 { | |
681 //signed int v3; // eax@1 | |
682 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 683 signed int v5; // edi@15 |
684 PlayerFrame *v6; // esi@17 | |
685 signed int v7; // eax@20 | |
686 | |
187 | 687 //LOWORD(v3) = this->expression; |
688 //v4 = expr; | |
689 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
690 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
691 { | |
692 int v3 = (unsigned)expression; | |
0 | 693 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
694 { | |
695 if ( v3 <= 7 ) | |
696 goto LABEL_12; | |
697 if ( v3 > 8 ) | |
698 { | |
699 if ( v3 > 11 ) | |
700 { | |
187 | 701 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
702 return; | |
0 | 703 goto LABEL_15; |
704 } | |
705 LABEL_12: | |
187 | 706 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
707 return; | |
0 | 708 goto LABEL_15; |
709 } | |
710 } | |
711 } | |
712 LABEL_15: | |
187 | 713 //LOWORD(v3) = a3; |
0 | 714 v5 = 0; |
715 this->uExpressionTimeLength = a3; | |
716 this->uExpressionTimePassed = 0; | |
717 if ( !a3 ) | |
718 { | |
719 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
720 { | |
721 LABEL_20: | |
722 v7 = 0; | |
723 } | |
724 else | |
725 { | |
726 v6 = pPlayerFrameTable->pFrames; | |
187 | 727 while ( v6->expression != new_expression ) |
0 | 728 { |
729 ++v5; | |
730 ++v6; | |
731 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
732 goto LABEL_20; | |
733 } | |
734 v7 = v5; | |
735 } | |
187 | 736 //v4 = expr; |
737 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
738 } | |
739 expression = new_expression; | |
0 | 740 viewparams->bRedrawGameUI = 1; |
741 } | |
742 | |
743 //----- (0049327B) -------------------------------------------------------- | |
744 int Player::_49327B(unsigned int uClass, int a3) | |
745 { | |
746 Player *v3; // esi@1 | |
747 char v4; // zf@4 | |
748 __int16 v5; // dx@9 | |
749 signed int result; // eax@84 | |
750 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
751 int v8; // [sp-4h] [bp-Ch]@3 | |
752 | |
753 v3 = this; | |
135 | 754 if ( this->classType == uClass ) |
0 | 755 { |
756 LABEL_84: | |
757 result = 1; | |
758 } | |
759 else | |
760 { | |
761 switch ( uClass ) | |
762 { | |
763 case 0u: | |
764 v8 = a3; | |
765 v7 = 1; | |
766 goto LABEL_4; | |
767 case 1u: | |
484 | 768 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 769 || _49327B(2u, a3) ) |
770 goto LABEL_84; | |
771 v8 = a3; | |
772 v7 = 3; | |
773 goto LABEL_4; | |
774 case 2u: | |
775 v5 = 19; | |
776 goto LABEL_82; | |
777 case 3u: | |
778 v5 = 21; | |
779 goto LABEL_82; | |
780 case 4u: | |
781 v8 = a3; | |
782 v7 = 5; | |
783 goto LABEL_4; | |
784 case 5u: | |
484 | 785 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 786 || _49327B(6u, a3) ) |
787 goto LABEL_84; | |
788 v8 = a3; | |
789 v7 = 7; | |
790 goto LABEL_4; | |
791 case 6u: | |
792 if ( !a3 ) | |
793 break; | |
794 v5 = 13; | |
795 goto LABEL_82; | |
796 case 7u: | |
797 if ( !a3 ) | |
798 break; | |
799 v5 = 15; | |
800 goto LABEL_82; | |
801 case 8u: | |
802 v8 = a3; | |
803 v7 = 9; | |
804 goto LABEL_4; | |
805 case 9u: | |
484 | 806 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 807 || _49327B(0xAu, a3) ) |
808 goto LABEL_84; | |
809 v8 = a3; | |
810 v7 = 11; | |
811 goto LABEL_4; | |
812 case 0xAu: | |
813 if ( !a3 ) | |
814 break; | |
815 v5 = 25; | |
816 goto LABEL_82; | |
817 case 0xBu: | |
818 if ( !a3 ) | |
819 break; | |
820 v5 = 27; | |
821 goto LABEL_82; | |
822 case 0xCu: | |
823 v8 = a3; | |
824 v7 = 13; | |
825 goto LABEL_4; | |
826 case 0xDu: | |
484 | 827 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 828 || _49327B(0xEu, a3) ) |
829 goto LABEL_84; | |
830 v8 = a3; | |
831 v7 = 15; | |
832 goto LABEL_4; | |
833 case 0xEu: | |
834 if ( !a3 ) | |
835 break; | |
836 v5 = 43; | |
837 goto LABEL_82; | |
838 case 0xFu: | |
839 if ( !a3 ) | |
840 break; | |
841 v5 = 45; | |
842 goto LABEL_82; | |
843 case 0x10u: | |
844 v8 = a3; | |
845 v7 = 17; | |
846 goto LABEL_4; | |
847 case 0x11u: | |
484 | 848 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 849 || _49327B(0x12u, a3) ) |
850 goto LABEL_84; | |
851 v8 = a3; | |
852 v7 = 19; | |
853 goto LABEL_4; | |
854 case 0x12u: | |
855 if ( !a3 ) | |
856 break; | |
857 v5 = 37; | |
858 goto LABEL_82; | |
859 case 0x13u: | |
860 v5 = 39; | |
861 goto LABEL_82; | |
862 case 0x14u: | |
863 v8 = a3; | |
864 v7 = 21; | |
865 goto LABEL_4; | |
866 case 0x15u: | |
484 | 867 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 868 || _49327B(0x16u, a3) ) |
869 goto LABEL_84; | |
870 v8 = a3; | |
871 v7 = 23; | |
872 goto LABEL_4; | |
873 case 0x16u: | |
874 if ( !a3 ) | |
875 break; | |
876 v5 = 31; | |
877 goto LABEL_82; | |
878 case 0x17u: | |
879 if ( !a3 ) | |
880 break; | |
881 v5 = 33; | |
882 goto LABEL_82; | |
883 case 0x18u: | |
884 if ( !_49327B(0x19u, a3) ) | |
885 goto LABEL_56; | |
886 break; | |
887 case 0x19u: | |
888 LABEL_56: | |
484 | 889 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 890 || _49327B(0x1Au, a3) ) |
891 goto LABEL_84; | |
892 v8 = a3; | |
893 v7 = 27; | |
894 goto LABEL_4; | |
895 case 0x1Au: | |
896 if ( !a3 ) | |
897 break; | |
898 v5 = 65; | |
899 goto LABEL_82; | |
900 case 0x1Bu: | |
901 if ( !a3 ) | |
902 break; | |
903 v5 = 67; | |
904 goto LABEL_82; | |
905 case 0x1Cu: | |
906 v8 = a3; | |
907 v7 = 29; | |
908 goto LABEL_4; | |
909 case 0x1Du: | |
484 | 910 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 911 || _49327B(0x1Eu, a3) ) |
912 goto LABEL_84; | |
913 v8 = a3; | |
914 v7 = 31; | |
915 goto LABEL_4; | |
916 case 0x1Eu: | |
917 if ( !a3 ) | |
918 break; | |
919 v5 = 71; | |
920 goto LABEL_82; | |
921 case 0x1Fu: | |
922 if ( !a3 ) | |
923 break; | |
924 v5 = 73; | |
925 goto LABEL_82; | |
926 case 0x20u: | |
927 v8 = a3; | |
928 v7 = 33; | |
929 goto LABEL_4; | |
930 case 0x21u: | |
484 | 931 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 932 || _49327B(0x22u, a3) ) |
933 goto LABEL_84; | |
934 v8 = a3; | |
935 v7 = 35; | |
936 LABEL_4: | |
937 v4 = _49327B(v7, v8) == 0; | |
938 goto LABEL_83; | |
939 case 0x22u: | |
940 if ( !a3 ) | |
941 break; | |
942 v5 = 77; | |
943 goto LABEL_82; | |
944 case 0x23u: | |
945 if ( a3 ) | |
946 { | |
947 v5 = 79; | |
948 LABEL_82: | |
484 | 949 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 950 LABEL_83: |
951 if ( !v4 ) | |
952 goto LABEL_84; | |
953 } | |
954 break; | |
955 default: | |
956 break; | |
957 } | |
958 result = 0; | |
959 } | |
960 return result; | |
961 } | |
962 | |
963 | |
964 //----- (00492C0B) -------------------------------------------------------- | |
965 bool Player::CanAct() | |
966 { | |
967 bool result; // eax@2 | |
968 | |
969 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
970 result = 0; | |
971 else | |
972 result = 1; | |
973 return result; | |
974 } | |
975 | |
976 //----- (00492C40) -------------------------------------------------------- | |
977 bool Player::CanSteal() | |
978 { | |
979 int v1; // eax@1 | |
980 | |
981 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
982 return v1 != 0; | |
983 } | |
984 | |
985 //----- (00492C4E) -------------------------------------------------------- | |
986 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
987 { | |
988 char v2; // zf@9 | |
989 __int16 v4; // dx@13 | |
990 char v5; // zf@15 | |
991 | |
992 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ਪ 䠪, | |
993 // uItemID == 516 || // item221 䠪, | |
994 // uItemID == 524) // item325 ࠪ ५, | |
995 { | |
996 if ( uItemID == 533 ) | |
997 { | |
998 v2 = GetRace() == 1; | |
999 } | |
1000 else | |
1001 { | |
1002 if ( uItemID != 534 ) | |
1003 { | |
1004 if ( uItemID == 535 ) // | |
1005 // if (uItemID == 530) // item093 䠪, | |
1006 { | |
1007 switch ( this->uVoiceID ) | |
1008 { | |
1009 default: | |
1010 return 1; | |
1011 case 4u: | |
1012 case 5u: | |
1013 case 6u: | |
1014 case 7u: | |
1015 case 0xAu: | |
1016 case 0xBu: | |
1017 case 0xEu: // | |
1018 // if (uItemID == 535) // item129 䠪, 騭 | |
1019 case 0xFu: | |
1020 case 0x12u: | |
1021 case 0x13u: | |
1022 case 0x15u: | |
1023 case 0x18u: | |
1024 return 0; | |
1025 } | |
1026 return 0; | |
1027 } | |
1028 if ( uItemID == 536 ) // | |
1029 // if (uItemID == 531) // item093 䠪, 祫 | |
1030 { | |
1031 switch ( this->uVoiceID ) | |
1032 { | |
1033 case 4u: | |
1034 case 5u: | |
1035 case 6u: | |
1036 case 7u: | |
1037 case 0xAu: | |
1038 case 0xBu: | |
1039 case 0xEu: | |
1040 case 0xFu: | |
1041 case 0x12u: | |
1042 case 0x13u: | |
1043 case 0x15u: | |
1044 case 0x18u: | |
1045 return 1; | |
1046 default: | |
1047 return 0; | |
1048 } | |
1049 return 0; | |
1050 } | |
1051 if ( uItemID != 604 ) // | |
1052 // if (uItemID == 532) // item073 䨩᪠ 㣠 䠪, | |
1053 return 1; | |
1054 v5 = _43EEF3() == 0; | |
1055 goto LABEL_23; | |
1056 } | |
1057 v2 = GetRace() == 3; // | |
1058 // if (uItemID == 533) // item113 㪠 䠪, | |
1059 } | |
1060 } | |
1061 else | |
1062 { | |
1063 if ( uItemID != 532 ) | |
1064 { | |
1065 if ( uItemID != 515 && uItemID != 517 ) // | |
1066 // if (uItemID == 534) // item104 䠪, 稭 | |
1067 { | |
1068 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 䠪, | |
1069 // uItemID == 526) // item230 ࠢ ५, | |
1070 { | |
1071 LABEL_13: | |
1072 v4 = 99; | |
1073 LABEL_15: | |
484 | 1074 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1075 LABEL_23: |
1076 if ( !v5 ) | |
1077 return 1; | |
1078 return 0; | |
1079 } | |
1080 if ( uItemID != 525 ) | |
1081 { | |
1082 if ( uItemID != 527 ) | |
1083 { | |
1084 if ( uItemID != 531 ) | |
1085 return 1; | |
1086 v2 = GetRace() == 2; | |
1087 goto LABEL_10; | |
1088 } | |
1089 goto LABEL_13; | |
1090 } | |
1091 } | |
1092 v4 = 100; | |
1093 goto LABEL_15; | |
1094 } | |
1095 v2 = GetRace() == 0; | |
1096 } | |
1097 LABEL_10: | |
1098 if ( v2 ) | |
1099 return 1; | |
1100 return 0; | |
1101 } | |
1102 | |
1103 //----- (00492D65) -------------------------------------------------------- | |
1104 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1105 { | |
1106 Player *v3; // esi@1 | |
1107 Player **v4; // ebx@2 | |
1108 Player *v5; // ecx@21 | |
1109 Player *v6; // ecx@22 | |
1110 Player *v7; // ecx@29 | |
1111 Player *v8; // ecx@30 | |
1112 Player *v9; // ecx@37 | |
1113 Player *v10; // ecx@38 | |
1114 Player *v11; // ecx@45 | |
1115 Player *v12; // ecx@46 | |
1116 char *v13; // eax@49 | |
1117 Player *v14; // ecx@58 | |
1118 Player *v15; // ecx@59 | |
1119 Player *v16; // ecx@60 | |
1120 signed int result; // eax@76 | |
1121 signed int v18; // ecx@77 | |
1122 int v19; // eax@77 | |
1123 char v20; // al@80 | |
1124 signed int v21; // ebx@82 | |
1125 signed int v22; // esi@82 | |
1126 int v23; // [sp-8h] [bp-1Ch]@7 | |
1127 int v24; // [sp-8h] [bp-1Ch]@15 | |
1128 int v25; // [sp-8h] [bp-1Ch]@53 | |
1129 int v26; // [sp-4h] [bp-18h]@7 | |
1130 signed int v27; // [sp-4h] [bp-18h]@15 | |
1131 int v28; // [sp-4h] [bp-18h]@53 | |
1132 char *v29; // [sp+Ch] [bp-8h]@1 | |
1133 int v30; // [sp+10h] [bp-4h]@2 | |
1134 int v31; // [sp+20h] [bp+Ch]@82 | |
1135 | |
1136 v3 = this; | |
1137 v29 = (char *)this + 8 * uConditionIdx; | |
1138 if ( *(_QWORD *)v29 ) | |
1139 { | |
1140 LABEL_76: | |
1141 result = 0; | |
1142 } | |
1143 else | |
1144 { | |
1145 v4 = &pPlayers[1]; | |
1146 v30 = 0; | |
1147 do | |
1148 { | |
1149 if ( (*v4)->CanAct() ) | |
1150 ++v30; | |
1151 ++v4; | |
1152 } | |
1153 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
1154 switch ( uConditionIdx ) | |
1155 { | |
1156 case 0u: | |
1157 v26 = 0; | |
1158 v23 = 30; | |
1159 goto LABEL_81; | |
1160 case 1u: | |
1161 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1162 goto LABEL_10; | |
1163 v26 = 0; | |
1164 v23 = 25; | |
1165 goto LABEL_81; | |
1166 case 2u: | |
1167 if ( a3 != 1 ) | |
1168 goto LABEL_82; | |
1169 if ( v3->HasEnchantedItemEquipped(22) ) | |
1170 goto LABEL_76; | |
1171 v27 = 3; | |
1172 v24 = 505; | |
1173 goto LABEL_16; | |
1174 case 3u: | |
1175 v26 = 0; | |
1176 v23 = 26; | |
1177 goto LABEL_81; | |
1178 case 4u: | |
1179 v26 = 0; | |
1180 v23 = 31; | |
1181 goto LABEL_81; | |
1182 case 5u: | |
1183 if ( a3 == 1 | |
1184 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) | |
1185 goto LABEL_76; | |
1186 v26 = 0; | |
1187 v23 = 29; | |
1188 goto LABEL_81; | |
1189 case 6u: | |
1190 case 8u: | |
1191 case 0xAu: | |
1192 if ( a3 == 1 ) | |
1193 { | |
1194 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) | |
1195 { | |
1196 --pParty->pPartyBuffs[13].uPower; | |
1197 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1198 pParty->pPartyBuffs[13].Reset(); | |
1199 } | |
1200 if ( v3->HasEnchantedItemEquipped(21) | |
1201 || v7->WearsItem(505, 3) | |
1202 || v8->WearsItem(530, 6) ) | |
1203 goto LABEL_76; | |
1204 } | |
1205 v26 = 0; | |
1206 v23 = 27; | |
1207 goto LABEL_81; | |
1208 case 7u: | |
1209 case 9u: | |
1210 case 0xBu: | |
1211 if ( a3 != 1 ) | |
1212 goto LABEL_40; | |
1213 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1214 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1215 goto LABEL_10; | |
1216 if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) | |
1217 goto LABEL_76; | |
1218 LABEL_40: | |
1219 v26 = 0; | |
1220 v23 = 28; | |
1221 goto LABEL_81; | |
1222 case 0xCu: | |
1223 if ( a3 != 1 ) | |
1224 goto LABEL_82; | |
1225 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1226 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) | |
1227 goto LABEL_10; | |
1228 if ( v3->HasEnchantedItemEquipped(20) | |
1229 || v11->WearsItem(505, 3) | |
1230 || v12->WearsItem(507, 16) ) | |
1231 goto LABEL_76; | |
1232 v27 = 6; | |
1233 v24 = 530; | |
1234 LABEL_16: | |
1235 if ( v3->WearsItem(v24, v27) ) | |
1236 goto LABEL_76; | |
1237 goto LABEL_82; | |
1238 case 0xDu: | |
187 | 1239 v3->PlaySound(SPEECH_32, 0); |
0 | 1240 v13 = (char *)&v3->sHealth; |
1241 goto LABEL_70; | |
1242 case 0xEu: | |
1243 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1244 goto LABEL_10; | |
1245 v28 = 0; | |
1246 v25 = 33; | |
1247 goto LABEL_67; | |
1248 case 0xFu: | |
1249 if ( a3 == 1 | |
1250 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 | |
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) | |
1252 || v3->HasEnchantedItemEquipped(23) | |
1253 || v14->WearsItem(520, 16) | |
1254 || v15->WearsItem(505, 3) | |
1255 || v16->WearsItem(530, 6)) ) | |
1256 goto LABEL_76; | |
1257 v26 = 0; | |
1258 v23 = 34; | |
1259 goto LABEL_81; | |
1260 case 0x10u: | |
1261 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | |
1262 { | |
1263 LABEL_10: | |
1264 --pParty->pPartyBuffs[13].uPower; | |
1265 if ( pParty->pPartyBuffs[13].uPower < 1u ) | |
1266 pParty->pPartyBuffs[13].Reset(); | |
1267 goto LABEL_76; | |
1268 } | |
1269 v28 = 0; | |
187 | 1270 v25 = SPEECH_35; |
0 | 1271 LABEL_67: |
187 | 1272 v3->PlaySound((PlayerSpeech)v25, v28); |
0 | 1273 if ( v3->sHealth > 0 ) |
1274 v3->sHealth = 0; | |
1275 v13 = (char *)&v3->sMana; | |
1276 LABEL_70: | |
1277 if ( *(int *)v13 > 0 ) | |
1278 *(int *)v13 = 0; | |
1279 LABEL_82: | |
1280 v21 = 0; | |
1281 *(_QWORD *)v29 = pParty->uTimePlayed; | |
1282 v31 = 0; | |
1283 v22 = 1; | |
1284 do | |
1285 { | |
1286 if ( pPlayers[v22]->CanAct() ) | |
1287 { | |
1288 ++v31; | |
1289 v21 = v22; | |
1290 } | |
1291 ++v22; | |
1292 } | |
1293 while ( v22 <= 4 ); | |
1294 if ( v30 == 2 ) | |
1295 { | |
1296 if ( v31 == 1 ) | |
187 | 1297 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
0 | 1298 } |
1299 result = 1; | |
1300 break; | |
1301 case 0x11u: | |
135 | 1302 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1303 v3->Zombie() || !v3->Dead()) | |
0 | 1304 goto LABEL_76; |
1305 memset(v3, 0, 0xA0u); | |
1306 v3->sHealth = v3->GetMaxHealth(); | |
1307 v18 = 0; | |
1308 v3->field_1928 = v3->uFace; | |
1309 v19 = v3->uVoiceID; | |
1310 v3->sMana = 0; | |
1311 v3->field_1924 = v19; | |
1312 switch ( v19 ) | |
1313 { | |
1314 case 0: | |
1315 case 1: | |
1316 case 2: | |
1317 case 3: | |
1318 case 8: | |
1319 case 9: | |
1320 case 12: | |
1321 case 13: | |
1322 case 16: | |
1323 case 17: | |
1324 case 20: | |
1325 case 23: | |
1326 v18 = 0; | |
1327 break; | |
1328 case 4: | |
1329 case 5: | |
1330 case 6: | |
1331 case 7: | |
1332 case 10: | |
1333 case 11: | |
1334 case 14: | |
1335 case 15: | |
1336 case 18: | |
1337 case 19: | |
1338 case 21: | |
1339 case 24: | |
1340 v18 = 1; | |
1341 break; | |
1342 default: | |
1343 break; | |
1344 } | |
1345 v26 = 0; | |
1346 v20 = (v18 != 0) + 23; | |
187 | 1347 v23 = SPEECH_99; |
0 | 1348 v3->uFace = v20; |
1349 v3->uVoiceID = v20; | |
1350 LABEL_81: | |
187 | 1351 v3->PlaySound((PlayerSpeech)v23, v26); |
0 | 1352 goto LABEL_82; |
1353 default: | |
1354 goto LABEL_82; | |
1355 } | |
1356 } | |
1357 return result; | |
1358 } | |
1359 | |
1360 //----- (00492528) -------------------------------------------------------- | |
1361 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1362 { | |
1363 unsigned int v3; // eax@1 | |
1364 Texture *v4; // esi@1 | |
1365 unsigned int v5; // ebx@1 | |
1366 signed int v6; // edi@5 | |
1367 int *v7; // ecx@6 | |
1368 signed int v8; // edx@7 | |
1369 int *v9; // eax@8 | |
1370 Player *v11; // [sp+Ch] [bp-4h]@1 | |
1371 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 | |
1372 | |
1373 v11 = this; | |
1374 v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
203 | 1375 v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0); |
0 | 1376 v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24); |
1377 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); | |
1378 if ( !areWeLoadingTexture ) | |
1379 { | |
1380 v4->Release(); | |
1381 pIcons_LOD->_40F9C5(); | |
1382 } | |
1383 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1384 { | |
1385 v6 = 0; | |
1386 if ( (signed int)uItemIDa <= 0 ) | |
1387 return 1; | |
1388 v7 = &v11->pInventoryIndices[uSlot]; | |
1389 while ( 1 ) | |
1390 { | |
1391 v8 = 0; | |
1392 if ( (signed int)v5 > 0 ) | |
1393 break; | |
1394 LABEL_11: | |
1395 ++v6; | |
1396 v7 += 14; | |
1397 if ( v6 >= (signed int)uItemIDa ) | |
1398 return 1; | |
1399 } | |
1400 v9 = v7; | |
1401 while ( !*v9 ) | |
1402 { | |
1403 ++v8; | |
1404 ++v9; | |
1405 if ( v8 >= (signed int)v5 ) | |
1406 goto LABEL_11; | |
1407 } | |
1408 } | |
1409 return 0; | |
1410 } | |
1411 // 506128: using guessed type int areWeLoadingTexture; | |
1412 | |
1413 //----- (004925E6) -------------------------------------------------------- | |
1414 unsigned int Player::FindFreeInventorySlot() | |
1415 { | |
1416 unsigned int result; // eax@1 | |
1417 ItemGen *v2; // ecx@1 | |
1418 | |
1419 result = 0; | |
1420 v2 = this->pInventoryItems; | |
1421 while ( v2->uItemID ) | |
1422 { | |
1423 ++result; | |
1424 ++v2; | |
1425 if ( (signed int)result >= 126 ) | |
1426 return -1; | |
1427 } | |
1428 return result; | |
1429 } | |
1430 | |
1431 //----- (00492600) -------------------------------------------------------- | |
1432 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1433 { | |
1434 signed int v3; // edx@1 | |
1435 ItemGen *v4; // eax@1 | |
1436 int result; // eax@8 | |
1437 unsigned int v6; // ebx@10 | |
1438 unsigned int v7; // eax@10 | |
1439 Texture *v8; // esi@10 | |
1440 void *v9; // esi@13 | |
1441 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1442 Player *v11; // [sp+4h] [bp-8h]@1 | |
1443 signed int v12; // [sp+8h] [bp-4h]@4 | |
1444 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1445 | |
1446 v11 = this; | |
1447 v3 = 0; | |
1448 v4 = this->pInventoryItems; | |
1449 while ( v4->uItemID ) | |
1450 { | |
1451 ++v3; | |
1452 ++v4; | |
1453 if ( v3 >= 126 ) | |
1454 { | |
1455 v12 = -1; | |
1456 goto LABEL_5; | |
1457 } | |
1458 } | |
1459 v12 = v3; | |
1460 LABEL_5: | |
1461 if ( v12 == -1 ) | |
1462 { | |
1463 if ( uActiveCharacter ) | |
201 | 1464 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1465 result = 0; |
1466 } | |
1467 else | |
1468 { | |
1469 v6 = uItemID; | |
1470 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1471 v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); | |
1472 v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
1473 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); | |
1474 if ( !areWeLoadingTexture ) | |
1475 { | |
1476 v8->Release(); | |
1477 pIcons_LOD->_40F9C5(); | |
1478 } | |
1479 if ( (signed int)uItemIDa > 0 ) | |
1480 { | |
1481 v9 = &v11->pInventoryIndices[uSlot]; | |
1482 do | |
1483 { | |
1484 if ( (signed int)v10 > 0 ) | |
1485 memset32(v9, -1 - uSlot, v10); | |
1486 v9 = (char *)v9 + 56; | |
1487 --uItemIDa; | |
1488 } | |
1489 while ( uItemIDa ); | |
1490 } | |
1491 result = v12 + 1; | |
1492 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1493 v11->pInventoryItems[v12].uItemID = v6; | |
1494 } | |
1495 return result; | |
1496 } | |
1497 // 506128: using guessed type int areWeLoadingTexture; | |
1498 | |
1499 //----- (00492700) -------------------------------------------------------- | |
1500 int Player::HasSkill(unsigned int uSkillType) | |
1501 { | |
1502 signed int result; // eax@3 | |
1503 | |
1504 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1505 { | |
1506 result = 1; | |
1507 } | |
1508 else | |
1509 { | |
809 | 1510 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName); |
0 | 1511 ShowStatusBarString(pTmpBuf, 2u); |
1512 result = 0; | |
1513 } | |
1514 return result; | |
1515 } | |
1516 | |
1517 //----- (00492745) -------------------------------------------------------- | |
1518 int Player::WearItem(unsigned int uItemID) | |
1519 { | |
1520 signed int v2; // eax@1 | |
1521 ItemGen *v3; // edx@1 | |
1522 int v4; // edi@6 | |
1523 char *v5; // eax@6 | |
1524 char *v6; // esi@6 | |
1525 | |
1526 v2 = 0; | |
1527 v3 = this->pInventoryItems; | |
1528 while ( v3->uItemID ) | |
1529 { | |
1530 ++v2; | |
1531 ++v3; | |
1532 if ( v2 >= 126 ) | |
1533 { | |
1534 v2 = -1; | |
1535 break; | |
1536 } | |
1537 } | |
1538 if ( v2 != -1 ) | |
1539 { | |
1540 v4 = v2 + 1; | |
1541 v5 = (char *)this + 36 * v2; | |
1542 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; | |
1543 *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; | |
1544 *((int *)v5 + 133) = uItemID; | |
1545 v5[556] = *v6 + 1; | |
1546 } | |
1547 return 0; | |
1548 } | |
1549 | |
1550 //----- (004927A8) -------------------------------------------------------- | |
1551 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) | |
1552 { | |
1553 signed int v3; // ebx@2 | |
1554 signed int v4; // edi@3 | |
1555 unsigned int v5; // esi@3 | |
1556 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1557 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1558 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1559 | |
1560 thisa = this; | |
1561 if ( uSlot == -1 ) | |
1562 { | |
1563 v3 = 0; | |
1564 while ( 2 ) | |
1565 { | |
1566 v4 = 0; | |
1567 v5 = v3; | |
1568 do | |
1569 { | |
1570 if ( CanFitItem(v5, uItemID) ) | |
1571 { | |
1572 v8 = uItemID; | |
1573 v7 = v5; | |
1574 return CreateItemInInventory(v7, v8); | |
1575 } | |
1576 ++v4; | |
1577 v5 += 14; | |
1578 } | |
1579 while ( v4 < 9 ); | |
1580 ++v3; | |
1581 if ( v3 < 14 ) | |
1582 continue; | |
1583 break; | |
1584 } | |
1585 return 0; | |
1586 } | |
1587 if ( !CanFitItem(uSlot, uItemID) ) | |
1588 { | |
1589 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1590 return 0; | |
1591 } | |
1592 v8 = uItemID; | |
1593 v7 = uSlot; | |
1594 return CreateItemInInventory(v7, v8); | |
1595 } | |
1596 | |
1597 //----- (00492826) -------------------------------------------------------- | |
1598 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) | |
1599 { | |
1600 unsigned int v3; // ebx@1 | |
1601 unsigned int v4; // esi@3 | |
1602 signed int v5; // edi@3 | |
1603 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1604 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1605 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1606 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1607 | |
1608 thisa = this; | |
1609 v3 = Src->uItemID; | |
1610 pItemsTable->SetSpecialBonus(Src); | |
1611 if ( uSlot == -1 ) | |
1612 { | |
1613 uSlota = 0; | |
1614 while ( 2 ) | |
1615 { | |
1616 v4 = uSlota; | |
1617 v5 = 0; | |
1618 do | |
1619 { | |
1620 if ( CanFitItem(v4, v3) ) | |
1621 { | |
1622 v8 = Src; | |
1623 v7 = v4; | |
1624 return CreateItemInInventory2(v7, v8); | |
1625 } | |
1626 ++v5; | |
1627 v4 += 14; | |
1628 } | |
1629 while ( v5 < 14 ); | |
1630 ++uSlota; | |
1631 if ( uSlota < 9 ) | |
1632 continue; | |
1633 break; | |
1634 } | |
1635 return 0; | |
1636 } | |
1637 if ( !CanFitItem(uSlot, v3) ) | |
1638 return 0; | |
1639 v8 = Src; | |
1640 v7 = uSlot; | |
1641 return CreateItemInInventory2(v7, v8); | |
1642 } | |
1643 | |
1644 //----- (0049289C) -------------------------------------------------------- | |
1645 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1646 { | |
1647 signed int v3; // ebx@1 | |
1648 ItemGen *v4; // eax@1 | |
1649 int result; // eax@6 | |
1650 unsigned int v6; // eax@7 | |
1651 Texture *v7; // esi@7 | |
1652 unsigned int v8; // edx@9 | |
1653 void *v9; // esi@10 | |
1654 unsigned int v10; // [sp+4h] [bp-Ch]@7 | |
1655 unsigned int v11; // [sp+8h] [bp-8h]@7 | |
1656 Player *v12; // [sp+Ch] [bp-4h]@1 | |
1657 unsigned int uSlota; // [sp+18h] [bp+8h]@10 | |
1658 | |
1659 v12 = this; | |
1660 v3 = 0; | |
1661 v4 = this->pInventoryItems; | |
1662 while ( v4->uItemID ) | |
1663 { | |
1664 ++v3; | |
1665 ++v4; | |
1666 if ( v3 >= 126 ) | |
1667 { | |
1668 v3 = -1; | |
1669 break; | |
1670 } | |
1671 } | |
1672 if ( v3 == -1 ) | |
1673 { | |
1674 result = 0; | |
1675 } | |
1676 else | |
1677 { | |
1678 v6 = pIcons_LOD->LoadTexture( | |
1679 pItemsTable->pItems[Src->uItemID].pIconName, | |
1680 TEXTURE_16BIT_PALETTE); | |
1681 v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); | |
1682 v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); | |
1683 v11 = GetSizeInInventorySlots(v7->uTextureHeight); | |
1684 if ( !areWeLoadingTexture ) | |
1685 { | |
1686 v7->Release(); | |
1687 pIcons_LOD->_40F9C5(); | |
1688 } | |
1689 v8 = uSlot; | |
1690 if ( (signed int)v11 > 0 ) | |
1691 { | |
1692 uSlota = v11; | |
1693 v9 = &v12->pInventoryIndices[v8]; | |
1694 do | |
1695 { | |
1696 if ( (signed int)v10 > 0 ) | |
1697 memset32(v9, -1 - v8, v10); | |
1698 v9 = (char *)v9 + 56; | |
1699 --uSlota; | |
1700 } | |
1701 while ( uSlota ); | |
1702 } | |
1703 v12->pInventoryIndices[v8] = v3 + 1; | |
1704 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); | |
1705 result = v3 + 1; | |
1706 } | |
1707 return result; | |
1708 } | |
1709 // 506128: using guessed type int areWeLoadingTexture; | |
1710 | |
1711 //----- (0049298B) -------------------------------------------------------- | |
1712 bool Player::_49298B(ItemGen *a2, int a3, int a4) | |
1713 { | |
1714 Player *v4; // ebx@1 | |
1715 unsigned int v5; // eax@1 | |
1716 Texture *v6; // esi@1 | |
1717 void *v7; // esi@4 | |
1718 unsigned int v9; // [sp+Ch] [bp-4h]@1 | |
1719 unsigned int a2a; // [sp+18h] [bp+8h]@1 | |
1720 | |
1721 v4 = this; | |
1722 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1723 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1724 v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1725 a2a = GetSizeInInventorySlots(v6->uTextureHeight); | |
1726 if ( !areWeLoadingTexture ) | |
1727 { | |
1728 v6->Release(); | |
1729 pIcons_LOD->_40F9C5(); | |
1730 } | |
1731 if ( (signed int)a2a > 0 ) | |
1732 { | |
1733 v7 = &v4->pInventoryIndices[a4]; | |
1734 do | |
1735 { | |
1736 if ( (signed int)v9 > 0 ) | |
1737 memset32(v7, -1 - a4, v9); | |
1738 v7 = (char *)v7 + 56; | |
1739 --a2a; | |
1740 } | |
1741 while ( a2a ); | |
1742 } | |
1743 v4->pInventoryIndices[a4] = a3 + 1; | |
1744 return 1; | |
1745 } | |
278 | 1746 |
0 | 1747 // 506128: using guessed type int areWeLoadingTexture; |
1748 | |
1749 //----- (00492A36) -------------------------------------------------------- | |
1750 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) | |
1751 { | |
1752 int *pIndices; // edi@1 | |
1753 ItemGen *v3; // ecx@1 | |
1754 unsigned int v4; // esi@1 | |
1755 unsigned int v5; // eax@1 | |
1756 Texture *v6; // esi@1 | |
1757 unsigned int result; // eax@1 | |
1758 unsigned int v8; // ebp@1 | |
1759 void *v9; // edx@4 | |
1760 unsigned int uSlota; // [sp+14h] [bp+4h]@1 | |
1761 | |
1762 pIndices = &this->pInventoryIndices[uSlot]; | |
232 | 1763 v3 = &this->pInventoryItems[*pIndices-1]; |
0 | 1764 v4 = v3->uItemID; |
1765 v3->Reset(); | |
1766 v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); | |
1767 v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); | |
1768 uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); | |
1769 result = GetSizeInInventorySlots(v6->uTextureHeight); | |
1770 v8 = result; | |
1771 if ( !areWeLoadingTexture ) | |
1772 { | |
1773 v6->Release(); | |
1774 result = pIcons_LOD->_40F9C5(); | |
1775 } | |
1776 if ( (signed int)v8 > 0 ) | |
1777 { | |
1778 v9 = pIndices; | |
1779 do | |
1780 { | |
1781 if ( (signed int)uSlota > 0 ) | |
1782 { | |
1783 result = 0; | |
1784 memset(v9, 0, 4 * uSlota); | |
1785 } | |
1786 v9 = (char *)v9 + 56; | |
1787 --v8; | |
1788 } | |
1789 while ( v8 ); | |
1790 } | |
1791 return result; | |
1792 } | |
1793 // 506128: using guessed type int areWeLoadingTexture; | |
1794 | |
436 | 1795 //identf |
0 | 1796 //----- (00490EEE) -------------------------------------------------------- |
1797 int Player::_490EEE(ItemGen *pItem, int a3, int a4, int a5) | |
1798 { | |
1799 int v5; // eax@1 | |
1800 int result; // eax@1 | |
1801 unsigned int v7; // edx@1 | |
1802 unsigned int v8; // ecx@1 | |
1803 signed int v9; // esi@1 | |
1804 char v10; // zf@14 | |
1805 unsigned __int8 v11; // zf@22 | |
1806 char v12; // sf@22 | |
1807 unsigned __int8 v13; // of@22 | |
1808 float *v14; // esi@26 | |
1809 float v15; // ST04_4@26 | |
1810 signed int v16; // eax@26 | |
1811 int v17; // edi@26 | |
1812 float v18; // ST04_4@30 | |
1813 signed int v19; // eax@30 | |
1814 float v20; // ST04_4@34 | |
1815 signed int v21; // eax@34 | |
1816 signed int v22; // eax@34 | |
1817 float v23; // ST04_4@37 | |
1818 signed int v24; // eax@37 | |
1819 int v26; // [sp+10h] [bp-8h]@1 | |
1820 Player *v27; // [sp+14h] [bp-4h]@1 | |
1821 | |
1822 v27 = this; | |
607 | 1823 v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 1824 v26 = v5; |
1825 result = 4; | |
1826 v7 = pItem->uItemID; | |
1827 v8 = pItem->uItemID; | |
1828 v9 = pItemsTable->pItems[v8].uEquipType; | |
1829 if ( (a3 != 4 || (signed int)v7 < 740 || (signed int)v7 > 771) | |
1830 && ((signed int)v7 >= 600 || (signed int)v7 >= 529 && (signed int)v7 <= 599) ) | |
1831 return 5; | |
1832 if ( a3 == 1 ) | |
1833 { | |
1834 v13 = __OFSUB__(v9, 2); | |
1835 v11 = v9 == 2; | |
1836 v12 = v9 - 2 < 0; | |
1837 goto LABEL_24; | |
1838 } | |
1839 if ( a3 == 2 ) | |
1840 { | |
1841 if ( v9 < 3 ) | |
1842 return result; | |
1843 v13 = __OFSUB__(v9, 9); | |
1844 v11 = v9 == 9; | |
1845 v12 = v9 - 9 < 0; | |
1846 LABEL_24: | |
1847 if ( !((unsigned __int8)(v12 ^ v13) | v11) ) | |
1848 return result; | |
1849 goto LABEL_16; | |
1850 } | |
1851 if ( a3 == 3 ) | |
1852 { | |
1853 if ( pItemsTable->pItems[v8].uSkillType == 38 ) | |
1854 goto LABEL_16; | |
1855 v10 = v9 == 16; | |
1856 goto LABEL_15; | |
1857 } | |
1858 if ( a3 != 4 ) | |
1859 goto LABEL_26; | |
1860 if ( v9 < 13 ) | |
1861 return result; | |
1862 if ( v9 > 14 ) | |
1863 { | |
1864 v10 = v9 == 17; | |
1865 LABEL_15: | |
1866 if ( !v10 ) | |
1867 return result; | |
1868 } | |
1869 LABEL_16: | |
315 | 1870 if (pItem->Stolen()) |
0 | 1871 return 6; |
1872 LABEL_26: | |
1873 //v14 = &p2DEvents_minus1__20[13 * a4]; | |
1874 v14 = &p2DEvents[a4 - 1].fPriceMultiplier; | |
1875 v15 = *v14; | |
1876 v16 = pItem->GetValue(); | |
749 | 1877 v17 = GetBuyingPrice(v16, v15); |
0 | 1878 if ( a5 == 3 ) |
1879 { | |
1880 v23 = *v14; | |
1881 v24 = pItem->GetValue(); | |
1882 v17 = v27->_4B8102(v24, v23); | |
315 | 1883 if (!pItem->Broken()) |
0 | 1884 goto LABEL_39; |
1885 goto LABEL_38; | |
1886 } | |
1887 if ( a5 == 4 ) | |
1888 { | |
1889 v22 = v27->_4B8179(*v14); | |
1890 goto LABEL_35; | |
1891 } | |
1892 if ( a5 == 5 ) | |
1893 { | |
1894 v20 = *v14; | |
1895 v21 = pItem->GetValue(); | |
1896 v22 = v27->_4B81C3(v21, v20); | |
1897 LABEL_35: | |
1898 v17 = v22; | |
1899 goto LABEL_39; | |
1900 } | |
1901 if ( a5 != 6 ) | |
1902 goto LABEL_39; | |
1903 v18 = *v14; | |
1904 v19 = pItem->GetValue(); | |
1905 v17 = v27->_4B8102(v19, v18) / 2; | |
315 | 1906 if (pItem->Broken()) |
0 | 1907 v17 = 1; |
1908 if ( v17 >= 1 ) | |
1909 goto LABEL_39; | |
1910 LABEL_38: | |
1911 v17 = 1; | |
1912 LABEL_39: | |
1913 if ( v26 ) | |
1914 result = (v17 == pItem->GetValue()) + 2; | |
1915 else | |
1916 result = 1; | |
1917 return result; | |
1918 } | |
1919 | |
1920 //----- (0049107D) -------------------------------------------------------- | |
1921 int Player::GetBodybuilding() | |
1922 { | |
1923 char v1; // al@1 | |
1924 int v2; // ecx@1 | |
1925 int v4; // eax@3 | |
1926 signed int v6; // [sp-4h] [bp-4h]@2 | |
1927 | |
1928 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1929 v2 = v1 & 0x3F; | |
1930 if ( v1 & 0x100 ) | |
1931 { | |
1932 v6 = 5; | |
1933 } | |
1934 else | |
1935 { | |
1936 if ( v1 >= 0 ) | |
1937 { | |
1938 v4 = ((v1 & 0x40) != 0) + 1; | |
1939 return v2 * v4; | |
1940 } | |
1941 v6 = 3; | |
1942 } | |
1943 v4 = v6; | |
1944 return v2 * v4; | |
1945 } | |
1946 | |
1947 //----- (004910A8) -------------------------------------------------------- | |
607 | 1948 int Player::GetMeditation() |
0 | 1949 { |
1950 char v1; // al@1 | |
1951 int v2; // ecx@1 | |
1952 int v4; // eax@3 | |
1953 signed int v6; // [sp-4h] [bp-4h]@2 | |
1954 | |
1955 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1956 v2 = v1 & 0x3F; | |
1957 if ( v1 & 0x100 ) | |
1958 { | |
1959 v6 = 5; | |
1960 } | |
1961 else | |
1962 { | |
1963 if ( v1 >= 0 ) | |
1964 { | |
1965 v4 = ((v1 & 0x40) != 0) + 1; | |
1966 return v2 * v4; | |
1967 } | |
1968 v6 = 3; | |
1969 } | |
1970 v4 = v6; | |
1971 return v2 * v4; | |
1972 } | |
1973 | |
1974 //----- (004910D3) -------------------------------------------------------- | |
1975 int Player::CanIdentify(ItemGen *pItem) | |
1976 { | |
1977 unsigned __int16 v2; // ax@1 | |
1978 unsigned __int16 v3; // bx@1 | |
1979 int uSkillMult; // eax@3 | |
1980 int v5; // edi@7 | |
1981 signed int v6; // ebp@7 | |
1982 char *v7; // esi@7 | |
1983 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1984 |
1985 if (CheckHiredNPCSpeciality(Scholar)) | |
1986 return true; | |
0 | 1987 |
179 | 1988 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1989 v3 = v2; |
179 | 1990 if ( v2 & 1 ) |
0 | 1991 { |
1992 uSkillMultiplier = 5; | |
1993 } | |
1994 else | |
1995 { | |
1996 if ( (v2 & 0x80u) == 0 ) | |
1997 { | |
1998 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1999 v5 = uSkillMult * (v3 & 0x3F); |
2000 v6 = 0; | |
2001 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2002 |
179 | 2003 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2004 v6 = 1; | |
2005 if ( v5 >= (unsigned __int8)v7[46] ) | |
2006 v6 = 1; | |
2007 return v6; | |
0 | 2008 } |
2009 uSkillMultiplier = 3; | |
2010 } | |
2011 uSkillMult = uSkillMultiplier; | |
2012 v5 = uSkillMult * (v3 & 0x3F); | |
2013 v6 = 0; | |
2014 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 2015 |
0 | 2016 if ( (signed int)SkillToMastery(v3) >= 4 ) |
2017 v6 = 1; | |
2018 if ( v5 >= (unsigned __int8)v7[46] ) | |
2019 v6 = 1; | |
2020 return v6; | |
2021 } | |
2022 | |
2023 //----- (00491151) -------------------------------------------------------- | |
2024 int Player::CanRepair(ItemGen *a2) | |
2025 { | |
2026 unsigned __int16 v2; // ax@1 | |
2027 unsigned __int16 v3; // bx@1 | |
2028 int v4; // eax@3 | |
2029 int v5; // edi@7 | |
2030 signed int v6; // ebp@7 | |
2031 char v8; // al@10 | |
2032 signed int v10; // [sp-4h] [bp-14h]@2 | |
2033 | |
652 | 2034 |
2035 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
2036 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
2037 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
2038 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
2039 return true; | |
2040 | |
0 | 2041 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
2042 v3 = v2; | |
2043 if ( HIBYTE(v2) & 1 ) | |
2044 { | |
2045 v10 = 5; | |
2046 } | |
2047 else | |
2048 { | |
2049 if ( (v2 & 0x80u) == 0 ) | |
2050 { | |
2051 v4 = ((v2 & 0x40) != 0) + 1; | |
2052 goto LABEL_7; | |
2053 } | |
2054 v10 = 3; | |
2055 } | |
2056 v4 = v10; | |
2057 LABEL_7: | |
2058 v5 = v4 * (v3 & 0x3F); | |
2059 v6 = 0; | |
2060 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2061 return true; | |
2062 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2063 { | |
2064 __debugbreak(); // really odd | |
2065 return true; | |
2066 } | |
2067 return false; | |
2068 } | |
2069 | |
2070 //----- (004911F3) -------------------------------------------------------- | |
2071 int Player::GetMerchant() | |
2072 { | |
2073 Player *v1; // edi@1 | |
2074 unsigned __int16 v2; // ax@1 | |
2075 unsigned __int16 v3; // bx@1 | |
2076 int v4; // esi@1 | |
2077 int v5; // edi@1 | |
2078 int v7; // eax@3 | |
2079 int v8; // ecx@7 | |
2080 signed int v9; // [sp-4h] [bp-10h]@6 | |
2081 | |
2082 v1 = this; | |
607 | 2083 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
0 | 2084 v3 = v1->pActiveSkills[22]; |
607 | 2085 v4 = v2 & 0x003F; |
0 | 2086 v5 = v1->pActiveSkills[22] & 0x3F; |
2087 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2088 return 10000; | |
2089 v7 = GetPartyReputation(); | |
2090 if ( !v4 ) | |
2091 return -v7; | |
2092 if ( HIBYTE(v3) & 1 ) | |
2093 { | |
2094 v9 = 5; | |
2095 } | |
2096 else | |
2097 { | |
2098 if ( (v3 & 0x80u) == 0 ) | |
2099 { | |
2100 v8 = ((v3 & 0x40) != 0) + 1; | |
2101 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2102 } | |
2103 v9 = 3; | |
2104 } | |
2105 v8 = v9; | |
2106 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2107 } | |
2108 | |
2109 //----- (0049125A) -------------------------------------------------------- | |
2110 int Player::GetPerception() | |
2111 { | |
2112 Player *v1; // edi@1 | |
2113 unsigned __int16 v2; // ax@1 | |
2114 unsigned __int16 v3; // bx@1 | |
2115 int v4; // esi@1 | |
2116 int v5; // edi@1 | |
2117 int v7; // eax@5 | |
2118 signed int v8; // [sp-4h] [bp-10h]@4 | |
2119 | |
2120 v1 = this; | |
2121 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); | |
2122 v3 = v1->pActiveSkills[26]; | |
2123 v4 = v2 & 0x3F; | |
2124 v5 = v1->pActiveSkills[26] & 0x3F; | |
2125 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2126 return 10000; | |
2127 if ( HIBYTE(v3) & 1 ) | |
2128 { | |
2129 v8 = 5; | |
2130 } | |
2131 else | |
2132 { | |
2133 if ( (v3 & 0x80u) == 0 ) | |
2134 { | |
2135 v7 = ((v3 & 0x40) != 0) + 1; | |
2136 return v4 + v5 * (v7 - 1); | |
2137 } | |
2138 v8 = 3; | |
2139 } | |
2140 v7 = v8; | |
2141 return v4 + v5 * (v7 - 1); | |
2142 } | |
2143 | |
2144 //----- (004912B0) -------------------------------------------------------- | |
2145 int Player::GetDisarmTrap() | |
2146 { | |
2147 Player *v1; // ebp@1 | |
2148 unsigned __int16 v2; // ax@1 | |
2149 unsigned __int16 v3; // bx@1 | |
2150 int v4; // esi@1 | |
2151 int v5; // edi@1 | |
2152 int v7; // eax@7 | |
2153 signed int v8; // [sp-4h] [bp-14h]@6 | |
2154 | |
2155 v1 = this; | |
2156 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); | |
2157 v3 = v1->pActiveSkills[29]; | |
2158 v4 = v2 & 0x3F; | |
2159 v5 = v1->pActiveSkills[29] & 0x3F; | |
2160 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2161 return 10000; | |
2162 if ( HasEnchantedItemEquipped(35) ) | |
2163 v4 *= 2; | |
2164 if ( HIBYTE(v3) & 1 ) | |
2165 { | |
2166 v8 = 5; | |
2167 } | |
2168 else | |
2169 { | |
2170 if ( (v3 & 0x80u) == 0 ) | |
2171 { | |
2172 v7 = ((v3 & 0x40) != 0) + 1; | |
2173 return v4 + v5 * (v7 - 1); | |
2174 } | |
2175 v8 = 3; | |
2176 } | |
2177 v7 = v8; | |
2178 return v4 + v5 * (v7 - 1); | |
2179 } | |
2180 | |
2181 //----- (00491317) -------------------------------------------------------- | |
2182 char Player::GetLearningPercent() | |
2183 { | |
2184 Player *v1; // esi@1 | |
2185 int v2; // eax@1 | |
2186 unsigned __int16 v3; // bx@1 | |
2187 int v4; // ecx@1 | |
2188 int v5; // eax@4 | |
2189 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2190 | |
2191 v1 = this; | |
2192 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); | |
2193 v3 = v1->pActiveSkills[36]; | |
2194 v4 = v2 & 0x3F; | |
2195 if ( v2 ) | |
2196 { | |
2197 if ( HIBYTE(v3) & 1 ) | |
2198 { | |
2199 v7 = 5; | |
2200 } | |
2201 else | |
2202 { | |
2203 if ( (v3 & 0x80u) == 0 ) | |
2204 { | |
2205 v5 = ((v3 & 0x40) != 0) + 1; | |
2206 goto LABEL_8; | |
2207 } | |
2208 v7 = 3; | |
2209 } | |
2210 v5 = v7; | |
2211 LABEL_8: | |
2212 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2213 } | |
2214 return v2; | |
2215 } | |
2216 | |
2217 //----- (0048C6AF) -------------------------------------------------------- | |
2218 Player::Player() | |
2219 { | |
2220 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2221 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2222 for (uint i = 0; i < 126; ++i) | |
2223 pInventoryItems[i].Reset(); | |
2224 for (uint i = 0; i < 12; ++i) | |
2225 pEquippedItems[i].Reset(); | |
2226 | |
2227 | |
2228 for (uint i = 0; i < 24; ++i) | |
2229 { | |
2230 pPlayerBuffs[i].uSkill = 0; | |
2231 pPlayerBuffs[i].uSkill = 0; | |
2232 pPlayerBuffs[i].uPower = 0; | |
2233 pPlayerBuffs[i].uExpireTime = 0; | |
2234 pPlayerBuffs[i].uCaster = 0; | |
2235 pPlayerBuffs[i].uFlags = 0; | |
2236 } | |
2237 | |
2238 pName[0] = 0; | |
2239 uFace = 0; | |
2240 uVoiceID = 0; | |
2241 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2242 | |
2243 field_BB = 0; | |
2244 | |
2245 uMight = uMightBonus = 0; | |
2246 uIntelligence = uIntelligenceBonus = 0; | |
2247 uWillpower = uWillpowerBonus = 0; | |
2248 uEndurance = uEnduranceBonus = 0; | |
2249 uSpeed = uSpeedBonus = 0; | |
2250 uAccuracy = uAccuracyBonus = 0; | |
2251 uLuck = uLuckBonus = 0; | |
2252 uLevel = sLevelModifier = 0; | |
2253 sAgeModifier = 0; | |
2254 | |
2255 memset(field_1F5, 0, 30); | |
2256 | |
2257 sResFireBase = sResFireBonus = 0; | |
2258 sResAirBase = sResAirBonus = 0; | |
2259 sResWaterBase = sResWaterBonus = 0; | |
2260 sResEarthBase = sResEarthBonus = 0; | |
2261 sResMagicBase = sResMagicBonus = 0; | |
2262 sResSpiritBase = sResSpiritBonus = 0; | |
2263 sResMindBase = sResMindBonus = 0; | |
2264 sResBodyBase = sResBodyBonus = 0; | |
2265 sResLightBase = sResLightBonus = 0; | |
2266 sResDarkBase = sResDarkBonus = 0; | |
2267 | |
2268 uTimeToRecovery = 0; | |
2269 | |
2270 uSkillPoints = 0; | |
2271 | |
2272 sHealth = 0; | |
2273 uFullHealthBonus = 0; | |
2274 _health_related = 0; | |
2275 | |
2276 sMana = 0; | |
2277 uFullManaBonus = 0; | |
2278 _mana_related = 0; | |
2279 | |
2280 uQuickSpell = 0; | |
2281 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2282 | |
2283 _some_attack_bonus = 0; | |
2284 field_1A91 = 0; | |
2285 _melee_dmg_bonus = 0; | |
2286 field_1A93 = 0; | |
2287 _ranged_atk_bonus = 0; | |
2288 field_1A95 = 0; | |
2289 _ranged_dmg_bonus = 0; | |
2290 field_1A97 = 0; | |
2291 | |
130 | 2292 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2293 uExpressionTimePassed = 0; |
2294 uExpressionTimeLength = 0; | |
2295 | |
2296 uNumDivineInterventionCastsThisDay = 0; | |
2297 uNumArmageddonCasts = 0; | |
2298 uNumFireSpikeCasts = 0; | |
2299 | |
2300 memset(field_1988, 0, 49 * sizeof(int)); | |
2301 memset(field_1A50, 0, 64 * sizeof(char)); | |
2302 | |
2303 field_E0 = 0; | |
2304 field_E4 = 0; | |
2305 field_E8 = 0; | |
2306 field_EC = 0; | |
2307 field_F0 = 0; | |
2308 field_F4 = 0; | |
2309 field_F8 = 0; | |
2310 field_FC = 0; | |
2311 field_100 = 0; | |
2312 field_104 = 0; | |
198 | 2313 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2314 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2315 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2316 |
198 | 2317 lastOpenedSpellbookPage = 0; |
0 | 2318 } |
2319 | |
2320 //----- (0048C6F6) -------------------------------------------------------- | |
2321 bool Party::AddItem(ItemGen *pItem) | |
2322 { | |
2323 unsigned int v2; // eax@1 | |
2324 unsigned int v3; // ecx@4 | |
2325 signed int v4; // edx@4 | |
2326 char *v5; // eax@8 | |
2327 unsigned int v6; // eax@10 | |
2328 Texture *v7; // ebx@10 | |
2329 signed int v8; // esi@10 | |
2330 Player *v9; // edi@11 | |
2331 int v10; // eax@11 | |
2332 bool result; // eax@15 | |
2333 std::string v12; // [sp-18h] [bp-40h]@9 | |
2334 const char *v13; // [sp-8h] [bp-30h]@9 | |
2335 int v14; // [sp-4h] [bp-2Ch]@9 | |
188 | 2336 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2337 //int v16; // [sp+10h] [bp-18h]@3 | |
2338 //int v17; // [sp+14h] [bp-14h]@3 | |
2339 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2340 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2341 Party *v20; // [sp+20h] [bp-8h]@1 | |
2342 int v21; // [sp+24h] [bp-4h]@10 | |
2343 | |
2344 auto thos = this; | |
2345 | |
2346 v20 = thos; | |
2347 v2 = pItem->uItemID; | |
222 | 2348 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2349 pItem->SetIdentified(); |
188 | 2350 ///v15 = 0; |
2351 //v16 = 1; | |
2352 //v18 = 3; | |
2353 //v17 = 2; | |
0 | 2354 if ( uActiveCharacter ) |
2355 { | |
2356 v3 = uActiveCharacter - 1; | |
2357 v4 = 0; | |
2358 do | |
2359 { | |
188 | 2360 v15[v4++] = v3++; |
0 | 2361 if ( (signed int)v3 >= 4 ) |
2362 v3 = 0; | |
2363 } | |
2364 while ( v4 < 4 ); | |
2365 } | |
2366 v5 = pItemsTable->pItems[v2].pIconName; | |
2367 if ( v5 ) | |
2368 { | |
2369 v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); | |
188 | 2370 v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); |
0 | 2371 v21 = areWeLoadingTexture; |
2372 v8 = 0; | |
2373 while ( 1 ) | |
2374 { | |
188 | 2375 v9 = &v20->pPlayers[v15[v8]]; |
2376 v19 = &v20->pPlayers[v15[v8]]; | |
0 | 2377 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); |
2378 if ( v10 ) | |
2379 break; | |
2380 ++v8; | |
2381 if ( v8 >= 4 ) | |
2382 { | |
2383 if ( !v21 ) | |
2384 { | |
2385 v7->Release(); | |
2386 pIcons_LOD->_40F9C5(); | |
2387 } | |
2388 goto LABEL_15; | |
2389 } | |
2390 } | |
232 | 2391 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2392 pItem->Reset(); |
2393 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2394 v19->PlaySound(SPEECH_60, 0); |
0 | 2395 if ( !v21 ) |
2396 { | |
2397 v7->Release(); | |
2398 pIcons_LOD->_40F9C5(); | |
2399 } | |
2400 result = 1; | |
2401 } | |
2402 else | |
2403 { | |
2404 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2405 LABEL_15: | |
2406 result = 0; | |
2407 } | |
2408 return result; | |
2409 } | |
2410 // 506128: using guessed type int areWeLoadingTexture; | |
2411 | |
2412 //----- (0048C855) -------------------------------------------------------- | |
2413 int Player::GetBaseStrength() | |
2414 { | |
2415 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2416 } | |
2417 | |
2418 //----- (0048C86C) -------------------------------------------------------- | |
2419 int Player::GetBaseIntelligence() | |
2420 { | |
2421 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2422 } | |
2423 | |
2424 //----- (0048C883) -------------------------------------------------------- | |
2425 int Player::GetBaseWillpower() | |
2426 { | |
2427 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2428 } | |
2429 | |
2430 //----- (0048C89A) -------------------------------------------------------- | |
2431 int Player::GetBaseEndurance() | |
2432 { | |
2433 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2434 } | |
2435 | |
2436 //----- (0048C8B1) -------------------------------------------------------- | |
2437 int Player::GetBaseAccuracy() | |
2438 { | |
2439 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2440 } | |
2441 | |
2442 //----- (0048C8C8) -------------------------------------------------------- | |
2443 int Player::GetBaseSpeed() | |
2444 { | |
2445 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2446 } | |
2447 | |
2448 //----- (0048C8DF) -------------------------------------------------------- | |
2449 int Player::GetBaseLuck() | |
2450 { | |
2451 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2452 } | |
2453 | |
2454 //----- (0048C8F6) -------------------------------------------------------- | |
2455 int Player::GetBaseLevel() | |
2456 { | |
2457 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2458 } | |
2459 | |
2460 //----- (0048C90D) -------------------------------------------------------- | |
2461 int Player::GetActualLevel() | |
2462 { | |
2463 return uLevel + sLevelModifier + | |
2464 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2465 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2466 } | |
2467 | |
2468 //----- (0048C93C) -------------------------------------------------------- | |
2469 int Player::GetActualMight() | |
2470 { | |
2471 Player *v1; // esi@1 | |
2472 unsigned int v2; // eax@1 | |
2473 signed int v3; // ecx@1 | |
2474 signed int v4; // ebx@4 | |
2475 int v5; // edi@5 | |
2476 int v6; // ST14_4@5 | |
2477 | |
2478 v1 = this; | |
2479 v2 = this->sAgeModifier + GetBaseAge(); | |
2480 v3 = 0; | |
2481 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2482 { | |
2483 ++v3; | |
2484 if ( v3 >= 4 ) | |
2485 { | |
2486 v4 = 100; | |
2487 goto LABEL_5; | |
2488 } | |
2489 } | |
2490 v4 = pAgeingStrengthMultiplier[v3]; | |
2491 LABEL_5: | |
2492 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2493 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2494 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2495 } | |
2496 | |
2497 //----- (0048C9C2) -------------------------------------------------------- | |
2498 int Player::GetActualIntelligence() | |
2499 { | |
2500 Player *v1; // esi@1 | |
2501 unsigned int sAge; // eax@1 | |
2502 signed int uAgeLevel; // ecx@1 | |
2503 signed int v4; // ebx@4 | |
2504 int v5; // edi@5 | |
2505 int v6; // ebp@5 | |
2506 | |
2507 v1 = this; | |
2508 sAge = this->sAgeModifier + GetBaseAge(); | |
2509 uAgeLevel = 0; | |
2510 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2511 { | |
2512 ++uAgeLevel; | |
2513 if ( uAgeLevel >= 4 ) | |
2514 { | |
2515 v4 = 100; | |
2516 goto LABEL_5; | |
2517 } | |
2518 } | |
2519 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2520 LABEL_5: | |
2521 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2522 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2523 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2524 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2525 + v6 | |
2526 + v1->uIntelligenceBonus; | |
2527 } | |
2528 | |
2529 //----- (0048CA3F) -------------------------------------------------------- | |
2530 int Player::GetActualWillpower() | |
2531 { | |
2532 int v5; // edi@5 | |
2533 | |
2534 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2535 uint uAgeingMultiplier = 100; | |
2536 for (uint i = 0; i < 4; ++i) | |
2537 if (uActualAge >= pAgeingTable[i]) | |
2538 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2539 else break; | |
2540 | |
2541 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2542 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2543 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2544 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2545 + uWillpowerBonus; | |
2546 } | |
2547 | |
2548 //----- (0048CABC) -------------------------------------------------------- | |
2549 int Player::GetActualEndurance() | |
2550 { | |
2551 int v6; // ebp@5 | |
2552 | |
2553 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2554 uint uAgeingMultiplier = 100; | |
2555 for (uint i = 0; i < 4; ++i) | |
2556 if (uActualAge >= pAgeingTable[i]) | |
2557 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2558 else break; | |
2559 | |
2560 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2561 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2562 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2563 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2564 + uItemBonus | |
2565 + uEnduranceBonus; | |
2566 } | |
2567 | |
2568 //----- (0048CB39) -------------------------------------------------------- | |
2569 int Player::GetActualAccuracy() | |
2570 { | |
2571 Player *v1; // esi@1 | |
2572 unsigned int v2; // eax@1 | |
2573 signed int v3; // ecx@1 | |
2574 signed int v4; // ebx@4 | |
2575 int v5; // edi@5 | |
2576 int v6; // ebp@5 | |
2577 | |
2578 v1 = this; | |
2579 v2 = this->sAgeModifier + GetBaseAge(); | |
2580 v3 = 0; | |
2581 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2582 { | |
2583 ++v3; | |
2584 if ( v3 >= 4 ) | |
2585 { | |
2586 v4 = 100; | |
2587 goto LABEL_5; | |
2588 } | |
2589 } | |
2590 v4 = pAgeingAccuracyMultiplier[v3]; | |
2591 LABEL_5: | |
2592 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2593 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2594 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2595 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2596 + v6 | |
2597 + v1->uAccuracyBonus; | |
2598 } | |
2599 | |
2600 //----- (0048CBB6) -------------------------------------------------------- | |
2601 int Player::GetActualSpeed() | |
2602 { | |
2603 Player *v1; // esi@1 | |
2604 unsigned int v2; // eax@1 | |
2605 signed int v3; // ecx@1 | |
2606 signed int v4; // ebx@4 | |
2607 int v5; // edi@5 | |
2608 int v6; // ebp@5 | |
2609 | |
2610 v1 = this; | |
2611 v2 = this->sAgeModifier + GetBaseAge(); | |
2612 v3 = 0; | |
2613 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2614 { | |
2615 ++v3; | |
2616 if ( v3 >= 4 ) | |
2617 { | |
2618 v4 = 100; | |
2619 goto LABEL_5; | |
2620 } | |
2621 } | |
2622 v4 = pAgeingSpeedMultiplier[v3]; | |
2623 LABEL_5: | |
2624 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2625 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2626 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2627 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2628 + v6 | |
2629 + v1->uSpeedBonus; | |
2630 } | |
2631 | |
2632 //----- (0048CC33) -------------------------------------------------------- | |
2633 int Player::GetActualLuck() | |
2634 { | |
2635 Player *v1; // esi@1 | |
2636 unsigned int v2; // eax@7 | |
2637 signed int v3; // ecx@7 | |
2638 signed int v4; // ebx@10 | |
2639 int v5; // edi@11 | |
2640 int v6; // ebp@11 | |
2641 signed int v8; // [sp+10h] [bp-4h]@1 | |
2642 | |
2643 v8 = 0; | |
2644 v1 = this; | |
652 | 2645 if ( CheckHiredNPCSpeciality(Fool) ) |
0 | 2646 v8 = 5; |
652 | 2647 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
0 | 2648 v8 += 20; |
652 | 2649 if ( CheckHiredNPCSpeciality(Psychic) ) |
0 | 2650 v8 += 10; |
2651 v2 = v1->sAgeModifier + GetBaseAge(); | |
2652 v3 = 0; | |
2653 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2654 { | |
2655 ++v3; | |
2656 if ( v3 >= 4 ) | |
2657 { | |
2658 v4 = 100; | |
2659 goto LABEL_11; | |
2660 } | |
2661 } | |
2662 v4 = pAgeingLuckMultiplier[v3]; | |
2663 LABEL_11: | |
2664 v5 = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2665 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2666 return GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK) | |
2667 + v6 | |
2668 + v8 | |
2669 + v5 * v4 * v1->uLuck / 100 / 100 | |
2670 + v1->uLuckBonus; | |
2671 } | |
2672 | |
2673 //----- (0048CCF5) -------------------------------------------------------- | |
2674 int Player::GetActualAttack(int a2) | |
2675 { | |
2676 Player *v2; // esi@1 | |
2677 int v3; // eax@1 | |
2678 int v4; // edi@1 | |
2679 int v5; // ebx@1 | |
2680 int v6; // ebp@1 | |
2681 | |
2682 v2 = this; | |
2683 v3 = GetActualAccuracy(); | |
2684 v4 = _48EA1B_get_static_effect(v3); | |
2685 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); | |
2686 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2687 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2688 } | |
2689 | |
2690 //----- (0048CD45) -------------------------------------------------------- | |
2691 int Player::GetMeleeDamageMinimal() | |
2692 { | |
2693 Player *v1; // edi@1 | |
2694 int v2; // eax@1 | |
2695 int v3; // esi@1 | |
2696 int v4; // esi@1 | |
2697 int v5; // esi@1 | |
2698 int v6; // esi@1 | |
2699 signed int result; // eax@1 | |
2700 | |
2701 v1 = this; | |
2702 v2 = GetActualMight(); | |
2703 v3 = _48EA1B_get_static_effect(v2); | |
2704 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; | |
2705 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2706 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2707 result = 1; | |
2708 if ( v6 >= 1 ) | |
2709 result = v6; | |
2710 return result; | |
2711 } | |
2712 | |
2713 //----- (0048CD90) -------------------------------------------------------- | |
2714 int Player::GetMeleeDamageMaximal() | |
2715 { | |
2716 Player *v1; // edi@1 | |
2717 int v2; // eax@1 | |
2718 int v3; // esi@1 | |
2719 int v4; // esi@1 | |
2720 int v5; // esi@1 | |
2721 int v6; // esi@1 | |
2722 signed int result; // eax@1 | |
2723 | |
2724 v1 = this; | |
2725 v2 = GetActualMight(); | |
2726 v3 = _48EA1B_get_static_effect(v2); | |
2727 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; | |
2728 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2729 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2730 result = 1; | |
2731 if ( v6 >= 1 ) | |
2732 result = v6; | |
2733 return result; | |
2734 } | |
2735 | |
2736 //----- (0048CDDB) -------------------------------------------------------- | |
2737 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2738 { | |
2739 int v4; // esi@1 | |
2740 Player *v5; // edi@1 | |
2741 ItemGen *v6; // ebx@4 | |
2742 unsigned int v7; // ebp@4 | |
2743 unsigned int v8; // esi@4 | |
2744 int v9; // eax@4 | |
2745 int v10; // eax@9 | |
2746 char v11; // zf@9 | |
2747 int v12; // esi@10 | |
2748 int v13; // eax@11 | |
2749 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2750 ItemGen *v15; // ebx@35 | |
2751 unsigned int v16; // ebp@35 | |
2752 unsigned int v17; // esi@35 | |
2753 int v18; // edx@38 | |
2754 int v19; // eax@40 | |
2755 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2756 int v21; // esi@62 | |
2757 int v22; // eax@63 | |
2758 int v23; // ebx@63 | |
2759 int v24; // ebx@63 | |
2760 signed int result; // eax@64 | |
2761 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2762 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2763 int v28; // [sp+10h] [bp-10h]@1 | |
2764 int v29; // [sp+10h] [bp-10h]@33 | |
2765 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2766 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2767 int v32; // [sp+18h] [bp-8h]@1 | |
2768 int v33; // [sp+18h] [bp-8h]@8 | |
2769 int v34; // [sp+1Ch] [bp-4h]@1 | |
2770 int v35; // [sp+28h] [bp+8h]@37 | |
2771 | |
2772 v4 = 0; | |
2773 v5 = this; | |
2774 v34 = 0; | |
2775 v32 = 0; | |
2776 v28 = 0; | |
2777 if ( IsUnarmed() == 1 ) | |
2778 { | |
2779 v32 = rand() % 3 + 1; | |
2780 LABEL_61: | |
2781 v34 = v4; | |
2782 goto LABEL_62; | |
2783 } | |
816 | 2784 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2785 { |
232 | 2786 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2787 v7 = v6->uItemID; |
2788 v8 = v6->uItemID; | |
2789 v9 = pItemsTable->pItems[v8].uDamageDice; | |
2790 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) | |
2791 ++v9; | |
2792 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2793 if ( v9 > 0 ) | |
2794 { | |
2795 v33 = v9; | |
2796 do | |
2797 { | |
2798 v10 = rand(); | |
2799 v11 = v33-- == 1; | |
2800 v28 += v10 % v30 + 1; | |
2801 } | |
2802 while ( !v11 ); | |
2803 } | |
2804 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2805 if ( !uTargetActorID ) | |
2806 goto LABEL_28; | |
377 | 2807 v13 = v6->uSpecEnchantmentType; |
0 | 2808 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2809 { | |
2810 v14 = (MONSTER_SUPERTYPE)1; | |
2811 } | |
2812 else | |
2813 { | |
2814 if ( v13 == 39 ) | |
2815 { | |
2816 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2817 } | |
2818 else | |
2819 { | |
2820 if ( v13 == 40 ) | |
2821 { | |
2822 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2823 } | |
2824 else | |
2825 { | |
2826 if ( v13 == 63 || v7 == 517 ) | |
2827 { | |
2828 v26 = MONSTER_SUPERTYPE_ELF; | |
2829 } | |
2830 else | |
2831 { | |
2832 if ( v13 != 65 ) | |
2833 { | |
2834 LABEL_28: | |
2835 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2836 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2837 && rand() % 100 < 10 ) | |
2838 v12 *= 3; | |
2839 v32 = v12; | |
2840 goto LABEL_33; | |
2841 } | |
2842 v26 = MONSTER_SUPERTYPE_TITAN; | |
2843 } | |
2844 } | |
2845 } | |
2846 v14 = v26; | |
2847 } | |
2848 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2849 v12 *= 2; | |
2850 goto LABEL_28; | |
2851 } | |
2852 LABEL_33: | |
2853 v29 = 0; | |
2854 if ( !a3 ) | |
2855 { | |
2856 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2857 { | |
232 | 2858 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1]; |
0 | 2859 v16 = v15->uItemID; |
2860 v17 = v15->uItemID; | |
2861 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2862 { | |
2863 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2864 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2865 { | |
2866 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2867 do | |
2868 { | |
2869 v18 = rand() % v31; | |
2870 v11 = v35-- == 1; | |
2871 v29 += v18 + 1; | |
2872 } | |
2873 while ( !v11 ); | |
2874 } | |
2875 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2876 if ( !uTargetActorID ) | |
2877 goto LABEL_57; | |
377 | 2878 v19 = v15->uSpecEnchantmentType; |
0 | 2879 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2880 { | |
2881 v20 = (MONSTER_SUPERTYPE)1; | |
2882 } | |
2883 else | |
2884 { | |
2885 if ( v19 == 39 ) | |
2886 { | |
2887 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2888 } | |
2889 else | |
2890 { | |
2891 if ( v19 == 40 ) | |
2892 { | |
2893 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2894 } | |
2895 else | |
2896 { | |
2897 if ( v19 == 63 || v16 == 517 ) | |
2898 { | |
2899 v27 = MONSTER_SUPERTYPE_ELF; | |
2900 } | |
2901 else | |
2902 { | |
2903 if ( v19 != 65 ) | |
2904 { | |
2905 LABEL_57: | |
2906 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2907 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2908 && rand() % 100 < 10 ) | |
2909 v4 *= 3; | |
2910 goto LABEL_61; | |
2911 } | |
2912 v27 = MONSTER_SUPERTYPE_TITAN; | |
2913 } | |
2914 } | |
2915 } | |
2916 v20 = v27; | |
2917 } | |
2918 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2919 v4 *= 2; | |
2920 goto LABEL_57; | |
2921 } | |
2922 } | |
2923 } | |
2924 LABEL_62: | |
2925 v21 = v32 + v34; | |
2926 if ( !a2 ) | |
2927 { | |
2928 v22 = GetActualMight(); | |
2929 v23 = _48EA1B_get_static_effect(v22); | |
2930 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; | |
2931 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2932 } | |
2933 result = 1; | |
2934 if ( v21 >= 1 ) | |
2935 result = v21; | |
2936 return result; | |
2937 } | |
2938 | |
2939 //----- (0048D0B9) -------------------------------------------------------- | |
2940 int Player::GetRangedAttack() | |
2941 { | |
2942 Player *v1; // esi@1 | |
2943 int v2; // eax@1 | |
2944 int v3; // edi@3 | |
2945 int v4; // eax@4 | |
2946 int v5; // edi@4 | |
2947 int v6; // edi@4 | |
2948 int v7; // edi@4 | |
2949 | |
2950 v1 = this; | |
232 | 2951 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2952 if ( v2 < 64 || v2 > 65 ) |
2953 { | |
2954 v4 = GetActualAccuracy(); | |
2955 v5 = _48EA1B_get_static_effect(v4); | |
2956 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; | |
2957 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2958 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2959 } | |
2960 else | |
2961 { | |
2962 v3 = GetActualAttack(1); | |
2963 } | |
2964 return v3; | |
2965 } | |
2966 | |
2967 //----- (0048D124) -------------------------------------------------------- | |
2968 int Player::GetRangedDamageMin() | |
2969 { | |
2970 Player *v1; // esi@1 | |
2971 int v2; // edi@1 | |
2972 int v3; // edi@1 | |
2973 int v4; // edi@1 | |
2974 unsigned __int16 v5; // ax@1 | |
2975 int result; // eax@6 | |
2976 | |
2977 v1 = this; | |
2978 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MIN, 0); | |
2979 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
2980 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
2981 v5 = v1->pActiveSkills[5]; | |
2982 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2983 v4 += v1->pActiveSkills[5] & 0x3F; | |
2984 if ( v4 >= 1 ) | |
2985 result = v4; | |
2986 else | |
2987 result = 0; | |
2988 return result; | |
2989 } | |
2990 | |
2991 //----- (0048D191) -------------------------------------------------------- | |
2992 int Player::GetRangedDamageMax() | |
2993 { | |
2994 Player *v1; // esi@1 | |
2995 int v2; // edi@1 | |
2996 int v3; // edi@1 | |
2997 int v4; // edi@1 | |
2998 unsigned __int16 v5; // ax@1 | |
2999 int result; // eax@6 | |
3000 | |
3001 v1 = this; | |
3002 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_MAX, 0); | |
3003 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v2; | |
3004 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DAMAGE_BONUS) + v3; | |
3005 v5 = v1->pActiveSkills[5]; | |
3006 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
3007 v4 += v1->pActiveSkills[5] & 0x3F; | |
3008 if ( v4 >= 1 ) | |
3009 result = v4; | |
3010 else | |
3011 result = 0; | |
3012 return result; | |
3013 } | |
3014 | |
3015 //----- (0048D1FE) -------------------------------------------------------- | |
3016 bool Player::CalculateRangedDamageTo(int a2) | |
3017 { | |
3018 Player *v2; // ebx@1 | |
3019 bool result; // eax@1 | |
3020 ItemGen *v4; // ebx@2 | |
3021 unsigned int v5; // edi@2 | |
3022 unsigned int v6; // esi@2 | |
3023 int v7; // edx@4 | |
3024 char v8; // zf@4 | |
3025 int v9; // esi@5 | |
3026 int v10; // ebx@6 | |
3027 enum MONSTER_SUPERTYPE v11; // edx@7 | |
3028 unsigned __int16 v12; // ax@19 | |
3029 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
3030 Player *v14; // [sp+4h] [bp-10h]@1 | |
3031 signed int v15; // [sp+8h] [bp-Ch]@2 | |
3032 int v16; // [sp+Ch] [bp-8h]@3 | |
3033 int v17; // [sp+10h] [bp-4h]@1 | |
3034 | |
3035 v17 = 0; | |
3036 v2 = this; | |
3037 v14 = this; | |
3038 result = HasItemEquipped(EQUIP_BOW); | |
3039 if ( !result ) | |
3040 return result; | |
232 | 3041 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 3042 v5 = v4->uItemID; |
3043 v6 = v4->uItemID; | |
3044 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
3045 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3046 { | |
3047 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3048 do | |
3049 { | |
3050 v7 = rand() % v15; | |
3051 v8 = v16-- == 1; | |
3052 v17 += v7 + 1; | |
3053 } | |
3054 while ( !v8 ); | |
3055 } | |
3056 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3057 if ( a2 ) | |
3058 { | |
377 | 3059 v10 = v4->uSpecEnchantmentType; |
0 | 3060 if ( v10 == 64 ) |
3061 { | |
3062 v11 = (MONSTER_SUPERTYPE)1; | |
3063 goto LABEL_17; | |
3064 } | |
3065 if ( v10 == 39 || v5 == 508 ) | |
3066 { | |
3067 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3068 goto LABEL_16; | |
3069 } | |
3070 if ( v10 == 40 ) | |
3071 { | |
3072 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3073 goto LABEL_16; | |
3074 } | |
3075 if ( v10 == 63 || v5 == 517 ) | |
3076 { | |
3077 v13 = MONSTER_SUPERTYPE_ELF; | |
3078 LABEL_16: | |
3079 v11 = v13; | |
3080 LABEL_17: | |
3081 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3082 v9 *= 2; | |
3083 goto LABEL_19; | |
3084 } | |
3085 } | |
3086 LABEL_19: | |
3087 v12 = v14->pActiveSkills[5]; | |
3088 if ( v12 ) | |
3089 { | |
3090 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3091 v9 += v14->pActiveSkills[5] & 0x3F; | |
3092 } | |
3093 return v9; | |
3094 } | |
3095 | |
3096 //----- (0048D2EA) -------------------------------------------------------- | |
3097 char *Player::GetMeleeDamageString() | |
3098 { | |
3099 Player *v1; // esi@1 | |
3100 signed int v2; // eax@1 | |
3101 signed int v3; // edi@3 | |
3102 signed int v4; // eax@3 | |
3103 signed int v5; // ST0C_4@6 | |
3104 char *v6; // edi@6 | |
3105 signed int v7; // ST08_4@7 | |
3106 unsigned int v8; // eax@8 | |
3107 signed int v9; // esi@9 | |
3108 | |
3109 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3110 | |
3111 v1 = this; | |
232 | 3112 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3113 if ( v2 < 64 || v2 > 65 ) |
3114 { | |
3115 v3 = GetMeleeDamageMinimal(); | |
3116 v4 = GetMeleeDamageMaximal(); | |
3117 } | |
3118 else | |
3119 { | |
3120 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3121 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3122 } | |
3123 if ( v3 == v4 ) | |
3124 { | |
3125 v5 = v3; | |
3126 v6 = player__getmeleedamagestring_static_buff; | |
3127 sprintf(player__getmeleedamagestring_static_buff, "%d", v5); | |
3128 } | |
3129 else | |
3130 { | |
3131 v7 = v3; | |
3132 v6 = player__getmeleedamagestring_static_buff; | |
3133 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", v7, v4); | |
3134 } | |
3135 v8 = v1->pEquipment.uMainHand; | |
3136 if ( v8 ) | |
3137 { | |
232 | 3138 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3139 if ( v9 >= 135 ) |
3140 { | |
3141 if ( v9 <= 159 ) | |
3142 strcpy(v6, pGlobalTXT_LocalizationStrings[595]); | |
3143 } | |
3144 } | |
3145 return v6; | |
3146 } | |
3147 | |
3148 //----- (0048D396) -------------------------------------------------------- | |
3149 char *Player::GetRangedDamageString() | |
3150 { | |
3151 Player *v1; // esi@1 | |
3152 signed int v2; // eax@1 | |
3153 int v3; // edi@3 | |
3154 int v4; // eax@3 | |
3155 char *v5; // edi@6 | |
3156 int v6; // ST0C_4@8 | |
3157 int v7; // ST08_4@9 | |
3158 unsigned int v8; // eax@10 | |
3159 signed int v9; // esi@11 | |
3160 | |
3161 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3162 | |
3163 v1 = this; | |
232 | 3164 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 3165 if ( v2 < 64 || v2 > 65 ) |
3166 { | |
3167 v3 = GetRangedDamageMin(); | |
3168 v4 = GetRangedDamageMax(); | |
3169 } | |
3170 else | |
3171 { | |
3172 v3 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3173 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3174 } | |
3175 if ( v4 ) | |
3176 { | |
3177 if ( v3 == v4 ) | |
3178 { | |
3179 v6 = v3; | |
3180 v5 = player__getrangeddamagestring_static_buff; | |
3181 sprintf(player__getrangeddamagestring_static_buff, "%d", v6); | |
3182 } | |
3183 else | |
3184 { | |
3185 v7 = v3; | |
3186 v5 = player__getrangeddamagestring_static_buff; | |
3187 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", v7, v4); | |
3188 } | |
3189 } | |
3190 else | |
3191 { | |
3192 v5 = player__getrangeddamagestring_static_buff; | |
3193 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3194 } | |
3195 v8 = v1->pEquipment.uMainHand; | |
3196 if ( v8 ) | |
3197 { | |
232 | 3198 v9 = *(int *)&v1->pInventoryItems[v8-1]; |
0 | 3199 if ( v9 >= 135 ) |
3200 { | |
3201 if ( v9 <= 159 ) | |
3202 strcpy(v5, pGlobalTXT_LocalizationStrings[595]); | |
3203 } | |
3204 } | |
3205 return v5; | |
3206 } | |
3207 | |
3208 //----- (0048D45A) -------------------------------------------------------- | |
3209 bool Player::CanTrainToNextLevel() | |
3210 { | |
3211 int v1; // edx@1 | |
3212 int v2; // eax@1 | |
3213 int i; // esi@1 | |
3214 | |
3215 v1 = this->uLevel; | |
3216 v2 = 0; | |
3217 for ( i = 0; i < v1; ++i ) | |
3218 v2 += i + 1; | |
3219 return (signed __int64)this->uExperience >= 1000 * v2; | |
3220 } | |
3221 | |
3222 //----- (0048D498) -------------------------------------------------------- | |
3223 unsigned int Player::GetExperienceDisplayColor() | |
3224 { | |
3225 unsigned int result; // eax@2 | |
3226 | |
3227 if ( CanTrainToNextLevel() ) | |
3228 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
3229 else | |
3230 result = 0; | |
3231 return result; | |
3232 } | |
3233 | |
3234 //----- (0048D4B3) -------------------------------------------------------- | |
3235 int Player::CalculateIncommingDamage(int resistance, signed int type) | |
3236 { | |
3237 Player *v3; // esi@1 | |
3238 int v4; // edi@8 | |
3239 int v6; // eax@21 | |
3240 signed int v7; // ebx@21 | |
3241 int v8; // eax@22 | |
3242 signed int v9; // ebx@22 | |
3243 int v10; // eax@23 | |
3244 signed int v11; // ebx@23 | |
3245 int v12; // eax@24 | |
3246 signed int v13; // edi@24 | |
3247 unsigned int v14; // eax@27 | |
3248 int v15; // eax@29 | |
3249 double v16; // st7@32 | |
3250 enum CHARACTER_ATTRIBUTE_TYPE v17; // [sp-4h] [bp-10h]@9 | |
3251 signed int v18; // [sp+8h] [bp-4h]@17 | |
3252 | |
3253 v3 = this; | |
3254 if ( !resistance ) | |
3255 { | |
3256 v17 = (CHARACTER_ATTRIBUTE_TYPE)10; | |
3257 goto LABEL_16; | |
3258 } | |
3259 if ( resistance == 1 ) | |
3260 { | |
3261 v17 = (CHARACTER_ATTRIBUTE_TYPE)11; | |
3262 goto LABEL_16; | |
3263 } | |
3264 if ( resistance == 2 ) | |
3265 { | |
3266 v17 = (CHARACTER_ATTRIBUTE_TYPE)12; | |
3267 goto LABEL_16; | |
3268 } | |
3269 if ( resistance == 3 ) | |
3270 { | |
3271 v17 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3272 goto LABEL_16; | |
3273 } | |
3274 if ( resistance == 6 ) | |
3275 { | |
3276 v17 = (CHARACTER_ATTRIBUTE_TYPE)33; | |
3277 goto LABEL_16; | |
3278 } | |
3279 if ( resistance == 7 ) | |
3280 { | |
3281 v17 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3282 goto LABEL_16; | |
3283 } | |
3284 if ( resistance == 8 ) | |
3285 { | |
3286 v17 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3287 LABEL_16: | |
3288 v4 = GetActualResistance(v17); | |
3289 goto LABEL_17; | |
3290 } | |
3291 v4 = 0; | |
3292 LABEL_17: | |
3293 v18 = type; | |
135 | 3294 if ( v3->classType == PLAYER_CLASS_LICH && v4 >= 200 ) |
0 | 3295 return 0; |
3296 if ( v4 ) | |
3297 { | |
3298 v6 = GetActualLuck(); | |
3299 v7 = _48EA1B_get_static_effect(v6) + v4 + 30; | |
3300 if ( rand() % v7 >= 30 ) | |
3301 { | |
3302 v18 = type >> 1; | |
3303 v8 = GetActualLuck(); | |
3304 v9 = _48EA1B_get_static_effect(v8) + v4 + 30; | |
3305 if ( rand() % v9 >= 30 ) | |
3306 { | |
3307 v18 = type >> 2; | |
3308 v10 = GetActualLuck(); | |
3309 v11 = _48EA1B_get_static_effect(v10) + v4 + 30; | |
3310 if ( rand() % v11 >= 30 ) | |
3311 { | |
3312 v18 = type >> 3; | |
3313 v12 = GetActualLuck(); | |
3314 v13 = _48EA1B_get_static_effect(v12) + v4 + 30; | |
3315 if ( rand() % v13 >= 30 ) | |
3316 v18 = type >> 4; | |
3317 } | |
3318 } | |
3319 } | |
3320 } | |
3321 if ( resistance == 4 ) | |
3322 { | |
3323 v14 = v3->pEquipment.uBody; | |
3324 if ( v14 ) | |
3325 { | |
3326 if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) | |
3327 { | |
3328 v15 = GetEquippedItemSkillType(EQUIP_ARMOUR) - 10; | |
3329 if ( v15 ) | |
3330 { | |
3331 if ( v15 != 1 || (signed int)SkillToMastery(v3->pActiveSkills[11]) < 3 ) | |
3332 return v18; | |
3333 v16 = (double)v18 * 0.5; | |
3334 return (signed __int64)v16; | |
3335 } | |
3336 if ( (signed int)SkillToMastery(v3->pActiveSkills[10]) >= 4 ) | |
3337 { | |
3338 v16 = (double)v18 * 0.66670001; | |
3339 return (signed __int64)v16; | |
3340 } | |
3341 } | |
3342 } | |
3343 } | |
3344 return v18; | |
3345 } | |
3346 | |
3347 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3348 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3349 { | |
3350 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3351 } |
3352 | |
3353 //----- (0048D651) -------------------------------------------------------- | |
816 | 3354 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3355 { | |
3356 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3357 } |
3358 | |
3359 //----- (0048D676) -------------------------------------------------------- | |
3360 bool Player::IsUnarmed() | |
3361 { | |
816 | 3362 return HasItemEquipped(EQUIP_MAIN_HAND) != EQUIP_MAIN_HAND && |
3363 !(HasItemEquipped(EQUIP_OFF_HAND) == EQUIP_MAIN_HAND && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3364 } |
3365 | |
3366 //----- (0048D6AA) -------------------------------------------------------- | |
3367 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3368 { | |
3369 auto i = pEquipment.pIndices[uEquipIndex]; | |
3370 if (i) | |
3371 return ~pInventoryItems[i - 1].uAttributes & 0x02; | |
3372 else return false; | |
3373 } | |
3374 | |
3375 //----- (0048D6D0) -------------------------------------------------------- | |
3376 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3377 { | |
3378 for (uint i = 0; i < 16; ++i) | |
3379 { | |
3380 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
377 | 3381 pInventoryItems[i].uSpecEnchantmentType == uEnchantment) |
0 | 3382 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3383 return true; | |
3384 } | |
3385 return false; | |
3386 } | |
3387 | |
3388 //----- (0048D709) -------------------------------------------------------- | |
3389 bool Player::WearsItem(int a1, signed int a2) | |
3390 { | |
3391 int v3; // edx@2 | |
3392 Player *v4; // ecx@2 | |
3393 int v6; // esi@5 | |
3394 int v7; // edx@6 | |
3395 | |
3396 if ( a2 >= 16 ) | |
3397 { | |
3398 v6 = 0; | |
3399 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
727 | 3400 || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) |
0 | 3401 { |
3402 ++v6; | |
3403 if ( (signed int)v6 >= 16 ) | |
3404 return 0; | |
3405 } | |
3406 return 1; | |
3407 } | |
727 | 3408 if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) |
0 | 3409 return 1; |
3410 return 0; | |
3411 } | |
3412 | |
3413 //----- (0048D76C) -------------------------------------------------------- | |
3414 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3415 { | |
3416 unsigned __int16 v6; // cx@8 | |
3417 int v7; // edi@8 | |
3418 unsigned int v8; // ebx@8 | |
3419 unsigned int v9; // esi@8 | |
3420 int v10; // eax@8 | |
3421 int v11; // edi@12 | |
3422 bool result; // eax@13 | |
3423 | |
3424 if ( !a2 | |
3425 || this->pConditions[16] | |
3426 || this->pConditions[14] | |
3427 || this->pConditions[15] | |
3428 || this->pConditions[4] | |
3429 || this->pConditions[13] | |
3430 || this->pConditions[2] ) | |
3431 { | |
3432 result = 0; | |
3433 } | |
3434 else | |
3435 { | |
3436 v6 = this->pActiveSkills[34]; | |
3437 v7 = v6 & 0x3F; | |
3438 v8 = SkillToMastery(v6); | |
3439 v9 = a2->GetValue(); | |
3440 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3441 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3442 v9 *= 3; | |
3443 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3444 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3445 if ( rand() % 100 >= 5 ) | |
3446 { | |
3447 if ( *a6 > v11 ) | |
3448 result = *a6 - v11 < 500; | |
3449 else | |
3450 result = 2; | |
3451 } | |
3452 else | |
3453 { | |
3454 result = 0; | |
3455 } | |
3456 } | |
3457 return result; | |
3458 } | |
3459 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3460 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3461 | |
3462 //----- (0048D88B) -------------------------------------------------------- | |
3463 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3464 { | |
3465 Player *v4; // esi@1 | |
3466 Actor *v5; // edi@1 | |
3467 unsigned __int16 v6; // cx@10 | |
3468 int v7; // ebx@10 | |
3469 unsigned int v8; // esi@10 | |
3470 int v9; // eax@10 | |
3471 int v10; // esi@10 | |
3472 int v11; // eax@13 | |
3473 signed int v12; // ebx@15 | |
3474 signed int v13; // edx@15 | |
3475 int v14; // ecx@15 | |
3476 unsigned __int16 v15; // si@21 | |
3477 unsigned int v16; // ebx@24 | |
3478 int v17; // esi@24 | |
3479 const void *v18; // eax@29 | |
3480 unsigned int v19; // esi@31 | |
3481 int v20; // eax@34 | |
3482 char v21; // zf@36 | |
3483 unsigned int v22; // ST0C_4@39 | |
3484 char *v23; // esi@39 | |
3485 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3486 int v26; // [sp-8h] [bp-44h]@40 | |
3487 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3488 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3489 int v29; // [sp+30h] [bp-Ch]@10 | |
3490 int v30; // [sp+34h] [bp-8h]@10 | |
3491 Player *v31; // [sp+38h] [bp-4h]@1 | |
3492 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3493 | |
3494 v4 = this; | |
3495 v5 = &pActors[uActorID]; | |
3496 v31 = this; | |
3497 if ( &pActors[uActorID] | |
3498 && !this->pConditions[16] | |
3499 && !this->pConditions[14] | |
3500 && !this->pConditions[15] | |
3501 && !this->pConditions[4] | |
3502 && !this->pConditions[13] | |
3503 && !this->pConditions[2] ) | |
3504 { | |
3505 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3506 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3507 v6 = v4->pActiveSkills[34]; | |
3508 v7 = v6 & 0x3F; | |
3509 v8 = SkillToMastery(v6); | |
3510 v9 = rand(); | |
3511 v28 = 4 * v8; | |
3512 v30 = dword_4EDEA0[v8]; | |
3513 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3514 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3515 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3516 { | |
322 | 3517 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3518 _steal_perma = 0; |
3519 v26 = (int)v31->pName; | |
3520 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3521 } | |
3522 else | |
3523 { | |
3524 v11 = rand(); | |
3525 if ( v11 % 100 >= 40 ) | |
3526 { | |
3527 if ( v11 % 100 >= 70 ) | |
3528 { | |
3529 v19 = 0; | |
3530 if ( v7 > 0 ) | |
3531 { | |
3532 do | |
3533 { | |
3534 --v7; | |
3535 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3536 } | |
3537 while ( v7 ); | |
3538 } | |
3539 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3540 return _steal_perma; | |
377 | 3541 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3542 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3543 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3544 v21 = *(int *)v20 == v19; |
3545 *(int *)v20 -= v19; | |
3546 if ( v21 ) | |
3547 v5->array_000234[3].uItemID = 0; | |
3548 if ( v19 ) | |
3549 { | |
3550 party_finds_gold(v19, 2); | |
3551 v22 = v19; | |
3552 v23 = pTmpBuf2; | |
3553 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22); | |
3554 LABEL_43: | |
3555 ShowStatusBarString(v23, 2u); | |
3556 return _steal_perma; | |
3557 } | |
3558 } | |
3559 else | |
3560 { | |
3561 v27.Reset(); | |
3562 v12 = 0; | |
3563 v13 = 0; | |
3564 v14 = (int)v5->array_000234; | |
3565 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3566 { | |
3567 ++v13; | |
3568 v14 += 36; | |
3569 if ( v13 >= 4 ) | |
3570 goto LABEL_21; | |
3571 } | |
3572 v12 = 1; | |
3573 LABEL_21: | |
3574 v15 = v5->uCarriedItemID; | |
3575 if ( v15 || v12 ) | |
3576 { | |
3577 v27.Reset(); | |
3578 if ( v15 ) | |
3579 { | |
3580 v16 = (signed __int16)v15; | |
3581 v5->uCarriedItemID = 0; | |
3582 v27.uItemID = (signed __int16)v15; | |
3583 v17 = (signed __int16)v15; | |
3584 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3585 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3586 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3587 { | |
3588 if ( v16 != 220 ) | |
570 | 3589 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3590 } |
3591 } | |
3592 else | |
3593 { | |
3594 v18 = &v5->array_000234[rand() % 4]; | |
3595 memcpy(&v27, v18, sizeof(v27)); | |
3596 ((ItemGen *)v18)->Reset(); | |
3597 v16 = v27.uItemID; | |
3598 } | |
3599 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3600 sprintf( | |
3601 pTmpBuf2, | |
3602 pGlobalTXT_LocalizationStrings[304], | |
3603 v31->pName, | |
3604 pItemsTable->pItems[v16].pUnidentifiedName); | |
3605 ShowStatusBarString(pTmpBuf2, 2u); | |
3606 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3607 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3608 pMouse->SetCursorBitmapFromItemID(v16); | |
3609 return _steal_perma; | |
3610 } | |
3611 } | |
3612 } | |
3613 v26 = (int)v31->pName; | |
3614 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3615 } | |
3616 v23 = pTmpBuf2; | |
809 | 3617 sprintfex(pTmpBuf2, v25, v26); |
0 | 3618 goto LABEL_43; |
3619 } | |
3620 return 0; | |
3621 } | |
3622 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3623 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3624 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3625 | |
3626 //----- (0048DBB9) -------------------------------------------------------- | |
3627 void Player::Heal(int amount) | |
3628 { | |
3629 Player *v2; // esi@1 | |
3630 signed int v3; // eax@3 | |
3631 | |
3632 v2 = this; | |
3633 if ( !this->pConditions[16] && !this->pConditions[14] ) | |
3634 { | |
3635 v3 = GetMaxHealth(); | |
3636 if ( v2->pConditions[17] ) | |
3637 v3 /= 2; | |
3638 v2->sHealth += amount; | |
3639 if ( v2->sHealth > v3 ) | |
3640 v2->sHealth = v3; | |
3641 if ( v2->pConditions[13] ) | |
3642 { | |
3643 if ( v2->sHealth > 0 ) | |
3644 { | |
3645 LODWORD(v2->pConditions[13]) = 0; | |
3646 HIDWORD(v2->pConditions[13]) = 0; | |
3647 } | |
3648 } | |
3649 } | |
3650 } | |
3651 | |
3652 //----- (0048DC1E) -------------------------------------------------------- | |
3653 int Player::ReceiveDamage(signed int type, int resistance) | |
3654 { | |
3655 Player *v3; // esi@1 | |
3656 signed int v4; // eax@1 | |
3657 int v5; // eax@1 | |
3658 bool v6; // ebx@1 | |
3659 unsigned int v7; // eax@8 | |
3660 char *v8; // ecx@9 | |
3661 int v9; // eax@9 | |
187 | 3662 //signed int typea; // [sp+14h] [bp+8h]@1 |
0 | 3663 |
3664 v3 = this; | |
3665 this->pConditions[2] = 0i64; | |
3666 v4 = CalculateIncommingDamage(resistance, type); | |
3667 v3->sHealth -= v4; | |
187 | 3668 //typea = v4; |
0 | 3669 v5 = v3->sHealth; |
3670 v6 = v5 < -10; | |
3671 LOBYTE(v6) = v5 <= -10; | |
3672 if ( v5 < 1 ) | |
3673 { | |
3674 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 | |
3675 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) | |
3676 { | |
3677 SetCondition(0xDu, 0); | |
3678 } | |
3679 else | |
3680 { | |
3681 SetCondition(0xEu, 0); | |
3682 v6 = LODWORD(pParty->uTimePlayed); | |
3683 if ( v3->sHealth > 0 ) | |
3684 v3->sHealth = 0; | |
3685 } | |
3686 if ( v6 ) | |
3687 { | |
3688 v7 = v3->pEquipment.uBody; | |
3689 if ( v7 ) | |
3690 { | |
3691 v8 = &v3->field_1F5[36 * v7 + 15]; | |
3692 v9 = *(int *)v8; | |
3693 if ( !(BYTE1(v9) & 2) ) | |
3694 { | |
3695 LOBYTE(v9) = v9 | 2; | |
3696 *(int *)v8 = v9; | |
3697 } | |
3698 } | |
3699 } | |
3700 } | |
187 | 3701 if ( v4 && CanAct() ) |
3702 PlaySound(SPEECH_24, 0); | |
3703 return v4; | |
0 | 3704 } |
3705 | |
3706 //----- (0048DCF6) -------------------------------------------------------- | |
3707 int Player::_48DCF6(int a2, Actor *pActor) | |
3708 { | |
3709 signed int v3; // edi@1 | |
3710 signed int v4; // ebx@1 | |
3711 Player *v5; // esi@1 | |
3712 int v6; // eax@2 | |
3713 int v7; // eax@5 | |
3714 int v8; // eax@8 | |
3715 int v9; // ebx@8 | |
3716 int v10; // eax@8 | |
3717 int v11; // ebx@8 | |
3718 signed int v12; // edx@9 | |
3719 ItemGen *v13; // eax@9 | |
3720 int v14; // edx@16 | |
3721 unsigned int v15; // edx@17 | |
3722 int v16; // edx@26 | |
3723 unsigned int v17; // edx@27 | |
3724 Player *v18; // ecx@32 | |
3725 signed int v19; // edx@38 | |
3726 int *v20; // ecx@38 | |
3727 signed int v21; // eax@40 | |
3728 int v22; // eax@49 | |
3729 signed int v23; // ebx@49 | |
3730 unsigned int v24; // eax@60 | |
3731 int v25; // ecx@61 | |
3732 int v26; // ebx@74 | |
3733 void *v27; // ecx@76 | |
3734 unsigned int v28; // ebx@78 | |
3735 signed int result; // eax@86 | |
3736 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3737 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3738 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3739 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3740 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3741 int v35; // [sp-Ch] [bp-ACh]@56 | |
3742 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3743 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3744 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3745 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3746 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3747 int v41; // [sp-4h] [bp-A4h]@51 | |
3748 int v42; // [sp-4h] [bp-A4h]@56 | |
3749 int v43; // [sp-4h] [bp-A4h]@57 | |
3750 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3751 int v45; // [sp-4h] [bp-A4h]@68 | |
3752 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3753 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3754 int v48; // [sp+9Ch] [bp-4h]@1 | |
3755 | |
3756 v3 = 0; | |
3757 v4 = 0; | |
3758 v5 = this; | |
3759 v47 = 0; | |
3760 v48 = 0; | |
3761 switch ( a2 ) | |
3762 { | |
3763 case 1: | |
3764 v6 = GetActualWillpower(); | |
3765 goto LABEL_46; | |
3766 case 2: | |
3767 case 3: | |
3768 case 4: | |
3769 case 9: | |
3770 case 10: | |
3771 case 11: | |
3772 case 13: | |
3773 case 21: | |
3774 v6 = GetActualEndurance(); | |
3775 goto LABEL_46; | |
3776 case 5: | |
3777 case 12: | |
3778 case 23: | |
3779 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3780 goto LABEL_5; | |
3781 case 15: | |
3782 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3783 goto LABEL_5; | |
3784 case 6: | |
3785 case 7: | |
3786 case 8: | |
3787 case 14: | |
3788 case 16: | |
3789 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3790 LABEL_5: | |
3791 v7 = GetActualResistance(v40); | |
3792 goto LABEL_47; | |
3793 case 22: | |
3794 v8 = GetActualWillpower(); | |
3795 v9 = _48EA1B_get_static_effect(v8); | |
3796 v10 = GetActualIntelligence(); | |
3797 v11 = (_48EA1B_get_static_effect(v10) + v9) >> 1; | |
3798 break; | |
3799 case 17: | |
3800 v12 = 0; | |
3801 v13 = this->pInventoryItems; | |
3802 do | |
3803 { | |
315 | 3804 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3805 v46[v4++] = v12; |
3806 ++v12; | |
3807 ++v13; | |
3808 } | |
3809 while ( v12 < 138 ); | |
3810 goto LABEL_36; | |
3811 case 18: | |
3812 v14 = 0; | |
3813 do | |
3814 { | |
3815 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3816 { | |
816 | 3817 if ( v15 == EQUIP_ARMOUR ) |
0 | 3818 v46[v4++] = LOBYTE(v5->pEquipment.uBody) - 1; |
816 | 3819 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
0 | 3820 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v15) - 1; |
3821 } | |
3822 v14 = v15 + 1; | |
3823 } | |
3824 while ( v14 < 16 ); | |
3825 goto LABEL_36; | |
3826 case 19: | |
3827 v16 = 0; | |
3828 do | |
3829 { | |
3830 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3831 { | |
3832 if ( v17 == 2 ) | |
3833 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3834 if ( (!v17 || v17 == 1) | |
816 | 3835 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
0 | 3836 v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v17) - 1; |
3837 } | |
3838 v16 = v17 + 1; | |
3839 } | |
3840 while ( v16 < 16 ); | |
3841 LABEL_36: | |
3842 if ( !v4 ) | |
3843 goto LABEL_87; | |
3844 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3845 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3846 break; | |
3847 case 20: | |
3848 v19 = 0; | |
3849 v20 = this->pInventoryIndices; | |
3850 do | |
3851 { | |
3852 if ( *v20 > 0 ) | |
3853 { | |
232 | 3854 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3855 if ( v21 > 0 ) |
3856 { | |
3857 if ( v21 <= 134 ) | |
3858 v46[v4++] = v19; | |
3859 } | |
3860 } | |
3861 ++v19; | |
3862 ++v20; | |
3863 } | |
3864 while ( v19 < 126 ); | |
3865 if ( !v4 ) | |
3866 goto LABEL_87; | |
3867 v47 = (unsigned __int8)v46[rand() % v4]; | |
3868 v6 = GetActualAccuracy(); | |
3869 LABEL_46: | |
3870 v7 = _48EA1B_get_static_effect(v6); | |
3871 LABEL_47: | |
3872 v11 = v7; | |
3873 break; | |
3874 default: | |
3875 v11 = 0; | |
3876 break; | |
3877 } | |
3878 v22 = GetActualLuck(); | |
3879 v23 = _48EA1B_get_static_effect(v22) + v11 + 30; | |
3880 if ( rand() % v23 >= 30 ) | |
3881 { | |
3882 LABEL_87: | |
3883 result = 0; | |
3884 } | |
3885 else | |
3886 { | |
3887 switch ( a2 ) | |
3888 { | |
3889 case 1: | |
3890 v41 = 1; | |
3891 v36 = 0; | |
3892 goto LABEL_56; | |
3893 case 2: | |
3894 v41 = 1; | |
3895 v36 = 1; | |
3896 goto LABEL_56; | |
3897 case 3: | |
3898 v41 = 1; | |
3899 v36 = 2; | |
3900 goto LABEL_56; | |
3901 case 23: | |
3902 v41 = 1; | |
3903 v36 = 3; | |
3904 goto LABEL_56; | |
3905 case 4: | |
3906 v41 = 1; | |
3907 v36 = 4; | |
3908 LABEL_56: | |
3909 SetCondition(v36, v41); | |
3910 v42 = 0; | |
3911 v37 = 0; | |
3912 v35 = 0; | |
3913 v34 = 0; | |
3914 v33 = -1; | |
3915 v32 = 0; | |
3916 v31 = 0; | |
3917 v30 = (SoundID)221; | |
3918 goto LABEL_83; | |
3919 case 5: | |
3920 v43 = 1; | |
3921 v38 = 5; | |
3922 goto LABEL_70; | |
3923 case 6: | |
3924 case 7: | |
3925 case 8: | |
3926 if ( a2 == 6 ) | |
3927 { | |
3928 v44 = 6; | |
3929 goto LABEL_60; | |
3930 } | |
3931 v25 = 2 * (a2 != 8) + 8; | |
3932 goto LABEL_65; | |
3933 case 9: | |
3934 if ( a2 == 6 ) | |
3935 { | |
3936 v44 = 7; | |
3937 LABEL_60: | |
3938 v24 = v44; | |
3939 } | |
3940 else | |
3941 { | |
3942 v25 = 2 * (a2 != 8) + 9; | |
3943 LABEL_65: | |
3944 v24 = v25; | |
3945 } | |
3946 SetCondition(v24, 1); | |
3947 v42 = 0; | |
3948 v37 = 0; | |
3949 v35 = 0; | |
3950 v34 = 0; | |
3951 v33 = -1; | |
3952 v32 = 0; | |
3953 v31 = 0; | |
3954 v30 = (SoundID)222; | |
3955 LABEL_83: | |
3956 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3957 do | |
3958 { | |
3959 LABEL_84: | |
3960 if ( v5 == pPlayers[v3 + 1] ) | |
3961 break; | |
3962 ++v3; | |
3963 } | |
3964 while ( v3 < 4 ); | |
3965 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3966 result = 1; | |
3967 break; | |
3968 case 12: | |
3969 v43 = 1; | |
3970 v38 = 12; | |
3971 goto LABEL_70; | |
3972 case 15: | |
3973 v45 = 1; | |
3974 v39 = 15; | |
3975 goto LABEL_73; | |
3976 case 13: | |
3977 v43 = 1; | |
3978 v38 = 13; | |
3979 LABEL_70: | |
3980 SetCondition(v38, v43); | |
3981 v42 = 0; | |
3982 v37 = 0; | |
3983 v35 = 0; | |
3984 v34 = 0; | |
3985 v33 = -1; | |
3986 v32 = 0; | |
3987 v31 = 0; | |
3988 v30 = (SoundID)224; | |
3989 goto LABEL_83; | |
3990 case 14: | |
3991 v45 = 1; | |
3992 v39 = 14; | |
3993 goto LABEL_73; | |
3994 case 16: | |
3995 v45 = 1; | |
3996 v39 = 16; | |
3997 LABEL_73: | |
3998 SetCondition(v39, v45); | |
3999 v42 = 0; | |
4000 v37 = 0; | |
4001 v35 = 0; | |
4002 v34 = 0; | |
4003 v33 = -1; | |
4004 v32 = 0; | |
4005 v31 = 0; | |
4006 v30 = (SoundID)225; | |
4007 goto LABEL_83; | |
4008 case 17: | |
4009 case 18: | |
4010 case 19: | |
4011 v26 = v48; | |
4012 if ( *(char *)(v48 + 21) & 2 ) | |
4013 goto LABEL_84; | |
187 | 4014 PlaySound(SPEECH_40, 0); |
0 | 4015 *(int *)(v26 + 20) |= 2u; |
4016 goto LABEL_79; | |
4017 case 20: | |
187 | 4018 PlaySound(SPEECH_40, 0); |
0 | 4019 v27 = pActor->array_000234; |
4020 if ( pActor->array_000234[0].uItemID ) | |
4021 { | |
4022 v27 = &pActor->array_000234[1]; | |
4023 if ( pActor->array_000234[1].uItemID ) | |
4024 goto LABEL_84; | |
4025 } | |
4026 v28 = v47; | |
654 | 4027 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 4028 RemoveItemAtInventoryIndex(v28); |
4029 LABEL_79: | |
4030 v42 = 0; | |
4031 v37 = 0; | |
4032 v35 = 0; | |
4033 v34 = 0; | |
4034 v33 = -1; | |
4035 v32 = 0; | |
4036 v31 = 0; | |
4037 v30 = (SoundID)47; | |
4038 goto LABEL_83; | |
4039 case 21: | |
187 | 4040 PlaySound(SPEECH_42, 0); |
0 | 4041 ++v5->sAgeModifier; |
4042 goto LABEL_82; | |
4043 case 22: | |
187 | 4044 PlaySound(SPEECH_41, 0); |
0 | 4045 v5->sMana = 0; |
4046 LABEL_82: | |
4047 v42 = 0; | |
4048 v37 = 0; | |
4049 v35 = 0; | |
4050 v34 = 0; | |
4051 v33 = -1; | |
4052 v32 = 0; | |
4053 v31 = 0; | |
4054 v30 = (SoundID)226; | |
4055 goto LABEL_83; | |
4056 default: | |
4057 goto LABEL_87; | |
4058 } | |
4059 } | |
4060 return result; | |
4061 } | |
324 | 4062 |
0 | 4063 // 48DCF6: using guessed type char var_94[140]; |
4064 | |
4065 //----- (0048E1A3) -------------------------------------------------------- | |
4066 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
4067 { | |
4068 return LOBYTE(pSpellStats->pInfos[uSpellID].uSchool); | |
4069 } | |
4070 | |
4071 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 4072 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
4073 { | |
4074 ItemGen *weapon = nullptr; | |
4075 ItemDesc *weapon_desc = nullptr; | |
4076 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
4077 if (bRangedAttack) | |
0 | 4078 { |
4079 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4080 goto LABEL_17; | |
816 | 4081 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
4082 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4083 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
4084 goto LABEL_17; | |
4085 } | |
4086 else if ( IsUnarmed() == 1 ) | |
4087 { | |
4088 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
4089 { | |
4090 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 4091 goto LABEL_17; |
4092 } | |
4093 } | |
816 | 4094 |
4095 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4096 { | |
4097 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
4098 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4099 if (weapon_desc->uEquipType == EQUIP_WAND) | |
4100 { | |
4101 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
4102 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
4103 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
4104 } | |
0 | 4105 else |
816 | 4106 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
4107 } | |
4108 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
4109 { | |
4110 auto v12 = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4111 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; | |
4112 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
4113 { | |
4114 weapon = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4115 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
4116 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
4117 } | |
4118 } | |
4119 | |
0 | 4120 LABEL_17: |
816 | 4121 uint armour_recovery = 0; |
0 | 4122 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4123 { | |
816 | 4124 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uBody - 1].uItemID].uSkillType; |
4125 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; | |
4126 | |
4127 float armour_recovery_multipliers[4]; | |
4128 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4129 { | |
4130 armour_recovery_multipliers[0] = 1.0f; | |
4131 armour_recovery_multipliers[1] = 0; | |
4132 armour_recovery_multipliers[2] = 0; | |
4133 armour_recovery_multipliers[3] = 0; | |
4134 } | |
4135 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4136 { | |
4137 armour_recovery_multipliers[0] = 1.0f; | |
4138 armour_recovery_multipliers[1] = 0.5f; | |
4139 armour_recovery_multipliers[2] = 0; | |
4140 armour_recovery_multipliers[3] = 0; | |
4141 } | |
4142 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4143 { | |
4144 armour_recovery_multipliers[0] = 1.0f; | |
4145 armour_recovery_multipliers[1] = 0.5f; | |
4146 armour_recovery_multipliers[2] = 0.5f; | |
4147 armour_recovery_multipliers[3] = 0; | |
0 | 4148 } |
4149 else | |
4150 { | |
816 | 4151 assert(false && "Unknown armour type"); // what kind of armour is that? |
4152 armour_recovery_multipliers[0] = 1.0f; | |
4153 armour_recovery_multipliers[1] = 1.0f; | |
4154 armour_recovery_multipliers[2] = 1.0f; | |
4155 armour_recovery_multipliers[3] = 1.0f; | |
4156 } | |
4157 | |
4158 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4159 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4160 } | |
4161 | |
4162 uint shield_recovery = 0; | |
4163 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4164 { | |
4165 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4166 | |
4167 auto shield = &pInventoryItems[pEquipment.uOffHand - 1]; | |
4168 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; | |
4169 | |
4170 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4171 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4172 } | |
4173 | |
4174 uint player_speed_recovery_reduction = _48EA1B_get_static_effect(GetActualSpeed()), | |
4175 sword_axe_bow_recovery_reduction = 0; | |
4176 bool shooting_laser = false; | |
4177 if (weapon_desc) | |
4178 { | |
4179 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4180 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4181 { | |
4182 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4183 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4184 } | |
4185 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4186 shooting_laser = true; | |
4187 } | |
4188 | |
4189 uint armsmaster_recovery_reduction = 0; | |
4190 if (!bRangedAttack && !shooting_laser) | |
4191 { | |
4192 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4193 { | |
4194 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4195 if (SkillToMastery(armsmaster_level) >= 4) | |
4196 armsmaster_recovery_reduction *= 2; | |
4197 } | |
4198 } | |
4199 | |
4200 uint v41 = 0; | |
4201 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4202 v41 = 25; |
816 | 4203 |
4204 uint weapon_enchantment_recovery_reduction = 0; | |
4205 if ( weapon ) | |
4206 { | |
4207 if (weapon->uSpecEnchantmentType == 59 || | |
4208 weapon->uSpecEnchantmentType == 41 || | |
4209 weapon->uSpecEnchantmentType == 500) | |
4210 weapon_enchantment_recovery_reduction = 20; | |
4211 } | |
4212 | |
4213 | |
4214 int recovery = weapon_recovery + | |
4215 armour_recovery + | |
4216 shield_recovery | |
4217 - armsmaster_recovery_reduction | |
4218 - weapon_enchantment_recovery_reduction | |
4219 - v41 | |
4220 - sword_axe_bow_recovery_reduction | |
4221 - player_speed_recovery_reduction; | |
4222 | |
4223 if (recovery < 0) | |
4224 recovery = 0; | |
4225 return recovery; | |
0 | 4226 } |
4227 | |
4228 //----- (0048E4F8) -------------------------------------------------------- | |
4229 int Player::GetMaxHealth() | |
4230 { | |
4231 int v3; // esi@1 | |
4232 int v4; // esi@1 | |
4233 int v6; // esi@1 | |
4234 | |
4235 v3 = _48EA1B_get_static_effect(GetActualEndurance()); | |
135 | 4236 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4237 v6 = uFullHealthBonus |
135 | 4238 + pBaseHealthByClass[classType / 4] |
0 | 4239 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4240 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4241 if (v6 <= 0) | |
4242 return 1; | |
4243 return v6; | |
4244 } | |
4245 | |
4246 //----- (0048E565) -------------------------------------------------------- | |
4247 int Player::GetMaxMana() | |
4248 { | |
4249 int v2; // eax@2 | |
4250 int v3; // esi@4 | |
4251 int v4; // eax@5 | |
4252 int v5; // esi@5 | |
4253 int v6; // eax@5 | |
4254 int v7; // esi@6 | |
4255 int v8; // esi@6 | |
4256 int v9; // esi@6 | |
4257 int result; // eax@7 | |
4258 | |
135 | 4259 switch (classType) |
0 | 4260 { |
4261 case 5u: | |
4262 case 6u: | |
4263 case 7u: | |
4264 case 0x10u: | |
4265 case 0x11u: | |
4266 case 0x12u: | |
4267 case 0x13u: | |
4268 case 0x20u: | |
4269 case 0x21u: | |
4270 case 0x22u: | |
4271 case 0x23u: | |
4272 v2 = GetActualIntelligence(); | |
4273 v3 = _48EA1B_get_static_effect(v2); | |
4274 goto LABEL_6; | |
4275 case 9u: | |
4276 case 0xAu: | |
4277 case 0xBu: | |
4278 case 0xCu: | |
4279 case 0xDu: | |
4280 case 0xEu: | |
4281 case 0xFu: | |
4282 case 0x18u: | |
4283 case 0x19u: | |
4284 case 0x1Au: | |
4285 case 0x1Bu: | |
4286 v2 = GetActualWillpower(); | |
4287 v3 = _48EA1B_get_static_effect(v2); | |
4288 goto LABEL_6; | |
4289 case 0x15u: | |
4290 case 0x16u: | |
4291 case 0x17u: | |
4292 case 0x1Cu: | |
4293 case 0x1Du: | |
4294 case 0x1Eu: | |
4295 case 0x1Fu: | |
4296 v4 = GetActualWillpower(); | |
4297 v5 = _48EA1B_get_static_effect(v4); | |
4298 v6 = GetActualIntelligence(); | |
4299 v3 = _48EA1B_get_static_effect(v6) + v5; | |
4300 LABEL_6: | |
135 | 4301 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4302 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; |
4303 v9 = uFullManaBonus | |
135 | 4304 + pBaseManaByClass[classType / 4] |
0 | 4305 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) |
4306 + v8; | |
4307 if ( v9 < 1 ) | |
4308 goto LABEL_7; | |
4309 result = v9; | |
4310 break; | |
4311 default: | |
4312 LABEL_7: | |
4313 result = 0; | |
4314 break; | |
4315 } | |
4316 return result; | |
4317 } | |
4318 | |
4319 //----- (0048E656) -------------------------------------------------------- | |
4320 int Player::GetBaseAC() | |
4321 { | |
4322 Player *v1; // edi@1 | |
4323 int v2; // eax@1 | |
4324 int v3; // esi@1 | |
4325 int v4; // esi@1 | |
4326 int v5; // esi@1 | |
4327 int result; // eax@2 | |
4328 | |
4329 v1 = this; | |
4330 v2 = GetActualSpeed(); | |
4331 v3 = _48EA1B_get_static_effect(v2); | |
4332 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4333 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4334 if ( v5 >= 1 ) | |
4335 result = v5; | |
4336 else | |
4337 result = 0; | |
4338 return result; | |
4339 } | |
4340 | |
4341 //----- (0048E68F) -------------------------------------------------------- | |
4342 int Player::GetActualAC() | |
4343 { | |
4344 Player *v1; // edi@1 | |
4345 int v2; // eax@1 | |
4346 int v3; // esi@1 | |
4347 int v4; // esi@1 | |
4348 int v5; // esi@1 | |
4349 int v6; // esi@1 | |
4350 int result; // eax@2 | |
4351 | |
4352 v1 = this; | |
4353 v2 = GetActualSpeed(); | |
4354 v3 = _48EA1B_get_static_effect(v2); | |
4355 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; | |
4356 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4357 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4358 if ( v6 >= 1 ) | |
4359 result = v6; | |
4360 else | |
4361 result = 0; | |
4362 return result; | |
4363 } | |
4364 | |
4365 //----- (0048E6DC) -------------------------------------------------------- | |
4366 unsigned int Player::GetBaseAge() | |
4367 { | |
352 | 4368 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4369 } |
4370 | |
4371 //----- (0048E72C) -------------------------------------------------------- | |
4372 unsigned int Player::GetActualAge() | |
4373 { | |
4374 return this->sAgeModifier + GetBaseAge(); | |
4375 } | |
4376 | |
4377 //----- (0048E73F) -------------------------------------------------------- | |
4378 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4379 { | |
4380 Player *v2; // ebx@1 | |
4381 signed int v3; // esi@1 | |
4382 enum CHARACTER_RACE v4; // eax@1 | |
4383 signed int v5; // edi@8 | |
4384 char v6; // zf@9 | |
4385 int v7; // esi@20 | |
4386 int result; // eax@21 | |
4387 signed int v9; // [sp-4h] [bp-10h]@11 | |
4388 | |
4389 v2 = this; | |
4390 v3 = 0; | |
4391 v4 = GetRace(); | |
4392 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4393 { | |
4394 v5 = 0; | |
4395 goto LABEL_16; | |
4396 } | |
4397 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4398 { | |
4399 v5 = 1; | |
4400 LABEL_16: | |
4401 v6 = v4 == 2; | |
4402 goto LABEL_17; | |
4403 } | |
4404 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4405 { | |
4406 v6 = v4 == 3; | |
4407 v5 = 2; | |
4408 goto LABEL_17; | |
4409 } | |
4410 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4411 { | |
4412 v5 = 3; | |
4413 v6 = v4 == 3; | |
4414 goto LABEL_17; | |
4415 } | |
4416 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4417 { | |
4418 v5 = 7; | |
4419 if ( v4 != 1 ) | |
4420 goto LABEL_20; | |
4421 v9 = 10; | |
4422 LABEL_19: | |
4423 v3 = v9; | |
4424 goto LABEL_20; | |
4425 } | |
4426 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4427 { | |
4428 v5 = 8; | |
4429 v6 = v4 == 0; | |
4430 LABEL_17: | |
4431 if ( !v6 ) | |
4432 goto LABEL_20; | |
4433 v9 = 5; | |
4434 goto LABEL_19; | |
4435 } | |
4436 v5 = 0; | |
4437 LABEL_20: | |
4438 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4439 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4440 result = v7 + *(&v2->sResFireBase + v5); |
4441 return result; | |
4442 } | |
4443 | |
4444 //----- (0048E7D0) -------------------------------------------------------- | |
4445 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4446 { | |
4447 signed int v2; // edi@1 | |
4448 Player *v3; // esi@1 | |
4449 enum CHARACTER_RACE v4; // ebx@1 | |
4450 Player *v5; // ecx@8 | |
4451 char v6; // zf@18 | |
4452 int v7; // ebx@28 | |
4453 int result; // eax@28 | |
4454 signed int v9; // [sp+10h] [bp-8h]@1 | |
4455 signed int v10; // [sp+14h] [bp-4h]@1 | |
4456 | |
4457 v2 = 0; | |
4458 v3 = this; | |
4459 v10 = 0; | |
4460 v9 = 0; | |
4461 v4 = GetRace(); | |
652 | 4462 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4463 v10 = 20; |
4464 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4465 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4466 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4467 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4468 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4469 && HasItemEquipped(EQUIP_ARMOUR) | |
4470 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4471 v10 += v3->pActiveSkills[9] & 0x3F; | |
4472 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4473 goto LABEL_25; | |
4474 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4475 { | |
4476 v2 = 1; | |
4477 LABEL_25: | |
4478 v6 = v4 == 2; | |
4479 LABEL_26: | |
4480 if ( v6 ) | |
4481 v9 = 5; | |
4482 goto LABEL_28; | |
4483 } | |
4484 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4485 { | |
4486 v6 = v4 == 3; | |
4487 v2 = 2; | |
4488 goto LABEL_26; | |
4489 } | |
4490 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4491 { | |
4492 v2 = 3; | |
4493 if ( v4 == 3 ) | |
4494 v10 += 5; | |
4495 } | |
4496 else | |
4497 { | |
4498 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4499 { | |
4500 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4501 goto LABEL_28; | |
4502 v2 = 8; | |
4503 v6 = v4 == 0; | |
4504 goto LABEL_26; | |
4505 } | |
4506 v2 = 7; | |
4507 if ( v4 == 1 ) | |
4508 v9 = 10; | |
4509 } | |
4510 LABEL_28: | |
4511 v7 = GetItemsBonus(a2, 0); | |
4512 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4513 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4514 { |
4515 if ( result > 200 ) | |
4516 result = 200; | |
4517 } | |
4518 return result; | |
4519 } | |
4520 | |
4521 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4522 bool Player::Recover(int dt) |
4523 { | |
4524 //Player *v2; // esi@1 | |
0 | 4525 signed __int64 v3; // qax@1 |
816 | 4526 //bool result; // eax@4 |
4527 | |
4528 //v2 = this; | |
4529 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4530 | |
4531 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4532 | |
4533 if (uTimeToRecovery > v3) | |
4534 { | |
4535 uTimeToRecovery -= v3; | |
4536 return true; | |
0 | 4537 } |
4538 else | |
4539 { | |
816 | 4540 uTimeToRecovery = 0; |
4541 viewparams->bRedrawGameUI = true; | |
4542 if (!uActiveCharacter) | |
0 | 4543 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4544 return false; |
4545 } | |
0 | 4546 } |
4547 | |
4548 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4549 void Player::SetRecoveryTime(signed int rec) |
4550 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4551 assert(rec >= 0); |
816 | 4552 |
4553 if (rec > uTimeToRecovery) | |
4554 uTimeToRecovery = rec; | |
4555 | |
4556 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4557 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4558 |
4559 viewparams->bRedrawGameUI = true; | |
0 | 4560 } |
4561 // 50C0C4: using guessed type int some_active_character; | |
4562 | |
4563 //----- (0048E9B7) -------------------------------------------------------- | |
4564 void Player::RandomizeName() | |
4565 { | |
4566 if (!uExpressionTimePassed) | |
4567 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4568 } | |
4569 | |
4570 //----- (0048E9F4) -------------------------------------------------------- | |
4571 unsigned int Player::GetMajorConditionIdx() | |
4572 { | |
4573 for (uint i = 0; i < 18; ++i) | |
4574 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4575 return pConditionImportancyTable[i]; | |
4576 | |
4577 return 18; | |
4578 } | |
4579 | |
4580 //----- (0048EA1B) -------------------------------------------------------- | |
4581 int Player::_48EA1B_get_static_effect(int a2) | |
4582 { | |
4583 __int16 v2; // cx@1 | |
4584 int v3; // eax@1 | |
4585 | |
4586 v2 = word_4EDFFC[0]; | |
4587 v3 = 0; | |
4588 while ( a2 < v2 && v2 ) | |
4589 v2 = word_4EDFFC[v3++ + 1]; | |
4590 return player_stat_bonuses[v3]; | |
4591 } | |
4592 | |
4593 //----- (0048EA46) -------------------------------------------------------- | |
4594 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4595 { | |
4596 int v3; // esi@1 | |
4597 int v4; // edx@2 | |
4598 int v5; // eax@3 | |
4599 char *v6; // eax@4 | |
4600 | |
4601 v3 = 0; | |
4602 while ( 1 ) | |
4603 { | |
4604 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v3) ) | |
4605 goto LABEL_11; | |
816 | 4606 v5 = pEquipment.pIndices[v3] - 1; |
0 | 4607 if ( a2 != 17 ) |
816 | 4608 { |
4609 if ( a2 != 24 || this->pInventoryItems[v5].uSpecEnchantmentType != 24 ) | |
4610 goto LABEL_11; | |
4611 return 5; | |
4612 } | |
0 | 4613 v6 = (char *)this + 36 * v5; |
4614 if ( *((int *)v6 + 133) == 533 || *((int *)v6 + 136) == 17 ) | |
4615 return 50; | |
4616 LABEL_11: | |
4617 ++v3; | |
4618 if ( (signed int)v3 >= 16 ) | |
816 | 4619 return 0; |
4620 } | |
0 | 4621 } |
4622 | |
4623 //----- (0048EAAE) -------------------------------------------------------- | |
4624 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4625 { | |
4626 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
4627 signed int v4; // eax@1 | |
4628 int v5; // edi@1 | |
4629 Player *v6; // ebx@1 | |
4630 Player *v8; // ecx@48 | |
4631 int v9; // eax@49 | |
4632 int v10; // edx@49 | |
4633 Player *v11; // ecx@55 | |
4634 int v12; // eax@56 | |
4635 int v13; // edx@56 | |
4636 int v14; // ecx@58 | |
4637 int v15; // eax@58 | |
4638 Player *v16; // ecx@61 | |
4639 int v17; // eax@62 | |
4640 Player *v18; // ecx@66 | |
4641 int v19; // eax@67 | |
4642 int v20; // eax@69 | |
4643 Player *v21; // ecx@75 | |
4644 int v22; // eax@76 | |
4645 int v23; // edx@76 | |
4646 int v24; // eax@79 | |
4647 int v25; // ecx@80 | |
4648 int v26; // edi@80 | |
4649 Player *v27; // ecx@84 | |
4650 int v28; // eax@85 | |
4651 int v29; // edx@85 | |
4652 Player *v30; // ecx@96 | |
4653 int v31; // ebp@97 | |
4654 int v32; // eax@98 | |
4655 unsigned int v33; // eax@100 | |
4656 int v34; // eax@103 | |
4657 char v35; // zf@104 | |
4658 char v36; // zf@107 | |
4659 unsigned __int8 v37; // zf@119 | |
4660 char v38; // sf@119 | |
4661 unsigned __int8 v39; // of@119 | |
4662 char v40; // zf@122 | |
4663 char v41; // zf@145 | |
4664 char v42; // zf@164 | |
4665 char v43; // zf@173 | |
4666 char v44; // zf@189 | |
4667 char v45; // zf@198 | |
4668 char v46; // zf@239 | |
4669 int v47; // eax@268 | |
4670 int v48; // eax@269 | |
4671 int v49; // eax@291 | |
4672 char v50; // zf@295 | |
4673 int v51; // eax@306 | |
4674 int v52; // eax@307 | |
4675 char v53; // zf@312 | |
4676 char v54; // zf@336 | |
4677 char v55; // zf@348 | |
4678 int v56; // eax@365 | |
4679 int v57; // ebx@368 | |
4680 signed int v58; // [sp-4h] [bp-20h]@10 | |
4681 signed int v59; // [sp-4h] [bp-20h]@71 | |
4682 signed int v60; // [sp-4h] [bp-20h]@347 | |
4683 int v61; // [sp+10h] [bp-Ch]@1 | |
4684 int v62; // [sp+14h] [bp-8h]@1 | |
4685 int v63; // [sp+18h] [bp-4h]@101 | |
4686 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4687 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
4688 | |
4689 v3 = attr; | |
4690 v4 = 36; | |
4691 v5 = 0; | |
4692 v6 = this; | |
4693 v62 = 0; | |
4694 v61 = 0; | |
4695 | |
4696 switch (attr) | |
4697 { | |
4698 case CHARACTER_ATTRIBUTE_LEVEL: | |
4699 if (HasEnchantedItemEquipped(25)) | |
4700 return 5; | |
4701 return 0; | |
4702 }; | |
4703 | |
4704 if ( (signed int)attr > 36 ) | |
4705 { | |
4706 switch ( attr ) | |
4707 { | |
4708 case 37: | |
4709 v58 = 15; | |
4710 goto LABEL_35; | |
4711 case 38: | |
4712 v58 = 16; | |
4713 goto LABEL_35; | |
4714 case 39: | |
4715 v58 = 17; | |
4716 goto LABEL_35; | |
4717 case 40: | |
4718 v58 = 18; | |
4719 goto LABEL_35; | |
4720 case 41: | |
4721 v58 = 19; | |
4722 goto LABEL_35; | |
4723 case 42: | |
4724 v58 = 20; | |
4725 goto LABEL_35; | |
4726 case 43: | |
4727 v58 = 25; | |
4728 goto LABEL_35; | |
4729 case 44: | |
4730 v58 = 5; | |
4731 goto LABEL_35; | |
4732 case 45: | |
4733 v58 = 8; | |
4734 goto LABEL_35; | |
4735 case 46: | |
4736 goto LABEL_36; | |
4737 default: | |
4738 break; | |
4739 } | |
4740 } | |
4741 else | |
4742 { | |
4743 if ( attr == 36 ) | |
4744 { | |
4745 v58 = 14; | |
4746 } | |
4747 else | |
4748 { | |
4749 if ( (signed int)attr > 21 ) | |
4750 { | |
4751 switch ( attr ) | |
4752 { | |
4753 case 22: | |
4754 v58 = 30; | |
4755 break; | |
4756 case 23: | |
4757 v58 = 31; | |
4758 break; | |
4759 case 34: | |
4760 v58 = 12; | |
4761 break; | |
4762 default: | |
4763 if ( attr != 35 ) | |
4764 goto LABEL_38; | |
4765 v58 = 13; | |
4766 break; | |
4767 } | |
4768 } | |
4769 else | |
4770 { | |
4771 switch ( attr ) | |
4772 { | |
4773 case 21: | |
4774 v58 = 33; | |
4775 break; | |
4776 case 16: | |
4777 v58 = 35; | |
4778 break; | |
4779 case 17: | |
4780 v58 = 34; | |
4781 break; | |
4782 case 18: | |
4783 v58 = 29; | |
4784 break; | |
4785 case 19: | |
4786 v58 = 21; | |
4787 break; | |
4788 default: | |
4789 if ( attr != 20 ) | |
4790 goto LABEL_38; | |
4791 v58 = 32; | |
4792 break; | |
4793 } | |
4794 } | |
4795 } | |
4796 LABEL_35: | |
4797 v4 = v58; | |
4798 LABEL_36: | |
4799 if ( !this->pActiveSkills[v4] ) | |
4800 return 0; | |
4801 } | |
4802 LABEL_38: | |
4803 if ( (signed int)attr > 28 ) | |
4804 { | |
4805 if ( (signed int)attr < 29 ) | |
4806 return v5 + v62 + v61; | |
4807 if ( (signed int)attr <= 30 ) | |
4808 { | |
4809 if ( HasItemEquipped(EQUIP_BOW) ) | |
232 | 4810 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]].uDamageMod; |
0 | 4811 return v5 + v62 + v61; |
4812 } | |
4813 if ( attr == 31 ) | |
4814 { | |
4815 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4816 return v5 + v62 + v61; | |
232 | 4817 v57 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4818 v5 = pItemsTable->pItems[v57].uDamageMod; |
4819 v56 = pItemsTable->pItems[v57].uDamageDice; | |
4820 goto LABEL_366; | |
4821 } | |
4822 if ( attr == 32 ) | |
4823 { | |
4824 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4825 return v5 + v62 + v61; | |
232 | 4826 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uBow-1]; |
0 | 4827 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4828 LABEL_365: | |
4829 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4830 LABEL_366: | |
4831 v5 += v56; | |
4832 return v5 + v62 + v61; | |
4833 } | |
4834 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4835 return v5 + v62 + v61; | |
4836 LABEL_95: | |
4837 v65 = 0; | |
4838 while ( 1 ) | |
4839 { | |
4840 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4841 goto LABEL_361; | |
4842 v31 = *(&v6->pEquipment.uOffHand + v65) - 1; | |
4843 if ( v3 == 9 ) | |
4844 { | |
816 | 4845 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4846 if ( v32 >= 3 ) |
4847 { | |
4848 if ( v32 <= 11 ) | |
4849 { | |
4850 v33 = v6->pInventoryItems[v31].uItemID; | |
4851 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4852 } | |
4853 } | |
4854 } | |
4855 v63 = (int)((char *)v6 + 36 * v31); | |
4856 attra = (ItemGen *)(v63 + 532); | |
377 | 4857 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4858 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4859 { |
4860 v34 = attra->uItemID; | |
4861 switch ( attra->uItemID ) | |
4862 { | |
4863 case 0x1F4u: | |
4864 v35 = v3 == 5; | |
4865 goto LABEL_105; | |
4866 case 0x1F5u: | |
4867 v36 = v3 == 0; | |
4868 goto LABEL_108; | |
4869 case 0x1F6u: | |
4870 if ( v3 == 21 ) | |
4871 v61 += 10; | |
4872 v36 = v3 == 2; | |
4873 goto LABEL_108; | |
4874 case 0x1F7u: | |
4875 if ( v3 == 17 ) | |
4876 v61 += 5; | |
4877 if ( v3 == 18 ) | |
4878 v61 += 5; | |
4879 v36 = v3 == 6; | |
4880 goto LABEL_108; | |
4881 case 0x1F8u: | |
4882 goto LABEL_118; | |
4883 case 0x1F9u: | |
4884 v40 = v3 == 3; | |
4885 goto LABEL_123; | |
4886 case 0x1FAu: | |
4887 v35 = v3 == 10; | |
4888 goto LABEL_105; | |
4889 case 0x1FEu: | |
4890 v35 = v3 == 4; | |
4891 goto LABEL_105; | |
4892 case 0x1FFu: | |
4893 if ( v3 == 23 ) | |
4894 v61 += 10; | |
4895 if ( v3 == 22 ) | |
4896 v61 += 10; | |
4897 goto LABEL_361; | |
4898 case 0x200u: | |
4899 if ( v3 == 36 ) | |
4900 { | |
4901 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4902 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4903 } | |
4904 v36 = v3 == 5; | |
4905 LABEL_108: | |
4906 if ( v36 ) | |
4907 v5 += 40; | |
4908 goto LABEL_361; | |
4909 case 0x201u: | |
4910 if ( v3 == 39 ) | |
4911 { | |
4912 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4913 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4914 v62 = v34; | |
4915 } | |
4916 goto LABEL_136; | |
4917 case 0x202u: | |
4918 if ( !v3 ) | |
4919 v5 += 150; | |
4920 if ( v3 == 1 ) | |
4921 v5 -= 40; | |
4922 if ( v3 == 2 ) | |
4923 v5 -= 40; | |
4924 goto LABEL_145; | |
4925 case 0x203u: | |
4926 if ( v3 == 42 ) | |
4927 { | |
4928 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4929 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4930 } | |
4931 if ( v3 == 43 ) | |
4932 v61 += 15; | |
4933 goto LABEL_361; | |
4934 case 0x204u: | |
4935 if ( v3 == 17 ) | |
4936 v61 += 5; | |
4937 if ( v3 == 18 ) | |
4938 v61 += 5; | |
4939 if ( v3 == 6 ) | |
4940 v5 += 50; | |
4941 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4942 goto LABEL_166; | |
4943 v42 = v3 == 15; | |
4944 goto LABEL_165; | |
4945 case 0x205u: | |
4946 if ( v3 == 18 ) | |
4947 v61 += 5; | |
4948 goto LABEL_361; | |
4949 case 0x206u: | |
4950 if ( !v3 ) | |
4951 v5 += 100; | |
4952 if ( v3 == 3 ) | |
4953 v5 += 100; | |
4954 v43 = v3 == 9; | |
4955 goto LABEL_174; | |
4956 case 0x207u: | |
4957 if ( v3 == 45 ) | |
4958 v61 += 5; | |
4959 if ( v3 == 15 ) | |
4960 v5 -= 10; | |
4961 v42 = v3 == 14; | |
4962 LABEL_165: | |
4963 if ( v42 ) | |
4964 LABEL_166: | |
4965 v5 -= 10; | |
4966 goto LABEL_361; | |
4967 case 0x208u: | |
4968 v35 = v3 == 3; | |
4969 goto LABEL_105; | |
4970 case 0x209u: | |
4971 if ( v3 == 2 ) | |
4972 v5 += 15; | |
4973 if ( !v3 ) | |
4974 v5 += 15; | |
4975 v41 = v3 == 6; | |
4976 goto LABEL_146; | |
4977 case 0x20Au: | |
4978 if ( v3 == 46 ) | |
4979 v61 += 15; | |
4980 v44 = v3 == 3; | |
4981 goto LABEL_190; | |
4982 case 0x20Bu: | |
4983 if ( v3 == 34 ) | |
4984 { | |
4985 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4986 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4987 } | |
4988 if ( v3 == 12 ) | |
4989 v5 += 50; | |
4990 if ( v3 == 2 ) | |
4991 v5 += 30; | |
4992 v45 = v3 == 9; | |
4993 goto LABEL_199; | |
4994 case 0x20Cu: | |
4995 if ( !v3 ) | |
4996 v5 += 75; | |
4997 goto LABEL_145; | |
4998 case 0x20Du: | |
4999 if ( v3 == 5 ) | |
5000 v5 += 50; | |
5001 if ( v3 == 6 ) | |
5002 v5 += 50; | |
5003 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
5004 goto LABEL_374; | |
5005 v43 = v3 == 15; | |
5006 LABEL_174: | |
5007 if ( v43 ) | |
5008 LABEL_374: | |
5009 v5 -= 15; | |
5010 goto LABEL_361; | |
5011 case 0x20Eu: | |
5012 if ( v3 == 4 ) | |
5013 v5 += 150; | |
5014 if ( v3 == 44 ) | |
5015 v61 += 5; | |
5016 if ( v3 == 9 ) | |
5017 v5 -= 25; | |
5018 goto LABEL_361; | |
5019 case 0x20Fu: | |
5020 if ( v3 == 39 ) | |
5021 { | |
5022 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5023 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
5024 v62 = v34; | |
5025 } | |
5026 if ( v3 == 40 ) | |
5027 { | |
5028 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5029 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5030 } | |
5031 LABEL_145: | |
5032 v41 = v3 == 5; | |
5033 LABEL_146: | |
5034 if ( v41 ) | |
5035 v5 -= 40; | |
5036 goto LABEL_361; | |
5037 case 0x210u: | |
5038 if ( v3 == 38 ) | |
5039 { | |
5040 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5041 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5042 } | |
5043 if ( !v3 ) | |
5044 v5 += 75; | |
5045 v44 = v3 == 11; | |
5046 LABEL_190: | |
5047 if ( v44 ) | |
5048 v5 -= 50; | |
5049 goto LABEL_361; | |
5050 case 0x211u: | |
5051 if ( v3 == 5 ) | |
5052 v5 += 100; | |
5053 if ( v3 == 4 ) | |
5054 v5 += 50; | |
5055 v35 = v3 == 11; | |
5056 LABEL_105: | |
5057 if ( v35 ) | |
5058 v5 += 50; | |
5059 goto LABEL_361; | |
5060 case 0x212u: | |
5061 if ( v3 == 1 ) | |
5062 v5 -= 20; | |
5063 v45 = v3 == 2; | |
5064 LABEL_199: | |
5065 if ( v45 ) | |
5066 v5 -= 20; | |
5067 goto LABEL_361; | |
5068 case 0x214u: | |
5069 if ( v3 == 1 ) | |
5070 v5 += 15; | |
5071 v46 = v3 == 2; | |
5072 goto LABEL_240; | |
5073 case 0x215u: | |
5074 if ( v3 == 5 ) | |
5075 v5 += 15; | |
5076 v46 = v3 == 4; | |
5077 goto LABEL_240; | |
5078 case 0x216u: | |
5079 if ( v3 == 10 ) | |
5080 v5 += 30; | |
5081 if ( !v3 ) | |
5082 v5 += 15; | |
5083 goto LABEL_315; | |
5084 case 0x217u: | |
5085 if ( v3 == 21 ) | |
5086 v61 += 5; | |
5087 if ( !v3 ) | |
5088 v5 += 15; | |
5089 goto LABEL_253; | |
5090 case 0x218u: | |
5091 goto LABEL_253; | |
5092 default: | |
5093 goto LABEL_361; | |
5094 } | |
5095 goto LABEL_361; | |
5096 } | |
5097 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
5098 { | |
5099 if ( (signed int)v3 >= 0 ) | |
5100 { | |
5101 if ( (signed int)v3 <= 15 ) | |
5102 { | |
5103 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
5104 } | |
5105 else | |
5106 { | |
5107 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
5108 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
5109 } | |
5110 } | |
5111 goto LABEL_361; | |
5112 } | |
5113 v34 = *(int *)(v63 + 544); | |
5114 if ( v34 > 48 ) | |
5115 { | |
5116 switch ( v34 ) | |
5117 { | |
5118 case 54: | |
5119 goto LABEL_315; | |
5120 case 49: | |
5121 if ( v3 == 6 ) | |
5122 goto LABEL_121; | |
5123 v50 = v3 == 1; | |
5124 goto LABEL_296; | |
5125 case 51: | |
5126 if ( v3 != 5 && v3 != 1 ) | |
5127 goto LABEL_309; | |
5128 goto LABEL_121; | |
5129 case 52: | |
5130 if ( v3 == 3 ) | |
5131 goto LABEL_121; | |
5132 v50 = v3 == 4; | |
5133 goto LABEL_296; | |
5134 case 53: | |
5135 if ( !v3 ) | |
5136 goto LABEL_121; | |
5137 v50 = v3 == 2; | |
5138 goto LABEL_296; | |
5139 case 55: | |
5140 v46 = v3 == 6; | |
5141 goto LABEL_240; | |
5142 case 56: | |
5143 if ( !v3 ) | |
5144 goto LABEL_351; | |
5145 v53 = v3 == 3; | |
5146 goto LABEL_350; | |
5147 case 57: | |
5148 if ( v3 == 1 ) | |
5149 goto LABEL_351; | |
5150 v53 = v3 == 2; | |
5151 goto LABEL_350; | |
5152 case 50: | |
5153 if ( v3 == 10 ) | |
5154 v5 += 30; | |
5155 goto LABEL_361; | |
5156 case 60: | |
5157 if ( v3 != 23 ) | |
5158 goto LABEL_336; | |
5159 if ( v5 >= 3 ) | |
5160 goto LABEL_361; | |
5161 v5 = 3; | |
5162 LABEL_336: | |
5163 v54 = v3 == 22; | |
5164 goto LABEL_345; | |
5165 case 61: | |
5166 if ( v3 != 17 ) | |
5167 goto LABEL_340; | |
5168 if ( v5 >= 3 ) | |
5169 goto LABEL_361; | |
5170 v5 = 3; | |
5171 LABEL_340: | |
5172 v54 = v3 == 18; | |
5173 goto LABEL_345; | |
5174 case 62: | |
5175 if ( v3 != 19 ) | |
5176 goto LABEL_344; | |
5177 if ( v5 >= 3 ) | |
5178 goto LABEL_361; | |
5179 v5 = 3; | |
5180 LABEL_344: | |
5181 v54 = v3 == 20; | |
5182 LABEL_345: | |
5183 if ( !v54 ) | |
5184 goto LABEL_361; | |
5185 if ( v5 >= 3 ) | |
5186 goto LABEL_361; | |
5187 v60 = 3; | |
5188 goto LABEL_360; | |
5189 case 67: | |
5190 v55 = v3 == 18; | |
5191 goto LABEL_357; | |
5192 case 68: | |
5193 v53 = v3 == 9; | |
5194 goto LABEL_350; | |
5195 case 69: | |
5196 if ( v3 == 11 ) | |
5197 v5 += 20; | |
5198 break; | |
5199 case 70: | |
5200 if ( v3 == 12 ) | |
5201 v5 += 10; | |
5202 v55 = v3 == 16; | |
5203 LABEL_357: | |
5204 if ( v55 && v5 < 2 ) | |
5205 { | |
5206 v60 = 2; | |
5207 LABEL_360: | |
5208 v5 = v60; | |
5209 } | |
5210 break; | |
5211 default: | |
5212 goto LABEL_361; | |
5213 } | |
5214 goto LABEL_361; | |
5215 } | |
5216 if ( v34 == 48 ) | |
5217 { | |
5218 if ( v3 == 9 ) | |
5219 v5 += 5; | |
5220 LABEL_315: | |
5221 v46 = v3 == 3; | |
5222 LABEL_240: | |
5223 if ( v46 ) | |
5224 v5 += 15; | |
5225 goto LABEL_361; | |
5226 } | |
5227 if ( v34 > 32 ) | |
5228 { | |
5229 if ( v34 > 44 ) | |
5230 { | |
5231 v51 = v34 - 45; | |
5232 if ( !v51 ) | |
5233 { | |
5234 if ( v3 == 5 ) | |
5235 goto LABEL_351; | |
5236 v53 = v3 == 4; | |
5237 LABEL_350: | |
5238 if ( v53 ) | |
5239 LABEL_351: | |
5240 v5 += 5; | |
5241 goto LABEL_361; | |
5242 } | |
5243 v52 = v51 - 1; | |
5244 if ( !v52 ) | |
5245 { | |
5246 v40 = v3 == 0; | |
5247 LABEL_123: | |
5248 if ( v40 ) | |
5249 v5 += 25; | |
5250 goto LABEL_361; | |
5251 } | |
5252 if ( v52 == 1 ) | |
5253 { | |
5254 LABEL_309: | |
5255 v50 = v3 == 8; | |
5256 goto LABEL_296; | |
5257 } | |
5258 } | |
5259 else | |
5260 { | |
5261 if ( v34 == 44 ) | |
5262 { | |
5263 v50 = v3 == 7; | |
5264 goto LABEL_296; | |
5265 } | |
5266 v34 -= 33; | |
5267 if ( !v34 ) | |
5268 { | |
5269 if ( v3 != 38 ) | |
5270 goto LABEL_361; | |
5271 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5272 goto LABEL_138; | |
5273 } | |
5274 --v34; | |
5275 if ( !v34 ) | |
5276 { | |
5277 if ( v3 != 36 ) | |
5278 goto LABEL_361; | |
5279 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5280 goto LABEL_138; | |
5281 } | |
5282 v49 = v34 - 8; | |
5283 if ( !v49 ) | |
5284 { | |
5285 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5286 ++v5; | |
5287 goto LABEL_361; | |
5288 } | |
5289 if ( v49 == 1 ) | |
5290 { | |
5291 if ( v3 != 3 && v3 != 7 ) | |
5292 { | |
5293 v50 = v3 == 9; | |
5294 LABEL_296: | |
5295 if ( !v50 ) | |
5296 goto LABEL_361; | |
5297 } | |
5298 LABEL_121: | |
5299 v5 += 10; | |
5300 goto LABEL_361; | |
5301 } | |
5302 } | |
5303 } | |
5304 else | |
5305 { | |
5306 if ( v34 == 32 ) | |
5307 { | |
5308 if ( v3 != 39 ) | |
5309 goto LABEL_361; | |
5310 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5311 goto LABEL_138; | |
5312 } | |
5313 if ( v34 > 28 ) | |
5314 { | |
5315 v34 -= 29; | |
5316 if ( v34 ) | |
5317 { | |
5318 --v34; | |
5319 if ( v34 ) | |
5320 { | |
5321 --v34; | |
5322 if ( v34 || v3 != 41 ) | |
5323 goto LABEL_361; | |
5324 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5325 } | |
5326 else | |
5327 { | |
5328 if ( v3 != 34 ) | |
5329 goto LABEL_361; | |
5330 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5331 } | |
5332 } | |
5333 else | |
5334 { | |
5335 if ( v3 != 37 ) | |
5336 goto LABEL_361; | |
5337 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5338 } | |
5339 goto LABEL_138; | |
5340 } | |
5341 if ( v34 == 28 ) | |
5342 { | |
5343 LABEL_136: | |
5344 if ( v3 == 42 ) | |
5345 { | |
5346 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5347 LABEL_138: | |
5348 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5349 goto LABEL_361; | |
5350 } | |
5351 } | |
5352 else | |
5353 { | |
5354 v47 = v34 - 1; | |
5355 if ( v47 ) | |
5356 { | |
5357 v48 = v47 - 1; | |
5358 if ( v48 ) | |
5359 { | |
5360 v34 = v48 - 24; | |
5361 if ( v34 ) | |
5362 { | |
5363 --v34; | |
5364 if ( v34 || v3 != 40 ) | |
5365 goto LABEL_361; | |
5366 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5367 } | |
5368 else | |
5369 { | |
5370 if ( v3 != 35 ) | |
5371 goto LABEL_361; | |
5372 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5373 } | |
5374 goto LABEL_138; | |
5375 } | |
5376 LABEL_118: | |
5377 if ( (signed int)v3 < 0 ) | |
5378 goto LABEL_361; | |
5379 v39 = __OFSUB__((int)v3, 6); | |
5380 v37 = v3 == 6; | |
5381 v38 = v3 - 6 < 0; | |
5382 } | |
5383 else | |
5384 { | |
5385 LABEL_253: | |
5386 if ( (signed int)v3 < 10 ) | |
5387 goto LABEL_361; | |
5388 v39 = __OFSUB__((int)v3, 15); | |
5389 v37 = v3 == 15; | |
5390 v38 = v3 - 15 < 0; | |
5391 } | |
5392 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5393 goto LABEL_121; | |
5394 } | |
5395 } | |
5396 LABEL_361: | |
5397 ++v65; | |
5398 if ( (signed int)v65 >= 16 ) | |
5399 return v5 + v62 + v61; | |
5400 } | |
5401 } | |
5402 if ( attr == 28 ) | |
5403 { | |
5404 if ( IsUnarmed() != 1 ) | |
5405 { | |
816 | 5406 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5407 { | |
5408 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5409 if ( v22 >= 0 ) |
5410 { | |
5411 if ( v22 <= 2 ) | |
5412 { | |
118 | 5413 v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; |
5414 if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) | |
0 | 5415 { |
5416 v24 = v23; | |
5417 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5418 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5419 } | |
5420 else | |
5421 { | |
5422 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5423 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5424 } | |
5425 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5426 } | |
5427 } | |
5428 } | |
816 | 5429 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v27->GetEquippedItemEquipType(EQUIP_OFF_HAND), v28 < 0) || v28 > 2 ) |
0 | 5430 return v5 + v62 + v61; |
5431 v15 = pItemsTable->pItems[v29].uDamageMod; | |
5432 v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; | |
5433 goto LABEL_88; | |
5434 } | |
5435 v59 = 3; | |
5436 LABEL_74: | |
5437 v5 = v59; | |
5438 return v5 + v62 + v61; | |
5439 } | |
5440 if ( (signed int)attr < 0 ) | |
5441 return v5 + v62 + v61; | |
5442 if ( (signed int)attr <= 23 ) | |
5443 goto LABEL_95; | |
5444 if ( (signed int)attr <= 24 ) | |
5445 return v5 + v62 + v61; | |
5446 if ( (signed int)attr <= 26 ) | |
5447 { | |
5448 if ( IsUnarmed() == 1 ) | |
5449 { | |
5450 v5 = 0; | |
5451 return v5 + v62 + v61; | |
5452 } | |
816 | 5453 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5454 { | |
5455 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5456 if ( v17 >= 0 ) |
5457 { | |
5458 if ( v17 <= 2 ) | |
232 | 5459 v5 = pItemsTable->pItems[*(int *)&v6->pInventoryItems[v6->pEquipment.uMainHand-1]].uDamageMod; |
0 | 5460 } |
5461 } | |
816 | 5462 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v18->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5463 return v5 + v62 + v61; |
232 | 5464 v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1]; |
0 | 5465 goto LABEL_365; |
5466 } | |
5467 if ( attr == 27 ) | |
5468 { | |
5469 if ( IsUnarmed() == 1 ) | |
5470 { | |
5471 v5 = 1; | |
5472 return v5 + v62 + v61; | |
5473 } | |
816 | 5474 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5475 { | |
5476 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5477 if ( v9 >= 0 ) |
5478 { | |
5479 if ( v9 <= 2 ) | |
5480 { | |
118 | 5481 v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; |
0 | 5482 if ( !v6->pEquipment.uOffHand ) |
5483 { | |
118 | 5484 if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5485 ++v5; |
5486 } | |
5487 } | |
5488 } | |
5489 } | |
816 | 5490 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v11->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) |
0 | 5491 return v5 + v62 + v61; |
118 | 5492 v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; |
5493 v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; | |
0 | 5494 LABEL_88: |
5495 v5 += v15 + v14; | |
5496 } | |
5497 return v5 + v62 + v61; | |
5498 } | |
5499 | |
5500 //----- (0048F73C) -------------------------------------------------------- | |
5501 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5502 { | |
5503 int result; // eax@1 | |
5504 int v3; // eax@4 | |
5505 int v4; // ecx@5 | |
5506 | |
5507 switch (a2) | |
5508 { | |
5509 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5510 } | |
5511 | |
5512 result = 0; | |
5513 if ( (signed int)a2 > 10 ) | |
5514 { | |
5515 if ( (signed int)a2 <= 15 ) | |
5516 { | |
5517 switch ( a2 ) | |
5518 { | |
5519 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5520 v3 = this->pPlayerBuffs[2].uPower; | |
5521 v4 = pParty->pPartyBuffs[1].uPower; | |
5522 break; | |
5523 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5524 v3 = this->pPlayerBuffs[0].uPower; | |
5525 v4 = pParty->pPartyBuffs[0].uPower; | |
5526 break; | |
5527 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5528 v3 = this->pPlayerBuffs[22].uPower; | |
5529 v4 = pParty->pPartyBuffs[17].uPower; | |
5530 break; | |
5531 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5532 v3 = this->pPlayerBuffs[3].uPower; | |
5533 v4 = pParty->pPartyBuffs[4].uPower; | |
5534 break; | |
5535 default: | |
5536 if ( a2 != 14 ) | |
5537 return result; | |
5538 v3 = this->pPlayerBuffs[9].uPower; | |
5539 v4 = pParty->pPartyBuffs[12].uPower; | |
5540 break; | |
5541 } | |
5542 return v4 + v3; | |
5543 } | |
5544 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5545 { | |
5546 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5547 { | |
5548 v3 = this->pPlayerBuffs[8].uPower; | |
5549 v4 = pParty->pPartyBuffs[9].uPower; | |
5550 return v4 + v3; | |
5551 } | |
5552 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5553 return result; | |
5554 } | |
5555 return this->pPlayerBuffs[1].uPower; | |
5556 } | |
5557 if ( a2 == 10 ) | |
5558 { | |
5559 v3 = this->pPlayerBuffs[5].uPower; | |
5560 v4 = pParty->pPartyBuffs[6].uPower; | |
5561 return v4 + v3; | |
5562 } | |
5563 switch ( a2 ) | |
5564 { | |
5565 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5566 v3 = pPlayerBuffs[19].uPower; | |
5567 goto LABEL_5; | |
5568 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5569 v3 = pPlayerBuffs[17].uPower; | |
5570 goto LABEL_5; | |
5571 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5572 v3 = pPlayerBuffs[20].uPower; | |
5573 goto LABEL_5; | |
5574 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5575 v3 = pPlayerBuffs[16].uPower; | |
5576 goto LABEL_5; | |
5577 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5578 v3 = pPlayerBuffs[15].uPower; | |
5579 goto LABEL_5; | |
5580 case CHARACTER_ATTRIBUTE_SPEED: | |
5581 v3 = pPlayerBuffs[21].uPower; | |
5582 goto LABEL_5; | |
5583 case CHARACTER_ATTRIBUTE_LUCK: | |
5584 v3 = pPlayerBuffs[18].uPower; | |
5585 LABEL_5: | |
5586 v4 = pParty->pPartyBuffs[2].uPower; | |
5587 return v4 + v3; | |
5588 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5589 v3 = this->pPlayerBuffs[14].uPower; | |
5590 v4 = pParty->pPartyBuffs[15].uPower; | |
5591 return v4 + v3; | |
5592 default: | |
5593 return result; | |
5594 } | |
5595 return result; | |
5596 } | |
5597 | |
5598 //----- (0048F882) -------------------------------------------------------- | |
353 | 5599 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) |
0 | 5600 { |
5601 signed int v2; // esi@1 | |
5602 unsigned __int16 v3; // ax@126 | |
5603 char result; // al@127 | |
5604 unsigned int v5; // [sp-4h] [bp-14h]@13 | |
5605 signed int v6; // [sp-4h] [bp-14h]@27 | |
353 | 5606 //unsigned int v7; // [sp-4h] [bp-14h]@35 |
0 | 5607 CHARACTER_ATTRIBUTE_TYPE v8; // [sp-4h] [bp-14h]@68 |
353 | 5608 //Player *v9; // [sp+Ch] [bp-4h]@1 |
5609 | |
0 | 5610 v2 = 0; |
353 | 5611 switch (uSkillType) |
5612 { | |
5613 case PLAYER_SKILL_MONSTER_ID: | |
5614 { | |
652 | 5615 if ( CheckHiredNPCSpeciality(Hunter) ) |
353 | 5616 v2 = 6; |
652 | 5617 if ( CheckHiredNPCSpeciality(Sage) ) |
353 | 5618 v2 += 6; |
5619 v8 = (CHARACTER_ATTRIBUTE_TYPE)20; | |
5620 v2 += GetItemsBonus(v8, 0); | |
5621 } | |
5622 break; | |
5623 | |
5624 case PLAYER_SKILL_ARMSMASTER: | |
5625 { | |
652 | 5626 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
0 | 5627 v2 = 2; |
652 | 5628 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
0 | 5629 v2 += 3; |
353 | 5630 v8 = (CHARACTER_ATTRIBUTE_TYPE)21; |
5631 v2 += GetItemsBonus(v8, 0); | |
5632 } | |
5633 break; | |
5634 | |
5635 case PLAYER_SKILL_STEALING: | |
5636 { | |
652 | 5637 if (CheckHiredNPCSpeciality(Burglar)) |
353 | 5638 v2 = 8; |
5639 v8 = (CHARACTER_ATTRIBUTE_TYPE)17; | |
5640 v2 += GetItemsBonus(v8, 0); | |
5641 } | |
5642 break; | |
5643 | |
5644 | |
5645 case PLAYER_SKILL_ALCHEMY: | |
5646 { | |
652 | 5647 if ( CheckHiredNPCSpeciality(Herbalist) ) |
353 | 5648 v2 = 4; |
652 | 5649 if ( CheckHiredNPCSpeciality(Apothecary) ) |
353 | 5650 v2 += 8; |
5651 v8 = (CHARACTER_ATTRIBUTE_TYPE)16; | |
5652 v2 += GetItemsBonus(v8, 0); | |
5653 } | |
5654 break; | |
5655 | |
5656 case PLAYER_SKILL_LEARNING: | |
5657 { | |
652 | 5658 if ( CheckHiredNPCSpeciality(Teacher) ) |
353 | 5659 v2 = 10; |
652 | 5660 if ( CheckHiredNPCSpeciality(Instructor) ) |
353 | 5661 v2 += 15; |
652 | 5662 if ( CheckHiredNPCSpeciality(Scholar) ) |
353 | 5663 v2 += 5; |
5664 v8 = (CHARACTER_ATTRIBUTE_TYPE)46; | |
5665 v2 += GetItemsBonus(v8, 0); | |
5666 } | |
5667 break; | |
5668 | |
5669 case PLAYER_SKILL_UNARMED: | |
5670 { | |
652 | 5671 if (CheckHiredNPCSpeciality(Monk) ) |
353 | 5672 v2 = 2; |
5673 v8 = (CHARACTER_ATTRIBUTE_TYPE)23; | |
5674 v2 += GetItemsBonus(v8, 0); | |
5675 } | |
5676 break; | |
5677 | |
5678 case PLAYER_SKILL_DODGE: | |
5679 { | |
652 | 5680 if ( CheckHiredNPCSpeciality(Monk) ) |
353 | 5681 v2 = 2; |
5682 v8 = (CHARACTER_ATTRIBUTE_TYPE)22; | |
5683 v2 += GetItemsBonus(v8, 0); | |
5684 } | |
5685 break; | |
5686 | |
5687 case PLAYER_SKILL_BOW: | |
5688 v8 = (CHARACTER_ATTRIBUTE_TYPE)44; | |
5689 v2 += GetItemsBonus(v8, 0); | |
5690 break; | |
5691 case PLAYER_SKILL_SHIELD: | |
5692 v8 = (CHARACTER_ATTRIBUTE_TYPE)45; | |
5693 v2 += GetItemsBonus(v8, 0); | |
5694 break; | |
5695 | |
5696 case PLAYER_SKILL_EARTH: | |
652 | 5697 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5698 v2 = 2; |
652 | 5699 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5700 v2 += 3; |
652 | 5701 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5702 v2 += 4; |
5703 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5704 v2 += 3; | |
5705 v8 = (CHARACTER_ATTRIBUTE_TYPE)37; | |
5706 v2 += GetItemsBonus(v8, 0); | |
5707 break; | |
5708 case PLAYER_SKILL_FIRE: | |
652 | 5709 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5710 v2 = 2; |
652 | 5711 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5712 v2 += 3; |
652 | 5713 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5714 v2 += 4; |
5715 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5716 v2 += 3; | |
5717 v8 = (CHARACTER_ATTRIBUTE_TYPE)34; | |
5718 v2 += GetItemsBonus(v8, 0); | |
5719 break; | |
5720 case PLAYER_SKILL_AIR: | |
652 | 5721 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5722 v2 = 2; |
652 | 5723 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5724 v2 += 3; |
652 | 5725 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5726 v2 += 4; |
5727 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5728 v2 += 3; | |
5729 v8 = (CHARACTER_ATTRIBUTE_TYPE)35; | |
5730 v2 += GetItemsBonus(v8, 0); | |
5731 break; | |
5732 case PLAYER_SKILL_WATER: | |
652 | 5733 if ( CheckHiredNPCSpeciality(Apprentice) ) |
353 | 5734 v2 = 2; |
652 | 5735 if ( CheckHiredNPCSpeciality(Mystic) ) |
353 | 5736 v2 += 3; |
652 | 5737 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
353 | 5738 v2 += 4; |
5739 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) | |
5740 v2 += 3; | |
5741 v8 = (CHARACTER_ATTRIBUTE_TYPE)36; | |
5742 v2 += GetItemsBonus(v8, 0); | |
5743 break; | |
5744 case PLAYER_SKILL_SPIRIT: | |
652 | 5745 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5746 v2 = 2; |
652 | 5747 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5748 v2 += 3; |
652 | 5749 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5750 v2 += 4; |
5751 v8 = (CHARACTER_ATTRIBUTE_TYPE)38; | |
5752 v2 += GetItemsBonus(v8, 0); | |
5753 break; | |
5754 case PLAYER_SKILL_MIND: | |
652 | 5755 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5756 v2 = 2; |
652 | 5757 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5758 v2 += 3; |
652 | 5759 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5760 v2 += 4; |
5761 v8 = (CHARACTER_ATTRIBUTE_TYPE)39; | |
5762 v2 += GetItemsBonus(v8, 0); | |
5763 break; | |
5764 case PLAYER_SKILL_BODY: | |
652 | 5765 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
353 | 5766 v2 = 2; |
652 | 5767 if ( CheckHiredNPCSpeciality(Initiate) ) |
353 | 5768 v2 += 3; |
652 | 5769 if ( CheckHiredNPCSpeciality(Prelate) ) |
353 | 5770 v2 += 4; |
5771 v8 = (CHARACTER_ATTRIBUTE_TYPE)40; | |
5772 v2 += GetItemsBonus(v8, 0); | |
5773 break; | |
5774 case PLAYER_SKILL_LIGHT: | |
5775 v8 = (CHARACTER_ATTRIBUTE_TYPE)41; | |
5776 v2 += GetItemsBonus(v8, 0); | |
5777 break; | |
5778 case PLAYER_SKILL_DARK: | |
5779 { | |
5780 v8 = (CHARACTER_ATTRIBUTE_TYPE)42; | |
5781 v2 += GetItemsBonus(v8, 0); | |
5782 } | |
5783 break; | |
5784 | |
5785 case PLAYER_SKILL_MERCHANT: | |
5786 { | |
652 | 5787 if ( CheckHiredNPCSpeciality(Trader) ) |
353 | 5788 v2 = 4; |
652 | 5789 if ( CheckHiredNPCSpeciality(Merchant) ) |
353 | 5790 v2 += 6; |
652 | 5791 if ( CheckHiredNPCSpeciality(Gypsy) ) |
353 | 5792 v2 += 3; |
652 | 5793 if ( CheckHiredNPCSpeciality(Duper) ) |
353 | 5794 v2 += 8; |
5795 } | |
5796 break; | |
5797 | |
5798 case PLAYER_SKILL_PERCEPTION: | |
5799 { | |
652 | 5800 if ( CheckHiredNPCSpeciality(Scout) ) |
353 | 5801 v2 = 6; |
652 | 5802 if ( CheckHiredNPCSpeciality(Psychic) ) |
353 | 5803 v2 += 5; |
5804 } | |
5805 break; | |
5806 | |
0 | 5807 case PLAYER_SKILL_ITEM_ID: |
5808 v8 = (CHARACTER_ATTRIBUTE_TYPE)19; | |
353 | 5809 v2 += GetItemsBonus(v8, 0); |
0 | 5810 break; |
5811 case PLAYER_SKILL_MEDITATION: | |
5812 v8 = (CHARACTER_ATTRIBUTE_TYPE)43; | |
353 | 5813 v2 += GetItemsBonus(v8, 0); |
5814 break; | |
0 | 5815 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5816 { |
652 | 5817 if ( CheckHiredNPCSpeciality(Tinker) ) |
353 | 5818 v2 = 4; |
652 | 5819 if ( CheckHiredNPCSpeciality(Locksmith) ) |
353 | 5820 v2 += 6; |
652 | 5821 if ( CheckHiredNPCSpeciality(Burglar) ) |
353 | 5822 v2 += 8; |
0 | 5823 v8 = (CHARACTER_ATTRIBUTE_TYPE)18; |
353 | 5824 v2 += GetItemsBonus(v8, 0); |
5825 } | |
5826 break; | |
5827 } | |
5828 | |
5829 v3 = pActiveSkills[uSkillType]; | |
5830 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) | |
0 | 5831 result = v2 + v3; |
5832 else | |
5833 result = v3 & 0xFC | 0x3C; | |
5834 return result; | |
5835 } | |
5836 | |
5837 //----- (0048FC00) -------------------------------------------------------- | |
5838 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5839 { | |
5840 Player *v2; // esi@1 | |
5841 int v3; // eax@1 | |
5842 char v4; // di@1 | |
5843 signed int v5; // ebx@1 | |
5844 unsigned int v6; // eax@2 | |
5845 unsigned __int8 v7; // sf@5 | |
5846 unsigned __int8 v8; // of@5 | |
5847 PlayerEquipment *v9; // ebx@19 | |
5848 Player *v10; // ecx@20 | |
821 | 5849 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5850 int v12; // eax@21 |
5851 int v13; // edi@21 | |
5852 char v14; // di@25 | |
5853 signed int v15; // esi@25 | |
5854 char v16; // al@32 | |
5855 int v18; // eax@36 | |
5856 unsigned int v19; // eax@37 | |
5857 ITEM_EQUIP_TYPE v20; // edi@40 | |
5858 int v21; // edx@41 | |
5859 int v22; // eax@42 | |
821 | 5860 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5861 unsigned __int16 v24; // ax@45 |
5862 unsigned __int16 v25; // bx@45 | |
5863 unsigned int v26; // eax@45 | |
5864 unsigned __int8 v27; // sf@50 | |
5865 unsigned __int8 v28; // of@50 | |
5866 unsigned int v29; // eax@52 | |
5867 int v30; // eax@55 | |
5868 int v31; // eax@58 | |
5869 unsigned int v32; // eax@59 | |
5870 int v33; // eax@65 | |
5871 char v34; // si@65 | |
5872 ITEM_EQUIP_TYPE v35; // edi@69 | |
5873 int v36; // edx@70 | |
5874 int v37; // eax@71 | |
821 | 5875 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5876 int v39; // eax@74 |
5877 int v40; // eax@89 | |
5878 char v41; // si@89 | |
5879 int v42; // eax@96 | |
821 | 5880 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5881 int v44; // eax@97 |
5882 int v45; // eax@98 | |
5883 int v46; // eax@99 | |
5884 int v47; // eax@100 | |
5885 int v48; // eax@101 | |
5886 int v49; // eax@102 | |
5887 unsigned __int16 v50; // ax@113 | |
5888 char v51; // di@113 | |
5889 unsigned int v52; // eax@113 | |
5890 int v53; // edi@113 | |
5891 signed int i; // ecx@113 | |
5892 unsigned __int16 v55; // ax@118 | |
5893 char v56; // si@118 | |
5894 unsigned int v57; // eax@118 | |
5895 int v58; // esi@121 | |
5896 signed int j; // ecx@121 | |
5897 int v60; // edi@126 | |
5898 int v61; // eax@126 | |
5899 signed int v62; // [sp-4h] [bp-30h]@26 | |
5900 signed int v63; // [sp-4h] [bp-30h]@80 | |
5901 int v64; // [sp+Ch] [bp-20h]@104 | |
5902 int v65; // [sp+10h] [bp-1Ch]@104 | |
5903 int v66; // [sp+14h] [bp-18h]@104 | |
5904 int v67; // [sp+18h] [bp-14h]@104 | |
5905 int v68; // [sp+1Ch] [bp-10h]@69 | |
5906 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
5907 int v70; // [sp+24h] [bp-8h]@1 | |
5908 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 | |
5909 int a1; // [sp+34h] [bp+8h]@21 | |
5910 int a1a; // [sp+34h] [bp+8h]@74 | |
5911 signed int a1b; // [sp+34h] [bp+8h]@94 | |
5912 | |
5913 v2 = this; | |
5914 v70 = 0; | |
5915 v69 = 0; | |
5916 v71 = (ITEM_EQUIP_TYPE)0; | |
5917 LOBYTE(v3) = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); | |
5918 v4 = v3; | |
5919 v5 = 1; | |
5920 if ( v3 ) | |
5921 { | |
5922 v6 = SkillToMastery(v3); | |
5923 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5924 { | |
5925 if ( (signed int)v6 >= 4 ) | |
5926 goto LABEL_4; | |
5927 v8 = __OFSUB__(v6, 3); | |
5928 v7 = ((v6 - 3) & 0x80000000u) != 0; | |
5929 } | |
5930 else | |
5931 { | |
5932 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5933 goto LABEL_11; | |
5934 if ( (signed int)v6 >= 4 ) | |
5935 { | |
5936 LABEL_4: | |
5937 v71 = (ITEM_EQUIP_TYPE)2; | |
5938 LABEL_11: | |
5939 v69 = (PlayerEquipment *)(v71 * (v4 & 0x3F)); | |
5940 goto LABEL_12; | |
5941 } | |
5942 v8 = __OFSUB__(v6, 2); | |
5943 v7 = ((v6 - 2) & 0x80000000u) != 0; | |
5944 } | |
5945 if ( !(v7 ^ v8) ) | |
5946 v71 = (ITEM_EQUIP_TYPE)1; | |
5947 goto LABEL_11; | |
5948 } | |
5949 LABEL_12: | |
5950 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) | |
5951 { | |
135 | 5952 v60 = pBaseHealthPerLevelByClass[v2->classType]; |
0 | 5953 v61 = v2->GetBodybuilding(); |
5954 return v60 * v61; | |
5955 } | |
5956 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5957 { | |
135 | 5958 v60 = pBaseManaPerLevelByClass[v2->classType]; |
607 | 5959 v61 = v2->GetMeditation(); |
0 | 5960 return v60 * v61; |
5961 } | |
5962 if ( a2 != 9 ) | |
5963 { | |
5964 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5965 { | |
5966 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) | |
5967 return v70; | |
5968 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) | |
5969 { | |
5970 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5971 return v70; | |
5972 v71 = (ITEM_EQUIP_TYPE)0; | |
5973 v9 = &v2->pEquipment; | |
5974 while ( 1 ) | |
5975 { | |
5976 if ( v2->HasItemEquipped(v71) ) | |
5977 { | |
118 | 5978 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5979 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5980 a1 = v12; |
5981 SkillToMastery(v12); | |
5982 v13 = v11 - 5; | |
5983 if ( !v13 ) | |
5984 return a1 & 0x3F; | |
5985 if ( v13 == 2 ) | |
5986 break; | |
5987 } | |
5988 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5989 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5990 if ( (signed int)v71 >= 16 ) | |
5991 return v70; | |
5992 } | |
5993 v14 = a1; | |
5994 v15 = 1; | |
5995 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5996 { | |
5997 v62 = 5; | |
5998 goto LABEL_31; | |
5999 } | |
6000 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
6001 { | |
6002 v62 = 3; | |
6003 goto LABEL_31; | |
6004 } | |
6005 if ( (signed int)SkillToMastery(a1) < 2 ) | |
6006 goto LABEL_32; | |
6007 goto LABEL_30; | |
6008 } | |
6009 if ( v2->IsUnarmed() ) | |
6010 { | |
6011 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6012 v14 = v18; | |
6013 if ( !v18 ) | |
6014 return v70; | |
6015 v15 = 0; | |
6016 v19 = SkillToMastery(v18); | |
6017 if ( (signed int)v19 < 3 ) | |
6018 { | |
6019 if ( (signed int)v19 >= 2 ) | |
6020 v15 = 1; | |
6021 LABEL_32: | |
6022 v16 = v14; | |
6023 return v15 * (v16 & 0x3F); | |
6024 } | |
6025 LABEL_30: | |
6026 v62 = 2; | |
6027 LABEL_31: | |
6028 v15 = v62; | |
6029 goto LABEL_32; | |
6030 } | |
6031 v20 = (ITEM_EQUIP_TYPE)0; | |
6032 while ( 1 ) | |
6033 { | |
6034 if ( v2->HasItemEquipped(v20) ) | |
6035 { | |
118 | 6036 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6037 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6038 break; | |
6039 } | |
6040 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6041 if ( (signed int)v20 >= 16 ) | |
6042 return v70; | |
6043 } | |
6044 v71 = (ITEM_EQUIP_TYPE)0; | |
6045 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6046 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6047 v25 = v24; | |
6048 v26 = SkillToMastery(v24); | |
6049 if ( !v23 ) | |
6050 { | |
6051 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6052 { | |
6053 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6054 LOBYTE(v25) = v31; | |
6055 if ( v31 ) | |
6056 { | |
6057 v15 = 0; | |
6058 v32 = SkillToMastery(v31); | |
6059 if ( (signed int)v32 < 3 ) | |
6060 { | |
6061 if ( (signed int)v32 >= 2 ) | |
6062 v15 = 1; | |
6063 } | |
6064 else | |
6065 { | |
6066 v15 = 2; | |
6067 } | |
6068 v16 = v25; | |
6069 return v15 * (v16 & 0x3F); | |
6070 } | |
6071 } | |
6072 goto LABEL_55; | |
6073 } | |
6074 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6075 { | |
6076 v29 = SkillToMastery(v25); | |
6077 v28 = __OFSUB__(v29, 4); | |
6078 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6079 } | |
6080 else | |
6081 { | |
6082 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6083 goto LABEL_55; | |
6084 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6085 { | |
6086 if ( v23 == PLAYER_SKILL_MACE ) | |
6087 { | |
6088 v28 = __OFSUB__(v26, 2); | |
118 | 6089 v27 = v26 - 2 < 0; |
0 | 6090 goto LABEL_53; |
6091 } | |
6092 LABEL_55: | |
6093 v30 = v71 * (v25 & 0x3F); | |
6094 return (int)((char *)v69 + v30); | |
6095 } | |
6096 v28 = __OFSUB__(v26, 3); | |
118 | 6097 v27 = v26 - 3 < 0; |
0 | 6098 } |
6099 LABEL_53: | |
6100 if ( !(v27 ^ v28) ) | |
6101 v71 = (ITEM_EQUIP_TYPE)1; | |
6102 goto LABEL_55; | |
6103 } | |
6104 if ( v2->IsUnarmed() == 1 ) | |
6105 { | |
6106 LOBYTE(v33) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6107 v34 = v33; | |
6108 if ( !v33 ) | |
6109 return v70; | |
6110 if ( (signed int)SkillToMastery(v33) >= 3 ) | |
6111 v5 = 2; | |
6112 v30 = v5 * (v34 & 0x3F); | |
6113 return (int)((char *)v69 + v30); | |
6114 } | |
6115 v35 = (ITEM_EQUIP_TYPE)0; | |
6116 v68 = 0; | |
6117 while ( 1 ) | |
6118 { | |
6119 if ( v2->HasItemEquipped(v35) ) | |
6120 { | |
118 | 6121 v37 = *(int *)&v2->pInventoryItems[v35].uItemID; |
0 | 6122 if ( pItemsTable->pItems[v37].uEquipType <= 1u ) |
6123 break; | |
6124 } | |
6125 v35 = (ITEM_EQUIP_TYPE)((int)v35 + 1); | |
6126 if ( (signed int)v35 >= 16 ) | |
6127 return v70; | |
6128 } | |
6129 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
6130 LOBYTE(v39) = v2->GetActualSkillLevel(v38); | |
6131 a1a = v39; | |
6132 SkillToMastery(v39); | |
6133 v71 = (ITEM_EQUIP_TYPE)0; | |
6134 if ( v38 ) | |
6135 { | |
6136 if ( (signed int)v38 > 0 ) | |
6137 { | |
6138 if ( (signed int)v38 <= 4 || v38 == 6 ) | |
6139 { | |
6140 v71 = (ITEM_EQUIP_TYPE)1; | |
6141 } | |
6142 else | |
6143 { | |
6144 if ( v38 == 7 ) | |
6145 { | |
6146 if ( (signed int)SkillToMastery(a1a) < 4 ) | |
6147 { | |
6148 if ( (signed int)SkillToMastery(a1a) < 3 ) | |
6149 { | |
6150 if ( (signed int)SkillToMastery(a1a) < 2 ) | |
6151 return v5 * (a1a & 0x3F); | |
6152 v63 = 2; | |
6153 } | |
6154 else | |
6155 { | |
6156 v63 = 3; | |
6157 } | |
6158 } | |
6159 else | |
6160 { | |
6161 v63 = 5; | |
6162 } | |
6163 v5 = v63; | |
6164 return v5 * (a1a & 0x3F); | |
6165 } | |
6166 } | |
6167 } | |
6168 } | |
6169 else | |
6170 { | |
6171 v71 = (ITEM_EQUIP_TYPE)1; | |
6172 if ( (signed int)SkillToMastery(a1a) >= 4 ) | |
6173 { | |
6174 LOBYTE(v40) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6175 v41 = v40; | |
6176 if ( v40 ) | |
6177 { | |
6178 if ( (signed int)SkillToMastery(v40) >= 3 ) | |
6179 v5 = 2; | |
6180 v68 = v5 * (v41 & 0x3F); | |
6181 } | |
6182 } | |
6183 } | |
6184 v30 = v68 + v71 * (a1a & 0x3F); | |
6185 return (int)((char *)v69 + v30); | |
6186 } | |
6187 a1b = 0; | |
6188 v71 = (ITEM_EQUIP_TYPE)0; | |
6189 v68 = 16; | |
6190 v69 = &v2->pEquipment; | |
6191 do | |
6192 { | |
6193 if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) | |
6194 goto LABEL_117; | |
6195 v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6196 v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; | |
6197 if ( !v44 ) | |
6198 { | |
6199 v64 = 0; | |
6200 v65 = 1; | |
6201 LABEL_111: | |
6202 v66 = 0; | |
6203 goto LABEL_112; | |
6204 } | |
6205 v45 = v44 - 1; | |
6206 if ( !v45 || (v46 = v45 - 3) == 0 ) | |
6207 { | |
6208 v64 = 0; | |
6209 v65 = 0; | |
6210 v66 = 0; | |
6211 v67 = 1; | |
6212 goto LABEL_113; | |
6213 } | |
6214 v47 = v46 - 4; | |
6215 if ( v47 ) | |
6216 { | |
6217 v48 = v47 - 1; | |
6218 if ( v48 ) | |
6219 { | |
6220 v49 = v48 - 1; | |
6221 if ( v49 ) | |
6222 { | |
6223 if ( v49 != 1 ) | |
6224 goto LABEL_117; | |
6225 a1b = 1; | |
6226 v64 = 1; | |
6227 v65 = 0; | |
6228 v66 = 0; | |
6229 v67 = 0; | |
6230 goto LABEL_113; | |
6231 } | |
6232 a1b = 1; | |
6233 v64 = 1; | |
6234 v65 = 0; | |
6235 goto LABEL_111; | |
6236 } | |
6237 v71 = (ITEM_EQUIP_TYPE)1; | |
6238 } | |
6239 else | |
6240 { | |
6241 a1b = 1; | |
6242 } | |
6243 v64 = 1; | |
6244 v65 = 0; | |
6245 v66 = 1; | |
6246 LABEL_112: | |
6247 v67 = 0; | |
6248 LABEL_113: | |
6249 LOBYTE(v50) = v2->GetActualSkillLevel(v43); | |
6250 v51 = v50; | |
6251 v52 = SkillToMastery(v50); | |
6252 v53 = v51 & 0x3F; | |
6253 for ( i = 0; i < (signed int)v52; ++i ) | |
6254 { | |
6255 if ( *(&v64 + i) ) | |
6256 v70 += v53; | |
6257 } | |
6258 LABEL_117: | |
6259 v69 = (PlayerEquipment *)((char *)v69 + 4); | |
6260 --v68; | |
6261 } | |
6262 while ( v68 ); | |
6263 v64 = 1; | |
6264 v65 = 1; | |
6265 v66 = 1; | |
6266 v67 = 0; | |
6267 LOBYTE(v55) = v2->GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
6268 v56 = v55; | |
6269 v57 = SkillToMastery(v55); | |
6270 if ( !a1b && (!v71 || v57 == 4) ) | |
6271 { | |
6272 v58 = v56 & 0x3F; | |
6273 for ( j = 0; j < (signed int)v57; ++j ) | |
6274 { | |
6275 if ( *(&v64 + j) ) | |
6276 v70 += v58; | |
6277 } | |
6278 } | |
6279 return v70; | |
6280 } | |
6281 | |
6282 //----- (00490109) -------------------------------------------------------- | |
6283 // faces are: 0 1 2 3 human males | |
6284 // 4 5 6 7 human females | |
6285 // 8 9 elf males | |
6286 // 10 11 elf females | |
6287 // 12 13 dwarf males | |
6288 // 14 15 dwarf females | |
6289 // 16 17 goblin males | |
6290 // 18 19 goblin females | |
6291 // 20 lich male | |
6292 // 21 lich female | |
6293 // 22 underwater suits (unused) | |
6294 // 23 zombie male | |
6295 // 24 zombie female | |
6296 enum CHARACTER_RACE Player::GetRace() | |
6297 { | |
6298 if ( uFace > 15 ) | |
6299 { | |
6300 if ( uFace >= 16 && uFace <= 19 ) | |
6301 return CHARACTER_RACE_GOBLIN; | |
6302 } | |
6303 else | |
6304 { | |
6305 if ( uFace >= 12 ) | |
6306 { | |
6307 return CHARACTER_RACE_DWARF; | |
6308 } | |
6309 else | |
6310 { | |
6311 if ( uFace >= 0 ) | |
6312 { | |
6313 if ( uFace <= 7 ) | |
6314 { | |
6315 return CHARACTER_RACE_HUMAN; | |
6316 } | |
6317 else | |
6318 { | |
6319 if ( uFace <= 11 ) | |
6320 return CHARACTER_RACE_ELF; | |
6321 } | |
6322 } | |
6323 } | |
6324 } | |
6325 return CHARACTER_RACE_HUMAN; | |
6326 } | |
6327 | |
6328 //----- (00490141) -------------------------------------------------------- | |
187 | 6329 PLAYER_SEX Player::GetSexByVoice() |
0 | 6330 { |
6331 signed int result; // eax@1 | |
6332 | |
6333 result = 0; | |
6334 switch ( this->uVoiceID ) | |
6335 { | |
6336 case 0u: | |
6337 case 1u: | |
6338 case 2u: | |
6339 case 3u: | |
6340 case 8u: | |
6341 case 9u: | |
6342 case 0xCu: | |
6343 case 0xDu: | |
6344 case 0x10u: | |
6345 case 0x11u: | |
6346 case 0x14u: | |
6347 case 0x17u: | |
187 | 6348 return SEX_MALE; |
6349 | |
0 | 6350 case 4u: |
6351 case 5u: | |
6352 case 6u: | |
6353 case 7u: | |
6354 case 0xAu: | |
6355 case 0xBu: | |
6356 case 0xEu: | |
6357 case 0xFu: | |
6358 case 0x12u: | |
6359 case 0x13u: | |
6360 case 0x15u: | |
6361 case 0x18u: | |
187 | 6362 return SEX_FEMALE; |
6363 | |
0 | 6364 default: |
187 | 6365 assert(false); |
6366 } | |
0 | 6367 } |
6368 | |
6369 //----- (00490188) -------------------------------------------------------- | |
6370 void Player::SetInitialStats() | |
6371 { | |
6372 auto v1 = GetRace(); | |
290 | 6373 uMight = StatTable[v1][0].uBaseValue; |
6374 uIntelligence = StatTable[v1][1].uBaseValue; | |
6375 uWillpower = StatTable[v1][2].uBaseValue; | |
6376 uEndurance = StatTable[v1][3].uBaseValue; | |
6377 uAccuracy = StatTable[v1][4].uBaseValue; | |
6378 uSpeed = StatTable[v1][5].uBaseValue; | |
6379 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6380 } |
6381 | |
6382 //----- (004901FC) -------------------------------------------------------- | |
6383 int Player::SetSexByVoice() | |
6384 { | |
6385 __int64 v1; // qax@1 | |
6386 | |
6387 v1 = this->uVoiceID; | |
6388 switch ( (int)v1 ) | |
6389 { | |
6390 case 0: | |
6391 case 1: | |
6392 case 2: | |
6393 case 3: | |
6394 case 8: | |
6395 case 9: | |
6396 case 0xC: | |
6397 case 0xD: | |
6398 case 0x10: | |
6399 case 0x11: | |
6400 case 0x14: | |
6401 case 0x17: | |
6402 BYTE4(v1) = 0; | |
6403 break; | |
6404 case 4: | |
6405 case 5: | |
6406 case 6: | |
6407 case 7: | |
6408 case 0xA: | |
6409 case 0xB: | |
6410 case 0xE: | |
6411 case 0xF: | |
6412 case 0x12: | |
6413 case 0x13: | |
6414 case 0x15: | |
6415 case 0x18: | |
6416 BYTE4(v1) = 1; | |
6417 break; | |
6418 default: | |
6419 break; | |
6420 } | |
6421 this->uSex = (PLAYER_SEX)BYTE4(v1); | |
6422 return v1; | |
6423 } | |
6424 | |
6425 //----- (0049024A) -------------------------------------------------------- | |
135 | 6426 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6427 { |
6428 sLevelModifier = 0; | |
6429 sAgeModifier = 0; | |
6430 | |
135 | 6431 classType = cls; |
0 | 6432 uLuckBonus = 0; |
6433 uSpeedBonus = 0; | |
6434 uAccuracyBonus = 0; | |
6435 uEnduranceBonus = 0; | |
6436 uWillpowerBonus = 0; | |
6437 uIntelligenceBonus = 0; | |
6438 uMightBonus = 0; | |
6439 uLevel = 1; | |
6440 uExperience = 251 + rand() % 100; | |
6441 uBirthYear = 1147 - rand() % 6; | |
6442 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6443 memset(_guilds_member_bits, 0, 64); |
0 | 6444 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6445 | |
6446 for (uint i = 0; i < 37; ++i) | |
6447 { | |
135 | 6448 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6449 continue; |
6450 | |
6451 pActiveSkills[i] = 1; | |
6452 | |
6453 switch (i) | |
6454 { | |
486 | 6455 case PLAYER_SKILL_FIRE: spellbook.pFireSpellbook.bIsSpellAvailable[0] = true; |
6456 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6457 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6458 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
569 | 6459 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; |
6460 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6461 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6462 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6463 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; | |
6464 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6465 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6466 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6467 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6468 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6469 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6470 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6471 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6472 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6473 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6474 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6475 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6476 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6477 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6478 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6479 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6480 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6481 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6482 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
486 | 6483 break; |
198 | 6484 case PLAYER_SKILL_AIR: spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; break; |
6485 case PLAYER_SKILL_WATER: spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; break; | |
6486 case PLAYER_SKILL_EARTH: spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; break; | |
6487 case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break; | |
6488 case PLAYER_SKILL_MIND: spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; break; | |
569 | 6489 case PLAYER_SKILL_BODY: spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; |
6490 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6491 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6492 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6493 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6494 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6495 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6496 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6497 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6498 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6499 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6500 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; | |
6501 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6502 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6503 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6504 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6505 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6506 break; | |
198 | 6507 case PLAYER_SKILL_LIGHT: spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; break; |
6508 case PLAYER_SKILL_DARK: spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; break; | |
0 | 6509 } |
6510 } | |
6511 | |
6512 sHealth = GetMaxHealth(); | |
6513 sMana = GetMaxMana(); | |
6514 } | |
6515 | |
6516 //----- (004903C9) -------------------------------------------------------- | |
821 | 6517 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6518 { | |
6519 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6520 int v3; // edx@5 |
6521 char *v4; // ecx@5 | |
6522 int v5; // esi@11 | |
6523 unsigned __int16 *v6; // edx@11 | |
6524 int v7; // esi@18 | |
6525 unsigned __int16 *pActiveSkill; // edx@18 | |
6526 | |
6527 if ( order >= 0 ) | |
6528 { | |
6529 if ( order <= 1 ) | |
6530 { | |
6531 result = (PLAYER_SKILL_TYPE)0; | |
6532 v7 = 0; | |
6533 pActiveSkill = this->pActiveSkills; | |
6534 do | |
6535 { | |
135 | 6536 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6537 { |
6538 if ( v7 == order ) | |
6539 return result; | |
6540 ++v7; | |
6541 } | |
6542 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6543 ++pActiveSkill; | |
6544 } | |
6545 while ( (signed int)result < 37 ); | |
6546 } | |
6547 else | |
6548 { | |
6549 if ( order <= 3 ) | |
6550 { | |
6551 result = (PLAYER_SKILL_TYPE)0; | |
6552 v5 = 0; | |
6553 pActiveSkill = this->pActiveSkills; | |
6554 do | |
6555 { | |
135 | 6556 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6557 { |
6558 if ( v5 == order - 2 ) | |
6559 return result; | |
6560 ++v5; | |
6561 } | |
6562 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6563 ++pActiveSkill; | |
6564 } | |
6565 while ( (signed int)result < 37 ); | |
6566 } | |
6567 else | |
6568 { | |
6569 if ( order <= 12 ) | |
6570 { | |
6571 result = (PLAYER_SKILL_TYPE)0; | |
6572 v3 = 0; | |
135 | 6573 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6574 do |
6575 { | |
6576 if ( *v4 == 1 ) | |
6577 { | |
6578 if ( v3 == order - 4 ) | |
6579 return result; | |
6580 ++v3; | |
6581 } | |
6582 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6583 ++v4; | |
6584 } | |
6585 while ( (signed int)result < 37 ); | |
6586 } | |
6587 } | |
6588 } | |
6589 } | |
6590 return (PLAYER_SKILL_TYPE)37; | |
6591 } | |
6592 | |
6593 | |
6594 | |
6595 //----- (0049048D) -------------------------------------------------------- | |
6596 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6597 void Player::DecreaseAttribute(int eAttribute) | |
6598 { | |
6599 int v2; // eax@1 | |
6600 int pBaseValue; // ecx@1 | |
6601 int pDroppedStep; // ebx@1 | |
6602 int pStep; // esi@1 | |
6603 unsigned __int16 result; // ax@7 | |
6604 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6605 | |
6606 v2 = eAttribute + 7 * GetRace(); | |
290 | 6607 pBaseValue = StatTable[0][v2].uBaseValue; |
6608 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6609 uMinValue = pBaseValue - 2; |
290 | 6610 pStep = StatTable[0][v2].uBaseStep; |
0 | 6611 switch ( eAttribute ) |
6612 { | |
6613 case CHARACTER_MIGHT: | |
6614 if ( this->uMight <= pBaseValue ) | |
6615 pStep = pDroppedStep; | |
6616 if ( this->uMight - pStep >= uMinValue ) | |
6617 this->uMight -= pStep; | |
6618 break; | |
6619 case CHARACTER_INTELLIGANCE: | |
6620 if ( this->uIntelligence <= pBaseValue ) | |
6621 pStep = pDroppedStep; | |
6622 if ( this->uIntelligence - pStep >= uMinValue ) | |
6623 this->uIntelligence -= pStep; | |
6624 break; | |
6625 case CHARACTER_WILLPOWER: | |
6626 if ( this->uWillpower <= pBaseValue ) | |
6627 pStep = pDroppedStep; | |
6628 if ( this->uWillpower - pStep >= uMinValue ) | |
6629 this->uWillpower -= pStep; | |
6630 break; | |
6631 case CHARACTER_ENDURANCE: | |
6632 if ( this->uEndurance <= pBaseValue ) | |
6633 pStep = pDroppedStep; | |
6634 if ( this->uEndurance - pStep >= uMinValue ) | |
6635 this->uEndurance -= pStep; | |
6636 break; | |
6637 case CHARACTER_ACCURACY: | |
6638 if ( this->uAccuracy <= pBaseValue ) | |
6639 pStep = pDroppedStep; | |
6640 if ( this->uAccuracy - pStep >= uMinValue ) | |
6641 this->uAccuracy -= pStep; | |
6642 break; | |
6643 case CHARACTER_SPEED: | |
6644 if ( this->uSpeed <= pBaseValue ) | |
6645 pStep = pDroppedStep; | |
6646 if ( this->uSpeed - pStep >= uMinValue ) | |
6647 this->uSpeed -= pStep; | |
6648 break; | |
6649 case CHARACTER_LUCK: | |
6650 if ( this->uLuck <= pBaseValue ) | |
6651 pStep = pDroppedStep; | |
6652 if ( this->uLuck - pStep >= uMinValue ) | |
6653 this->uLuck -= pStep; | |
6654 break; | |
6655 } | |
6656 } | |
6657 | |
6658 //----- (004905F5) -------------------------------------------------------- | |
6659 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6660 int Player::IncreaseAttribute(int eAttribute) | |
6661 { | |
6662 Player *v2; // esi@1 | |
6663 int v3; // eax@1 | |
6664 int v4; // ebx@1 | |
6665 signed int v5; // edi@1 | |
6666 int v6; // eax@8 | |
6667 signed int v7; // eax@17 | |
6668 signed int result; // eax@18 | |
6669 int v9; // [sp+Ch] [bp-8h]@1 | |
6670 signed int v10; // [sp+10h] [bp-4h]@1 | |
6671 | |
6672 v2 = this; | |
6673 v3 = eAttribute + 7 * GetRace(); | |
290 | 6674 v4 = StatTable[0][v3].uMaxValue; |
6675 v5 = StatTable[0][v3].uBaseStep; | |
6676 v9 = StatTable[0][v3].uBaseValue; | |
6677 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6678 PlayerCreation_ComputeAttributeBonus(); |
6679 if ( eAttribute ) | |
6680 { | |
6681 switch ( eAttribute ) | |
6682 { | |
6683 case 1: | |
6684 v6 = v2->uIntelligence; | |
6685 break; | |
6686 case 2: | |
6687 v6 = v2->uWillpower; | |
6688 break; | |
6689 case 3: | |
6690 v6 = v2->uEndurance; | |
6691 break; | |
6692 case 4: | |
6693 v6 = v2->uAccuracy; | |
6694 break; | |
6695 case 5: | |
6696 v6 = v2->uSpeed; | |
6697 break; | |
6698 case 6: | |
6699 v6 = v2->uLuck; | |
6700 break; | |
6701 default: | |
6702 v6 = eAttribute; | |
6703 break; | |
6704 } | |
6705 } | |
6706 else | |
6707 { | |
6708 v6 = v2->uMight; | |
6709 } | |
6710 if ( v6 < v9 ) | |
6711 { | |
6712 v7 = v5; | |
6713 v5 = v10; | |
6714 v10 = v7; | |
6715 } | |
6716 result = PlayerCreation_ComputeAttributeBonus(); | |
6717 if ( result >= v10 ) | |
6718 { | |
6719 if ( eAttribute ) | |
6720 { | |
6721 switch ( eAttribute ) | |
6722 { | |
6723 case 1: | |
6724 result = (signed int)&v2->uIntelligence; | |
6725 break; | |
6726 case 2: | |
6727 result = (signed int)&v2->uWillpower; | |
6728 break; | |
6729 case 3: | |
6730 result = (signed int)&v2->uEndurance; | |
6731 break; | |
6732 case 4: | |
6733 result = (signed int)&v2->uAccuracy; | |
6734 break; | |
6735 case 5: | |
6736 result = (signed int)&v2->uSpeed; | |
6737 break; | |
6738 default: | |
6739 result = eAttribute - 6; | |
6740 if ( eAttribute != 6 ) | |
6741 return result; | |
6742 result = (signed int)&v2->uLuck; | |
6743 break; | |
6744 } | |
6745 } | |
6746 else | |
6747 { | |
6748 result = (signed int)&v2->uMight; | |
6749 } | |
6750 if ( v5 + *(short *)result <= v4 ) | |
6751 *(short *)result += v5; | |
6752 } | |
6753 return result; | |
6754 } | |
6755 | |
6756 //----- (0049070F) -------------------------------------------------------- | |
6757 void Player::Zero() | |
6758 { | |
6759 Player *v1; // esi@1 | |
6760 | |
6761 v1 = this; | |
6762 this->sLevelModifier = 0; | |
6763 this->sACModifier = 0; | |
6764 this->uLuckBonus = 0; | |
6765 this->uAccuracyBonus = 0; | |
6766 this->uSpeedBonus = 0; | |
6767 this->uEnduranceBonus = 0; | |
6768 this->uWillpowerBonus = 0; | |
6769 this->uIntelligenceBonus = 0; | |
6770 this->uMightBonus = 0; | |
6771 this->field_100 = 0; | |
6772 this->field_FC = 0; | |
6773 this->field_F8 = 0; | |
6774 this->field_F4 = 0; | |
6775 this->field_F0 = 0; | |
6776 this->field_EC = 0; | |
6777 this->field_E8 = 0; | |
6778 this->field_E4 = 0; | |
6779 this->field_E0 = 0; | |
766 | 6780 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6781 v1->field_1A97 = 0; |
6782 v1->_ranged_dmg_bonus = 0; | |
6783 v1->field_1A95 = 0; | |
6784 v1->_ranged_atk_bonus = 0; | |
6785 v1->field_1A93 = 0; | |
6786 v1->_melee_dmg_bonus = 0; | |
6787 v1->field_1A91 = 0; | |
6788 v1->_some_attack_bonus = 0; | |
6789 v1->_mana_related = 0; | |
6790 v1->uFullManaBonus = 0; | |
6791 v1->_health_related = 0; | |
6792 v1->uFullHealthBonus = 0; | |
6793 } | |
6794 | |
6795 //----- (004907E7) -------------------------------------------------------- | |
299 | 6796 unsigned int Player::GetStatColor(int uStat) |
0 | 6797 { |
6798 __int16 uWhite; // si@1 | |
290 | 6799 int attribute_value; // edx@1 |
299 | 6800 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6801 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6802 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6803 | |
6804 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6805 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6806 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
299 | 6807 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6808 |
0 | 6809 switch (uStat) |
6810 { | |
6811 case 0: attribute_value = uMight; break; | |
6812 case 1: attribute_value = uIntelligence; break; | |
6813 case 2: attribute_value = uWillpower; break; | |
6814 case 3: attribute_value = uEndurance; break; | |
290 | 6815 case 4: attribute_value = uAccuracy; break; |
6816 case 5: attribute_value = uSpeed; break; | |
0 | 6817 case 6: attribute_value = uLuck; break; |
6818 }; | |
6819 | |
299 | 6820 if ( attribute_value == pBaseAttrValue ) |
290 | 6821 return uWhite; |
299 | 6822 else if ( attribute_value > pBaseAttrValue ) |
290 | 6823 return uGreen; |
0 | 6824 else |
290 | 6825 return uRed; |
0 | 6826 } |
6827 | |
6828 //----- (004908A8) -------------------------------------------------------- | |
6829 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6830 { | |
6831 unsigned __int64 *result; // eax@1 | |
6832 | |
6833 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6834 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6835 { | |
6836 *(int *)result = 0; | |
6837 *((int *)result + 1) = 0; | |
6838 LOBYTE(result) = 1; | |
6839 } | |
6840 else | |
6841 { | |
6842 LOBYTE(result) = 0; | |
6843 } | |
6844 return (bool)result; | |
6845 } | |
6846 | |
6847 //----- (004680ED) -------------------------------------------------------- | |
6848 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6849 { | |
6850 Player *v3; // esi@1 | |
6851 unsigned int v4; // ebx@4 | |
6852 signed int v5; // eax@17 | |
6853 unsigned int v6; // eax@26 | |
6854 unsigned __int8 v7; // cf@37 | |
6855 int v8; // edx@39 | |
6856 int v9; // edx@40 | |
6857 int v10; // edx@41 | |
6858 int v11; // edx@42 | |
6859 int v12; // edx@43 | |
6860 char *v13; // eax@45 | |
6861 AudioPlayer *v14; // ecx@62 | |
6862 signed int v15; // edi@68 | |
6863 int v16; // edx@73 | |
6864 unsigned __int16 *v17; // edi@73 | |
6865 unsigned int v18; // eax@73 | |
6866 int v19; // eax@74 | |
6867 int v20; // eax@75 | |
6868 signed int v21; // eax@81 | |
6869 const char *v22; // eax@84 | |
6870 char *v23; // ecx@90 | |
6871 int v24; // esi@96 | |
6872 int v25; // eax@109 | |
6873 int v26; // eax@113 | |
6874 char *v27; // edi@114 | |
6875 signed __int64 v28; // qax@120 | |
6876 char *v29; // ecx@120 | |
6877 int v30; // edi@137 | |
6878 int v31; // ST30_4@137 | |
6879 int v32; // ST3C_4@137 | |
6880 int v33; // ST40_4@137 | |
6881 int v34; // ST34_4@137 | |
6882 int v35; // ST38_4@137 | |
6883 unsigned __int8 v36; // al@173 | |
6884 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6885 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6886 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6887 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6888 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6889 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6890 signed int v43; // [sp-14h] [bp-40h]@18 | |
6891 signed int v44; // [sp-14h] [bp-40h]@174 | |
6892 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6893 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6894 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6895 int v48; // [sp-Ch] [bp-38h]@18 | |
6896 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6897 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6898 int v51; // [sp-Ch] [bp-38h]@174 | |
6899 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6900 char *v53; // [sp-8h] [bp-34h]@33 | |
6901 int v54; // [sp-8h] [bp-34h]@34 | |
6902 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6903 int v56; // [sp-8h] [bp-34h]@66 | |
6904 const char *v57; // [sp-8h] [bp-34h]@69 | |
6905 const char *v58; // [sp-8h] [bp-34h]@89 | |
6906 int v59; // [sp-8h] [bp-34h]@120 | |
6907 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6908 int v61; // [sp-4h] [bp-30h]@18 | |
6909 char *v62; // [sp-4h] [bp-30h]@33 | |
6910 char *v63; // [sp-4h] [bp-30h]@34 | |
6911 int v64; // [sp-4h] [bp-30h]@60 | |
6912 int v65; // [sp-4h] [bp-30h]@66 | |
6913 const char *v66; // [sp-4h] [bp-30h]@69 | |
6914 signed int v67; // [sp-4h] [bp-30h]@77 | |
6915 const char *v68; // [sp-4h] [bp-30h]@89 | |
6916 int v69; // [sp-4h] [bp-30h]@110 | |
6917 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6918 int v71; // [sp-4h] [bp-30h]@174 | |
6919 char *v72; // [sp+20h] [bp-Ch]@68 | |
6920 signed int v73; // [sp+24h] [bp-8h]@1 | |
6921 char *v74; // [sp+24h] [bp-8h]@23 | |
6922 int v75; // [sp+24h] [bp-8h]@73 | |
6923 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6924 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6925 | |
6926 thisb = this; | |
243 | 6927 v3 = &pParty->pPlayers[a2-1]; |
0 | 6928 v73 = 1; |
6929 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6930 return; | |
6931 v4 = 0; | |
6932 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6933 { | |
6934 if ( pParty->pPickedItem.uItemID != 160 ) | |
6935 { | |
6936 if ( pParty->pPickedItem.uItemID == 161 ) | |
6937 { | |
6938 v27 = (char *)&v3->sMana; | |
6939 *(int *)v27 += 2; | |
6940 LABEL_170: | |
6941 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6942 *(int *)v27 = v3->GetMaxMana(); | |
6943 } | |
6944 else | |
6945 { | |
6946 if ( pParty->pPickedItem.uItemID != 162 ) | |
6947 { | |
6948 LABEL_167: | |
6949 v68 = pParty->pPickedItem.GetDisplayName(); | |
6950 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6951 goto LABEL_90; | |
6952 } | |
6953 v69 = 2; | |
6954 LABEL_111: | |
243 | 6955 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6956 } |
6957 LABEL_112: | |
187 | 6958 v3->PlaySound(SPEECH_36, 0); |
0 | 6959 goto LABEL_173; |
6960 } | |
6961 LABEL_172: | |
100 | 6962 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6963 goto LABEL_173; |
6964 } | |
6965 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6966 { | |
6967 switch ( pParty->pPickedItem.uItemID ) | |
6968 { | |
6969 case 0xDEu: | |
570 | 6970 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6971 goto LABEL_110; |
6972 case 0xDFu: | |
570 | 6973 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6974 goto LABEL_114; |
6975 case 0xE0u: | |
6976 LODWORD(v3->pConditions[1]) = 0; | |
6977 HIDWORD(v3->pConditions[1]) = 0; | |
6978 goto LABEL_112; | |
6979 case 0xE1u: | |
6980 LODWORD(v3->pConditions[11]) = 0; | |
6981 HIDWORD(v3->pConditions[11]) = 0; | |
6982 LODWORD(v3->pConditions[9]) = 0; | |
6983 HIDWORD(v3->pConditions[9]) = 0; | |
6984 LODWORD(v3->pConditions[7]) = 0; | |
6985 HIDWORD(v3->pConditions[7]) = 0; | |
6986 goto LABEL_112; | |
6987 case 0xE2u: | |
6988 LODWORD(v3->pConditions[10]) = 0; | |
6989 HIDWORD(v3->pConditions[10]) = 0; | |
6990 LODWORD(v3->pConditions[8]) = 0; | |
6991 HIDWORD(v3->pConditions[8]) = 0; | |
6992 LODWORD(v3->pConditions[6]) = 0; | |
6993 HIDWORD(v3->pConditions[6]) = 0; | |
6994 goto LABEL_112; | |
6995 case 0xE3u: | |
6996 LODWORD(v3->pConditions[2]) = 0; | |
6997 HIDWORD(v3->pConditions[2]) = 0; | |
6998 goto LABEL_112; | |
6999 case 0xE4u: | |
7000 if ( v3->pConditions[1] ) | |
7001 goto LABEL_173; | |
7002 v70 = 0; | |
7003 v59 = 0; | |
7004 v50 = 5; | |
7005 v46 = 3; | |
570 | 7006 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7007 v29 = (char *)&v3->pPlayerBuffs[7]; |
7008 goto LABEL_147; | |
7009 case 0xE5u: | |
7010 v70 = 0; | |
7011 v59 = 0; | |
7012 v50 = 5; | |
7013 v46 = 3; | |
570 | 7014 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7015 v29 = (char *)&v3->pPlayerBuffs[8]; |
7016 goto LABEL_147; | |
7017 case 0xE6u: | |
7018 v70 = 0; | |
7019 v59 = 0; | |
7020 v50 = 5; | |
7021 v46 = 3; | |
570 | 7022 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7023 v29 = (char *)&v3->pPlayerBuffs[1]; |
7024 goto LABEL_147; | |
7025 case 0xE7u: | |
7026 v70 = 0; | |
7027 v59 = 0; | |
570 | 7028 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7029 v46 = 0; |
570 | 7030 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7031 v29 = (char *)&v3->pPlayerBuffs[11]; |
7032 goto LABEL_147; | |
7033 case 0xE8u: | |
7034 v70 = 0; | |
7035 v59 = 0; | |
570 | 7036 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7037 v46 = 0; |
570 | 7038 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7039 v29 = (char *)&v3->pPlayerBuffs[13]; |
7040 goto LABEL_147; | |
7041 case 0xEAu: | |
7042 v70 = 0; | |
7043 v59 = 0; | |
7044 v50 = 5; | |
7045 v46 = 3; | |
570 | 7046 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7047 v29 = (char *)&v3->pPlayerBuffs[14]; |
7048 goto LABEL_147; | |
7049 case 0xEBu: | |
7050 v3->pPlayerBuffs[23].Apply( | |
570 | 7051 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7052 3u, |
7053 5u, | |
7054 0, | |
7055 0); | |
7056 goto LABEL_173; | |
7057 case 0xEDu: | |
7058 LODWORD(v3->pConditions[3]) = 0; | |
7059 HIDWORD(v3->pConditions[3]) = 0; | |
7060 goto LABEL_112; | |
7061 case 0xEEu: | |
7062 LODWORD(v3->pConditions[0]) = 0; | |
7063 HIDWORD(v3->pConditions[0]) = 0; | |
7064 goto LABEL_112; | |
7065 case 0xEFu: | |
7066 LODWORD(v3->pConditions[5]) = 0; | |
7067 HIDWORD(v3->pConditions[5]) = 0; | |
7068 goto LABEL_112; | |
7069 case 0xF0u: | |
7070 v70 = 0; | |
7071 v59 = 0; | |
570 | 7072 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7073 v46 = 0; |
570 | 7074 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7075 v29 = (char *)&v3->pPlayerBuffs[19]; |
7076 goto LABEL_147; | |
7077 case 0xF1u: | |
7078 v70 = 0; | |
7079 v59 = 0; | |
570 | 7080 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7081 v46 = 0; |
570 | 7082 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7083 v29 = (char *)&v3->pPlayerBuffs[17]; |
7084 goto LABEL_147; | |
7085 case 0xF2u: | |
7086 v70 = 0; | |
7087 v59 = 0; | |
570 | 7088 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7089 v46 = 0; |
570 | 7090 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7091 v29 = (char *)&v3->pPlayerBuffs[20]; |
7092 goto LABEL_147; | |
7093 case 0xF3u: | |
7094 v70 = 0; | |
7095 v59 = 0; | |
570 | 7096 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7097 v46 = 0; |
570 | 7098 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7099 v29 = (char *)&v3->pPlayerBuffs[16]; |
7100 goto LABEL_147; | |
7101 case 0xF4u: | |
7102 v70 = 0; | |
7103 v59 = 0; | |
570 | 7104 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7105 v46 = 0; |
570 | 7106 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7107 v29 = (char *)&v3->pPlayerBuffs[21]; |
7108 goto LABEL_147; | |
7109 case 0xF5u: | |
7110 v70 = 0; | |
7111 v59 = 0; | |
570 | 7112 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7113 v46 = 0; |
570 | 7114 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7115 v29 = (char *)&v3->pPlayerBuffs[15]; |
7116 goto LABEL_147; | |
7117 case 0xFBu: | |
7118 LODWORD(v3->pConditions[12]) = 0; | |
7119 HIDWORD(v3->pConditions[12]) = 0; | |
7120 goto LABEL_112; | |
7121 case 0xFCu: | |
7122 v30 = LODWORD(v3->pConditions[14]); | |
7123 v31 = HIDWORD(v3->pConditions[14]); | |
7124 v32 = LODWORD(v3->pConditions[15]); | |
7125 v33 = HIDWORD(v3->pConditions[15]); | |
7126 v34 = LODWORD(v3->pConditions[16]); | |
7127 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7128 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7129 HIDWORD(v3->pConditions[14]) = v31; |
7130 LODWORD(v3->pConditions[15]) = v32; | |
7131 HIDWORD(v3->pConditions[15]) = v33; | |
7132 LODWORD(v3->pConditions[16]) = v34; | |
7133 LODWORD(v3->pConditions[14]) = v30; | |
7134 HIDWORD(v3->pConditions[16]) = v35; | |
7135 goto LABEL_112; | |
7136 case 0xFDu: | |
570 | 7137 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7138 LABEL_110: |
7139 v69 = v25; | |
7140 goto LABEL_111; | |
7141 case 0xFEu: | |
570 | 7142 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7143 LABEL_114: |
7144 v27 = (char *)&v3->sMana; | |
7145 *(int *)v27 += v26; | |
7146 goto LABEL_170; | |
7147 case 0xFFu: | |
7148 v70 = 0; | |
7149 v59 = 0; | |
570 | 7150 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7151 v46 = 0; |
570 | 7152 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7153 v29 = (char *)&v3->pPlayerBuffs[18]; |
7154 goto LABEL_147; | |
7155 case 0x100u: | |
7156 v70 = 0; | |
7157 v59 = 0; | |
570 | 7158 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7159 v46 = 0; |
570 | 7160 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7161 v29 = (char *)&v3->pPlayerBuffs[5]; |
7162 goto LABEL_147; | |
7163 case 0x101u: | |
7164 v70 = 0; | |
7165 v59 = 0; | |
570 | 7166 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7167 v46 = 0; |
570 | 7168 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7169 v29 = (char *)v3->pPlayerBuffs; |
7170 goto LABEL_147; | |
7171 case 0x102u: | |
7172 v70 = 0; | |
7173 v59 = 0; | |
570 | 7174 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7175 v46 = 0; |
570 | 7176 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7177 v29 = (char *)&v3->pPlayerBuffs[22]; |
7178 goto LABEL_147; | |
7179 case 0x103u: | |
7180 v70 = 0; | |
7181 v59 = 0; | |
570 | 7182 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7183 v46 = 0; |
570 | 7184 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7185 v29 = (char *)&v3->pPlayerBuffs[3]; |
7186 goto LABEL_147; | |
7187 case 0x104u: | |
7188 v70 = 0; | |
7189 v59 = 0; | |
570 | 7190 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7191 v46 = 0; |
570 | 7192 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7193 v29 = (char *)&v3->pPlayerBuffs[9]; |
7194 goto LABEL_147; | |
7195 case 0x105u: | |
7196 v70 = 0; | |
7197 v59 = 0; | |
570 | 7198 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7199 v46 = 0; |
570 | 7200 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7201 v29 = (char *)&v3->pPlayerBuffs[2]; |
7202 LABEL_147: | |
7203 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7204 goto LABEL_112; | |
7205 case 0x106u: | |
7206 LODWORD(v3->pConditions[15]) = 0; | |
7207 HIDWORD(v3->pConditions[15]) = 0; | |
7208 goto LABEL_112; | |
7209 case 0x108u: | |
7210 if ( !*(int *)&v3->field_1F5[3] ) | |
7211 { | |
7212 v3->uLuck += 50; | |
7213 *(int *)&v3->field_1F5[3] = 1; | |
7214 } | |
7215 goto LABEL_112; | |
7216 case 0x109u: | |
7217 if ( !*(int *)&v3->field_1F5[7] ) | |
7218 { | |
7219 v3->uSpeed += 50; | |
7220 *(int *)&v3->field_1F5[7] = 1; | |
7221 } | |
7222 goto LABEL_112; | |
7223 case 0x10Au: | |
7224 if ( !*(int *)&v3->field_1F5[11] ) | |
7225 { | |
7226 v3->uIntelligence += 50; | |
7227 *(int *)&v3->field_1F5[11] = 1; | |
7228 } | |
7229 goto LABEL_112; | |
7230 case 0x10Bu: | |
7231 if ( !*(int *)&v3->field_1F5[15] ) | |
7232 { | |
7233 v3->uEndurance += 50; | |
7234 *(int *)&v3->field_1F5[15] = 1; | |
7235 } | |
7236 goto LABEL_112; | |
7237 case 0x10Cu: | |
7238 if ( !*(int *)&v3->field_1F5[19] ) | |
7239 { | |
7240 v3->uWillpower += 50; | |
7241 *(int *)&v3->field_1F5[19] = 1; | |
7242 } | |
7243 goto LABEL_112; | |
7244 case 0x10Du: | |
7245 if ( !*(int *)&v3->field_1F5[23] ) | |
7246 { | |
7247 v3->uAccuracy += 50; | |
7248 *(int *)&v3->field_1F5[23] = 1; | |
7249 } | |
7250 goto LABEL_112; | |
7251 case 0x10Eu: | |
7252 if ( !*(int *)&v3->field_1F5[27] ) | |
7253 { | |
7254 v3->uMight += 50; | |
7255 *(int *)&v3->field_1F5[27] = 1; | |
7256 } | |
7257 goto LABEL_112; | |
7258 case 0x10Fu: | |
7259 v3->sAgeModifier = 0; | |
7260 goto LABEL_112; | |
809 | 7261 case 0xDDu: |
7262 goto LABEL_172; | |
0 | 7263 default: |
7264 goto LABEL_167; | |
7265 } | |
7266 goto LABEL_172; | |
7267 } | |
7268 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7269 { | |
7270 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7271 { | |
7272 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7273 { | |
7274 if ( pParty->pPickedItem.uItemID == 616 ) | |
7275 { | |
7276 thisa = pParty->uCurrentMonthWeek + 1; | |
7277 if ( pParty->uCurrentMonth >= 7 ) | |
7278 v74 = 0; | |
7279 else | |
7280 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7281 switch ( pParty->uCurrentMonth ) | |
7282 { | |
7283 case 0u: | |
7284 v6 = pParty->uCurrentMonthWeek + 1; | |
7285 v3->uMight += thisa; | |
7286 goto LABEL_33; | |
7287 case 1u: | |
7288 v6 = pParty->uCurrentMonthWeek + 1; | |
7289 v3->uIntelligence += thisa; | |
7290 goto LABEL_33; | |
7291 case 2u: | |
7292 v6 = pParty->uCurrentMonthWeek + 1; | |
7293 v3->uWillpower += thisa; | |
7294 goto LABEL_33; | |
7295 case 3u: | |
7296 v6 = pParty->uCurrentMonthWeek + 1; | |
7297 v3->uEndurance += thisa; | |
7298 goto LABEL_33; | |
7299 case 4u: | |
7300 v6 = pParty->uCurrentMonthWeek + 1; | |
7301 v3->uAccuracy += thisa; | |
7302 goto LABEL_33; | |
7303 case 5u: | |
7304 v6 = pParty->uCurrentMonthWeek + 1; | |
7305 v3->uSpeed += thisa; | |
7306 goto LABEL_33; | |
7307 case 6u: | |
7308 v6 = pParty->uCurrentMonthWeek + 1; | |
7309 v3->uLuck += thisa; | |
7310 LABEL_33: | |
7311 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7312 v53 = v74; | |
7313 v49 = v6; | |
7314 goto LABEL_53; | |
7315 case 7u: | |
7316 party_finds_gold(1000 * thisa, 0); | |
7317 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7318 v54 = 1000 * thisa; | |
7319 goto LABEL_38; | |
7320 case 8u: | |
7321 Party::GiveFood(5 * thisa); | |
7322 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7323 v54 = 5 * thisa; | |
7324 goto LABEL_38; | |
7325 case 9u: | |
7326 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7327 v3->uSkillPoints += 2 * thisa; | |
7328 v54 = 2 * thisa; | |
7329 goto LABEL_38; | |
7330 case 0xAu: | |
7331 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7332 v54 = 2500 * thisa; | |
7333 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7334 LODWORD(v3->uExperience) += 2500 * thisa; | |
7335 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7336 LABEL_38: | |
7337 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7338 goto LABEL_54; | |
7339 case 0xBu: | |
7340 v8 = rand() % 6; | |
7341 if ( v8 ) | |
7342 { | |
7343 v9 = v8 - 1; | |
7344 if ( v9 ) | |
7345 { | |
7346 v10 = v9 - 1; | |
7347 if ( v10 ) | |
7348 { | |
7349 v11 = v10 - 1; | |
7350 if ( v11 ) | |
7351 { | |
7352 v12 = v11 - 1; | |
7353 if ( v12 ) | |
7354 { | |
7355 if ( v12 != 1 ) | |
7356 goto LABEL_52; | |
7357 v3->sResBodyBase += thisa; | |
7358 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7359 } | |
7360 else | |
7361 { | |
7362 v3->sResMindBase += thisa; | |
7363 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7364 } | |
7365 } | |
7366 else | |
7367 { | |
7368 v3->sResEarthBase += thisa; | |
7369 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7370 } | |
7371 } | |
7372 else | |
7373 { | |
7374 v3->sResWaterBase += thisa; | |
7375 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7376 } | |
7377 } | |
7378 else | |
7379 { | |
7380 v3->sResAirBase += thisa; | |
7381 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7382 } | |
7383 } | |
7384 else | |
7385 { | |
7386 v3->sResFireBase += thisa; | |
7387 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7388 } | |
7389 v74 = v13; | |
7390 LABEL_52: | |
7391 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7392 v53 = v74; | |
7393 v49 = thisa; | |
7394 LABEL_53: | |
7395 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7396 LABEL_54: | |
7397 ShowStatusBarString(pTmpBuf, 2u); | |
7398 pMouse->RemoveHoldingItem(); | |
7399 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7400 v3->PlaySound(SPEECH_93, 0); |
0 | 7401 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7402 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7403 { | |
7404 v64 = 0; | |
7405 v55 = 16; | |
7406 } | |
7407 else | |
7408 { | |
7409 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7410 { | |
7411 v64 = 0; | |
7412 v55 = 14; | |
7413 } | |
7414 else | |
7415 { | |
7416 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7417 return; | |
7418 v64 = 0; | |
7419 v55 = 15; | |
7420 } | |
7421 } | |
7422 v3->SetCondition(v55, v64); | |
7423 v61 = 0; | |
7424 v52 = 0; | |
7425 v48 = 0; | |
7426 v45 = 0; | |
7427 v43 = -1; | |
7428 v41 = 0; | |
7429 v39 = 0; | |
7430 v37 = (SoundID)215; | |
7431 v14 = pAudioPlayer; | |
7432 goto LABEL_63; | |
7433 default: | |
7434 goto LABEL_54; | |
7435 } | |
7436 } | |
7437 if ( pParty->pPickedItem.uItemID == 630 ) | |
7438 { | |
7439 Party::GiveFood(1u); | |
7440 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7441 } | |
7442 else | |
7443 { | |
7444 if ( pParty->pPickedItem.uItemID == 632 ) | |
7445 { | |
7446 v61 = 0; | |
7447 v52 = 0; | |
7448 v48 = 0; | |
7449 v45 = 0; | |
7450 v43 = -1; | |
7451 v41 = 0; | |
7452 v39 = 0; | |
7453 v37 = (SoundID)133; | |
7454 goto LABEL_93; | |
7455 } | |
7456 if ( pParty->pPickedItem.uItemID == 633 ) | |
7457 { | |
7458 v61 = 0; | |
7459 v52 = 0; | |
7460 v48 = 0; | |
7461 v45 = 0; | |
7462 v43 = -1; | |
7463 v41 = 0; | |
7464 v39 = 0; | |
7465 v37 = (SoundID)134; | |
7466 goto LABEL_93; | |
7467 } | |
7468 if ( pParty->pPickedItem.uItemID == 634 ) | |
7469 { | |
7470 v61 = 0; | |
7471 v52 = 0; | |
7472 v48 = 0; | |
7473 v45 = 0; | |
7474 v43 = -1; | |
7475 v41 = 0; | |
7476 v39 = 0; | |
7477 v37 = (SoundID)135; | |
7478 goto LABEL_93; | |
7479 } | |
7480 if ( pParty->pPickedItem.uItemID != 646 ) | |
7481 { | |
7482 if ( pParty->pPickedItem.uItemID == 650 ) | |
7483 { | |
7484 sub_44C28F_open_nwc_dungeon(); | |
7485 return; | |
7486 } | |
7487 goto LABEL_167; | |
7488 } | |
7489 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7490 v5 = 8 * a2 + 392; | |
849 | 7491 LOBYTE(v5) = PID(a2 - 120,OBJECT_Player); |
0 | 7492 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7493 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7494 } | |
7495 LABEL_187: | |
7496 pMouse->RemoveHoldingItem(); | |
7497 return; | |
7498 } | |
243 | 7499 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7500 { |
7501 sub_467F48(pParty->pPickedItem.uItemID); | |
7502 v65 = 0; | |
187 | 7503 v56 = SPEECH_37; |
0 | 7504 LABEL_67: |
187 | 7505 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7506 return; |
7507 } | |
7508 LABEL_89: | |
7509 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7510 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7511 LABEL_90: | |
809 | 7512 sprintfex(pTmpBuf, v58, v68); |
0 | 7513 v23 = pTmpBuf; |
7514 LABEL_91: | |
7515 ShowStatusBarString(v23, 2u); | |
7516 v4 = 0; | |
7517 goto LABEL_92; | |
7518 } | |
7519 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7520 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7521 if ( *v72 ) |
7522 { | |
7523 v66 = pParty->pPickedItem.GetDisplayName(); | |
7524 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7525 LABEL_72: | |
7526 sprintf(pTmpBuf, v57, v66); | |
7527 ShowStatusBarString(pTmpBuf, 2u); | |
7528 LABEL_92: | |
7529 v61 = v4; | |
7530 v52 = v4; | |
7531 v48 = v4; | |
7532 v45 = v4; | |
7533 v43 = -1; | |
7534 v41 = v4; | |
7535 v39 = v4; | |
7536 v37 = (SoundID)27; | |
7537 LABEL_93: | |
7538 v14 = pAudioPlayer; | |
7539 LABEL_63: | |
7540 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7541 return; | |
7542 } | |
243 | 7543 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7544 { |
7545 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7546 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7547 goto LABEL_72; | |
7548 } | |
7549 v16 = v15 % 11 + 1; | |
7550 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7551 v75 = v16; | |
7552 v18 = SkillToMastery(*v17) - 1; | |
7553 if ( v18 ) | |
7554 { | |
7555 v19 = v18 - 1; | |
7556 if ( v19 ) | |
7557 { | |
7558 v20 = v19 - 1; | |
7559 if ( v20 ) | |
7560 { | |
7561 if ( v20 != 1 ) | |
7562 { | |
7563 v21 = a2; | |
7564 LABEL_83: | |
7565 if ( v75 > v21 || !*v17 ) | |
7566 { | |
7567 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7568 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7569 ShowStatusBarString(pTmpBuf, 2u); |
7570 v65 = 0; | |
7571 v56 = 20; | |
7572 goto LABEL_67; | |
7573 } | |
7574 *v72 = 1; | |
187 | 7575 v3->PlaySound(SPEECH_21, 0); |
0 | 7576 v73 = 0; |
7577 LABEL_173: | |
7578 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7579 if ( v36 == 14 ) | |
7580 { | |
7581 v71 = 0; | |
7582 v60 = 0; | |
7583 v51 = 0; | |
7584 v47 = 0; | |
7585 v44 = -1; | |
7586 v42 = 0; | |
7587 v40 = 0; | |
7588 v38 = (SoundID)210; | |
7589 } | |
7590 else | |
7591 { | |
7592 if ( v36 != 13 ) | |
7593 { | |
7594 LABEL_178: | |
7595 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7596 { | |
7597 if ( !v73 ) | |
7598 goto LABEL_187; | |
437 | 7599 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7600 { |
7601 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7602 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7603 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7604 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7605 }*/ |
7606 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7607 } |
7608 if ( v73 ) | |
7609 { | |
7610 if ( pParty->bTurnBasedModeOn ) | |
7611 { | |
7612 *(&pParty->field_16140 + a2) = 100; | |
7613 thisb->SetRecoveryTime(100); | |
7614 pTurnEngine->_40471C(); | |
7615 } | |
7616 else | |
7617 { | |
7618 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7619 } | |
7620 } | |
7621 goto LABEL_187; | |
7622 } | |
7623 v71 = 0; | |
7624 v60 = 0; | |
7625 v51 = 0; | |
7626 v47 = 0; | |
7627 v44 = -1; | |
7628 v42 = 0; | |
7629 v40 = 0; | |
7630 v38 = (SoundID)211; | |
7631 } | |
7632 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7633 goto LABEL_178; | |
7634 } | |
7635 v67 = 11; | |
7636 } | |
7637 else | |
7638 { | |
7639 v67 = 10; | |
7640 } | |
7641 } | |
7642 else | |
7643 { | |
7644 v67 = 7; | |
7645 } | |
7646 } | |
7647 else | |
7648 { | |
7649 v67 = 4; | |
7650 } | |
7651 v21 = v67; | |
7652 goto LABEL_83; | |
7653 } | |
151 | 7654 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7655 return; |
243 | 7656 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7657 goto LABEL_89; |
7658 if ( bUnderwater == 1 ) | |
7659 { | |
7660 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7661 goto LABEL_91; | |
7662 } | |
7663 dword_50C9AC = 1; | |
7664 v24 = pParty->pPickedItem.uItemID - 299; | |
7665 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7666 { | |
7667 pMouse->RemoveHoldingItem(); | |
7668 pGUIWindow_CurrentMenu->Release(); | |
7669 pIcons_LOD->_4114F2(); | |
151 | 7670 pCurrentScreen = SCREEN_GAME; |
0 | 7671 viewparams->bRedrawGameUI = 1; |
7672 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7673 } | |
7674 else | |
7675 { | |
7676 _720984_unused = pParty->pPickedItem.uItemID; | |
7677 pMouse->RemoveHoldingItem(); | |
7678 if ( dword_50C9E8 < 40 ) | |
7679 { | |
7680 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7681 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7682 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7683 ++dword_50C9E8; |
7684 } | |
7685 if ( pCurrentScreen | |
7686 && pGUIWindow_CurrentMenu | |
437 | 7687 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7688 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7689 { | |
7690 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
0 | 7691 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7692 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7693 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7694 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7695 } | |
7696 } | |
7697 } | |
0 | 7698 |
7699 | |
7700 | |
7701 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7702 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7703 { | |
0 | 7704 Player *v3; // esi@1 |
7705 signed int v4; // edi@1 | |
7706 unsigned int v5; // eax@8 | |
7707 int v6; // eax@9 | |
7708 enum CHARACTER_RACE v7; // eax@11 | |
7709 signed int v8; // eax@17 | |
7710 unsigned __int8 v9; // sf@17 | |
7711 unsigned __int8 v10; // of@17 | |
7712 int v11; // eax@19 | |
7713 unsigned int v12; // eax@20 | |
484 | 7714 unsigned int test_bit_value; // eax@25 |
7715 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7716 signed int v15; // ecx@28 |
7717 ItemGen *v16; // eax@28 | |
7718 char v17; // zf@31 | |
7719 int v18; // edi@90 | |
7720 DDM_DLV_Header *v19; // eax@122 | |
7721 char v20; // cl@124 | |
7722 DDM_DLV_Header *v21; // eax@126 | |
7723 unsigned int v22; // edi@129 | |
100 | 7724 Player *v23; // esi@134 |
0 | 7725 ItemGen *v24; // ecx@135 |
7726 signed int v25; // edx@135 | |
7727 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7728 char *v27; // edi@155 | |
7729 int v28; // ebx@161 | |
7730 int v29; // eax@161 | |
7731 | |
469 | 7732 v6 = 0; |
0 | 7733 v3 = this; |
7734 v4 = -1; | |
469 | 7735 if ( VarNum > VAR_AutoNotes ) |
7736 { | |
7737 switch ( VarNum ) | |
0 | 7738 { |
7739 case VAR_Invisible: | |
484 | 7740 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7741 return true; |
484 | 7742 return false; |
0 | 7743 case VAR_NumDeaths: |
7744 v4 = pParty->uNumDeaths; | |
469 | 7745 return v4 >= pValue; |
0 | 7746 case VAR_NumBounties: |
7747 v4 = pParty->uNumBountiesCollected; | |
469 | 7748 return v4 >= pValue; |
0 | 7749 case VAR_PrisonTerms: |
7750 v4 = pParty->uNumPrisonTerms; | |
469 | 7751 return v4 >= pValue; |
0 | 7752 case VAR_ArenaWinsPage: |
7753 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7754 return v4 >= pValue; |
0 | 7755 case VAR_ArenaWinsSquire: |
7756 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7757 return v4 >= pValue; |
0 | 7758 case VAR_ArenaWinsKnight: |
7759 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7760 return v4 >= pValue; |
0 | 7761 case VAR_ArenaWinsLord: |
7762 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7763 return v4 >= pValue; |
0 | 7764 case VAR_ReputationInCurrentLocation: |
7765 v19 = &pOutdoor->ddm; | |
7766 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7767 v19 = &pIndoor->dlv; | |
469 | 7768 v6 = v19->uReputation >= pValue; |
7769 return v6; | |
0 | 7770 case VAR_History_28|VAR_Sex: |
7771 v21 = &pOutdoor->ddm; | |
7772 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7773 v21 = &pIndoor->dlv; | |
469 | 7774 v6 = v21->field_C_alert == pValue; |
0 | 7775 return v6; |
7776 case VAR_MonthEquals2|VAR_Sex: | |
7777 case VAR_MonthEquals2|VAR_Class: | |
7778 case VAR_Counter1: | |
7779 case VAR_Counter2: | |
7780 case VAR_Counter3: | |
7781 case VAR_Counter4: | |
7782 case VAR_Counter5: | |
7783 case VAR_Counter6: | |
7784 case VAR_Counter7: | |
7785 case VAR_Counter8: | |
469 | 7786 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7787 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7788 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7789 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7790 return true; | |
7791 return false; | |
0 | 7792 case VAR_NumSkillPoints: |
7793 v4 = this->uSkillPoints; | |
469 | 7794 return v4 >= pValue; |
0 | 7795 case VAR_CircusPrises: |
7796 v4 = 0; | |
100 | 7797 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7798 do |
7799 { | |
469 | 7800 v24 = v23->pInventoryItems; |
0 | 7801 v25 = 138; |
7802 do | |
7803 { | |
7804 switch ( v24->uItemID ) | |
7805 { | |
7806 case 0x1D6u: | |
7807 ++v4; | |
7808 break; | |
7809 case 0x1D7u: | |
7810 v4 += 3; | |
7811 break; | |
7812 case 0x1DDu: | |
7813 v4 += 5; | |
7814 break; | |
7815 } | |
7816 ++v24; | |
7817 --v25; | |
7818 } | |
7819 while ( v25 ); | |
100 | 7820 ++v23; |
0 | 7821 } |
100 | 7822 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7823 return v4 >= pValue; |
0 | 7824 case VAR_MonthEquals2: |
469 | 7825 v6 = pParty->uCurrentMonth == pValue; |
7826 return v6; | |
0 | 7827 case VAR_IsFlying: |
7828 if ( pParty->bFlying | |
484 | 7829 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7830 return true; |
7831 return false; | |
0 | 7832 case VAR_HiredNPCHasSpeciality: |
469 | 7833 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7834 return v6; |
7835 case VAR_NPCs2: | |
469 | 7836 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7837 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7838 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7839 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7840 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7841 return v4 >= pValue; |
7842 v4 = pValue; | |
7843 return v4 >= pValue; | |
0 | 7844 case VAR_ItemEquipped: |
7845 v26 = (ITEM_EQUIP_TYPE)0; | |
7846 v27 = (char *)&this->pEquipment; | |
7847 break; | |
7848 case VAR_GoldInBank: | |
7849 v4 = pParty->uNumGoldInBank; | |
469 | 7850 return v4 >= pValue; |
0 | 7851 case VAR_ThieverySkill|0x80: |
7852 v28 = GetActualMight(); | |
7853 v29 = v3->GetBaseStrength(); | |
7854 goto LABEL_168; | |
7855 case VAR_DisarmTrapSkill|0x80: | |
7856 v28 = GetActualIntelligence(); | |
7857 v29 = v3->GetBaseIntelligence(); | |
7858 goto LABEL_168; | |
7859 case VAR_MonthEquals: | |
7860 v28 = GetActualWillpower(); | |
7861 v29 = v3->GetBaseWillpower(); | |
7862 goto LABEL_168; | |
7863 case VAR_MonthEquals|VAR_Sex: | |
7864 v28 = GetActualEndurance(); | |
7865 v29 = v3->GetBaseEndurance(); | |
7866 goto LABEL_168; | |
7867 case VAR_IdentifyMonsterSkill|0x80: | |
7868 v28 = GetActualSpeed(); | |
7869 v29 = v3->GetBaseSpeed(); | |
7870 goto LABEL_168; | |
7871 case VAR_ArmsmasterSkill|0x80: | |
7872 v28 = GetActualAccuracy(); | |
7873 v29 = v3->GetBaseAccuracy(); | |
7874 goto LABEL_168; | |
7875 case VAR_MonthEquals|VAR_MaxHP: | |
7876 v28 = GetActualLuck(); | |
7877 v29 = v3->GetBaseLuck(); | |
7878 LABEL_168: | |
7879 v10 = __OFSUB__(v28, v29); | |
7880 v9 = v28 - v29 < 0; | |
7881 LABEL_169: | |
7882 if ( v9 ^ v10 ) | |
469 | 7883 return v4 >= pValue; |
7884 return true; | |
0 | 7885 default: |
469 | 7886 return v4 >= pValue; |
0 | 7887 } |
7888 while ( !v3->HasItemEquipped(v26) | |
654 | 7889 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7890 { |
7891 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7892 v27 += 4; | |
7893 if ( (signed int)v26 >= 16 ) | |
469 | 7894 return false; |
7895 } | |
7896 return true; | |
7897 } | |
7898 if ( VarNum == VAR_AutoNotes ) | |
0 | 7899 { |
484 | 7900 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7901 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7902 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7903 return false; | |
7904 return true; | |
469 | 7905 } |
7906 if ( VarNum <= VAR_BaseLuck ) | |
7907 { | |
7908 if ( VarNum != VAR_BaseLuck ) | |
7909 { | |
7910 switch ( VarNum ) | |
0 | 7911 { |
7912 case VAR_Hour: | |
469 | 7913 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7914 return true; | |
7915 return false; | |
0 | 7916 case VAR_DayOfYear: |
469 | 7917 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7918 v6 = v5 == pValue; | |
7919 return v6; | |
0 | 7920 case VAR_DayOfWeek: |
469 | 7921 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7922 v6 = v5 == pValue; | |
0 | 7923 return v6; |
7924 case VAR_Sex: | |
469 | 7925 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7926 return true; | |
7927 return v4 >= pValue; | |
0 | 7928 case VAR_Class: |
135 | 7929 v7 = (CHARACTER_RACE)this->classType; |
469 | 7930 if ( pValue == v7 ) |
7931 return true; | |
7932 return v4 >= pValue; | |
0 | 7933 case VAR_Race: |
7934 v7 = GetRace(); | |
469 | 7935 if ( pValue == v7 ) |
7936 return true; | |
7937 return v4 >= pValue; | |
0 | 7938 case VAR_CurrentHP: |
7939 v4 = this->sHealth; | |
469 | 7940 return v4 >= pValue; |
0 | 7941 case VAR_MaxHP: |
7942 v8 = GetMaxHealth(); | |
7943 v10 = __OFSUB__(v3->sHealth, v8); | |
7944 v9 = v3->sHealth - v8 < 0; | |
7945 goto LABEL_169; | |
7946 case VAR_CurrentSP: | |
7947 v4 = this->sMana; | |
469 | 7948 return v4 >= pValue; |
0 | 7949 case VAR_MaxSP: |
7950 v11 = GetMaxMana(); | |
7951 v10 = __OFSUB__(v3->sMana, v11); | |
7952 v9 = v3->sMana - v11 < 0; | |
7953 goto LABEL_169; | |
7954 case VAR_ActualAC: | |
7955 v12 = GetActualAC(); | |
7956 goto _j_cmp_against_arg; | |
7957 case VAR_ACModifier: | |
7958 v4 = this->sACModifier; | |
469 | 7959 return v4 >= pValue; |
0 | 7960 case VAR_BaseLevel: |
7961 v4 = this->uLevel; | |
469 | 7962 return v4 >= pValue; |
0 | 7963 case VAR_LevelModifier: |
7964 v4 = this->sLevelModifier; | |
469 | 7965 return v4 >= pValue; |
0 | 7966 case VAR_Age: |
7967 v12 = GetActualAge(); | |
7968 goto _j_cmp_against_arg; | |
7969 case VAR_Award: | |
484 | 7970 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7971 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
7972 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7973 return true; | |
7974 return false; | |
0 | 7975 case VAR_Experience: |
7976 v4 = LODWORD(this->uExperience); | |
469 | 7977 return v4 >= pValue; |
0 | 7978 case VAR_QBits_QuestsDone: |
484 | 7979 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7980 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7981 if ( test_bit_value & our_bit_value ) | |
478 | 7982 return true; |
7983 return false; | |
0 | 7984 case VAR_PlayerItemInHands: |
7985 v15 = 0; | |
7986 v16 = v3->pInventoryItems; | |
7987 break; | |
7988 case VAR_FixedGold: | |
7989 v4 = pParty->uNumGold; | |
469 | 7990 return v4 >= pValue; |
0 | 7991 case VAR_MightBonus: |
7992 v4 = this->uMightBonus; | |
469 | 7993 return v4 >= pValue; |
0 | 7994 case VAR_IntellectBonus: |
7995 v4 = this->uIntelligenceBonus; | |
469 | 7996 return v4 >= pValue; |
0 | 7997 case VAR_PersonalityBonus: |
7998 v4 = this->uWillpowerBonus; | |
469 | 7999 return v4 >= pValue; |
0 | 8000 case VAR_EnduranceBonus: |
8001 v4 = this->uEnduranceBonus; | |
469 | 8002 return v4 >= pValue; |
0 | 8003 case VAR_SpeedBonus: |
8004 v4 = this->uSpeedBonus; | |
469 | 8005 return v4 >= pValue; |
0 | 8006 case VAR_AccuracyBonus: |
8007 v4 = this->uAccuracyBonus; | |
469 | 8008 return v4 >= pValue; |
0 | 8009 case VAR_LuckBonus: |
8010 v4 = this->uLuckBonus; | |
469 | 8011 return v4 >= pValue; |
0 | 8012 case VAR_BaseMight: |
8013 v4 = this->uMight; | |
469 | 8014 return v4 >= pValue; |
0 | 8015 case VAR_BaseIntellect: |
8016 v4 = this->uIntelligence; | |
469 | 8017 return v4 >= pValue; |
0 | 8018 case VAR_BasePersonality: |
8019 v4 = this->uWillpower; | |
469 | 8020 return v4 >= pValue; |
0 | 8021 case VAR_BaseEndurance: |
8022 v4 = this->uEndurance; | |
469 | 8023 return v4 >= pValue; |
0 | 8024 case VAR_BaseSpeed: |
8025 v4 = this->uSpeed; | |
469 | 8026 return v4 >= pValue; |
0 | 8027 case VAR_BaseAccuracy: |
8028 v4 = this->uAccuracy; | |
469 | 8029 return v4 >= pValue; |
0 | 8030 case VAR_FixedFood: |
8031 v4 = pParty->uNumFoodRations; | |
469 | 8032 return v4 >= pValue; |
0 | 8033 default: |
469 | 8034 return v4 >= pValue; |
8035 } | |
8036 while ( v16->uItemID != pValue ) | |
0 | 8037 { |
8038 ++v15; | |
8039 ++v16; | |
8040 if ( v15 >= 138 ) | |
8041 { | |
469 | 8042 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8043 return v6; |
8044 } | |
8045 } | |
469 | 8046 return true; |
0 | 8047 } |
8048 v4 = this->uLuck; | |
469 | 8049 return v4 >= pValue; |
8050 } | |
8051 if ( VarNum <= VAR_MagicResistance ) | |
8052 { | |
8053 if ( VarNum == VAR_MagicResistance ) | |
0 | 8054 { |
8055 v4 = this->sResMagicBase; | |
8056 } | |
8057 else | |
8058 { | |
469 | 8059 switch ( VarNum ) |
0 | 8060 { |
8061 case VAR_FireResistance: | |
8062 v4 = this->sResFireBase; | |
469 | 8063 return v4 >= pValue; |
0 | 8064 case VAR_AirResistance: |
8065 v4 = this->sResAirBase; | |
469 | 8066 return v4 >= pValue; |
0 | 8067 case VAR_WaterResistance: |
8068 v4 = this->sResWaterBase; | |
469 | 8069 return v4 >= pValue; |
0 | 8070 case VAR_EarthResistance: |
8071 v4 = this->sResEarthBase; | |
469 | 8072 return v4 >= pValue; |
0 | 8073 case VAR_SpiritResistance: |
8074 v4 = this->sResSpiritBase; | |
469 | 8075 return v4 >= pValue; |
0 | 8076 case VAR_MindResistance: |
8077 v4 = this->sResMindBase; | |
469 | 8078 return v4 >= pValue; |
0 | 8079 case VAR_BodyResistance: |
8080 v4 = this->sResBodyBase; | |
469 | 8081 return v4 >= pValue; |
0 | 8082 case VAR_LightResistance: |
8083 v4 = this->sResLightBase; | |
469 | 8084 return v4 >= pValue; |
0 | 8085 case VAR_DarkResistance: |
8086 v4 = this->sResDarkBase; | |
469 | 8087 return v4 >= pValue; |
0 | 8088 case VAR_ActualMight: |
8089 v12 = GetActualMight(); | |
8090 goto _j_cmp_against_arg; | |
8091 case VAR_ActualIntellect: | |
8092 v12 = GetActualIntelligence(); | |
8093 goto _j_cmp_against_arg; | |
8094 case VAR_ActualPersonality: | |
8095 v12 = GetActualWillpower(); | |
8096 goto _j_cmp_against_arg; | |
8097 case VAR_ActualEndurance: | |
8098 v12 = GetActualEndurance(); | |
8099 goto _j_cmp_against_arg; | |
8100 case VAR_ActualSpeed: | |
8101 v12 = GetActualSpeed(); | |
8102 goto _j_cmp_against_arg; | |
8103 case VAR_ActualAccuracy: | |
8104 v12 = GetActualAccuracy(); | |
8105 goto _j_cmp_against_arg; | |
8106 case VAR_ActualLuck: | |
8107 v12 = GetActualLuck(); | |
8108 _j_cmp_against_arg: | |
8109 v4 = v12; | |
8110 break; | |
8111 default: | |
469 | 8112 return v4 >= pValue; |
8113 } | |
8114 } | |
8115 return v4 >= pValue; | |
8116 } | |
8117 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8118 { | |
8119 if ( VarNum != VAR_DisarmTrapSkill ) | |
8120 { | |
8121 if ( VarNum <= VAR_MindResistanceBonus ) | |
8122 { | |
8123 switch ( VarNum ) | |
0 | 8124 { |
8125 case VAR_MindResistanceBonus: | |
8126 v4 = this->sResMindBonus; | |
8127 break; | |
8128 case VAR_FireResistanceBonus: | |
8129 v4 = this->sResFireBonus; | |
8130 break; | |
8131 case VAR_AirResistanceBonus: | |
8132 v4 = this->sResAirBonus; | |
8133 break; | |
8134 case VAR_WaterResistanceBonus: | |
8135 v4 = this->sResWaterBonus; | |
8136 break; | |
8137 case VAR_EarthResistanceBonus: | |
8138 v4 = this->sResEarthBonus; | |
8139 break; | |
8140 case VAR_SpiritResistanceBonus: | |
8141 v4 = this->sResSpiritBonus; | |
8142 break; | |
8143 } | |
469 | 8144 return v4 >= pValue; |
8145 } | |
8146 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8147 { |
8148 v4 = this->sResBodyBonus; | |
469 | 8149 return v4 >= pValue; |
8150 } | |
8151 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8152 { |
8153 v4 = this->sResLightBonus; | |
469 | 8154 return v4 >= pValue; |
8155 } | |
8156 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8157 { |
8158 v4 = this->sResDarkBonus; | |
469 | 8159 return v4 >= pValue; |
8160 } | |
8161 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8162 { |
8163 v4 = this->sResMagicBonus; | |
469 | 8164 return v4 >= pValue; |
8165 } | |
8166 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8167 return v4 >= pValue; | |
0 | 8168 } |
8169 LABEL_90: | |
469 | 8170 v18 = *((short *)&this->pConditions[16] + VarNum); |
8171 if ( pValue <= 63 ) | |
0 | 8172 v4 = v18 & 0x3F; |
8173 else | |
469 | 8174 v4 = pValue & v18; |
8175 return v4 >= pValue; | |
8176 } | |
8177 if ( VarNum == 104 ) | |
0 | 8178 goto LABEL_90; |
469 | 8179 if ( (signed int)VarNum <= 104 ) |
8180 return v4 >= pValue; | |
8181 if ( (signed int)VarNum > 0x79 ) | |
8182 { | |
8183 if ( VarNum != 122 ) | |
8184 { | |
8185 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8186 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8187 return v4 >= pValue; | |
0 | 8188 } |
8189 v4 = GetMajorConditionIdx(); | |
8190 if ( v4 != 18 ) | |
8191 { | |
469 | 8192 return v4 >= pValue; |
8193 } | |
8194 v4 = pValue; | |
8195 return v4 >= pValue; | |
8196 } | |
8197 return *((int *)this + 2 * VarNum - 210); | |
0 | 8198 } |
8199 | |
8200 | |
8201 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8202 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8203 { | |
8204 signed int currPlayerId; // ebx@1 | |
0 | 8205 Player *v4; // esi@1 |
8206 unsigned int v5; // edi@1 | |
8207 unsigned int v6; // esi@13 | |
8208 unsigned int v7; // esi@14 | |
8209 signed int v8; // eax@17 | |
8210 ItemGen *v9; // ecx@17 | |
8211 int v10; // eax@21 | |
8212 signed int v11; // eax@30 | |
8213 Player *v12; // ecx@44 | |
8214 char *v13; // ecx@45 | |
8215 Player *v14; // ecx@49 | |
8216 int v15; // ecx@86 | |
8217 int v16; // esi@106 | |
8218 char v17; // al@106 | |
8219 int v18; // eax@107 | |
8220 Player *v19; // ecx@112 | |
8221 Player *v20; // ecx@127 | |
8222 int v21; // eax@127 | |
8223 int v22; // eax@145 | |
8224 char v23; // zf@146 | |
8225 DDM_DLV_Header *v24; // ecx@148 | |
8226 signed int v25; // eax@172 | |
8227 int v26; // [sp-8h] [bp-3Ch]@84 | |
8228 signed int v27; // [sp-4h] [bp-38h]@4 | |
8229 int v28; // [sp-4h] [bp-38h]@84 | |
8230 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8231 char v30; // [sp+32h] [bp-2h]@1 | |
8232 char v31; // [sp+33h] [bp-1h]@1 | |
8233 | |
492 | 8234 currPlayerId = 0; |
0 | 8235 v30 = 0; |
8236 v31 = 0; | |
8237 v4 = this; | |
8238 v5 = 0; | |
8239 if ( this == pPlayers[2] ) | |
492 | 8240 currPlayerId = 1; |
8241 else if ( this == pPlayers[3] ) | |
8242 currPlayerId = 2; | |
757 | 8243 else if ( this == pPlayers[4] ) |
492 | 8244 currPlayerId = 3; |
8245 if ( var_type > VAR_AutoNotes ) | |
8246 { | |
8247 if ( var_type <= VAR_GoldInBank ) | |
8248 { | |
8249 if ( var_type == VAR_GoldInBank ) | |
8250 { | |
8251 pParty->uNumGoldInBank = var_value; | |
0 | 8252 return; |
8253 } | |
492 | 8254 if ( var_type <= VAR_Counter8 ) |
8255 { | |
8256 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8257 { |
492 | 8258 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8259 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8260 } |
8261 else | |
8262 { | |
492 | 8263 switch ( var_type ) |
0 | 8264 { |
8265 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8266 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8267 break; |
8268 case VAR_NPCs2: | |
8269 pParty->field_709 = 0; | |
492 | 8270 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8271 Party__CountHirelings(); |
0 | 8272 viewparams->bRedrawGameUI = 1; |
8273 break; | |
8274 case VAR_NumSkillPoints: | |
492 | 8275 this->uSkillPoints = var_value; |
0 | 8276 break; |
8277 } | |
8278 } | |
8279 return; | |
8280 } | |
492 | 8281 if ( var_type < VAR_Counter9 ) |
0 | 8282 return; |
492 | 8283 if ( (signed int)var_type <= 0x112 ) |
8284 { | |
8285 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8286 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8287 } |
8288 else | |
8289 { | |
492 | 8290 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8291 { |
8292 v24 = &pOutdoor->ddm; | |
8293 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8294 v24 = &pIndoor->dlv; | |
492 | 8295 v24->uReputation = var_value; |
8296 if ( var_value > 10000 ) | |
0 | 8297 v24->uReputation = 10000; |
8298 return; | |
8299 } | |
492 | 8300 if ( var_type <= VAR_ReputationInCurrentLocation |
8301 || var_type > VAR_History_28 | |
8302 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8303 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8304 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8305 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8306 v23) ) |
8307 return; | |
8308 bFlashHistoryBook = 1; | |
8309 } | |
8310 LABEL_172: | |
492 | 8311 v25 = 8 * currPlayerId + 400; |
849 | 8312 LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); |
0 | 8313 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8314 return; | |
8315 } | |
492 | 8316 if ( var_type != 307 ) |
8317 { | |
8318 switch ( var_type ) | |
0 | 8319 { |
8320 case 308: | |
492 | 8321 pParty->uNumBountiesCollected = var_value; |
0 | 8322 break; |
8323 case 309: | |
492 | 8324 pParty->uNumPrisonTerms = var_value; |
0 | 8325 break; |
8326 case 310: | |
492 | 8327 pParty->uNumArenaPageWins = var_value; |
0 | 8328 break; |
8329 case 311: | |
492 | 8330 pParty->uNumArenaSquireWins = var_value; |
0 | 8331 break; |
8332 case 312: | |
492 | 8333 pParty->uNumArenaKnightWins = var_value; |
0 | 8334 break; |
8335 case 313: | |
492 | 8336 pParty->uNumArenaLordWins = var_value; |
0 | 8337 break; |
8338 } | |
8339 return; | |
8340 } | |
492 | 8341 pParty->uNumDeaths = var_value; |
0 | 8342 LABEL_168: |
8343 if ( v30 != 1 ) | |
8344 { | |
8345 LABEL_170: | |
8346 if ( v31 != 1 ) | |
8347 return; | |
8348 v5 = 0; | |
8349 goto LABEL_172; | |
8350 } | |
8351 LABEL_169: | |
492 | 8352 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8353 goto LABEL_170; |
8354 } | |
492 | 8355 if ( var_type == VAR_AutoNotes ) |
8356 { | |
8357 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
|
8358 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8359 && pAutonoteTxt[var_value-1].pText ) |
8360 { | |
8361 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8362 v30 = 1; |
187 | 8363 v20->PlaySound(SPEECH_96, 0); |
492 | 8364 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8365 bFlashAutonotesBook = 1; |
8366 dword_506568 = v21; | |
8367 } | |
492 | 8368 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8369 v31 = 1; |
8370 goto LABEL_168; | |
8371 } | |
492 | 8372 if ( var_type <= VAR_ActualMight ) |
8373 { | |
8374 if ( var_type != VAR_ActualMight ) | |
8375 { | |
8376 switch ( var_type ) | |
0 | 8377 { |
8378 case VAR_RandomGold: | |
492 | 8379 v6 = rand() % var_value + 1; |
0 | 8380 Party::SetGold(v6); |
8381 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8382 ShowStatusBarString(pTmpBuf, 2u); | |
8383 GameUI_DrawFoodAndGold(); | |
8384 return; | |
8385 case VAR_RandomFood: | |
492 | 8386 v7 = rand() % var_value + 1; |
0 | 8387 Party::SetFood(v7); |
8388 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8389 ShowStatusBarString(pTmpBuf, 2u); | |
8390 GameUI_DrawFoodAndGold(); | |
8391 goto LABEL_124; | |
8392 case VAR_Sex: | |
492 | 8393 this->uSex = (PLAYER_SEX)var_value; |
0 | 8394 goto LABEL_124; |
8395 case VAR_Class: | |
492 | 8396 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8397 if ( (char)var_value != 35 ) | |
0 | 8398 goto LABEL_124; |
8399 v8 = 0; | |
8400 v9 = this->pInventoryItems; | |
8401 break; | |
8402 case VAR_CurrentHP: | |
492 | 8403 this->sHealth = var_value; |
0 | 8404 goto LABEL_124; |
8405 case VAR_MaxHP: | |
8406 this->sHealth = GetMaxHealth(); | |
8407 return; | |
8408 case VAR_CurrentSP: | |
492 | 8409 this->sMana = var_value; |
0 | 8410 goto LABEL_124; |
8411 case VAR_MaxSP: | |
8412 this->sMana = GetMaxMana(); | |
8413 return; | |
8414 case VAR_ACModifier: | |
492 | 8415 this->sACModifier = (unsigned __int8)var_value; |
0 | 8416 goto LABEL_124; |
8417 case VAR_BaseLevel: | |
492 | 8418 this->uLevel = (unsigned __int8)var_value; |
0 | 8419 goto LABEL_124; |
8420 case VAR_LevelModifier: | |
492 | 8421 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8422 goto LABEL_124; |
8423 case VAR_Age: | |
492 | 8424 this->sAgeModifier = var_value; |
0 | 8425 return; |
8426 case VAR_Award: | |
492 | 8427 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8428 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
|
8429 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8430 && pAwards[var_value].pText ) |
0 | 8431 { |
8432 v30 = 1; | |
8433 v31 = 1; | |
492 | 8434 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8435 } |
492 | 8436 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8437 goto LABEL_168; | |
0 | 8438 case VAR_Experience: |
492 | 8439 this->uExperience = var_value; |
0 | 8440 goto LABEL_124; |
8441 case VAR_QBits_QuestsDone: | |
492 | 8442 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
|
8443 // && (&dword_722F10)[4 * a3] ) |
492 | 8444 && pQuestTable[var_value-1] ) |
0 | 8445 { |
492 | 8446 v14 = pPlayers[currPlayerId + 1]; |
0 | 8447 bFlashQuestBook = 1; |
8448 v30 = 1; | |
8449 v31 = 1; | |
187 | 8450 v14->PlaySound(SPEECH_93, 0); |
0 | 8451 } |
484 | 8452 v13 = (char *)pParty->_quest_bits; |
0 | 8453 LABEL_51: |
492 | 8454 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8455 if (( v30 != 1 )&&( v31 != 1 )) | |
8456 return; | |
8457 else | |
8458 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8459 if ( v31 != 1 ) | |
8460 return; | |
8461 v25 = 8 * currPlayerId + 400; | |
849 | 8462 LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); |
492 | 8463 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8464 return; | |
0 | 8465 case VAR_PlayerItemInHands: |
8466 item.Reset(); | |
8467 item.Reset(); | |
492 | 8468 item.uItemID = var_value; |
0 | 8469 item.uAttributes = 1; |
8470 pParty->SetHoldingItem(&item); | |
492 | 8471 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8472 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8473 return; |
8474 case VAR_FixedGold: | |
492 | 8475 Party::SetGold(var_value); |
0 | 8476 return; |
8477 case VAR_BaseMight: | |
492 | 8478 this->uMight = (unsigned __int8)var_value; |
0 | 8479 goto LABEL_84; |
8480 case VAR_BaseIntellect: | |
492 | 8481 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8482 goto LABEL_84; |
8483 case VAR_BasePersonality: | |
492 | 8484 this->uWillpower = (unsigned __int8)var_value; |
0 | 8485 goto LABEL_84; |
8486 case VAR_BaseEndurance: | |
492 | 8487 this->uEndurance = (unsigned __int8)var_value; |
0 | 8488 goto LABEL_84; |
8489 case VAR_BaseSpeed: | |
492 | 8490 this->uSpeed = (unsigned __int8)var_value; |
0 | 8491 goto LABEL_84; |
8492 case VAR_BaseAccuracy: | |
492 | 8493 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8494 goto LABEL_84; |
8495 case VAR_BaseLuck: | |
492 | 8496 this->uLuck = (unsigned __int8)var_value; |
0 | 8497 goto LABEL_84; |
8498 case VAR_FixedFood: | |
492 | 8499 Party::SetFood(var_value); |
0 | 8500 goto LABEL_124; |
8501 case VAR_MightBonus: | |
8502 goto LABEL_64; | |
8503 case VAR_IntellectBonus: | |
8504 goto LABEL_68; | |
8505 case VAR_PersonalityBonus: | |
8506 goto LABEL_69; | |
8507 case VAR_EnduranceBonus: | |
8508 goto LABEL_70; | |
8509 case VAR_SpeedBonus: | |
8510 goto LABEL_71; | |
8511 case VAR_AccuracyBonus: | |
8512 goto LABEL_72; | |
8513 case VAR_LuckBonus: | |
8514 goto LABEL_73; | |
8515 default: | |
8516 return; | |
8517 } | |
8518 while ( v9->uItemID != 615 ) | |
8519 { | |
8520 ++v8; | |
8521 ++v9; | |
8522 if ( v8 >= 138 ) | |
8523 goto LABEL_22; | |
8524 } | |
8525 v10 = (int)((char *)v4 + 36 * v8); | |
8526 *(int *)(v10 + 532) = 601; | |
492 | 8527 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8528 LABEL_22: |
8529 if ( v4->sResFireBase < 20 ) | |
8530 v4->sResFireBase = 20; | |
8531 if ( v4->sResAirBase < 20 ) | |
8532 v4->sResAirBase = 20; | |
8533 if ( v4->sResWaterBase < 20 ) | |
8534 v4->sResWaterBase = 20; | |
8535 if ( v4->sResEarthBase < 20 ) | |
8536 v4->sResEarthBase = 20; | |
8537 v4->sResMindBase = 200; | |
8538 v4->sResBodyBase = 200; | |
8539 v11 = v4->GetSexByVoice(); | |
8540 v4->field_1924 = v4->uVoiceID; | |
8541 v4->field_1928 = v4->uFace; | |
8542 if ( v11 ) | |
8543 { | |
8544 v4->uFace = 21; | |
8545 v4->uVoiceID = 21; | |
8546 } | |
8547 else | |
8548 { | |
8549 v4->uFace = 20; | |
8550 v4->uVoiceID = 20; | |
8551 } | |
492 | 8552 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8553 goto LABEL_124; |
8554 } | |
8555 LABEL_64: | |
492 | 8556 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8557 LABEL_111: |
8558 v28 = 0; | |
187 | 8559 v26 = SPEECH_91; |
0 | 8560 LABEL_112: |
492 | 8561 v19 = pPlayers[currPlayerId + 1]; |
0 | 8562 v31 = 1; |
187 | 8563 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8564 goto LABEL_169; |
8565 } | |
492 | 8566 if ( var_type <= VAR_FireResistanceBonus ) |
8567 { | |
8568 if ( var_type == VAR_FireResistanceBonus ) | |
8569 { | |
8570 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8571 goto LABEL_111; |
8572 } | |
492 | 8573 switch ( var_type ) |
0 | 8574 { |
8575 case VAR_ActualIntellect: | |
8576 LABEL_68: | |
492 | 8577 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8578 goto LABEL_111; |
8579 case VAR_ActualPersonality: | |
8580 LABEL_69: | |
492 | 8581 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8582 goto LABEL_111; |
8583 case VAR_ActualEndurance: | |
8584 LABEL_70: | |
492 | 8585 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8586 goto LABEL_111; |
8587 case VAR_ActualSpeed: | |
8588 LABEL_71: | |
492 | 8589 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8590 goto LABEL_111; |
8591 case VAR_ActualAccuracy: | |
8592 LABEL_72: | |
492 | 8593 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8594 goto LABEL_111; |
8595 case VAR_ActualLuck: | |
8596 LABEL_73: | |
492 | 8597 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8598 goto LABEL_111; |
8599 case VAR_FireResistance: | |
492 | 8600 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8601 goto LABEL_84; |
8602 case VAR_AirResistance: | |
492 | 8603 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8604 goto LABEL_84; |
8605 case VAR_WaterResistance: | |
492 | 8606 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8607 goto LABEL_84; |
8608 case VAR_EarthResistance: | |
492 | 8609 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8610 goto LABEL_84; |
8611 case VAR_SpiritResistance: | |
492 | 8612 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8613 goto LABEL_84; |
8614 case VAR_MindResistance: | |
492 | 8615 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8616 goto LABEL_84; |
8617 case VAR_BodyResistance: | |
492 | 8618 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8619 goto LABEL_84; |
8620 case VAR_LightResistance: | |
492 | 8621 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8622 goto LABEL_84; |
8623 case VAR_DarkResistance: | |
492 | 8624 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8625 goto LABEL_84; |
8626 case VAR_MagicResistance: | |
492 | 8627 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8628 LABEL_84: |
8629 v28 = 0; | |
8630 v26 = 92; | |
8631 goto LABEL_112; | |
8632 default: | |
8633 return; | |
8634 } | |
8635 return; | |
8636 } | |
8637 HIWORD(v15) = 0; | |
492 | 8638 if ( var_type > VAR_DisarmTrapSkill ) |
8639 { | |
8640 if ( var_type != VAR_LearningSkill ) | |
8641 { | |
8642 if ( var_type <= VAR_LearningSkill ) | |
0 | 8643 return; |
492 | 8644 if ( var_type <= VAR_Eradicated ) |
8645 { | |
8646 v4->SetCondition(var_type - 105, 1); | |
0 | 8647 } |
8648 else | |
8649 { | |
492 | 8650 if ( var_type != VAR_MajorCondition ) |
0 | 8651 { |
492 | 8652 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8653 byte_5E4C15[var_type] = var_value; | |
0 | 8654 return; |
8655 } | |
8656 memset(v4, 0, 0xA0u); | |
8657 } | |
8658 LABEL_124: | |
8659 v31 = 1; | |
8660 goto LABEL_169; | |
8661 } | |
8662 LABEL_106: | |
492 | 8663 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8664 v17 = *(char *)v16; |
492 | 8665 if ( var_value <= VAR_BodyResistanceBonus ) |
8666 { | |
8667 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8668 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8669 } | |
8670 else | |
8671 { | |
492 | 8672 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8673 } |
8674 *(short *)v16 = v18; | |
8675 goto LABEL_124; | |
8676 } | |
492 | 8677 if ( var_type == VAR_DisarmTrapSkill ) |
8678 if ( v30 != 1 ) | |
8679 { | |
8680 if ( v31 != 1 ) | |
8681 return; | |
8682 v5 = 0; | |
8683 goto LABEL_172; | |
8684 } | |
8685 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8686 goto LABEL_170; | |
8687 if ( var_type <= VAR_BodyResistanceBonus ) | |
8688 { | |
8689 switch ( var_type ) | |
0 | 8690 { |
8691 case VAR_BodyResistanceBonus: | |
492 | 8692 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8693 break; |
8694 case VAR_AirResistanceBonus: | |
492 | 8695 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8696 break; |
8697 case VAR_WaterResistanceBonus: | |
492 | 8698 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8699 break; |
8700 case VAR_EarthResistanceBonus: | |
492 | 8701 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8702 break; |
8703 case VAR_SpiritResistanceBonus: | |
492 | 8704 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8705 break; |
8706 default: | |
492 | 8707 if ( var_type != 62 ) |
0 | 8708 return; |
492 | 8709 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8710 break; |
8711 } | |
8712 goto LABEL_111; | |
8713 } | |
492 | 8714 if ( var_type == VAR_LightResistanceBonus ) |
8715 { | |
8716 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8717 goto LABEL_111; |
8718 } | |
492 | 8719 if ( var_type == VAR_DarkResistanceBonus ) |
8720 { | |
8721 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8722 goto LABEL_111; | |
8723 } | |
8724 if ( var_type == VAR_MagicResistanceBonus ) | |
8725 { | |
8726 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8727 goto LABEL_111; |
8728 } | |
492 | 8729 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8730 if ( v30 != 1 ) | |
8731 { | |
8732 if ( v31 != 1 ) | |
8733 return; | |
8734 v5 = 0; | |
8735 v25 = 8 * currPlayerId + 400; | |
849 | 8736 LOBYTE(v25) = PID(currPlayerId - 112,OBJECT_Player); |
492 | 8737 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8738 return; | |
8739 } | |
8740 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8741 goto LABEL_170; | |
0 | 8742 } |
8743 | |
8744 | |
8745 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8746 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8747 { |
8748 char v3; // bl@1 | |
8749 Player *v4; // esi@1 | |
8750 signed int uPlayerIdx; // edi@1 | |
8751 int v6; // eax@15 | |
8752 unsigned int v7; // esi@18 | |
8753 int *v8; // ebx@21 | |
8754 int v9; // eax@22 | |
8755 signed int v10; // eax@24 | |
8756 int v11; // eax@27 | |
8757 __int16 *v12; // esi@28 | |
8758 Player *v13; // ecx@34 | |
8759 Player *v14; // ecx@36 | |
8760 char *v15; // ecx@37 | |
8761 unsigned __int8 v16; // cf@38 | |
8762 Player *v17; // ecx@42 | |
8763 __int16 *v18; // esi@53 | |
8764 __int16 *v19; // esi@62 | |
8765 char *v20; // esi@107 | |
8766 __int16 v21; // dx@107 | |
8767 int v22; // ecx@107 | |
8768 Player *v23; // ecx@132 | |
8769 int v24; // eax@132 | |
8770 int v25; // eax@150 | |
8771 char v26; // zf@151 | |
8772 DDM_DLV_Header *v27; // eax@153 | |
8773 signed int v28; // eax@176 | |
8774 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8775 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8776 int v31; // [sp-4h] [bp-3Ch]@84 |
8777 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8778 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8779 char v34; // [sp+37h] [bp-1h]@1 | |
8780 | |
8781 auto Dst = this; | |
8782 v3 = 0; | |
8783 v34 = 0; | |
8784 v4 = Dst; | |
8785 uPlayerIdx = 0; | |
8786 if ( Dst == pPlayers[2] ) | |
8787 uPlayerIdx = 1; | |
310 | 8788 else if ( Dst == pPlayers[3] ) |
8789 uPlayerIdx = 2; | |
8790 else if ( Dst == pPlayers[4] ) | |
8791 uPlayerIdx = 3; | |
8792 | |
8793 if ( var_type <= VAR_AutoNotes ) | |
8794 { | |
8795 if ( var_type != VAR_AutoNotes ) | |
8796 { | |
8797 if ( var_type <= VAR_ActualMight ) | |
8798 { | |
8799 if ( var_type != VAR_ActualMight ) | |
0 | 8800 { |
310 | 8801 switch ( var_type ) |
0 | 8802 { |
8803 case VAR_RandomGold: | |
8804 if ( !val ) | |
8805 val = 1; | |
8806 v6 = rand(); | |
8807 party_finds_gold(v6 % val + 1, 1); | |
8808 GameUI_DrawFoodAndGold(); | |
8809 return; | |
8810 case VAR_RandomFood: | |
8811 if ( !val ) | |
8812 val = 1; | |
8813 v7 = rand() % val + 1; | |
8814 Party::GiveFood(v7); | |
8815 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8816 ShowStatusBarString(pTmpBuf, 2u); | |
8817 GameUI_DrawFoodAndGold(); | |
8818 goto _play_sound; | |
8819 case VAR_Sex: | |
8820 Dst->uSex = (PLAYER_SEX)val; | |
8821 goto _play_anim_and_exit; | |
8822 case VAR_Class: | |
135 | 8823 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8824 goto _play_anim_and_exit; |
8825 case VAR_CurrentHP: | |
8826 v8 = &Dst->sHealth; | |
8827 *v8 += val; | |
8828 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8829 goto _play_anim_and_exit; | |
8830 v9 = v4->GetMaxHealth(); | |
8831 goto LABEL_23; | |
8832 case VAR_MaxHP: | |
8833 v10 = Dst->GetMaxHealth(); | |
8834 v4->_health_related = 0; | |
8835 v4->uFullHealthBonus = 0; | |
8836 v4->sHealth = v10; | |
8837 return; | |
8838 case VAR_CurrentSP: | |
8839 v8 = &Dst->sMana; | |
8840 *v8 += val; | |
8841 if ( Dst->sMana > GetMaxMana() ) | |
8842 { | |
8843 v9 = v4->GetMaxMana(); | |
8844 LABEL_23: | |
8845 *v8 = v9; | |
8846 } | |
8847 goto _play_anim_and_exit; | |
8848 case VAR_MaxSP: | |
8849 v11 = GetMaxMana(); | |
8850 v4->_mana_related = 0; | |
8851 v4->uFullManaBonus = 0; | |
8852 v4->sMana = v11; | |
8853 return; | |
8854 case VAR_ACModifier: | |
8855 v12 = &Dst->sACModifier; | |
8856 goto LABEL_29; | |
8857 case VAR_BaseLevel: | |
8858 v12 = (__int16 *)&Dst->uLevel; | |
8859 goto LABEL_29; | |
8860 case VAR_LevelModifier: | |
8861 v12 = &Dst->sLevelModifier; | |
8862 LABEL_29: | |
8863 *v12 += val; | |
8864 if ( *v12 > 255 ) | |
8865 *v12 = 255; | |
8866 goto _play_anim_and_exit; | |
8867 case VAR_Age: | |
8868 Dst->sAgeModifier += val; | |
8869 return; | |
8870 case VAR_Award: | |
8871 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8872 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8873 | |
492 | 8874 && pAwards[val].pText ) |
0 | 8875 { |
8876 v14 = pPlayers[uPlayerIdx + 1]; | |
8877 v34 = 1; | |
8878 v3 = 1; | |
187 | 8879 v14->PlaySound(SPEECH_96, 0); |
0 | 8880 } |
735 | 8881 v15 = (char *)v4->_guilds_member_bits; |
0 | 8882 goto LABEL_44; |
8883 case VAR_Experience: | |
8884 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8885 LODWORD(Dst->uExperience) += val; | |
8886 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8887 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8888 Dst->uExperience = 4000000000i64; | |
8889 goto _play_anim_and_exit; | |
8890 case VAR_QBits_QuestsDone: | |
484 | 8891 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
|
8892 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8893 && pQuestTable[val-1] ) |
0 | 8894 { |
501 | 8895 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8896 bFlashQuestBook = 1; |
8897 v34 = 1; | |
8898 v3 = 1; | |
501 | 8899 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8900 } |
484 | 8901 v15 = (char *)pParty->_quest_bits; |
0 | 8902 LABEL_44: |
8903 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8904 goto LABEL_173; | |
8905 case VAR_PlayerItemInHands: | |
8906 item.Reset(); | |
8907 item.Reset(); | |
8908 item.uAttributes = 1; | |
8909 item.uItemID = val; | |
8910 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8911 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8912 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8913 { | |
8914 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8915 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8916 } | |
8917 pParty->SetHoldingItem(&item); | |
8918 return; | |
8919 case VAR_FixedGold: | |
8920 party_finds_gold(val, 1); | |
8921 return; | |
8922 case VAR_BaseMight: | |
8923 v18 = (__int16 *)&Dst->uMight; | |
8924 goto LABEL_82; | |
8925 case VAR_BaseIntellect: | |
8926 v18 = (__int16 *)&Dst->uIntelligence; | |
8927 goto LABEL_82; | |
8928 case VAR_BasePersonality: | |
8929 v18 = (__int16 *)&Dst->uWillpower; | |
8930 goto LABEL_82; | |
8931 case VAR_BaseEndurance: | |
8932 v18 = (__int16 *)&Dst->uEndurance; | |
8933 goto LABEL_82; | |
8934 case VAR_BaseSpeed: | |
8935 v18 = (__int16 *)&Dst->uSpeed; | |
8936 goto LABEL_82; | |
8937 case VAR_BaseAccuracy: | |
8938 v18 = (__int16 *)&Dst->uAccuracy; | |
8939 goto LABEL_82; | |
8940 case VAR_BaseLuck: | |
8941 v18 = (__int16 *)&Dst->uLuck; | |
8942 goto LABEL_82; | |
8943 case VAR_FixedFood: | |
8944 Party::GiveFood(val); | |
715 | 8945 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8946 ShowStatusBarString(pTmpBuf, 2u); |
8947 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8948 Party::SetFood(0xFFFFu); | |
8949 goto _play_sound; | |
8950 case VAR_MightBonus: | |
8951 goto LABEL_62; | |
8952 case VAR_IntellectBonus: | |
8953 goto LABEL_66; | |
8954 case VAR_PersonalityBonus: | |
8955 goto LABEL_67; | |
8956 case VAR_EnduranceBonus: | |
8957 goto LABEL_68; | |
8958 case VAR_SpeedBonus: | |
8959 goto LABEL_69; | |
8960 case VAR_AccuracyBonus: | |
8961 goto LABEL_70; | |
8962 case VAR_LuckBonus: | |
8963 goto LABEL_71; | |
8964 default: | |
8965 return; | |
8966 } | |
8967 return; | |
8968 } | |
8969 LABEL_62: | |
8970 v19 = (__int16 *)&Dst->uMightBonus; | |
8971 goto LABEL_113; | |
8972 } | |
310 | 8973 if ( var_type <= VAR_FireResistanceBonus ) |
8974 { | |
8975 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8976 { |
310 | 8977 switch ( var_type ) |
0 | 8978 { |
8979 case VAR_ActualIntellect: | |
8980 LABEL_66: | |
8981 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8982 goto LABEL_113; | |
8983 case VAR_ActualPersonality: | |
8984 LABEL_67: | |
8985 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8986 goto LABEL_113; | |
8987 case VAR_ActualEndurance: | |
8988 LABEL_68: | |
8989 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8990 goto LABEL_113; | |
8991 case VAR_ActualSpeed: | |
8992 LABEL_69: | |
8993 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8994 goto LABEL_113; | |
8995 case VAR_ActualAccuracy: | |
8996 LABEL_70: | |
8997 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8998 goto LABEL_113; | |
8999 case VAR_ActualLuck: | |
9000 LABEL_71: | |
9001 v19 = (__int16 *)&Dst->uLuckBonus; | |
9002 goto LABEL_113; | |
9003 case VAR_FireResistance: | |
9004 v18 = &Dst->sResFireBase; | |
9005 goto LABEL_82; | |
9006 case VAR_AirResistance: | |
9007 v18 = &Dst->sResAirBase; | |
9008 goto LABEL_82; | |
9009 case VAR_WaterResistance: | |
9010 v18 = &Dst->sResWaterBase; | |
9011 goto LABEL_82; | |
9012 case VAR_EarthResistance: | |
9013 v18 = &Dst->sResEarthBase; | |
9014 goto LABEL_82; | |
9015 case VAR_SpiritResistance: | |
9016 v18 = &Dst->sResSpiritBase; | |
9017 goto LABEL_82; | |
9018 case VAR_MindResistance: | |
9019 v18 = &Dst->sResMindBase; | |
9020 goto LABEL_82; | |
9021 case VAR_BodyResistance: | |
9022 v18 = &Dst->sResBodyBase; | |
9023 goto LABEL_82; | |
9024 case VAR_LightResistance: | |
9025 v18 = &Dst->sResLightBase; | |
9026 goto LABEL_82; | |
9027 case VAR_DarkResistance: | |
9028 v18 = &Dst->sResDarkBase; | |
9029 goto LABEL_82; | |
9030 case VAR_MagicResistance: | |
9031 v18 = &Dst->sResMagicBase; | |
9032 LABEL_82: | |
9033 *v18 += val; | |
9034 if ( *v18 > 255 ) | |
9035 *v18 = 255; | |
9036 v31 = 0; | |
9037 v29 = 92; | |
9038 goto LABEL_116; | |
9039 default: | |
9040 return; | |
9041 } | |
9042 return; | |
9043 } | |
9044 v19 = &Dst->sResFireBonus; | |
9045 LABEL_113: | |
9046 *v19 += val; | |
9047 if ( *v19 > 255 ) | |
9048 *v19 = 255; | |
9049 v31 = 0; | |
187 | 9050 v29 = SPEECH_91; |
0 | 9051 LABEL_116: |
9052 v3 = 1; | |
187 | 9053 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9054 goto _play_anim_and_maybe_sound; |
9055 } | |
310 | 9056 if ( var_type <= VAR_DisarmTrapSkill ) |
9057 { | |
9058 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9059 { |
310 | 9060 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9061 { |
310 | 9062 switch ( var_type ) |
0 | 9063 { |
9064 case VAR_BodyResistanceBonus: | |
9065 v19 = &Dst->sResBodyBonus; | |
9066 break; | |
9067 case VAR_AirResistanceBonus: | |
9068 v19 = &Dst->sResAirBonus; | |
9069 break; | |
9070 case VAR_WaterResistanceBonus: | |
9071 v19 = &Dst->sResWaterBonus; | |
9072 break; | |
9073 case VAR_EarthResistanceBonus: | |
9074 v19 = &Dst->sResEarthBonus; | |
9075 break; | |
9076 case VAR_SpiritResistanceBonus: | |
9077 v19 = &Dst->sResSpiritBonus; | |
9078 break; | |
9079 default: | |
310 | 9080 if ( var_type != 62 ) |
0 | 9081 return; |
9082 v19 = &Dst->sResMindBonus; | |
9083 break; | |
9084 } | |
9085 goto LABEL_113; | |
9086 } | |
310 | 9087 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9088 { |
9089 v19 = &Dst->sResLightBonus; | |
9090 goto LABEL_113; | |
9091 } | |
310 | 9092 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9093 { |
9094 v19 = &Dst->sResDarkBonus; | |
9095 goto LABEL_113; | |
9096 } | |
310 | 9097 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9098 { |
9099 v19 = &Dst->sResMagicBonus; | |
9100 goto LABEL_113; | |
9101 } | |
310 | 9102 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9103 return; |
9104 } | |
9105 goto LABEL_106; | |
9106 } | |
310 | 9107 if ( var_type == VAR_LearningSkill ) |
0 | 9108 { |
9109 LABEL_106: | |
9110 if ( val <= VAR_BodyResistanceBonus ) | |
9111 { | |
310 | 9112 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9113 } |
9114 else | |
9115 { | |
310 | 9116 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9117 v21 = *(short *)v20; |
9118 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9119 if ( v22 > 60 ) | |
9120 LOWORD(v22) = 60; | |
9121 LOBYTE(v21) = v21 & 0xC0; | |
9122 *(short *)v20 = v22 | v21; | |
9123 } | |
9124 goto _play_anim_and_exit; | |
9125 } | |
310 | 9126 if ( var_type <= VAR_LearningSkill ) |
0 | 9127 return; |
310 | 9128 if ( var_type <= VAR_Eradicated ) |
9129 { | |
9130 Dst->SetCondition(var_type - 105, 0); | |
0 | 9131 } |
9132 else | |
9133 { | |
310 | 9134 if ( var_type != VAR_MajorCondition ) |
0 | 9135 { |
310 | 9136 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9137 { |
310 | 9138 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9139 byte_5E4C15[var_type] += val; | |
0 | 9140 else |
310 | 9141 byte_5E4C15[var_type] = -1; |
0 | 9142 } |
9143 return; | |
9144 } | |
9145 memset(Dst, 0, 0xA0u); | |
9146 } | |
9147 _play_anim_and_exit: | |
9148 v3 = 1; | |
9149 _play_anim_and_maybe_sound: | |
9150 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9151 _maybe_play_sound: | |
9152 if ( v3 != 1 ) | |
9153 return; | |
9154 goto _play_sound; | |
9155 } | |
9156 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
|
9157 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9158 && pAutonoteTxt[val-1].pText ) |
0 | 9159 { |
9160 v23 = pPlayers[uPlayerIdx + 1]; | |
9161 v34 = 1; | |
187 | 9162 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9163 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9164 bFlashAutonotesBook = 1; |
9165 dword_506568 = v24; | |
9166 } | |
9167 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9168 v3 = 1; | |
9169 LABEL_173: | |
9170 if ( v34 != 1 ) | |
9171 goto _maybe_play_sound; | |
9172 goto _play_anim_and_maybe_sound; | |
9173 } | |
310 | 9174 if ( var_type > VAR_GoldInBank ) |
9175 { | |
9176 if ( var_type == 307 ) | |
0 | 9177 { |
9178 pParty->uNumDeaths += val; | |
9179 goto LABEL_173; | |
9180 } | |
310 | 9181 switch ( var_type ) |
0 | 9182 { |
9183 case 308: | |
9184 pParty->uNumBountiesCollected += val; | |
9185 break; | |
9186 case 309: | |
9187 pParty->uNumPrisonTerms += val; | |
9188 break; | |
9189 case 310: | |
9190 pParty->uNumArenaPageWins += val; | |
9191 break; | |
9192 case 311: | |
9193 pParty->uNumArenaSquireWins += val; | |
9194 break; | |
9195 case 312: | |
9196 pParty->uNumArenaKnightWins += val; | |
9197 break; | |
9198 case 313: | |
9199 pParty->uNumArenaLordWins += val; | |
9200 break; | |
9201 } | |
9202 } | |
9203 else | |
9204 { | |
310 | 9205 if ( var_type == VAR_GoldInBank ) |
0 | 9206 { |
9207 pParty->uNumGoldInBank += val; | |
9208 return; | |
9209 } | |
310 | 9210 if ( var_type <= VAR_Counter8 ) |
9211 { | |
9212 if ( (signed int)var_type >= 245 ) | |
9213 { | |
9214 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9215 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9216 } |
9217 else | |
9218 { | |
310 | 9219 switch ( var_type ) |
0 | 9220 { |
9221 case VAR_MonthEquals|VAR_CurrentSP: | |
9222 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9223 break; | |
9224 case VAR_NPCs2: | |
9225 pParty->field_709 = 0; | |
9226 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9227 Party__CountHirelings(); |
0 | 9228 viewparams->bRedrawGameUI = 1; |
9229 break; | |
9230 case VAR_NumSkillPoints: | |
9231 Dst->uSkillPoints += val; | |
9232 break; | |
9233 } | |
9234 } | |
9235 return; | |
9236 } | |
310 | 9237 if ( var_type < VAR_Counter9 ) |
0 | 9238 return; |
310 | 9239 if ( (signed int)var_type <= 274 ) |
9240 { | |
9241 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9242 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9243 goto _play_sound; |
9244 } | |
310 | 9245 if ( var_type != VAR_ReputationInCurrentLocation ) |
9246 { | |
9247 if ( var_type <= VAR_ReputationInCurrentLocation | |
9248 || var_type > VAR_History_28 | |
9249 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9250 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9251 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9252 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9253 v26) ) |
9254 return; | |
9255 bFlashHistoryBook = 1; | |
9256 _play_sound: | |
9257 v28 = 8 * uPlayerIdx + 400; | |
849 | 9258 LOBYTE(v28) = PID(uPlayerIdx - 112,OBJECT_Player); |
0 | 9259 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9260 return; | |
9261 } | |
9262 v27 = &pOutdoor->ddm; | |
9263 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9264 v27 = &pIndoor->dlv; | |
9265 v27->uReputation += val; | |
9266 if ( v27->uReputation > 10000 ) | |
9267 v27->uReputation = 10000; | |
9268 } | |
9269 } | |
9270 // 506568: using guessed type int dword_506568; | |
9271 // 507948: using guessed type char bFlashHistoryBook; | |
9272 // 507949: using guessed type char bFlashAutonotesBook; | |
9273 // 50794A: using guessed type char bFlashQuestBook; | |
9274 // 72371C: using guessed type int dword_72371C[]; | |
9275 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9276 | |
9277 | |
9278 | |
9279 | |
9280 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9281 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9282 { |
9283 unsigned int v3; // ebx@1 | |
9284 signed int v4; // esi@1 | |
501 | 9285 bool result; // eax@8 |
0 | 9286 int v6; // esi@11 |
9287 int v7; // edi@14 | |
9288 signed int v8; // eax@17 | |
9289 char *v9; // eax@20 | |
9290 char v10; // sf@20 | |
9291 char *v11; // ecx@26 | |
9292 char *v12; // ecx@27 | |
9293 __int64 v13; // qax@27 | |
9294 unsigned __int8 v14; // cf@27 | |
501 | 9295 int *v15; // edx@29 |
0 | 9296 char *v16; // eax@90 |
9297 char *v17; // ecx@94 | |
501 | 9298 int v18; // esi@97 |
0 | 9299 signed int v19; // edx@97 |
9300 char *v20; // ecx@98 | |
9301 int v21; // eax@100 | |
9302 __int16 v22; // dx@112 | |
9303 int v23; // [sp-8h] [bp-14h]@45 | |
9304 signed int v24; // [sp-4h] [bp-10h]@4 | |
9305 int v25; // [sp-4h] [bp-10h]@45 | |
9306 | |
9307 v3 = 0; | |
605 | 9308 v4 = uActiveCharacter - 1; |
501 | 9309 result = false; |
9310 if ( (signed int)VarNum > 222 ) | |
9311 { | |
9312 if ( (signed int)VarNum <= 307 ) | |
9313 { | |
9314 if ( VarNum == 307 ) | |
9315 { | |
9316 pParty->uNumDeaths -= (unsigned int)pValue; | |
9317 return pValue; | |
9318 } | |
9319 if ( VarNum == 223 ) | |
0 | 9320 { |
9321 v11 = (char *)pParty->_autonote_bits; | |
501 | 9322 v22 = (short)pValue - 1; |
0 | 9323 } |
9324 else | |
9325 { | |
501 | 9326 if ( VarNum != 231 ) |
0 | 9327 { |
501 | 9328 switch ( VarNum ) |
0 | 9329 { |
9330 case 232: | |
501 | 9331 VarNum = (VariableType)0; |
602 | 9332 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9333 result = (bool) pValue; |
9334 dword_5B65CC = 0; | |
9335 if ( (int)VarNum == pValue ) | |
0 | 9336 { |
501 | 9337 dword_5B65CC = (int)pValue; |
0 | 9338 } |
9339 else | |
9340 { | |
9341 pParty->field_709 = 0; | |
501 | 9342 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9343 Party__CountHirelings(); |
0 | 9344 viewparams->bRedrawGameUI = 1; |
9345 } | |
9346 break; | |
9347 case 241: | |
9348 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9349 { | |
9350 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9351 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9352 { |
605 | 9353 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9354 { |
9355 v21 = *(int *)v20; | |
9356 if ( (char)*(int *)v20 < 0 ) | |
9357 { | |
9358 LOBYTE(v21) = v21 & 0x7F; | |
9359 *(int *)v20 = v21; | |
9360 } | |
9361 } | |
9362 v20 += 76; | |
9363 } | |
9364 } | |
605 | 9365 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9366 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9367 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9368 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9369 pParty->field_709 = 0; | |
659 | 9370 Party__CountHirelings(); |
0 | 9371 break; |
9372 case 243: | |
9373 v17 = (char *)&this->uSkillPoints; | |
501 | 9374 result = *v17; |
9375 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9376 { | |
9377 *(int *)v17 -= (int)pValue; | |
9378 result = v17; | |
9379 } | |
0 | 9380 else |
9381 *(int *)v17 = 0; | |
9382 break; | |
9383 case 275: | |
9384 v16 = (char *)&pOutdoor->ddm; | |
9385 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9386 v16 = (char *)&pIndoor->dlv; | |
501 | 9387 *((int *)v16 + 2) -= (int)pValue; |
0 | 9388 if ( *((int *)v16 + 2) < -10000 ) |
9389 *((int *)v16 + 2) = -10000; | |
9390 break; | |
9391 case 306: | |
501 | 9392 result = VarNum - 306; |
9393 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9394 { | |
9395 result = (bool)pValue; | |
9396 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9397 } |
0 | 9398 else |
9399 LABEL_88: | |
9400 dword_5B65C4 = 1; | |
9401 break; | |
9402 } | |
501 | 9403 return result; |
0 | 9404 } |
9405 v11 = this->field_1A50; | |
501 | 9406 v22 = (signed __int16)pValue; |
0 | 9407 } |
9408 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9409 return result; |
9410 } | |
9411 switch ( VarNum ) | |
0 | 9412 { |
9413 case 308: | |
501 | 9414 result = (bool)pValue; |
9415 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9416 break; |
9417 case 309: | |
501 | 9418 result = (bool)pValue; |
9419 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9420 break; |
9421 case 310: | |
501 | 9422 result = (bool)pValue; |
9423 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9424 break; |
9425 case 311: | |
501 | 9426 result = (bool)pValue; |
9427 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9428 break; |
9429 case 312: | |
501 | 9430 result = (bool)pValue; |
9431 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9432 break; |
9433 case 313: | |
501 | 9434 result = (bool)pValue; |
9435 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9436 break; |
9437 } | |
9438 } | |
9439 else | |
9440 { | |
501 | 9441 if ( (signed int)VarNum >= 123 ) |
9442 { | |
9443 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9444 } |
9445 else | |
9446 { | |
501 | 9447 switch ( VarNum ) |
0 | 9448 { |
9449 case VAR_RandomGold: | |
501 | 9450 v6 = rand() % (signed int)pValue + 1; |
0 | 9451 if ( v6 > pParty->uNumGold ) |
9452 v6 = pParty->uNumGold; | |
9453 Party::TakeGold(v6); | |
9454 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9455 ShowStatusBarString(pTmpBuf, 2); |
0 | 9456 GameUI_DrawFoodAndGold(); |
501 | 9457 return result; |
0 | 9458 case VAR_RandomFood: |
501 | 9459 v7 = rand() % (signed int)pValue + 1; |
0 | 9460 if ( v7 > pParty->uNumFoodRations ) |
9461 v7 = pParty->uNumFoodRations; | |
9462 Party::TakeFood(v7); | |
9463 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9464 ShowStatusBarString(pTmpBuf, 2u); | |
9465 GameUI_DrawFoodAndGold(); | |
605 | 9466 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9467 v8 = 8 * v4 + 400; | |
849 | 9468 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9469 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9470 return result; |
0 | 9471 case VAR_CurrentHP: |
501 | 9472 ReceiveDamage((signed int)pValue, 4); |
605 | 9473 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9474 v8 = 8 * v4 + 400; | |
849 | 9475 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9476 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9477 return result; | |
0 | 9478 case VAR_CurrentSP: |
9479 v9 = (char *)&this->sMana; | |
501 | 9480 v10 = this->sMana - (signed int)pValue < 0; |
9481 *(int *)v9 -= (int)pValue; | |
0 | 9482 if ( v10 ) |
9483 *(int *)v9 = 0; | |
605 | 9484 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9485 v8 = 8 * v4 + 400; | |
849 | 9486 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9487 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9488 return result; | |
0 | 9489 case VAR_ACModifier: |
501 | 9490 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9491 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9492 v8 = 8 * v4 + 400; | |
849 | 9493 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9494 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9495 return result; | |
0 | 9496 case VAR_BaseLevel: |
501 | 9497 this->uLevel -= (unsigned __int8)pValue; |
605 | 9498 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9499 v8 = 8 * v4 + 400; | |
849 | 9500 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9501 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9502 return result; | |
0 | 9503 case VAR_LevelModifier: |
501 | 9504 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9505 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9506 v8 = 8 * v4 + 400; | |
849 | 9507 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9508 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9509 return result; | |
0 | 9510 case VAR_Age: |
501 | 9511 this->sAgeModifier -= (signed __int16)pValue; |
9512 return result; | |
0 | 9513 case VAR_Award: |
605 | 9514 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9515 return result; | |
0 | 9516 case VAR_Experience: |
9517 v12 = (char *)&this->uExperience; | |
501 | 9518 v13 = (signed int)pValue; |
9519 v14 = *(int *)v12 < (unsigned int)pValue; | |
9520 *(int *)v12 -= (int)pValue; | |
0 | 9521 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9522 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9523 v8 = 8 * v4 + 400; | |
849 | 9524 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9525 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9526 return result; | |
0 | 9527 case VAR_QBits_QuestsDone: |
501 | 9528 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9529 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9530 return true; |
0 | 9531 case VAR_PlayerItemInHands: |
501 | 9532 v15 = this->pInventoryIndices; |
0 | 9533 break; |
9534 case VAR_FixedGold: | |
501 | 9535 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9536 goto LABEL_88; |
501 | 9537 Party::TakeGold((unsigned int)pValue); |
9538 return result; | |
0 | 9539 case VAR_MightBonus: |
9540 case VAR_ActualMight: | |
501 | 9541 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9542 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9543 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9544 v8 = 8 * v4 + 400; | |
849 | 9545 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9546 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9547 return result; | |
0 | 9548 case VAR_IntellectBonus: |
9549 case VAR_ActualIntellect: | |
501 | 9550 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9551 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9552 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9553 v8 = 8 * v4 + 400; | |
849 | 9554 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9555 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9556 return result; | |
0 | 9557 case VAR_PersonalityBonus: |
9558 case VAR_ActualPersonality: | |
501 | 9559 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9560 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9561 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9562 v8 = 8 * v4 + 400; | |
849 | 9563 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9564 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9565 return result; | |
0 | 9566 case VAR_EnduranceBonus: |
9567 case VAR_ActualEndurance: | |
501 | 9568 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9569 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9570 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9571 v8 = 8 * v4 + 400; | |
849 | 9572 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9573 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9574 return result; | |
0 | 9575 case VAR_SpeedBonus: |
9576 case VAR_ActualSpeed: | |
501 | 9577 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9578 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9579 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9580 v8 = 8 * v4 + 400; | |
849 | 9581 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9582 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9583 return result; | |
0 | 9584 case VAR_AccuracyBonus: |
9585 case VAR_ActualAccuracy: | |
501 | 9586 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9587 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9588 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9589 v8 = 8 * v4 + 400; | |
849 | 9590 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9591 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9592 return result; | |
0 | 9593 case VAR_LuckBonus: |
9594 case VAR_ActualLuck: | |
501 | 9595 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9596 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9597 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9598 v8 = 8 * v4 + 400; | |
849 | 9599 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9600 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9601 return result; | |
0 | 9602 case VAR_BaseMight: |
501 | 9603 this->uMight -= (unsigned __int16)pValue; |
605 | 9604 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9605 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9606 v8 = 8 * v4 + 400; | |
849 | 9607 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9608 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9609 return result; | |
0 | 9610 case VAR_BaseIntellect: |
501 | 9611 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9612 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9613 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9614 v8 = 8 * v4 + 400; | |
849 | 9615 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9616 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9617 return result; | |
0 | 9618 case VAR_BasePersonality: |
501 | 9619 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9620 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9621 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9622 v8 = 8 * v4 + 400; | |
849 | 9623 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9624 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9625 return result; | |
0 | 9626 case VAR_BaseEndurance: |
501 | 9627 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9628 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9629 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9630 v8 = 8 * v4 + 400; | |
849 | 9631 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9632 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9633 return result; | |
0 | 9634 case VAR_BaseSpeed: |
501 | 9635 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9636 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9637 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9638 v8 = 8 * v4 + 400; | |
849 | 9639 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9640 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9641 return result; | |
0 | 9642 case VAR_BaseAccuracy: |
501 | 9643 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9644 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9645 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9646 v8 = 8 * v4 + 400; | |
849 | 9647 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9648 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9649 return result; | |
0 | 9650 case VAR_BaseLuck: |
501 | 9651 this->uLuck -= (unsigned __int16)pValue; |
605 | 9652 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9653 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9654 v8 = 8 * v4 + 400; | |
849 | 9655 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9656 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9657 return result; | |
0 | 9658 case VAR_FireResistance: |
501 | 9659 this->sResFireBase -= (signed __int16)pValue; |
605 | 9660 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9661 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9662 v8 = 8 * v4 + 400; | |
849 | 9663 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9664 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9665 return result; | |
0 | 9666 case VAR_AirResistance: |
501 | 9667 this->sResAirBase -= (signed __int16)pValue; |
605 | 9668 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9669 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9670 v8 = 8 * v4 + 400; | |
849 | 9671 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9672 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9673 return result; | |
0 | 9674 case VAR_WaterResistance: |
501 | 9675 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9676 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9677 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9678 v8 = 8 * v4 + 400; | |
849 | 9679 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9680 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9681 return result; | |
0 | 9682 case VAR_EarthResistance: |
501 | 9683 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9684 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9685 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9686 v8 = 8 * v4 + 400; | |
849 | 9687 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9688 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9689 return result; | |
0 | 9690 case VAR_SpiritResistance: |
501 | 9691 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9692 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9693 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9694 v8 = 8 * v4 + 400; | |
849 | 9695 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9696 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9697 return result; | |
0 | 9698 case VAR_MindResistance: |
501 | 9699 this->sResMindBase -= (signed __int16)pValue; |
605 | 9700 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9701 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9702 v8 = 8 * v4 + 400; | |
849 | 9703 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9704 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9705 return result; | |
0 | 9706 case VAR_BodyResistance: |
501 | 9707 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9708 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9709 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9710 v8 = 8 * v4 + 400; | |
849 | 9711 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9712 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9713 return result; | |
0 | 9714 case VAR_LightResistance: |
501 | 9715 this->sResLightBase -= (signed __int16)pValue; |
605 | 9716 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9717 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9718 v8 = 8 * v4 + 400; | |
849 | 9719 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9720 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9721 return result; | |
0 | 9722 case VAR_DarkResistance: |
501 | 9723 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9724 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9725 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9726 v8 = 8 * v4 + 400; | |
849 | 9727 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9728 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9729 return result; | |
0 | 9730 case VAR_MagicResistance: |
501 | 9731 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9732 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9733 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9734 v8 = 8 * v4 + 400; | |
849 | 9735 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9736 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9737 return result; | |
0 | 9738 case VAR_FireResistanceBonus: |
501 | 9739 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9740 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9741 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9742 v8 = 8 * v4 + 400; | |
849 | 9743 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9744 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9745 return result; | |
0 | 9746 case VAR_AirResistanceBonus: |
501 | 9747 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9748 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9749 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9750 v8 = 8 * v4 + 400; | |
849 | 9751 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9752 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9753 return result; | |
0 | 9754 case VAR_WaterResistanceBonus: |
501 | 9755 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9756 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9757 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9758 v8 = 8 * v4 + 400; | |
849 | 9759 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9760 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9761 return result; | |
0 | 9762 case VAR_EarthResistanceBonus: |
501 | 9763 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9764 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9765 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9766 v8 = 8 * v4 + 400; | |
849 | 9767 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9768 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9769 return result; | |
0 | 9770 case VAR_SpiritResistanceBonus: |
501 | 9771 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9772 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9773 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9774 v8 = 8 * v4 + 400; | |
849 | 9775 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9776 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9777 return result; | |
0 | 9778 case VAR_MindResistanceBonus: |
501 | 9779 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9780 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9781 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9782 v8 = 8 * v4 + 400; | |
849 | 9783 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9784 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9785 return result; | |
0 | 9786 case VAR_BodyResistanceBonus: |
501 | 9787 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9788 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9789 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9790 v8 = 8 * v4 + 400; | |
849 | 9791 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9792 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9793 return result; | |
0 | 9794 case VAR_LightResistanceBonus: |
501 | 9795 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9796 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9797 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9798 v8 = 8 * v4 + 400; | |
849 | 9799 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9800 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9801 return result; | |
0 | 9802 case VAR_DarkResistanceBonus: |
501 | 9803 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9804 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9805 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9806 v8 = 8 * v4 + 400; | |
849 | 9807 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9808 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9809 return result; | |
0 | 9810 case VAR_MagicResistanceBonus: |
501 | 9811 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9812 v25 = 0; |
187 | 9813 v23 = SPEECH_91; |
9814 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9815 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9816 v8 = 8 * v4 + 400; | |
849 | 9817 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9818 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9819 return result; | |
0 | 9820 case VAR_FixedFood: |
501 | 9821 Party::TakeFood((unsigned int)pValue); |
605 | 9822 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9823 v8 = 8 * v4 + 400; | |
849 | 9824 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9825 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9826 return result; | |
0 | 9827 case VAR_StaffSkill: |
9828 case VAR_SwordSkill: | |
9829 case VAR_DaggerSkill: | |
9830 case VAR_AxeSkill: | |
9831 case VAR_SpearSkill: | |
9832 case VAR_BowSkill: | |
9833 case VAR_MaceSkill: | |
9834 case VAR_BlasterSkill: | |
9835 case VAR_ShieldSkill: | |
9836 case VAR_LeatherSkill: | |
9837 case VAR_SkillChain: | |
9838 case VAR_PlateSkill: | |
9839 case VAR_FireSkill: | |
9840 case VAR_AirSkill: | |
9841 case VAR_WaterSkill: | |
9842 case VAR_EarthSkill: | |
9843 case VAR_SpiritSkill: | |
9844 case VAR_MindSkill: | |
9845 case VAR_BodySkill: | |
9846 case VAR_LightSkill: | |
9847 case VAR_DarkSkill: | |
9848 case VAR_IdentifyItemSkill: | |
9849 case VAR_MerchantSkill: | |
9850 case VAR_RepairSkill: | |
9851 case VAR_BodybuildingSkill: | |
9852 case VAR_MeditationSkill: | |
9853 case VAR_PerceptionSkill: | |
9854 case VAR_DiplomacySkill: | |
9855 case VAR_DisarmTrapSkill: | |
9856 case VAR_LearningSkill: | |
501 | 9857 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9858 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9859 v8 = 8 * v4 + 400; | |
849 | 9860 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
605 | 9861 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9862 return result; | |
0 | 9863 case VAR_Cursed: |
9864 case VAR_Weak: | |
9865 case VAR_Asleep: | |
9866 case VAR_Afraid: | |
9867 case VAR_Drunk: | |
9868 case VAR_Insane: | |
9869 case VAR_PoisonedGreen: | |
9870 case VAR_DiseasedGreen: | |
9871 case VAR_PoisonedYellow: | |
9872 case VAR_DiseasedYellow: | |
9873 case VAR_PoisonedRed: | |
9874 case VAR_DiseasedRed: | |
9875 case VAR_Paralyzed: | |
9876 case VAR_Unconsious: | |
9877 case VAR_Dead: | |
9878 case VAR_Stoned: | |
9879 case VAR_Eradicated: | |
501 | 9880 *((int *)this + 2 * VarNum - 210) = 0; |
9881 *((int *)this + 2 * result - 209) = 0; | |
0 | 9882 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9883 v8 = 8 * v4 + 400; | |
849 | 9884 LOBYTE(v8) = PID(v4 - 112,OBJECT_Player); |
0 | 9885 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9886 return result; |
605 | 9887 default: |
9888 return result; | |
9889 } | |
9890 for (v3 = 1; v3 < 126; v3++) | |
9891 { | |
9892 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9893 { |
605 | 9894 RemoveItemAtInventoryIndex(v3); |
501 | 9895 return true; |
0 | 9896 } |
605 | 9897 } |
501 | 9898 if ( pParty->pPickedItem.uItemID == pValue ) |
9899 { | |
605 | 9900 pMouse->RemoveHoldingItem(); |
9901 return true; | |
9902 } | |
9903 return false; | |
0 | 9904 } |
9905 } | |
9906 } | |
9907 // 5B65C4: using guessed type int dword_5B65C4; | |
9908 // 5B65CC: using guessed type int dword_5B65CC; |