Mercurial > mm7
annotate Player.cpp @ 892:18f785019d36
Слияние
author | Ritor1 |
---|---|
date | Wed, 03 Apr 2013 10:01:53 +0600 |
parents | b6573b99ca40 |
children | df0ffbb70cc6 |
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) -------------------------------------------------------- | |
886 | 223 void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx) |
0 | 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 } | |
865 | 5429 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v28 = v6->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 } | |
865 | 5462 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->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 } | |
865 | 5490 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->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 { | |
886 | 6455 case PLAYER_SKILL_FIRE: |
6456 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
6457 | |
486 | 6458 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; |
6459 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6460 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
569 | 6461 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; |
6462 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6463 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6464 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
886 | 6465 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; |
6466 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6467 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
6468 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
569 | 6469 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6470 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6471 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6472 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6473 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6474 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6475 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6476 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6477 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6478 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6479 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6480 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6481 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6482 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6483 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6484 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6485 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6486 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6487 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6488 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6489 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
486 | 6490 break; |
886 | 6491 case PLAYER_SKILL_AIR: |
6492 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6493 break; | |
6494 case PLAYER_SKILL_WATER: | |
6495 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6496 break; | |
6497 case PLAYER_SKILL_EARTH: | |
6498 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6499 break; | |
6500 case PLAYER_SKILL_SPIRIT: | |
6501 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6502 | |
6503 break; | |
6504 case PLAYER_SKILL_MIND: | |
6505 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6506 break; | |
6507 case PLAYER_SKILL_BODY: | |
6508 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
6509 | |
569 | 6510 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; |
6511 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6512 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6513 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6514 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6515 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6516 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6517 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6518 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
886 | 6519 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; |
569 | 6520 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6521 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6522 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6523 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6524 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6525 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
886 | 6526 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; |
6527 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6528 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6529 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
569 | 6530 break; |
886 | 6531 case PLAYER_SKILL_LIGHT: |
6532 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6533 break; | |
6534 case PLAYER_SKILL_DARK: | |
6535 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6536 break; | |
0 | 6537 } |
6538 } | |
6539 | |
6540 sHealth = GetMaxHealth(); | |
6541 sMana = GetMaxMana(); | |
6542 } | |
6543 | |
6544 //----- (004903C9) -------------------------------------------------------- | |
821 | 6545 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6546 { | |
6547 PLAYER_SKILL_TYPE result; // eax@5 | |
0 | 6548 int v3; // edx@5 |
6549 char *v4; // ecx@5 | |
6550 int v5; // esi@11 | |
6551 unsigned __int16 *v6; // edx@11 | |
6552 int v7; // esi@18 | |
6553 unsigned __int16 *pActiveSkill; // edx@18 | |
6554 | |
6555 if ( order >= 0 ) | |
6556 { | |
6557 if ( order <= 1 ) | |
6558 { | |
6559 result = (PLAYER_SKILL_TYPE)0; | |
6560 v7 = 0; | |
6561 pActiveSkill = this->pActiveSkills; | |
6562 do | |
6563 { | |
135 | 6564 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) |
0 | 6565 { |
6566 if ( v7 == order ) | |
6567 return result; | |
6568 ++v7; | |
6569 } | |
6570 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6571 ++pActiveSkill; | |
6572 } | |
6573 while ( (signed int)result < 37 ); | |
6574 } | |
6575 else | |
6576 { | |
6577 if ( order <= 3 ) | |
6578 { | |
6579 result = (PLAYER_SKILL_TYPE)0; | |
6580 v5 = 0; | |
6581 pActiveSkill = this->pActiveSkills; | |
6582 do | |
6583 { | |
135 | 6584 if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) |
0 | 6585 { |
6586 if ( v5 == order - 2 ) | |
6587 return result; | |
6588 ++v5; | |
6589 } | |
6590 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6591 ++pActiveSkill; | |
6592 } | |
6593 while ( (signed int)result < 37 ); | |
6594 } | |
6595 else | |
6596 { | |
6597 if ( order <= 12 ) | |
6598 { | |
6599 result = (PLAYER_SKILL_TYPE)0; | |
6600 v3 = 0; | |
135 | 6601 v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; |
0 | 6602 do |
6603 { | |
6604 if ( *v4 == 1 ) | |
6605 { | |
6606 if ( v3 == order - 4 ) | |
6607 return result; | |
6608 ++v3; | |
6609 } | |
6610 result = (PLAYER_SKILL_TYPE)((int)result + 1); | |
6611 ++v4; | |
6612 } | |
6613 while ( (signed int)result < 37 ); | |
6614 } | |
6615 } | |
6616 } | |
6617 } | |
6618 return (PLAYER_SKILL_TYPE)37; | |
6619 } | |
6620 | |
6621 | |
6622 | |
6623 //----- (0049048D) -------------------------------------------------------- | |
6624 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6625 void Player::DecreaseAttribute(int eAttribute) | |
6626 { | |
6627 int v2; // eax@1 | |
6628 int pBaseValue; // ecx@1 | |
6629 int pDroppedStep; // ebx@1 | |
6630 int pStep; // esi@1 | |
6631 unsigned __int16 result; // ax@7 | |
6632 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6633 | |
6634 v2 = eAttribute + 7 * GetRace(); | |
290 | 6635 pBaseValue = StatTable[0][v2].uBaseValue; |
6636 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6637 uMinValue = pBaseValue - 2; |
290 | 6638 pStep = StatTable[0][v2].uBaseStep; |
0 | 6639 switch ( eAttribute ) |
6640 { | |
6641 case CHARACTER_MIGHT: | |
6642 if ( this->uMight <= pBaseValue ) | |
6643 pStep = pDroppedStep; | |
6644 if ( this->uMight - pStep >= uMinValue ) | |
6645 this->uMight -= pStep; | |
6646 break; | |
6647 case CHARACTER_INTELLIGANCE: | |
6648 if ( this->uIntelligence <= pBaseValue ) | |
6649 pStep = pDroppedStep; | |
6650 if ( this->uIntelligence - pStep >= uMinValue ) | |
6651 this->uIntelligence -= pStep; | |
6652 break; | |
6653 case CHARACTER_WILLPOWER: | |
6654 if ( this->uWillpower <= pBaseValue ) | |
6655 pStep = pDroppedStep; | |
6656 if ( this->uWillpower - pStep >= uMinValue ) | |
6657 this->uWillpower -= pStep; | |
6658 break; | |
6659 case CHARACTER_ENDURANCE: | |
6660 if ( this->uEndurance <= pBaseValue ) | |
6661 pStep = pDroppedStep; | |
6662 if ( this->uEndurance - pStep >= uMinValue ) | |
6663 this->uEndurance -= pStep; | |
6664 break; | |
6665 case CHARACTER_ACCURACY: | |
6666 if ( this->uAccuracy <= pBaseValue ) | |
6667 pStep = pDroppedStep; | |
6668 if ( this->uAccuracy - pStep >= uMinValue ) | |
6669 this->uAccuracy -= pStep; | |
6670 break; | |
6671 case CHARACTER_SPEED: | |
6672 if ( this->uSpeed <= pBaseValue ) | |
6673 pStep = pDroppedStep; | |
6674 if ( this->uSpeed - pStep >= uMinValue ) | |
6675 this->uSpeed -= pStep; | |
6676 break; | |
6677 case CHARACTER_LUCK: | |
6678 if ( this->uLuck <= pBaseValue ) | |
6679 pStep = pDroppedStep; | |
6680 if ( this->uLuck - pStep >= uMinValue ) | |
6681 this->uLuck -= pStep; | |
6682 break; | |
6683 } | |
6684 } | |
6685 | |
6686 //----- (004905F5) -------------------------------------------------------- | |
6687 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6688 int Player::IncreaseAttribute(int eAttribute) | |
6689 { | |
6690 Player *v2; // esi@1 | |
6691 int v3; // eax@1 | |
6692 int v4; // ebx@1 | |
6693 signed int v5; // edi@1 | |
6694 int v6; // eax@8 | |
6695 signed int v7; // eax@17 | |
6696 signed int result; // eax@18 | |
6697 int v9; // [sp+Ch] [bp-8h]@1 | |
6698 signed int v10; // [sp+10h] [bp-4h]@1 | |
6699 | |
6700 v2 = this; | |
6701 v3 = eAttribute + 7 * GetRace(); | |
290 | 6702 v4 = StatTable[0][v3].uMaxValue; |
6703 v5 = StatTable[0][v3].uBaseStep; | |
6704 v9 = StatTable[0][v3].uBaseValue; | |
6705 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6706 PlayerCreation_ComputeAttributeBonus(); |
6707 if ( eAttribute ) | |
6708 { | |
6709 switch ( eAttribute ) | |
6710 { | |
6711 case 1: | |
6712 v6 = v2->uIntelligence; | |
6713 break; | |
6714 case 2: | |
6715 v6 = v2->uWillpower; | |
6716 break; | |
6717 case 3: | |
6718 v6 = v2->uEndurance; | |
6719 break; | |
6720 case 4: | |
6721 v6 = v2->uAccuracy; | |
6722 break; | |
6723 case 5: | |
6724 v6 = v2->uSpeed; | |
6725 break; | |
6726 case 6: | |
6727 v6 = v2->uLuck; | |
6728 break; | |
6729 default: | |
6730 v6 = eAttribute; | |
6731 break; | |
6732 } | |
6733 } | |
6734 else | |
6735 { | |
6736 v6 = v2->uMight; | |
6737 } | |
6738 if ( v6 < v9 ) | |
6739 { | |
6740 v7 = v5; | |
6741 v5 = v10; | |
6742 v10 = v7; | |
6743 } | |
6744 result = PlayerCreation_ComputeAttributeBonus(); | |
6745 if ( result >= v10 ) | |
6746 { | |
6747 if ( eAttribute ) | |
6748 { | |
6749 switch ( eAttribute ) | |
6750 { | |
6751 case 1: | |
6752 result = (signed int)&v2->uIntelligence; | |
6753 break; | |
6754 case 2: | |
6755 result = (signed int)&v2->uWillpower; | |
6756 break; | |
6757 case 3: | |
6758 result = (signed int)&v2->uEndurance; | |
6759 break; | |
6760 case 4: | |
6761 result = (signed int)&v2->uAccuracy; | |
6762 break; | |
6763 case 5: | |
6764 result = (signed int)&v2->uSpeed; | |
6765 break; | |
6766 default: | |
6767 result = eAttribute - 6; | |
6768 if ( eAttribute != 6 ) | |
6769 return result; | |
6770 result = (signed int)&v2->uLuck; | |
6771 break; | |
6772 } | |
6773 } | |
6774 else | |
6775 { | |
6776 result = (signed int)&v2->uMight; | |
6777 } | |
6778 if ( v5 + *(short *)result <= v4 ) | |
6779 *(short *)result += v5; | |
6780 } | |
6781 return result; | |
6782 } | |
6783 | |
6784 //----- (0049070F) -------------------------------------------------------- | |
6785 void Player::Zero() | |
6786 { | |
6787 Player *v1; // esi@1 | |
6788 | |
6789 v1 = this; | |
6790 this->sLevelModifier = 0; | |
6791 this->sACModifier = 0; | |
6792 this->uLuckBonus = 0; | |
6793 this->uAccuracyBonus = 0; | |
6794 this->uSpeedBonus = 0; | |
6795 this->uEnduranceBonus = 0; | |
6796 this->uWillpowerBonus = 0; | |
6797 this->uIntelligenceBonus = 0; | |
6798 this->uMightBonus = 0; | |
6799 this->field_100 = 0; | |
6800 this->field_FC = 0; | |
6801 this->field_F8 = 0; | |
6802 this->field_F4 = 0; | |
6803 this->field_F0 = 0; | |
6804 this->field_EC = 0; | |
6805 this->field_E8 = 0; | |
6806 this->field_E4 = 0; | |
6807 this->field_E0 = 0; | |
766 | 6808 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6809 v1->field_1A97 = 0; |
6810 v1->_ranged_dmg_bonus = 0; | |
6811 v1->field_1A95 = 0; | |
6812 v1->_ranged_atk_bonus = 0; | |
6813 v1->field_1A93 = 0; | |
6814 v1->_melee_dmg_bonus = 0; | |
6815 v1->field_1A91 = 0; | |
6816 v1->_some_attack_bonus = 0; | |
6817 v1->_mana_related = 0; | |
6818 v1->uFullManaBonus = 0; | |
6819 v1->_health_related = 0; | |
6820 v1->uFullHealthBonus = 0; | |
6821 } | |
6822 | |
6823 //----- (004907E7) -------------------------------------------------------- | |
299 | 6824 unsigned int Player::GetStatColor(int uStat) |
0 | 6825 { |
6826 __int16 uWhite; // si@1 | |
290 | 6827 int attribute_value; // edx@1 |
299 | 6828 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6829 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6830 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6831 | |
6832 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | |
6833 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
6834 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
299 | 6835 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6836 |
0 | 6837 switch (uStat) |
6838 { | |
6839 case 0: attribute_value = uMight; break; | |
6840 case 1: attribute_value = uIntelligence; break; | |
6841 case 2: attribute_value = uWillpower; break; | |
6842 case 3: attribute_value = uEndurance; break; | |
290 | 6843 case 4: attribute_value = uAccuracy; break; |
6844 case 5: attribute_value = uSpeed; break; | |
0 | 6845 case 6: attribute_value = uLuck; break; |
6846 }; | |
6847 | |
299 | 6848 if ( attribute_value == pBaseAttrValue ) |
290 | 6849 return uWhite; |
299 | 6850 else if ( attribute_value > pBaseAttrValue ) |
290 | 6851 return uGreen; |
0 | 6852 else |
290 | 6853 return uRed; |
0 | 6854 } |
6855 | |
6856 //----- (004908A8) -------------------------------------------------------- | |
6857 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6858 { | |
6859 unsigned __int64 *result; // eax@1 | |
6860 | |
6861 result = (unsigned __int64 *)((char *)this + 8 * uCondition); | |
6862 if ( *result && (signed __int64)uTime < (signed __int64)*result ) | |
6863 { | |
6864 *(int *)result = 0; | |
6865 *((int *)result + 1) = 0; | |
6866 LOBYTE(result) = 1; | |
6867 } | |
6868 else | |
6869 { | |
6870 LOBYTE(result) = 0; | |
6871 } | |
6872 return (bool)result; | |
6873 } | |
6874 | |
6875 //----- (004680ED) -------------------------------------------------------- | |
6876 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) | |
6877 { | |
6878 Player *v3; // esi@1 | |
6879 unsigned int v4; // ebx@4 | |
6880 signed int v5; // eax@17 | |
6881 unsigned int v6; // eax@26 | |
6882 unsigned __int8 v7; // cf@37 | |
6883 int v8; // edx@39 | |
6884 int v9; // edx@40 | |
6885 int v10; // edx@41 | |
6886 int v11; // edx@42 | |
6887 int v12; // edx@43 | |
6888 char *v13; // eax@45 | |
6889 AudioPlayer *v14; // ecx@62 | |
6890 signed int v15; // edi@68 | |
6891 int v16; // edx@73 | |
6892 unsigned __int16 *v17; // edi@73 | |
6893 unsigned int v18; // eax@73 | |
6894 int v19; // eax@74 | |
6895 int v20; // eax@75 | |
6896 signed int v21; // eax@81 | |
6897 const char *v22; // eax@84 | |
6898 char *v23; // ecx@90 | |
6899 int v24; // esi@96 | |
6900 int v25; // eax@109 | |
6901 int v26; // eax@113 | |
6902 char *v27; // edi@114 | |
6903 signed __int64 v28; // qax@120 | |
6904 char *v29; // ecx@120 | |
6905 int v30; // edi@137 | |
6906 int v31; // ST30_4@137 | |
6907 int v32; // ST3C_4@137 | |
6908 int v33; // ST40_4@137 | |
6909 int v34; // ST34_4@137 | |
6910 int v35; // ST38_4@137 | |
6911 unsigned __int8 v36; // al@173 | |
6912 SoundID v37; // [sp-20h] [bp-4Ch]@18 | |
6913 SoundID v38; // [sp-20h] [bp-4Ch]@174 | |
6914 signed int v39; // [sp-1Ch] [bp-48h]@18 | |
6915 signed int v40; // [sp-1Ch] [bp-48h]@174 | |
6916 unsigned int v41; // [sp-18h] [bp-44h]@18 | |
6917 unsigned int v42; // [sp-18h] [bp-44h]@174 | |
6918 signed int v43; // [sp-14h] [bp-40h]@18 | |
6919 signed int v44; // [sp-14h] [bp-40h]@174 | |
6920 signed int v45; // [sp-10h] [bp-3Ch]@18 | |
6921 unsigned __int16 v46; // [sp-10h] [bp-3Ch]@120 | |
6922 signed int v47; // [sp-10h] [bp-3Ch]@174 | |
6923 int v48; // [sp-Ch] [bp-38h]@18 | |
6924 unsigned int v49; // [sp-Ch] [bp-38h]@33 | |
6925 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6926 int v51; // [sp-Ch] [bp-38h]@174 | |
6927 unsigned int v52; // [sp-8h] [bp-34h]@18 | |
6928 char *v53; // [sp-8h] [bp-34h]@33 | |
6929 int v54; // [sp-8h] [bp-34h]@34 | |
6930 unsigned int v55; // [sp-8h] [bp-34h]@60 | |
6931 int v56; // [sp-8h] [bp-34h]@66 | |
6932 const char *v57; // [sp-8h] [bp-34h]@69 | |
6933 const char *v58; // [sp-8h] [bp-34h]@89 | |
6934 int v59; // [sp-8h] [bp-34h]@120 | |
6935 unsigned int v60; // [sp-8h] [bp-34h]@174 | |
6936 int v61; // [sp-4h] [bp-30h]@18 | |
6937 char *v62; // [sp-4h] [bp-30h]@33 | |
6938 char *v63; // [sp-4h] [bp-30h]@34 | |
6939 int v64; // [sp-4h] [bp-30h]@60 | |
6940 int v65; // [sp-4h] [bp-30h]@66 | |
6941 const char *v66; // [sp-4h] [bp-30h]@69 | |
6942 signed int v67; // [sp-4h] [bp-30h]@77 | |
6943 const char *v68; // [sp-4h] [bp-30h]@89 | |
6944 int v69; // [sp-4h] [bp-30h]@110 | |
6945 unsigned __int8 v70; // [sp-4h] [bp-30h]@120 | |
6946 int v71; // [sp-4h] [bp-30h]@174 | |
6947 char *v72; // [sp+20h] [bp-Ch]@68 | |
6948 signed int v73; // [sp+24h] [bp-8h]@1 | |
6949 char *v74; // [sp+24h] [bp-8h]@23 | |
6950 int v75; // [sp+24h] [bp-8h]@73 | |
6951 Player *thisb; // [sp+28h] [bp-4h]@1 | |
6952 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6953 | |
6954 thisb = this; | |
243 | 6955 v3 = &pParty->pPlayers[a2-1]; |
0 | 6956 v73 = 1; |
6957 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6958 return; | |
6959 v4 = 0; | |
6960 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 13 ) | |
6961 { | |
6962 if ( pParty->pPickedItem.uItemID != 160 ) | |
6963 { | |
6964 if ( pParty->pPickedItem.uItemID == 161 ) | |
6965 { | |
6966 v27 = (char *)&v3->sMana; | |
6967 *(int *)v27 += 2; | |
6968 LABEL_170: | |
6969 if ( *(int *)v27 > v3->GetMaxMana() ) | |
6970 *(int *)v27 = v3->GetMaxMana(); | |
6971 } | |
6972 else | |
6973 { | |
6974 if ( pParty->pPickedItem.uItemID != 162 ) | |
6975 { | |
6976 LABEL_167: | |
6977 v68 = pParty->pPickedItem.GetDisplayName(); | |
6978 v58 = pGlobalTXT_LocalizationStrings[36]; | |
6979 goto LABEL_90; | |
6980 } | |
6981 v69 = 2; | |
6982 LABEL_111: | |
243 | 6983 pParty->pPlayers[a2-1].Heal(v69); |
0 | 6984 } |
6985 LABEL_112: | |
187 | 6986 v3->PlaySound(SPEECH_36, 0); |
0 | 6987 goto LABEL_173; |
6988 } | |
6989 LABEL_172: | |
100 | 6990 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
0 | 6991 goto LABEL_173; |
6992 } | |
6993 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == 14 ) | |
6994 { | |
6995 switch ( pParty->pPickedItem.uItemID ) | |
6996 { | |
6997 case 0xDEu: | |
570 | 6998 v25 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 6999 goto LABEL_110; |
7000 case 0xDFu: | |
570 | 7001 v26 = pParty->pPickedItem.uEnchantmentType + 10; |
0 | 7002 goto LABEL_114; |
7003 case 0xE0u: | |
7004 LODWORD(v3->pConditions[1]) = 0; | |
7005 HIDWORD(v3->pConditions[1]) = 0; | |
7006 goto LABEL_112; | |
7007 case 0xE1u: | |
7008 LODWORD(v3->pConditions[11]) = 0; | |
7009 HIDWORD(v3->pConditions[11]) = 0; | |
7010 LODWORD(v3->pConditions[9]) = 0; | |
7011 HIDWORD(v3->pConditions[9]) = 0; | |
7012 LODWORD(v3->pConditions[7]) = 0; | |
7013 HIDWORD(v3->pConditions[7]) = 0; | |
7014 goto LABEL_112; | |
7015 case 0xE2u: | |
7016 LODWORD(v3->pConditions[10]) = 0; | |
7017 HIDWORD(v3->pConditions[10]) = 0; | |
7018 LODWORD(v3->pConditions[8]) = 0; | |
7019 HIDWORD(v3->pConditions[8]) = 0; | |
7020 LODWORD(v3->pConditions[6]) = 0; | |
7021 HIDWORD(v3->pConditions[6]) = 0; | |
7022 goto LABEL_112; | |
7023 case 0xE3u: | |
7024 LODWORD(v3->pConditions[2]) = 0; | |
7025 HIDWORD(v3->pConditions[2]) = 0; | |
7026 goto LABEL_112; | |
7027 case 0xE4u: | |
7028 if ( v3->pConditions[1] ) | |
7029 goto LABEL_173; | |
7030 v70 = 0; | |
7031 v59 = 0; | |
7032 v50 = 5; | |
7033 v46 = 3; | |
570 | 7034 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7035 v29 = (char *)&v3->pPlayerBuffs[7]; |
7036 goto LABEL_147; | |
7037 case 0xE5u: | |
7038 v70 = 0; | |
7039 v59 = 0; | |
7040 v50 = 5; | |
7041 v46 = 3; | |
570 | 7042 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7043 v29 = (char *)&v3->pPlayerBuffs[8]; |
7044 goto LABEL_147; | |
7045 case 0xE6u: | |
7046 v70 = 0; | |
7047 v59 = 0; | |
7048 v50 = 5; | |
7049 v46 = 3; | |
570 | 7050 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7051 v29 = (char *)&v3->pPlayerBuffs[1]; |
7052 goto LABEL_147; | |
7053 case 0xE7u: | |
7054 v70 = 0; | |
7055 v59 = 0; | |
570 | 7056 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7057 v46 = 0; |
570 | 7058 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7059 v29 = (char *)&v3->pPlayerBuffs[11]; |
7060 goto LABEL_147; | |
7061 case 0xE8u: | |
7062 v70 = 0; | |
7063 v59 = 0; | |
570 | 7064 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7065 v46 = 0; |
570 | 7066 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7067 v29 = (char *)&v3->pPlayerBuffs[13]; |
7068 goto LABEL_147; | |
7069 case 0xEAu: | |
7070 v70 = 0; | |
7071 v59 = 0; | |
7072 v50 = 5; | |
7073 v46 = 3; | |
570 | 7074 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7075 v29 = (char *)&v3->pPlayerBuffs[14]; |
7076 goto LABEL_147; | |
7077 case 0xEBu: | |
7078 v3->pPlayerBuffs[23].Apply( | |
570 | 7079 pParty->uTimePlayed + (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
0 | 7080 3u, |
7081 5u, | |
7082 0, | |
7083 0); | |
7084 goto LABEL_173; | |
7085 case 0xEDu: | |
7086 LODWORD(v3->pConditions[3]) = 0; | |
7087 HIDWORD(v3->pConditions[3]) = 0; | |
7088 goto LABEL_112; | |
7089 case 0xEEu: | |
7090 LODWORD(v3->pConditions[0]) = 0; | |
7091 HIDWORD(v3->pConditions[0]) = 0; | |
7092 goto LABEL_112; | |
7093 case 0xEFu: | |
7094 LODWORD(v3->pConditions[5]) = 0; | |
7095 HIDWORD(v3->pConditions[5]) = 0; | |
7096 goto LABEL_112; | |
7097 case 0xF0u: | |
7098 v70 = 0; | |
7099 v59 = 0; | |
570 | 7100 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7101 v46 = 0; |
570 | 7102 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7103 v29 = (char *)&v3->pPlayerBuffs[19]; |
7104 goto LABEL_147; | |
7105 case 0xF1u: | |
7106 v70 = 0; | |
7107 v59 = 0; | |
570 | 7108 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7109 v46 = 0; |
570 | 7110 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7111 v29 = (char *)&v3->pPlayerBuffs[17]; |
7112 goto LABEL_147; | |
7113 case 0xF2u: | |
7114 v70 = 0; | |
7115 v59 = 0; | |
570 | 7116 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7117 v46 = 0; |
570 | 7118 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7119 v29 = (char *)&v3->pPlayerBuffs[20]; |
7120 goto LABEL_147; | |
7121 case 0xF3u: | |
7122 v70 = 0; | |
7123 v59 = 0; | |
570 | 7124 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7125 v46 = 0; |
570 | 7126 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7127 v29 = (char *)&v3->pPlayerBuffs[16]; |
7128 goto LABEL_147; | |
7129 case 0xF4u: | |
7130 v70 = 0; | |
7131 v59 = 0; | |
570 | 7132 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7133 v46 = 0; |
570 | 7134 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7135 v29 = (char *)&v3->pPlayerBuffs[21]; |
7136 goto LABEL_147; | |
7137 case 0xF5u: | |
7138 v70 = 0; | |
7139 v59 = 0; | |
570 | 7140 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7141 v46 = 0; |
570 | 7142 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7143 v29 = (char *)&v3->pPlayerBuffs[15]; |
7144 goto LABEL_147; | |
7145 case 0xFBu: | |
7146 LODWORD(v3->pConditions[12]) = 0; | |
7147 HIDWORD(v3->pConditions[12]) = 0; | |
7148 goto LABEL_112; | |
7149 case 0xFCu: | |
7150 v30 = LODWORD(v3->pConditions[14]); | |
7151 v31 = HIDWORD(v3->pConditions[14]); | |
7152 v32 = LODWORD(v3->pConditions[15]); | |
7153 v33 = HIDWORD(v3->pConditions[15]); | |
7154 v34 = LODWORD(v3->pConditions[16]); | |
7155 v35 = HIDWORD(v3->pConditions[16]); | |
243 | 7156 memset(&pParty->pPlayers[a2-1],0,0xA0u); |
0 | 7157 HIDWORD(v3->pConditions[14]) = v31; |
7158 LODWORD(v3->pConditions[15]) = v32; | |
7159 HIDWORD(v3->pConditions[15]) = v33; | |
7160 LODWORD(v3->pConditions[16]) = v34; | |
7161 LODWORD(v3->pConditions[14]) = v30; | |
7162 HIDWORD(v3->pConditions[16]) = v35; | |
7163 goto LABEL_112; | |
7164 case 0xFDu: | |
570 | 7165 v25 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7166 LABEL_110: |
7167 v69 = v25; | |
7168 goto LABEL_111; | |
7169 case 0xFEu: | |
570 | 7170 v26 = 5 * pParty->pPickedItem.uEnchantmentType; |
0 | 7171 LABEL_114: |
7172 v27 = (char *)&v3->sMana; | |
7173 *(int *)v27 += v26; | |
7174 goto LABEL_170; | |
7175 case 0xFFu: | |
7176 v70 = 0; | |
7177 v59 = 0; | |
570 | 7178 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7179 v46 = 0; |
570 | 7180 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7181 v29 = (char *)&v3->pPlayerBuffs[18]; |
7182 goto LABEL_147; | |
7183 case 0x100u: | |
7184 v70 = 0; | |
7185 v59 = 0; | |
570 | 7186 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7187 v46 = 0; |
570 | 7188 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7189 v29 = (char *)&v3->pPlayerBuffs[5]; |
7190 goto LABEL_147; | |
7191 case 0x101u: | |
7192 v70 = 0; | |
7193 v59 = 0; | |
570 | 7194 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7195 v46 = 0; |
570 | 7196 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7197 v29 = (char *)v3->pPlayerBuffs; |
7198 goto LABEL_147; | |
7199 case 0x102u: | |
7200 v70 = 0; | |
7201 v59 = 0; | |
570 | 7202 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7203 v46 = 0; |
570 | 7204 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7205 v29 = (char *)&v3->pPlayerBuffs[22]; |
7206 goto LABEL_147; | |
7207 case 0x103u: | |
7208 v70 = 0; | |
7209 v59 = 0; | |
570 | 7210 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7211 v46 = 0; |
570 | 7212 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7213 v29 = (char *)&v3->pPlayerBuffs[3]; |
7214 goto LABEL_147; | |
7215 case 0x104u: | |
7216 v70 = 0; | |
7217 v59 = 0; | |
570 | 7218 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7219 v46 = 0; |
570 | 7220 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7221 v29 = (char *)&v3->pPlayerBuffs[9]; |
7222 goto LABEL_147; | |
7223 case 0x105u: | |
7224 v70 = 0; | |
7225 v59 = 0; | |
570 | 7226 v50 = 3 * LOWORD(pParty->pPickedItem.uEnchantmentType); |
0 | 7227 v46 = 0; |
570 | 7228 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
0 | 7229 v29 = (char *)&v3->pPlayerBuffs[2]; |
7230 LABEL_147: | |
7231 ((SpellBuff *)v29)->Apply(pParty->uTimePlayed + v28, v46, v50, v59, v70); | |
7232 goto LABEL_112; | |
7233 case 0x106u: | |
7234 LODWORD(v3->pConditions[15]) = 0; | |
7235 HIDWORD(v3->pConditions[15]) = 0; | |
7236 goto LABEL_112; | |
7237 case 0x108u: | |
7238 if ( !*(int *)&v3->field_1F5[3] ) | |
7239 { | |
7240 v3->uLuck += 50; | |
7241 *(int *)&v3->field_1F5[3] = 1; | |
7242 } | |
7243 goto LABEL_112; | |
7244 case 0x109u: | |
7245 if ( !*(int *)&v3->field_1F5[7] ) | |
7246 { | |
7247 v3->uSpeed += 50; | |
7248 *(int *)&v3->field_1F5[7] = 1; | |
7249 } | |
7250 goto LABEL_112; | |
7251 case 0x10Au: | |
7252 if ( !*(int *)&v3->field_1F5[11] ) | |
7253 { | |
7254 v3->uIntelligence += 50; | |
7255 *(int *)&v3->field_1F5[11] = 1; | |
7256 } | |
7257 goto LABEL_112; | |
7258 case 0x10Bu: | |
7259 if ( !*(int *)&v3->field_1F5[15] ) | |
7260 { | |
7261 v3->uEndurance += 50; | |
7262 *(int *)&v3->field_1F5[15] = 1; | |
7263 } | |
7264 goto LABEL_112; | |
7265 case 0x10Cu: | |
7266 if ( !*(int *)&v3->field_1F5[19] ) | |
7267 { | |
7268 v3->uWillpower += 50; | |
7269 *(int *)&v3->field_1F5[19] = 1; | |
7270 } | |
7271 goto LABEL_112; | |
7272 case 0x10Du: | |
7273 if ( !*(int *)&v3->field_1F5[23] ) | |
7274 { | |
7275 v3->uAccuracy += 50; | |
7276 *(int *)&v3->field_1F5[23] = 1; | |
7277 } | |
7278 goto LABEL_112; | |
7279 case 0x10Eu: | |
7280 if ( !*(int *)&v3->field_1F5[27] ) | |
7281 { | |
7282 v3->uMight += 50; | |
7283 *(int *)&v3->field_1F5[27] = 1; | |
7284 } | |
7285 goto LABEL_112; | |
7286 case 0x10Fu: | |
7287 v3->sAgeModifier = 0; | |
7288 goto LABEL_112; | |
809 | 7289 case 0xDDu: |
7290 goto LABEL_172; | |
0 | 7291 default: |
7292 goto LABEL_167; | |
7293 } | |
7294 goto LABEL_172; | |
7295 } | |
7296 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 15 ) | |
7297 { | |
7298 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 16 ) | |
7299 { | |
7300 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType != 17 ) | |
7301 { | |
7302 if ( pParty->pPickedItem.uItemID == 616 ) | |
7303 { | |
7304 thisa = pParty->uCurrentMonthWeek + 1; | |
7305 if ( pParty->uCurrentMonth >= 7 ) | |
7306 v74 = 0; | |
7307 else | |
7308 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7309 switch ( pParty->uCurrentMonth ) | |
7310 { | |
7311 case 0u: | |
7312 v6 = pParty->uCurrentMonthWeek + 1; | |
7313 v3->uMight += thisa; | |
7314 goto LABEL_33; | |
7315 case 1u: | |
7316 v6 = pParty->uCurrentMonthWeek + 1; | |
7317 v3->uIntelligence += thisa; | |
7318 goto LABEL_33; | |
7319 case 2u: | |
7320 v6 = pParty->uCurrentMonthWeek + 1; | |
7321 v3->uWillpower += thisa; | |
7322 goto LABEL_33; | |
7323 case 3u: | |
7324 v6 = pParty->uCurrentMonthWeek + 1; | |
7325 v3->uEndurance += thisa; | |
7326 goto LABEL_33; | |
7327 case 4u: | |
7328 v6 = pParty->uCurrentMonthWeek + 1; | |
7329 v3->uAccuracy += thisa; | |
7330 goto LABEL_33; | |
7331 case 5u: | |
7332 v6 = pParty->uCurrentMonthWeek + 1; | |
7333 v3->uSpeed += thisa; | |
7334 goto LABEL_33; | |
7335 case 6u: | |
7336 v6 = pParty->uCurrentMonthWeek + 1; | |
7337 v3->uLuck += thisa; | |
7338 LABEL_33: | |
7339 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7340 v53 = v74; | |
7341 v49 = v6; | |
7342 goto LABEL_53; | |
7343 case 7u: | |
7344 party_finds_gold(1000 * thisa, 0); | |
7345 v63 = pGlobalTXT_LocalizationStrings[97]; | |
7346 v54 = 1000 * thisa; | |
7347 goto LABEL_38; | |
7348 case 8u: | |
7349 Party::GiveFood(5 * thisa); | |
7350 v63 = pGlobalTXT_LocalizationStrings[653]; | |
7351 v54 = 5 * thisa; | |
7352 goto LABEL_38; | |
7353 case 9u: | |
7354 v63 = pGlobalTXT_LocalizationStrings[207]; | |
7355 v3->uSkillPoints += 2 * thisa; | |
7356 v54 = 2 * thisa; | |
7357 goto LABEL_38; | |
7358 case 0xAu: | |
7359 v63 = pGlobalTXT_LocalizationStrings[83]; | |
7360 v54 = 2500 * thisa; | |
7361 v7 = __CFADD__(2500 * thisa, LODWORD(v3->uExperience)); | |
7362 LODWORD(v3->uExperience) += 2500 * thisa; | |
7363 HIDWORD(v3->uExperience) += ((unsigned __int64)(signed int)(2500 * thisa) >> 32) + v7; | |
7364 LABEL_38: | |
7365 sprintf(pTmpBuf, "+%u %s", v54, v63); | |
7366 goto LABEL_54; | |
7367 case 0xBu: | |
7368 v8 = rand() % 6; | |
7369 if ( v8 ) | |
7370 { | |
7371 v9 = v8 - 1; | |
7372 if ( v9 ) | |
7373 { | |
7374 v10 = v9 - 1; | |
7375 if ( v10 ) | |
7376 { | |
7377 v11 = v10 - 1; | |
7378 if ( v11 ) | |
7379 { | |
7380 v12 = v11 - 1; | |
7381 if ( v12 ) | |
7382 { | |
7383 if ( v12 != 1 ) | |
7384 goto LABEL_52; | |
7385 v3->sResBodyBase += thisa; | |
7386 v13 = pGlobalTXT_LocalizationStrings[29]; | |
7387 } | |
7388 else | |
7389 { | |
7390 v3->sResMindBase += thisa; | |
7391 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7392 } | |
7393 } | |
7394 else | |
7395 { | |
7396 v3->sResEarthBase += thisa; | |
7397 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7398 } | |
7399 } | |
7400 else | |
7401 { | |
7402 v3->sResWaterBase += thisa; | |
7403 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7404 } | |
7405 } | |
7406 else | |
7407 { | |
7408 v3->sResAirBase += thisa; | |
7409 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7410 } | |
7411 } | |
7412 else | |
7413 { | |
7414 v3->sResFireBase += thisa; | |
7415 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7416 } | |
7417 v74 = v13; | |
7418 LABEL_52: | |
7419 v62 = pGlobalTXT_LocalizationStrings[121]; | |
7420 v53 = v74; | |
7421 v49 = thisa; | |
7422 LABEL_53: | |
7423 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | |
7424 LABEL_54: | |
7425 ShowStatusBarString(pTmpBuf, 2u); | |
7426 pMouse->RemoveHoldingItem(); | |
7427 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
187 | 7428 v3->PlaySound(SPEECH_93, 0); |
0 | 7429 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7430 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | |
7431 { | |
7432 v64 = 0; | |
7433 v55 = 16; | |
7434 } | |
7435 else | |
7436 { | |
7437 if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) | |
7438 { | |
7439 v64 = 0; | |
7440 v55 = 14; | |
7441 } | |
7442 else | |
7443 { | |
7444 if ( pParty->uDaysPlayed != 4 && pParty->uDaysPlayed != 25 ) | |
7445 return; | |
7446 v64 = 0; | |
7447 v55 = 15; | |
7448 } | |
7449 } | |
7450 v3->SetCondition(v55, v64); | |
7451 v61 = 0; | |
7452 v52 = 0; | |
7453 v48 = 0; | |
7454 v45 = 0; | |
7455 v43 = -1; | |
7456 v41 = 0; | |
7457 v39 = 0; | |
7458 v37 = (SoundID)215; | |
7459 v14 = pAudioPlayer; | |
7460 goto LABEL_63; | |
7461 default: | |
7462 goto LABEL_54; | |
7463 } | |
7464 } | |
7465 if ( pParty->pPickedItem.uItemID == 630 ) | |
7466 { | |
7467 Party::GiveFood(1u); | |
7468 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7469 } | |
7470 else | |
7471 { | |
7472 if ( pParty->pPickedItem.uItemID == 632 ) | |
7473 { | |
7474 v61 = 0; | |
7475 v52 = 0; | |
7476 v48 = 0; | |
7477 v45 = 0; | |
7478 v43 = -1; | |
7479 v41 = 0; | |
7480 v39 = 0; | |
7481 v37 = (SoundID)133; | |
7482 goto LABEL_93; | |
7483 } | |
7484 if ( pParty->pPickedItem.uItemID == 633 ) | |
7485 { | |
7486 v61 = 0; | |
7487 v52 = 0; | |
7488 v48 = 0; | |
7489 v45 = 0; | |
7490 v43 = -1; | |
7491 v41 = 0; | |
7492 v39 = 0; | |
7493 v37 = (SoundID)134; | |
7494 goto LABEL_93; | |
7495 } | |
7496 if ( pParty->pPickedItem.uItemID == 634 ) | |
7497 { | |
7498 v61 = 0; | |
7499 v52 = 0; | |
7500 v48 = 0; | |
7501 v45 = 0; | |
7502 v43 = -1; | |
7503 v41 = 0; | |
7504 v39 = 0; | |
7505 v37 = (SoundID)135; | |
7506 goto LABEL_93; | |
7507 } | |
7508 if ( pParty->pPickedItem.uItemID != 646 ) | |
7509 { | |
7510 if ( pParty->pPickedItem.uItemID == 650 ) | |
7511 { | |
7512 sub_44C28F_open_nwc_dungeon(); | |
7513 return; | |
7514 } | |
7515 goto LABEL_167; | |
7516 } | |
7517 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | |
7518 v5 = 8 * a2 + 392; | |
862 | 7519 LOBYTE(v5) = PID(OBJECT_Player,a2 - 120); |
0 | 7520 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7521 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7522 } | |
7523 LABEL_187: | |
7524 pMouse->RemoveHoldingItem(); | |
7525 return; | |
7526 } | |
243 | 7527 if ( pParty->pPlayers[a2-1].CanAct() ) |
0 | 7528 { |
7529 sub_467F48(pParty->pPickedItem.uItemID); | |
7530 v65 = 0; | |
187 | 7531 v56 = SPEECH_37; |
0 | 7532 LABEL_67: |
187 | 7533 v3->PlaySound((PlayerSpeech)v56, v65); |
0 | 7534 return; |
7535 } | |
7536 LABEL_89: | |
7537 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7538 v58 = pGlobalTXT_LocalizationStrings[382]; | |
7539 LABEL_90: | |
809 | 7540 sprintfex(pTmpBuf, v58, v68); |
0 | 7541 v23 = pTmpBuf; |
7542 LABEL_91: | |
7543 ShowStatusBarString(v23, 2u); | |
7544 v4 = 0; | |
7545 goto LABEL_92; | |
7546 } | |
7547 v15 = pParty->pPickedItem.uItemID - 400; | |
318 | 7548 v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; |
0 | 7549 if ( *v72 ) |
7550 { | |
7551 v66 = pParty->pPickedItem.GetDisplayName(); | |
7552 v57 = pGlobalTXT_LocalizationStrings[380]; | |
7553 LABEL_72: | |
7554 sprintf(pTmpBuf, v57, v66); | |
7555 ShowStatusBarString(pTmpBuf, 2u); | |
7556 LABEL_92: | |
7557 v61 = v4; | |
7558 v52 = v4; | |
7559 v48 = v4; | |
7560 v45 = v4; | |
7561 v43 = -1; | |
7562 v41 = v4; | |
7563 v39 = v4; | |
7564 v37 = (SoundID)27; | |
7565 LABEL_93: | |
7566 v14 = pAudioPlayer; | |
7567 LABEL_63: | |
7568 pAudioPlayer->PlaySound(v37, v39, v41, v43, v45, v48, v52, v61); | |
7569 return; | |
7570 } | |
243 | 7571 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7572 { |
7573 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
7574 v57 = pGlobalTXT_LocalizationStrings[382]; | |
7575 goto LABEL_72; | |
7576 } | |
7577 v16 = v15 % 11 + 1; | |
7578 v17 = &v3->pActiveSkills[v15 / 11 + 12]; | |
7579 v75 = v16; | |
7580 v18 = SkillToMastery(*v17) - 1; | |
7581 if ( v18 ) | |
7582 { | |
7583 v19 = v18 - 1; | |
7584 if ( v19 ) | |
7585 { | |
7586 v20 = v19 - 1; | |
7587 if ( v20 ) | |
7588 { | |
7589 if ( v20 != 1 ) | |
7590 { | |
7591 v21 = a2; | |
7592 LABEL_83: | |
7593 if ( v75 > v21 || !*v17 ) | |
7594 { | |
7595 v22 = pParty->pPickedItem.GetDisplayName(); | |
809 | 7596 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); |
0 | 7597 ShowStatusBarString(pTmpBuf, 2u); |
7598 v65 = 0; | |
7599 v56 = 20; | |
7600 goto LABEL_67; | |
7601 } | |
7602 *v72 = 1; | |
187 | 7603 v3->PlaySound(SPEECH_21, 0); |
0 | 7604 v73 = 0; |
7605 LABEL_173: | |
7606 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | |
7607 if ( v36 == 14 ) | |
7608 { | |
7609 v71 = 0; | |
7610 v60 = 0; | |
7611 v51 = 0; | |
7612 v47 = 0; | |
7613 v44 = -1; | |
7614 v42 = 0; | |
7615 v40 = 0; | |
7616 v38 = (SoundID)210; | |
7617 } | |
7618 else | |
7619 { | |
7620 if ( v36 != 13 ) | |
7621 { | |
7622 LABEL_178: | |
7623 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7624 { | |
7625 if ( !v73 ) | |
7626 goto LABEL_187; | |
437 | 7627 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 7628 { |
7629 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
7630 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
7631 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
7632 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 7633 }*/ |
7634 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
0 | 7635 } |
7636 if ( v73 ) | |
7637 { | |
7638 if ( pParty->bTurnBasedModeOn ) | |
7639 { | |
7640 *(&pParty->field_16140 + a2) = 100; | |
7641 thisb->SetRecoveryTime(100); | |
7642 pTurnEngine->_40471C(); | |
7643 } | |
7644 else | |
7645 { | |
7646 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7647 } | |
7648 } | |
7649 goto LABEL_187; | |
7650 } | |
7651 v71 = 0; | |
7652 v60 = 0; | |
7653 v51 = 0; | |
7654 v47 = 0; | |
7655 v44 = -1; | |
7656 v42 = 0; | |
7657 v40 = 0; | |
7658 v38 = (SoundID)211; | |
7659 } | |
7660 pAudioPlayer->PlaySound(v38, v40, v42, v44, v47, v51, v60, v71); | |
7661 goto LABEL_178; | |
7662 } | |
7663 v67 = 11; | |
7664 } | |
7665 else | |
7666 { | |
7667 v67 = 10; | |
7668 } | |
7669 } | |
7670 else | |
7671 { | |
7672 v67 = 7; | |
7673 } | |
7674 } | |
7675 else | |
7676 { | |
7677 v67 = 4; | |
7678 } | |
7679 v21 = v67; | |
7680 goto LABEL_83; | |
7681 } | |
151 | 7682 if ( pCurrentScreen == SCREEN_CASTING ) |
0 | 7683 return; |
243 | 7684 if ( !pParty->pPlayers[a2-1].CanAct() ) |
0 | 7685 goto LABEL_89; |
7686 if ( bUnderwater == 1 ) | |
7687 { | |
7688 v23 = pGlobalTXT_LocalizationStrings[652]; | |
7689 goto LABEL_91; | |
7690 } | |
7691 dword_50C9AC = 1; | |
7692 v24 = pParty->pPickedItem.uItemID - 299; | |
7693 if ( pParty->pPickedItem.uItemID == 329 || v24 == 4 || v24 == 91 || v24 == 28 ) | |
7694 { | |
7695 pMouse->RemoveHoldingItem(); | |
7696 pGUIWindow_CurrentMenu->Release(); | |
7697 pIcons_LOD->_4114F2(); | |
151 | 7698 pCurrentScreen = SCREEN_GAME; |
0 | 7699 viewparams->bRedrawGameUI = 1; |
7700 _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); | |
7701 } | |
7702 else | |
7703 { | |
7704 _720984_unused = pParty->pPickedItem.uItemID; | |
7705 pMouse->RemoveHoldingItem(); | |
7706 if ( dword_50C9E8 < 40 ) | |
7707 { | |
7708 dword_50C9EC[3 * dword_50C9E8] = 146; | |
437 | 7709 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; |
7710 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; | |
0 | 7711 ++dword_50C9E8; |
7712 } | |
7713 if ( pCurrentScreen | |
7714 && pGUIWindow_CurrentMenu | |
437 | 7715 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) |
7716 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
7717 { | |
7718 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
0 | 7719 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
7720 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 7721 ++pMessageQueue_50CBD0->uNumMessages;*/ |
7722 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7723 } | |
7724 } | |
7725 } | |
0 | 7726 |
7727 | |
7728 | |
7729 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7730 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
7731 { | |
0 | 7732 Player *v3; // esi@1 |
7733 signed int v4; // edi@1 | |
7734 unsigned int v5; // eax@8 | |
7735 int v6; // eax@9 | |
7736 enum CHARACTER_RACE v7; // eax@11 | |
7737 signed int v8; // eax@17 | |
7738 unsigned __int8 v9; // sf@17 | |
7739 unsigned __int8 v10; // of@17 | |
7740 int v11; // eax@19 | |
7741 unsigned int v12; // eax@20 | |
484 | 7742 unsigned int test_bit_value; // eax@25 |
7743 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7744 signed int v15; // ecx@28 |
7745 ItemGen *v16; // eax@28 | |
7746 char v17; // zf@31 | |
7747 int v18; // edi@90 | |
7748 DDM_DLV_Header *v19; // eax@122 | |
7749 char v20; // cl@124 | |
7750 DDM_DLV_Header *v21; // eax@126 | |
7751 unsigned int v22; // edi@129 | |
100 | 7752 Player *v23; // esi@134 |
0 | 7753 ItemGen *v24; // ecx@135 |
7754 signed int v25; // edx@135 | |
7755 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7756 char *v27; // edi@155 | |
7757 int v28; // ebx@161 | |
7758 int v29; // eax@161 | |
7759 | |
469 | 7760 v6 = 0; |
0 | 7761 v3 = this; |
7762 v4 = -1; | |
469 | 7763 if ( VarNum > VAR_AutoNotes ) |
7764 { | |
7765 switch ( VarNum ) | |
0 | 7766 { |
7767 case VAR_Invisible: | |
484 | 7768 if ( pParty->pPartyBuffs[11].uExpireTime >0 ) |
469 | 7769 return true; |
484 | 7770 return false; |
0 | 7771 case VAR_NumDeaths: |
7772 v4 = pParty->uNumDeaths; | |
469 | 7773 return v4 >= pValue; |
0 | 7774 case VAR_NumBounties: |
7775 v4 = pParty->uNumBountiesCollected; | |
469 | 7776 return v4 >= pValue; |
0 | 7777 case VAR_PrisonTerms: |
7778 v4 = pParty->uNumPrisonTerms; | |
469 | 7779 return v4 >= pValue; |
0 | 7780 case VAR_ArenaWinsPage: |
7781 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7782 return v4 >= pValue; |
0 | 7783 case VAR_ArenaWinsSquire: |
7784 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7785 return v4 >= pValue; |
0 | 7786 case VAR_ArenaWinsKnight: |
7787 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7788 return v4 >= pValue; |
0 | 7789 case VAR_ArenaWinsLord: |
7790 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7791 return v4 >= pValue; |
0 | 7792 case VAR_ReputationInCurrentLocation: |
7793 v19 = &pOutdoor->ddm; | |
7794 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7795 v19 = &pIndoor->dlv; | |
469 | 7796 v6 = v19->uReputation >= pValue; |
7797 return v6; | |
0 | 7798 case VAR_History_28|VAR_Sex: |
7799 v21 = &pOutdoor->ddm; | |
7800 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7801 v21 = &pIndoor->dlv; | |
469 | 7802 v6 = v21->field_C_alert == pValue; |
0 | 7803 return v6; |
7804 case VAR_MonthEquals2|VAR_Sex: | |
7805 case VAR_MonthEquals2|VAR_Class: | |
7806 case VAR_Counter1: | |
7807 case VAR_Counter2: | |
7808 case VAR_Counter3: | |
7809 case VAR_Counter4: | |
7810 case VAR_Counter5: | |
7811 case VAR_Counter6: | |
7812 case VAR_Counter7: | |
7813 case VAR_Counter8: | |
469 | 7814 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7815 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7816 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7817 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7818 return true; | |
7819 return false; | |
0 | 7820 case VAR_NumSkillPoints: |
7821 v4 = this->uSkillPoints; | |
469 | 7822 return v4 >= pValue; |
0 | 7823 case VAR_CircusPrises: |
7824 v4 = 0; | |
100 | 7825 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7826 do |
7827 { | |
469 | 7828 v24 = v23->pInventoryItems; |
0 | 7829 v25 = 138; |
7830 do | |
7831 { | |
7832 switch ( v24->uItemID ) | |
7833 { | |
7834 case 0x1D6u: | |
7835 ++v4; | |
7836 break; | |
7837 case 0x1D7u: | |
7838 v4 += 3; | |
7839 break; | |
7840 case 0x1DDu: | |
7841 v4 += 5; | |
7842 break; | |
7843 } | |
7844 ++v24; | |
7845 --v25; | |
7846 } | |
7847 while ( v25 ); | |
100 | 7848 ++v23; |
0 | 7849 } |
100 | 7850 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7851 return v4 >= pValue; |
0 | 7852 case VAR_MonthEquals2: |
469 | 7853 v6 = pParty->uCurrentMonth == pValue; |
7854 return v6; | |
0 | 7855 case VAR_IsFlying: |
7856 if ( pParty->bFlying | |
484 | 7857 && (pParty->pPartyBuffs[7].uExpireTime> 0) ) |
469 | 7858 return true; |
7859 return false; | |
0 | 7860 case VAR_HiredNPCHasSpeciality: |
469 | 7861 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7862 return v6; |
7863 case VAR_NPCs2: | |
469 | 7864 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7865 case VAR_MonthEquals|VAR_CurrentSP: |
484 | 7866 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7867 our_bit_value = this->field_1A50[((signed __int16)a1 - 1)/8]; | |
7868 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
469 | 7869 return v4 >= pValue; |
7870 v4 = pValue; | |
7871 return v4 >= pValue; | |
0 | 7872 case VAR_ItemEquipped: |
7873 v26 = (ITEM_EQUIP_TYPE)0; | |
7874 v27 = (char *)&this->pEquipment; | |
7875 break; | |
7876 case VAR_GoldInBank: | |
7877 v4 = pParty->uNumGoldInBank; | |
469 | 7878 return v4 >= pValue; |
0 | 7879 case VAR_ThieverySkill|0x80: |
7880 v28 = GetActualMight(); | |
7881 v29 = v3->GetBaseStrength(); | |
7882 goto LABEL_168; | |
7883 case VAR_DisarmTrapSkill|0x80: | |
7884 v28 = GetActualIntelligence(); | |
7885 v29 = v3->GetBaseIntelligence(); | |
7886 goto LABEL_168; | |
7887 case VAR_MonthEquals: | |
7888 v28 = GetActualWillpower(); | |
7889 v29 = v3->GetBaseWillpower(); | |
7890 goto LABEL_168; | |
7891 case VAR_MonthEquals|VAR_Sex: | |
7892 v28 = GetActualEndurance(); | |
7893 v29 = v3->GetBaseEndurance(); | |
7894 goto LABEL_168; | |
7895 case VAR_IdentifyMonsterSkill|0x80: | |
7896 v28 = GetActualSpeed(); | |
7897 v29 = v3->GetBaseSpeed(); | |
7898 goto LABEL_168; | |
7899 case VAR_ArmsmasterSkill|0x80: | |
7900 v28 = GetActualAccuracy(); | |
7901 v29 = v3->GetBaseAccuracy(); | |
7902 goto LABEL_168; | |
7903 case VAR_MonthEquals|VAR_MaxHP: | |
7904 v28 = GetActualLuck(); | |
7905 v29 = v3->GetBaseLuck(); | |
7906 LABEL_168: | |
7907 v10 = __OFSUB__(v28, v29); | |
7908 v9 = v28 - v29 < 0; | |
7909 LABEL_169: | |
7910 if ( v9 ^ v10 ) | |
469 | 7911 return v4 >= pValue; |
7912 return true; | |
0 | 7913 default: |
469 | 7914 return v4 >= pValue; |
0 | 7915 } |
7916 while ( !v3->HasItemEquipped(v26) | |
654 | 7917 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7918 { |
7919 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7920 v27 += 4; | |
7921 if ( (signed int)v26 >= 16 ) | |
469 | 7922 return false; |
7923 } | |
7924 return true; | |
7925 } | |
7926 if ( VarNum == VAR_AutoNotes ) | |
0 | 7927 { |
484 | 7928 test_bit_value = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; |
7929 our_bit_value = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) /8]; | |
7930 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
7931 return false; | |
7932 return true; | |
469 | 7933 } |
7934 if ( VarNum <= VAR_BaseLuck ) | |
7935 { | |
7936 if ( VarNum != VAR_BaseLuck ) | |
7937 { | |
7938 switch ( VarNum ) | |
0 | 7939 { |
7940 case VAR_Hour: | |
469 | 7941 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7942 return true; | |
7943 return false; | |
0 | 7944 case VAR_DayOfYear: |
469 | 7945 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7946 v6 = v5 == pValue; | |
7947 return v6; | |
0 | 7948 case VAR_DayOfWeek: |
469 | 7949 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7950 v6 = v5 == pValue; | |
0 | 7951 return v6; |
7952 case VAR_Sex: | |
469 | 7953 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7954 return true; | |
7955 return v4 >= pValue; | |
0 | 7956 case VAR_Class: |
135 | 7957 v7 = (CHARACTER_RACE)this->classType; |
469 | 7958 if ( pValue == v7 ) |
7959 return true; | |
7960 return v4 >= pValue; | |
0 | 7961 case VAR_Race: |
7962 v7 = GetRace(); | |
469 | 7963 if ( pValue == v7 ) |
7964 return true; | |
7965 return v4 >= pValue; | |
0 | 7966 case VAR_CurrentHP: |
7967 v4 = this->sHealth; | |
469 | 7968 return v4 >= pValue; |
0 | 7969 case VAR_MaxHP: |
7970 v8 = GetMaxHealth(); | |
7971 v10 = __OFSUB__(v3->sHealth, v8); | |
7972 v9 = v3->sHealth - v8 < 0; | |
7973 goto LABEL_169; | |
7974 case VAR_CurrentSP: | |
7975 v4 = this->sMana; | |
469 | 7976 return v4 >= pValue; |
0 | 7977 case VAR_MaxSP: |
7978 v11 = GetMaxMana(); | |
7979 v10 = __OFSUB__(v3->sMana, v11); | |
7980 v9 = v3->sMana - v11 < 0; | |
7981 goto LABEL_169; | |
7982 case VAR_ActualAC: | |
7983 v12 = GetActualAC(); | |
7984 goto _j_cmp_against_arg; | |
7985 case VAR_ACModifier: | |
7986 v4 = this->sACModifier; | |
469 | 7987 return v4 >= pValue; |
0 | 7988 case VAR_BaseLevel: |
7989 v4 = this->uLevel; | |
469 | 7990 return v4 >= pValue; |
0 | 7991 case VAR_LevelModifier: |
7992 v4 = this->sLevelModifier; | |
469 | 7993 return v4 >= pValue; |
0 | 7994 case VAR_Age: |
7995 v12 = GetActualAge(); | |
7996 goto _j_cmp_against_arg; | |
7997 case VAR_Award: | |
484 | 7998 test_bit_value = 0x80u >> ((signed __int16)a1 - 1) % 8; |
7999 our_bit_value = this->_guilds_member_bits[((signed __int16)a1 - 1) /8]; | |
8000 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
8001 return true; | |
8002 return false; | |
0 | 8003 case VAR_Experience: |
8004 v4 = LODWORD(this->uExperience); | |
469 | 8005 return v4 >= pValue; |
0 | 8006 case VAR_QBits_QuestsDone: |
484 | 8007 test_bit_value = 0x80u >> (pValue - 1) % 8; |
8008 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
8009 if ( test_bit_value & our_bit_value ) | |
478 | 8010 return true; |
8011 return false; | |
0 | 8012 case VAR_PlayerItemInHands: |
8013 v15 = 0; | |
8014 v16 = v3->pInventoryItems; | |
8015 break; | |
8016 case VAR_FixedGold: | |
8017 v4 = pParty->uNumGold; | |
469 | 8018 return v4 >= pValue; |
0 | 8019 case VAR_MightBonus: |
8020 v4 = this->uMightBonus; | |
469 | 8021 return v4 >= pValue; |
0 | 8022 case VAR_IntellectBonus: |
8023 v4 = this->uIntelligenceBonus; | |
469 | 8024 return v4 >= pValue; |
0 | 8025 case VAR_PersonalityBonus: |
8026 v4 = this->uWillpowerBonus; | |
469 | 8027 return v4 >= pValue; |
0 | 8028 case VAR_EnduranceBonus: |
8029 v4 = this->uEnduranceBonus; | |
469 | 8030 return v4 >= pValue; |
0 | 8031 case VAR_SpeedBonus: |
8032 v4 = this->uSpeedBonus; | |
469 | 8033 return v4 >= pValue; |
0 | 8034 case VAR_AccuracyBonus: |
8035 v4 = this->uAccuracyBonus; | |
469 | 8036 return v4 >= pValue; |
0 | 8037 case VAR_LuckBonus: |
8038 v4 = this->uLuckBonus; | |
469 | 8039 return v4 >= pValue; |
0 | 8040 case VAR_BaseMight: |
8041 v4 = this->uMight; | |
469 | 8042 return v4 >= pValue; |
0 | 8043 case VAR_BaseIntellect: |
8044 v4 = this->uIntelligence; | |
469 | 8045 return v4 >= pValue; |
0 | 8046 case VAR_BasePersonality: |
8047 v4 = this->uWillpower; | |
469 | 8048 return v4 >= pValue; |
0 | 8049 case VAR_BaseEndurance: |
8050 v4 = this->uEndurance; | |
469 | 8051 return v4 >= pValue; |
0 | 8052 case VAR_BaseSpeed: |
8053 v4 = this->uSpeed; | |
469 | 8054 return v4 >= pValue; |
0 | 8055 case VAR_BaseAccuracy: |
8056 v4 = this->uAccuracy; | |
469 | 8057 return v4 >= pValue; |
0 | 8058 case VAR_FixedFood: |
8059 v4 = pParty->uNumFoodRations; | |
469 | 8060 return v4 >= pValue; |
0 | 8061 default: |
469 | 8062 return v4 >= pValue; |
8063 } | |
8064 while ( v16->uItemID != pValue ) | |
0 | 8065 { |
8066 ++v15; | |
8067 ++v16; | |
8068 if ( v15 >= 138 ) | |
8069 { | |
469 | 8070 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 8071 return v6; |
8072 } | |
8073 } | |
469 | 8074 return true; |
0 | 8075 } |
8076 v4 = this->uLuck; | |
469 | 8077 return v4 >= pValue; |
8078 } | |
8079 if ( VarNum <= VAR_MagicResistance ) | |
8080 { | |
8081 if ( VarNum == VAR_MagicResistance ) | |
0 | 8082 { |
8083 v4 = this->sResMagicBase; | |
8084 } | |
8085 else | |
8086 { | |
469 | 8087 switch ( VarNum ) |
0 | 8088 { |
8089 case VAR_FireResistance: | |
8090 v4 = this->sResFireBase; | |
469 | 8091 return v4 >= pValue; |
0 | 8092 case VAR_AirResistance: |
8093 v4 = this->sResAirBase; | |
469 | 8094 return v4 >= pValue; |
0 | 8095 case VAR_WaterResistance: |
8096 v4 = this->sResWaterBase; | |
469 | 8097 return v4 >= pValue; |
0 | 8098 case VAR_EarthResistance: |
8099 v4 = this->sResEarthBase; | |
469 | 8100 return v4 >= pValue; |
0 | 8101 case VAR_SpiritResistance: |
8102 v4 = this->sResSpiritBase; | |
469 | 8103 return v4 >= pValue; |
0 | 8104 case VAR_MindResistance: |
8105 v4 = this->sResMindBase; | |
469 | 8106 return v4 >= pValue; |
0 | 8107 case VAR_BodyResistance: |
8108 v4 = this->sResBodyBase; | |
469 | 8109 return v4 >= pValue; |
0 | 8110 case VAR_LightResistance: |
8111 v4 = this->sResLightBase; | |
469 | 8112 return v4 >= pValue; |
0 | 8113 case VAR_DarkResistance: |
8114 v4 = this->sResDarkBase; | |
469 | 8115 return v4 >= pValue; |
0 | 8116 case VAR_ActualMight: |
8117 v12 = GetActualMight(); | |
8118 goto _j_cmp_against_arg; | |
8119 case VAR_ActualIntellect: | |
8120 v12 = GetActualIntelligence(); | |
8121 goto _j_cmp_against_arg; | |
8122 case VAR_ActualPersonality: | |
8123 v12 = GetActualWillpower(); | |
8124 goto _j_cmp_against_arg; | |
8125 case VAR_ActualEndurance: | |
8126 v12 = GetActualEndurance(); | |
8127 goto _j_cmp_against_arg; | |
8128 case VAR_ActualSpeed: | |
8129 v12 = GetActualSpeed(); | |
8130 goto _j_cmp_against_arg; | |
8131 case VAR_ActualAccuracy: | |
8132 v12 = GetActualAccuracy(); | |
8133 goto _j_cmp_against_arg; | |
8134 case VAR_ActualLuck: | |
8135 v12 = GetActualLuck(); | |
8136 _j_cmp_against_arg: | |
8137 v4 = v12; | |
8138 break; | |
8139 default: | |
469 | 8140 return v4 >= pValue; |
8141 } | |
8142 } | |
8143 return v4 >= pValue; | |
8144 } | |
8145 if ( VarNum <= VAR_DisarmTrapSkill ) | |
8146 { | |
8147 if ( VarNum != VAR_DisarmTrapSkill ) | |
8148 { | |
8149 if ( VarNum <= VAR_MindResistanceBonus ) | |
8150 { | |
8151 switch ( VarNum ) | |
0 | 8152 { |
8153 case VAR_MindResistanceBonus: | |
8154 v4 = this->sResMindBonus; | |
8155 break; | |
8156 case VAR_FireResistanceBonus: | |
8157 v4 = this->sResFireBonus; | |
8158 break; | |
8159 case VAR_AirResistanceBonus: | |
8160 v4 = this->sResAirBonus; | |
8161 break; | |
8162 case VAR_WaterResistanceBonus: | |
8163 v4 = this->sResWaterBonus; | |
8164 break; | |
8165 case VAR_EarthResistanceBonus: | |
8166 v4 = this->sResEarthBonus; | |
8167 break; | |
8168 case VAR_SpiritResistanceBonus: | |
8169 v4 = this->sResSpiritBonus; | |
8170 break; | |
8171 } | |
469 | 8172 return v4 >= pValue; |
8173 } | |
8174 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 8175 { |
8176 v4 = this->sResBodyBonus; | |
469 | 8177 return v4 >= pValue; |
8178 } | |
8179 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 8180 { |
8181 v4 = this->sResLightBonus; | |
469 | 8182 return v4 >= pValue; |
8183 } | |
8184 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 8185 { |
8186 v4 = this->sResDarkBonus; | |
469 | 8187 return v4 >= pValue; |
8188 } | |
8189 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 8190 { |
8191 v4 = this->sResMagicBonus; | |
469 | 8192 return v4 >= pValue; |
8193 } | |
8194 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
8195 return v4 >= pValue; | |
0 | 8196 } |
8197 LABEL_90: | |
469 | 8198 v18 = *((short *)&this->pConditions[16] + VarNum); |
8199 if ( pValue <= 63 ) | |
0 | 8200 v4 = v18 & 0x3F; |
8201 else | |
469 | 8202 v4 = pValue & v18; |
8203 return v4 >= pValue; | |
8204 } | |
8205 if ( VarNum == 104 ) | |
0 | 8206 goto LABEL_90; |
469 | 8207 if ( (signed int)VarNum <= 104 ) |
8208 return v4 >= pValue; | |
8209 if ( (signed int)VarNum > 0x79 ) | |
8210 { | |
8211 if ( VarNum != 122 ) | |
8212 { | |
8213 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
8214 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
8215 return v4 >= pValue; | |
0 | 8216 } |
8217 v4 = GetMajorConditionIdx(); | |
8218 if ( v4 != 18 ) | |
8219 { | |
469 | 8220 return v4 >= pValue; |
8221 } | |
8222 v4 = pValue; | |
8223 return v4 >= pValue; | |
8224 } | |
8225 return *((int *)this + 2 * VarNum - 210); | |
0 | 8226 } |
8227 | |
8228 | |
8229 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 8230 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
8231 { | |
8232 signed int currPlayerId; // ebx@1 | |
0 | 8233 Player *v4; // esi@1 |
8234 unsigned int v5; // edi@1 | |
8235 unsigned int v6; // esi@13 | |
8236 unsigned int v7; // esi@14 | |
8237 signed int v8; // eax@17 | |
8238 ItemGen *v9; // ecx@17 | |
8239 int v10; // eax@21 | |
8240 signed int v11; // eax@30 | |
8241 Player *v12; // ecx@44 | |
8242 char *v13; // ecx@45 | |
8243 Player *v14; // ecx@49 | |
8244 int v15; // ecx@86 | |
8245 int v16; // esi@106 | |
8246 char v17; // al@106 | |
8247 int v18; // eax@107 | |
8248 Player *v19; // ecx@112 | |
8249 Player *v20; // ecx@127 | |
8250 int v21; // eax@127 | |
8251 int v22; // eax@145 | |
8252 char v23; // zf@146 | |
8253 DDM_DLV_Header *v24; // ecx@148 | |
8254 signed int v25; // eax@172 | |
8255 int v26; // [sp-8h] [bp-3Ch]@84 | |
8256 signed int v27; // [sp-4h] [bp-38h]@4 | |
8257 int v28; // [sp-4h] [bp-38h]@84 | |
8258 ItemGen item; // [sp+Ch] [bp-28h]@52 | |
8259 char v30; // [sp+32h] [bp-2h]@1 | |
8260 char v31; // [sp+33h] [bp-1h]@1 | |
8261 | |
492 | 8262 currPlayerId = 0; |
0 | 8263 v30 = 0; |
8264 v31 = 0; | |
8265 v4 = this; | |
8266 v5 = 0; | |
8267 if ( this == pPlayers[2] ) | |
492 | 8268 currPlayerId = 1; |
8269 else if ( this == pPlayers[3] ) | |
8270 currPlayerId = 2; | |
757 | 8271 else if ( this == pPlayers[4] ) |
492 | 8272 currPlayerId = 3; |
8273 if ( var_type > VAR_AutoNotes ) | |
8274 { | |
8275 if ( var_type <= VAR_GoldInBank ) | |
8276 { | |
8277 if ( var_type == VAR_GoldInBank ) | |
8278 { | |
8279 pParty->uNumGoldInBank = var_value; | |
0 | 8280 return; |
8281 } | |
492 | 8282 if ( var_type <= VAR_Counter8 ) |
8283 { | |
8284 if ( (signed int)var_type >= 0xF5 ) | |
0 | 8285 { |
492 | 8286 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
8287 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8288 } |
8289 else | |
8290 { | |
492 | 8291 switch ( var_type ) |
0 | 8292 { |
8293 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 8294 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 8295 break; |
8296 case VAR_NPCs2: | |
8297 pParty->field_709 = 0; | |
492 | 8298 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
659 | 8299 Party__CountHirelings(); |
0 | 8300 viewparams->bRedrawGameUI = 1; |
8301 break; | |
8302 case VAR_NumSkillPoints: | |
492 | 8303 this->uSkillPoints = var_value; |
0 | 8304 break; |
8305 } | |
8306 } | |
8307 return; | |
8308 } | |
492 | 8309 if ( var_type < VAR_Counter9 ) |
0 | 8310 return; |
492 | 8311 if ( (signed int)var_type <= 0x112 ) |
8312 { | |
8313 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8314 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8315 } |
8316 else | |
8317 { | |
492 | 8318 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 8319 { |
8320 v24 = &pOutdoor->ddm; | |
8321 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8322 v24 = &pIndoor->dlv; | |
492 | 8323 v24->uReputation = var_value; |
8324 if ( var_value > 10000 ) | |
0 | 8325 v24->uReputation = 10000; |
8326 return; | |
8327 } | |
492 | 8328 if ( var_type <= VAR_ReputationInCurrentLocation |
8329 || var_type > VAR_History_28 | |
8330 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
8331 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8332 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 8333 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8334 v23) ) |
8335 return; | |
8336 bFlashHistoryBook = 1; | |
8337 } | |
8338 LABEL_172: | |
492 | 8339 v25 = 8 * currPlayerId + 400; |
862 | 8340 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
0 | 8341 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
8342 return; | |
8343 } | |
492 | 8344 if ( var_type != 307 ) |
8345 { | |
8346 switch ( var_type ) | |
0 | 8347 { |
8348 case 308: | |
492 | 8349 pParty->uNumBountiesCollected = var_value; |
0 | 8350 break; |
8351 case 309: | |
492 | 8352 pParty->uNumPrisonTerms = var_value; |
0 | 8353 break; |
8354 case 310: | |
492 | 8355 pParty->uNumArenaPageWins = var_value; |
0 | 8356 break; |
8357 case 311: | |
492 | 8358 pParty->uNumArenaSquireWins = var_value; |
0 | 8359 break; |
8360 case 312: | |
492 | 8361 pParty->uNumArenaKnightWins = var_value; |
0 | 8362 break; |
8363 case 313: | |
492 | 8364 pParty->uNumArenaLordWins = var_value; |
0 | 8365 break; |
8366 } | |
8367 return; | |
8368 } | |
492 | 8369 pParty->uNumDeaths = var_value; |
0 | 8370 LABEL_168: |
8371 if ( v30 != 1 ) | |
8372 { | |
8373 LABEL_170: | |
8374 if ( v31 != 1 ) | |
8375 return; | |
8376 v5 = 0; | |
8377 goto LABEL_172; | |
8378 } | |
8379 LABEL_169: | |
492 | 8380 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
0 | 8381 goto LABEL_170; |
8382 } | |
492 | 8383 if ( var_type == VAR_AutoNotes ) |
8384 { | |
8385 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
|
8386 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 8387 && pAutonoteTxt[var_value-1].pText ) |
8388 { | |
8389 v20 = pPlayers[currPlayerId + 1]; | |
0 | 8390 v30 = 1; |
187 | 8391 v20->PlaySound(SPEECH_96, 0); |
492 | 8392 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 8393 bFlashAutonotesBook = 1; |
8394 dword_506568 = v21; | |
8395 } | |
492 | 8396 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
0 | 8397 v31 = 1; |
8398 goto LABEL_168; | |
8399 } | |
492 | 8400 if ( var_type <= VAR_ActualMight ) |
8401 { | |
8402 if ( var_type != VAR_ActualMight ) | |
8403 { | |
8404 switch ( var_type ) | |
0 | 8405 { |
8406 case VAR_RandomGold: | |
492 | 8407 v6 = rand() % var_value + 1; |
0 | 8408 Party::SetGold(v6); |
8409 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | |
8410 ShowStatusBarString(pTmpBuf, 2u); | |
8411 GameUI_DrawFoodAndGold(); | |
8412 return; | |
8413 case VAR_RandomFood: | |
492 | 8414 v7 = rand() % var_value + 1; |
0 | 8415 Party::SetFood(v7); |
8416 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8417 ShowStatusBarString(pTmpBuf, 2u); | |
8418 GameUI_DrawFoodAndGold(); | |
8419 goto LABEL_124; | |
8420 case VAR_Sex: | |
492 | 8421 this->uSex = (PLAYER_SEX)var_value; |
0 | 8422 goto LABEL_124; |
8423 case VAR_Class: | |
492 | 8424 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8425 if ( (char)var_value != 35 ) | |
0 | 8426 goto LABEL_124; |
8427 v8 = 0; | |
8428 v9 = this->pInventoryItems; | |
8429 break; | |
8430 case VAR_CurrentHP: | |
492 | 8431 this->sHealth = var_value; |
0 | 8432 goto LABEL_124; |
8433 case VAR_MaxHP: | |
8434 this->sHealth = GetMaxHealth(); | |
8435 return; | |
8436 case VAR_CurrentSP: | |
492 | 8437 this->sMana = var_value; |
0 | 8438 goto LABEL_124; |
8439 case VAR_MaxSP: | |
8440 this->sMana = GetMaxMana(); | |
8441 return; | |
8442 case VAR_ACModifier: | |
492 | 8443 this->sACModifier = (unsigned __int8)var_value; |
0 | 8444 goto LABEL_124; |
8445 case VAR_BaseLevel: | |
492 | 8446 this->uLevel = (unsigned __int8)var_value; |
0 | 8447 goto LABEL_124; |
8448 case VAR_LevelModifier: | |
492 | 8449 this->sLevelModifier = (unsigned __int8)var_value; |
0 | 8450 goto LABEL_124; |
8451 case VAR_Age: | |
492 | 8452 this->sAgeModifier = var_value; |
0 | 8453 return; |
8454 case VAR_Award: | |
492 | 8455 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
8456 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
|
8457 //&& dword_723E80_award_related[2 * a3] ) |
492 | 8458 && pAwards[var_value].pText ) |
0 | 8459 { |
8460 v30 = 1; | |
8461 v31 = 1; | |
492 | 8462 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
0 | 8463 } |
492 | 8464 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); |
8465 goto LABEL_168; | |
0 | 8466 case VAR_Experience: |
492 | 8467 this->uExperience = var_value; |
0 | 8468 goto LABEL_124; |
8469 case VAR_QBits_QuestsDone: | |
492 | 8470 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
|
8471 // && (&dword_722F10)[4 * a3] ) |
492 | 8472 && pQuestTable[var_value-1] ) |
0 | 8473 { |
492 | 8474 v14 = pPlayers[currPlayerId + 1]; |
0 | 8475 bFlashQuestBook = 1; |
8476 v30 = 1; | |
8477 v31 = 1; | |
187 | 8478 v14->PlaySound(SPEECH_93, 0); |
0 | 8479 } |
484 | 8480 v13 = (char *)pParty->_quest_bits; |
0 | 8481 LABEL_51: |
492 | 8482 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
8483 if (( v30 != 1 )&&( v31 != 1 )) | |
8484 return; | |
8485 else | |
8486 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8487 if ( v31 != 1 ) | |
8488 return; | |
8489 v25 = 8 * currPlayerId + 400; | |
862 | 8490 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8491 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8492 return; | |
0 | 8493 case VAR_PlayerItemInHands: |
8494 item.Reset(); | |
8495 item.Reset(); | |
492 | 8496 item.uItemID = var_value; |
0 | 8497 item.uAttributes = 1; |
8498 pParty->SetHoldingItem(&item); | |
492 | 8499 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8500 pParty->pIsArtifactFound[var_value-500] = 1; | |
0 | 8501 return; |
8502 case VAR_FixedGold: | |
492 | 8503 Party::SetGold(var_value); |
0 | 8504 return; |
8505 case VAR_BaseMight: | |
492 | 8506 this->uMight = (unsigned __int8)var_value; |
0 | 8507 goto LABEL_84; |
8508 case VAR_BaseIntellect: | |
492 | 8509 this->uIntelligence = (unsigned __int8)var_value; |
0 | 8510 goto LABEL_84; |
8511 case VAR_BasePersonality: | |
492 | 8512 this->uWillpower = (unsigned __int8)var_value; |
0 | 8513 goto LABEL_84; |
8514 case VAR_BaseEndurance: | |
492 | 8515 this->uEndurance = (unsigned __int8)var_value; |
0 | 8516 goto LABEL_84; |
8517 case VAR_BaseSpeed: | |
492 | 8518 this->uSpeed = (unsigned __int8)var_value; |
0 | 8519 goto LABEL_84; |
8520 case VAR_BaseAccuracy: | |
492 | 8521 this->uAccuracy = (unsigned __int8)var_value; |
0 | 8522 goto LABEL_84; |
8523 case VAR_BaseLuck: | |
492 | 8524 this->uLuck = (unsigned __int8)var_value; |
0 | 8525 goto LABEL_84; |
8526 case VAR_FixedFood: | |
492 | 8527 Party::SetFood(var_value); |
0 | 8528 goto LABEL_124; |
8529 case VAR_MightBonus: | |
8530 goto LABEL_64; | |
8531 case VAR_IntellectBonus: | |
8532 goto LABEL_68; | |
8533 case VAR_PersonalityBonus: | |
8534 goto LABEL_69; | |
8535 case VAR_EnduranceBonus: | |
8536 goto LABEL_70; | |
8537 case VAR_SpeedBonus: | |
8538 goto LABEL_71; | |
8539 case VAR_AccuracyBonus: | |
8540 goto LABEL_72; | |
8541 case VAR_LuckBonus: | |
8542 goto LABEL_73; | |
8543 default: | |
8544 return; | |
8545 } | |
8546 while ( v9->uItemID != 615 ) | |
8547 { | |
8548 ++v8; | |
8549 ++v9; | |
8550 if ( v8 >= 138 ) | |
8551 goto LABEL_22; | |
8552 } | |
8553 v10 = (int)((char *)v4 + 36 * v8); | |
8554 *(int *)(v10 + 532) = 601; | |
492 | 8555 *(char *)(v10 + 558) = currPlayerId + 1; |
0 | 8556 LABEL_22: |
8557 if ( v4->sResFireBase < 20 ) | |
8558 v4->sResFireBase = 20; | |
8559 if ( v4->sResAirBase < 20 ) | |
8560 v4->sResAirBase = 20; | |
8561 if ( v4->sResWaterBase < 20 ) | |
8562 v4->sResWaterBase = 20; | |
8563 if ( v4->sResEarthBase < 20 ) | |
8564 v4->sResEarthBase = 20; | |
8565 v4->sResMindBase = 200; | |
8566 v4->sResBodyBase = 200; | |
8567 v11 = v4->GetSexByVoice(); | |
8568 v4->field_1924 = v4->uVoiceID; | |
8569 v4->field_1928 = v4->uFace; | |
8570 if ( v11 ) | |
8571 { | |
8572 v4->uFace = 21; | |
8573 v4->uVoiceID = 21; | |
8574 } | |
8575 else | |
8576 { | |
8577 v4->uFace = 20; | |
8578 v4->uVoiceID = 20; | |
8579 } | |
492 | 8580 ReloadPlayerPortraits(currPlayerId, v4->uFace); |
0 | 8581 goto LABEL_124; |
8582 } | |
8583 LABEL_64: | |
492 | 8584 this->uMightBonus = (unsigned __int8)var_value; |
0 | 8585 LABEL_111: |
8586 v28 = 0; | |
187 | 8587 v26 = SPEECH_91; |
0 | 8588 LABEL_112: |
492 | 8589 v19 = pPlayers[currPlayerId + 1]; |
0 | 8590 v31 = 1; |
187 | 8591 v19->PlaySound((PlayerSpeech)v26, v28); |
0 | 8592 goto LABEL_169; |
8593 } | |
492 | 8594 if ( var_type <= VAR_FireResistanceBonus ) |
8595 { | |
8596 if ( var_type == VAR_FireResistanceBonus ) | |
8597 { | |
8598 this->sResFireBonus = (unsigned __int8)var_value; | |
0 | 8599 goto LABEL_111; |
8600 } | |
492 | 8601 switch ( var_type ) |
0 | 8602 { |
8603 case VAR_ActualIntellect: | |
8604 LABEL_68: | |
492 | 8605 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8606 goto LABEL_111; |
8607 case VAR_ActualPersonality: | |
8608 LABEL_69: | |
492 | 8609 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8610 goto LABEL_111; |
8611 case VAR_ActualEndurance: | |
8612 LABEL_70: | |
492 | 8613 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8614 goto LABEL_111; |
8615 case VAR_ActualSpeed: | |
8616 LABEL_71: | |
492 | 8617 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8618 goto LABEL_111; |
8619 case VAR_ActualAccuracy: | |
8620 LABEL_72: | |
492 | 8621 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8622 goto LABEL_111; |
8623 case VAR_ActualLuck: | |
8624 LABEL_73: | |
492 | 8625 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8626 goto LABEL_111; |
8627 case VAR_FireResistance: | |
492 | 8628 this->sResFireBase = (unsigned __int8)var_value; |
0 | 8629 goto LABEL_84; |
8630 case VAR_AirResistance: | |
492 | 8631 this->sResAirBase = (unsigned __int8)var_value; |
0 | 8632 goto LABEL_84; |
8633 case VAR_WaterResistance: | |
492 | 8634 this->sResWaterBase = (unsigned __int8)var_value; |
0 | 8635 goto LABEL_84; |
8636 case VAR_EarthResistance: | |
492 | 8637 this->sResEarthBase = (unsigned __int8)var_value; |
0 | 8638 goto LABEL_84; |
8639 case VAR_SpiritResistance: | |
492 | 8640 this->sResSpiritBase = (unsigned __int8)var_value; |
0 | 8641 goto LABEL_84; |
8642 case VAR_MindResistance: | |
492 | 8643 this->sResMindBase = (unsigned __int8)var_value; |
0 | 8644 goto LABEL_84; |
8645 case VAR_BodyResistance: | |
492 | 8646 this->sResBodyBase = (unsigned __int8)var_value; |
0 | 8647 goto LABEL_84; |
8648 case VAR_LightResistance: | |
492 | 8649 this->sResLightBase = (unsigned __int8)var_value; |
0 | 8650 goto LABEL_84; |
8651 case VAR_DarkResistance: | |
492 | 8652 this->sResDarkBase = (unsigned __int8)var_value; |
0 | 8653 goto LABEL_84; |
8654 case VAR_MagicResistance: | |
492 | 8655 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8656 LABEL_84: |
8657 v28 = 0; | |
8658 v26 = 92; | |
8659 goto LABEL_112; | |
8660 default: | |
8661 return; | |
8662 } | |
8663 return; | |
8664 } | |
8665 HIWORD(v15) = 0; | |
492 | 8666 if ( var_type > VAR_DisarmTrapSkill ) |
8667 { | |
8668 if ( var_type != VAR_LearningSkill ) | |
8669 { | |
8670 if ( var_type <= VAR_LearningSkill ) | |
0 | 8671 return; |
492 | 8672 if ( var_type <= VAR_Eradicated ) |
8673 { | |
8674 v4->SetCondition(var_type - 105, 1); | |
0 | 8675 } |
8676 else | |
8677 { | |
492 | 8678 if ( var_type != VAR_MajorCondition ) |
0 | 8679 { |
492 | 8680 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8681 byte_5E4C15[var_type] = var_value; | |
0 | 8682 return; |
8683 } | |
8684 memset(v4, 0, 0xA0u); | |
8685 } | |
8686 LABEL_124: | |
8687 v31 = 1; | |
8688 goto LABEL_169; | |
8689 } | |
8690 LABEL_106: | |
492 | 8691 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); |
0 | 8692 v17 = *(char *)v16; |
492 | 8693 if ( var_value <= VAR_BodyResistanceBonus ) |
8694 { | |
8695 LOWORD(v15) = (unsigned __int8)var_value; | |
0 | 8696 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8697 } | |
8698 else | |
8699 { | |
492 | 8700 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
0 | 8701 } |
8702 *(short *)v16 = v18; | |
8703 goto LABEL_124; | |
8704 } | |
492 | 8705 if ( var_type == VAR_DisarmTrapSkill ) |
8706 if ( v30 != 1 ) | |
8707 { | |
8708 if ( v31 != 1 ) | |
8709 return; | |
8710 v5 = 0; | |
8711 goto LABEL_172; | |
8712 } | |
8713 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8714 goto LABEL_170; | |
8715 if ( var_type <= VAR_BodyResistanceBonus ) | |
8716 { | |
8717 switch ( var_type ) | |
0 | 8718 { |
8719 case VAR_BodyResistanceBonus: | |
492 | 8720 v4->sResBodyBonus = (unsigned __int8)var_value; |
0 | 8721 break; |
8722 case VAR_AirResistanceBonus: | |
492 | 8723 v4->sResAirBonus = (unsigned __int8)var_value; |
0 | 8724 break; |
8725 case VAR_WaterResistanceBonus: | |
492 | 8726 v4->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8727 break; |
8728 case VAR_EarthResistanceBonus: | |
492 | 8729 v4->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8730 break; |
8731 case VAR_SpiritResistanceBonus: | |
492 | 8732 v4->sResSpiritBonus = (unsigned __int8)var_value; |
0 | 8733 break; |
8734 default: | |
492 | 8735 if ( var_type != 62 ) |
0 | 8736 return; |
492 | 8737 v4->sResMindBonus = (unsigned __int8)var_value; |
0 | 8738 break; |
8739 } | |
8740 goto LABEL_111; | |
8741 } | |
492 | 8742 if ( var_type == VAR_LightResistanceBonus ) |
8743 { | |
8744 v4->sResLightBonus = (unsigned __int8)var_value; | |
0 | 8745 goto LABEL_111; |
8746 } | |
492 | 8747 if ( var_type == VAR_DarkResistanceBonus ) |
8748 { | |
8749 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8750 goto LABEL_111; | |
8751 } | |
8752 if ( var_type == VAR_MagicResistanceBonus ) | |
8753 { | |
8754 v4->sResMagicBonus = (unsigned __int8)var_value; | |
0 | 8755 goto LABEL_111; |
8756 } | |
492 | 8757 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8758 if ( v30 != 1 ) | |
8759 { | |
8760 if ( v31 != 1 ) | |
8761 return; | |
8762 v5 = 0; | |
8763 v25 = 8 * currPlayerId + 400; | |
862 | 8764 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
492 | 8765 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8766 return; | |
8767 } | |
8768 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8769 goto LABEL_170; | |
0 | 8770 } |
8771 | |
8772 | |
8773 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8774 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8775 { |
8776 char v3; // bl@1 | |
8777 Player *v4; // esi@1 | |
8778 signed int uPlayerIdx; // edi@1 | |
8779 int v6; // eax@15 | |
8780 unsigned int v7; // esi@18 | |
8781 int *v8; // ebx@21 | |
8782 int v9; // eax@22 | |
8783 signed int v10; // eax@24 | |
8784 int v11; // eax@27 | |
8785 __int16 *v12; // esi@28 | |
8786 Player *v13; // ecx@34 | |
8787 Player *v14; // ecx@36 | |
8788 char *v15; // ecx@37 | |
8789 unsigned __int8 v16; // cf@38 | |
8790 Player *v17; // ecx@42 | |
8791 __int16 *v18; // esi@53 | |
8792 __int16 *v19; // esi@62 | |
8793 char *v20; // esi@107 | |
8794 __int16 v21; // dx@107 | |
8795 int v22; // ecx@107 | |
8796 Player *v23; // ecx@132 | |
8797 int v24; // eax@132 | |
8798 int v25; // eax@150 | |
8799 char v26; // zf@151 | |
8800 DDM_DLV_Header *v27; // eax@153 | |
8801 signed int v28; // eax@176 | |
8802 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8803 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8804 int v31; // [sp-4h] [bp-3Ch]@84 |
8805 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8806 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8807 char v34; // [sp+37h] [bp-1h]@1 | |
8808 | |
8809 auto Dst = this; | |
8810 v3 = 0; | |
8811 v34 = 0; | |
8812 v4 = Dst; | |
8813 uPlayerIdx = 0; | |
8814 if ( Dst == pPlayers[2] ) | |
8815 uPlayerIdx = 1; | |
310 | 8816 else if ( Dst == pPlayers[3] ) |
8817 uPlayerIdx = 2; | |
8818 else if ( Dst == pPlayers[4] ) | |
8819 uPlayerIdx = 3; | |
8820 | |
8821 if ( var_type <= VAR_AutoNotes ) | |
8822 { | |
8823 if ( var_type != VAR_AutoNotes ) | |
8824 { | |
8825 if ( var_type <= VAR_ActualMight ) | |
8826 { | |
8827 if ( var_type != VAR_ActualMight ) | |
0 | 8828 { |
310 | 8829 switch ( var_type ) |
0 | 8830 { |
8831 case VAR_RandomGold: | |
8832 if ( !val ) | |
8833 val = 1; | |
8834 v6 = rand(); | |
8835 party_finds_gold(v6 % val + 1, 1); | |
8836 GameUI_DrawFoodAndGold(); | |
8837 return; | |
8838 case VAR_RandomFood: | |
8839 if ( !val ) | |
8840 val = 1; | |
8841 v7 = rand() % val + 1; | |
8842 Party::GiveFood(v7); | |
8843 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | |
8844 ShowStatusBarString(pTmpBuf, 2u); | |
8845 GameUI_DrawFoodAndGold(); | |
8846 goto _play_sound; | |
8847 case VAR_Sex: | |
8848 Dst->uSex = (PLAYER_SEX)val; | |
8849 goto _play_anim_and_exit; | |
8850 case VAR_Class: | |
135 | 8851 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8852 goto _play_anim_and_exit; |
8853 case VAR_CurrentHP: | |
8854 v8 = &Dst->sHealth; | |
8855 *v8 += val; | |
8856 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8857 goto _play_anim_and_exit; | |
8858 v9 = v4->GetMaxHealth(); | |
8859 goto LABEL_23; | |
8860 case VAR_MaxHP: | |
8861 v10 = Dst->GetMaxHealth(); | |
8862 v4->_health_related = 0; | |
8863 v4->uFullHealthBonus = 0; | |
8864 v4->sHealth = v10; | |
8865 return; | |
8866 case VAR_CurrentSP: | |
8867 v8 = &Dst->sMana; | |
8868 *v8 += val; | |
8869 if ( Dst->sMana > GetMaxMana() ) | |
8870 { | |
8871 v9 = v4->GetMaxMana(); | |
8872 LABEL_23: | |
8873 *v8 = v9; | |
8874 } | |
8875 goto _play_anim_and_exit; | |
8876 case VAR_MaxSP: | |
8877 v11 = GetMaxMana(); | |
8878 v4->_mana_related = 0; | |
8879 v4->uFullManaBonus = 0; | |
8880 v4->sMana = v11; | |
8881 return; | |
8882 case VAR_ACModifier: | |
8883 v12 = &Dst->sACModifier; | |
8884 goto LABEL_29; | |
8885 case VAR_BaseLevel: | |
8886 v12 = (__int16 *)&Dst->uLevel; | |
8887 goto LABEL_29; | |
8888 case VAR_LevelModifier: | |
8889 v12 = &Dst->sLevelModifier; | |
8890 LABEL_29: | |
8891 *v12 += val; | |
8892 if ( *v12 > 255 ) | |
8893 *v12 = 255; | |
8894 goto _play_anim_and_exit; | |
8895 case VAR_Age: | |
8896 Dst->sAgeModifier += val; | |
8897 return; | |
8898 case VAR_Award: | |
8899 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8900 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8901 | |
492 | 8902 && pAwards[val].pText ) |
0 | 8903 { |
8904 v14 = pPlayers[uPlayerIdx + 1]; | |
8905 v34 = 1; | |
8906 v3 = 1; | |
187 | 8907 v14->PlaySound(SPEECH_96, 0); |
0 | 8908 } |
735 | 8909 v15 = (char *)v4->_guilds_member_bits; |
0 | 8910 goto LABEL_44; |
8911 case VAR_Experience: | |
8912 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8913 LODWORD(Dst->uExperience) += val; | |
8914 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8915 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8916 Dst->uExperience = 4000000000i64; | |
8917 goto _play_anim_and_exit; | |
8918 case VAR_QBits_QuestsDone: | |
484 | 8919 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
|
8920 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8921 && pQuestTable[val-1] ) |
0 | 8922 { |
501 | 8923 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8924 bFlashQuestBook = 1; |
8925 v34 = 1; | |
8926 v3 = 1; | |
501 | 8927 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8928 } |
484 | 8929 v15 = (char *)pParty->_quest_bits; |
0 | 8930 LABEL_44: |
8931 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8932 goto LABEL_173; | |
8933 case VAR_PlayerItemInHands: | |
8934 item.Reset(); | |
8935 item.Reset(); | |
8936 item.uAttributes = 1; | |
8937 item.uItemID = val; | |
8938 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8939 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8940 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8941 { | |
8942 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8943 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8944 } | |
8945 pParty->SetHoldingItem(&item); | |
8946 return; | |
8947 case VAR_FixedGold: | |
8948 party_finds_gold(val, 1); | |
8949 return; | |
8950 case VAR_BaseMight: | |
8951 v18 = (__int16 *)&Dst->uMight; | |
8952 goto LABEL_82; | |
8953 case VAR_BaseIntellect: | |
8954 v18 = (__int16 *)&Dst->uIntelligence; | |
8955 goto LABEL_82; | |
8956 case VAR_BasePersonality: | |
8957 v18 = (__int16 *)&Dst->uWillpower; | |
8958 goto LABEL_82; | |
8959 case VAR_BaseEndurance: | |
8960 v18 = (__int16 *)&Dst->uEndurance; | |
8961 goto LABEL_82; | |
8962 case VAR_BaseSpeed: | |
8963 v18 = (__int16 *)&Dst->uSpeed; | |
8964 goto LABEL_82; | |
8965 case VAR_BaseAccuracy: | |
8966 v18 = (__int16 *)&Dst->uAccuracy; | |
8967 goto LABEL_82; | |
8968 case VAR_BaseLuck: | |
8969 v18 = (__int16 *)&Dst->uLuck; | |
8970 goto LABEL_82; | |
8971 case VAR_FixedFood: | |
8972 Party::GiveFood(val); | |
715 | 8973 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val); |
0 | 8974 ShowStatusBarString(pTmpBuf, 2u); |
8975 if ( pParty->uNumFoodRations > 0xFFFF ) | |
8976 Party::SetFood(0xFFFFu); | |
8977 goto _play_sound; | |
8978 case VAR_MightBonus: | |
8979 goto LABEL_62; | |
8980 case VAR_IntellectBonus: | |
8981 goto LABEL_66; | |
8982 case VAR_PersonalityBonus: | |
8983 goto LABEL_67; | |
8984 case VAR_EnduranceBonus: | |
8985 goto LABEL_68; | |
8986 case VAR_SpeedBonus: | |
8987 goto LABEL_69; | |
8988 case VAR_AccuracyBonus: | |
8989 goto LABEL_70; | |
8990 case VAR_LuckBonus: | |
8991 goto LABEL_71; | |
8992 default: | |
8993 return; | |
8994 } | |
8995 return; | |
8996 } | |
8997 LABEL_62: | |
8998 v19 = (__int16 *)&Dst->uMightBonus; | |
8999 goto LABEL_113; | |
9000 } | |
310 | 9001 if ( var_type <= VAR_FireResistanceBonus ) |
9002 { | |
9003 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 9004 { |
310 | 9005 switch ( var_type ) |
0 | 9006 { |
9007 case VAR_ActualIntellect: | |
9008 LABEL_66: | |
9009 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
9010 goto LABEL_113; | |
9011 case VAR_ActualPersonality: | |
9012 LABEL_67: | |
9013 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
9014 goto LABEL_113; | |
9015 case VAR_ActualEndurance: | |
9016 LABEL_68: | |
9017 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
9018 goto LABEL_113; | |
9019 case VAR_ActualSpeed: | |
9020 LABEL_69: | |
9021 v19 = (__int16 *)&Dst->uSpeedBonus; | |
9022 goto LABEL_113; | |
9023 case VAR_ActualAccuracy: | |
9024 LABEL_70: | |
9025 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
9026 goto LABEL_113; | |
9027 case VAR_ActualLuck: | |
9028 LABEL_71: | |
9029 v19 = (__int16 *)&Dst->uLuckBonus; | |
9030 goto LABEL_113; | |
9031 case VAR_FireResistance: | |
9032 v18 = &Dst->sResFireBase; | |
9033 goto LABEL_82; | |
9034 case VAR_AirResistance: | |
9035 v18 = &Dst->sResAirBase; | |
9036 goto LABEL_82; | |
9037 case VAR_WaterResistance: | |
9038 v18 = &Dst->sResWaterBase; | |
9039 goto LABEL_82; | |
9040 case VAR_EarthResistance: | |
9041 v18 = &Dst->sResEarthBase; | |
9042 goto LABEL_82; | |
9043 case VAR_SpiritResistance: | |
9044 v18 = &Dst->sResSpiritBase; | |
9045 goto LABEL_82; | |
9046 case VAR_MindResistance: | |
9047 v18 = &Dst->sResMindBase; | |
9048 goto LABEL_82; | |
9049 case VAR_BodyResistance: | |
9050 v18 = &Dst->sResBodyBase; | |
9051 goto LABEL_82; | |
9052 case VAR_LightResistance: | |
9053 v18 = &Dst->sResLightBase; | |
9054 goto LABEL_82; | |
9055 case VAR_DarkResistance: | |
9056 v18 = &Dst->sResDarkBase; | |
9057 goto LABEL_82; | |
9058 case VAR_MagicResistance: | |
9059 v18 = &Dst->sResMagicBase; | |
9060 LABEL_82: | |
9061 *v18 += val; | |
9062 if ( *v18 > 255 ) | |
9063 *v18 = 255; | |
9064 v31 = 0; | |
9065 v29 = 92; | |
9066 goto LABEL_116; | |
9067 default: | |
9068 return; | |
9069 } | |
9070 return; | |
9071 } | |
9072 v19 = &Dst->sResFireBonus; | |
9073 LABEL_113: | |
9074 *v19 += val; | |
9075 if ( *v19 > 255 ) | |
9076 *v19 = 255; | |
9077 v31 = 0; | |
187 | 9078 v29 = SPEECH_91; |
0 | 9079 LABEL_116: |
9080 v3 = 1; | |
187 | 9081 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 9082 goto _play_anim_and_maybe_sound; |
9083 } | |
310 | 9084 if ( var_type <= VAR_DisarmTrapSkill ) |
9085 { | |
9086 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 9087 { |
310 | 9088 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 9089 { |
310 | 9090 switch ( var_type ) |
0 | 9091 { |
9092 case VAR_BodyResistanceBonus: | |
9093 v19 = &Dst->sResBodyBonus; | |
9094 break; | |
9095 case VAR_AirResistanceBonus: | |
9096 v19 = &Dst->sResAirBonus; | |
9097 break; | |
9098 case VAR_WaterResistanceBonus: | |
9099 v19 = &Dst->sResWaterBonus; | |
9100 break; | |
9101 case VAR_EarthResistanceBonus: | |
9102 v19 = &Dst->sResEarthBonus; | |
9103 break; | |
9104 case VAR_SpiritResistanceBonus: | |
9105 v19 = &Dst->sResSpiritBonus; | |
9106 break; | |
9107 default: | |
310 | 9108 if ( var_type != 62 ) |
0 | 9109 return; |
9110 v19 = &Dst->sResMindBonus; | |
9111 break; | |
9112 } | |
9113 goto LABEL_113; | |
9114 } | |
310 | 9115 if ( var_type == VAR_LightResistanceBonus ) |
0 | 9116 { |
9117 v19 = &Dst->sResLightBonus; | |
9118 goto LABEL_113; | |
9119 } | |
310 | 9120 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 9121 { |
9122 v19 = &Dst->sResDarkBonus; | |
9123 goto LABEL_113; | |
9124 } | |
310 | 9125 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 9126 { |
9127 v19 = &Dst->sResMagicBonus; | |
9128 goto LABEL_113; | |
9129 } | |
310 | 9130 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 9131 return; |
9132 } | |
9133 goto LABEL_106; | |
9134 } | |
310 | 9135 if ( var_type == VAR_LearningSkill ) |
0 | 9136 { |
9137 LABEL_106: | |
9138 if ( val <= VAR_BodyResistanceBonus ) | |
9139 { | |
310 | 9140 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 9141 } |
9142 else | |
9143 { | |
310 | 9144 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 9145 v21 = *(short *)v20; |
9146 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
9147 if ( v22 > 60 ) | |
9148 LOWORD(v22) = 60; | |
9149 LOBYTE(v21) = v21 & 0xC0; | |
9150 *(short *)v20 = v22 | v21; | |
9151 } | |
9152 goto _play_anim_and_exit; | |
9153 } | |
310 | 9154 if ( var_type <= VAR_LearningSkill ) |
0 | 9155 return; |
310 | 9156 if ( var_type <= VAR_Eradicated ) |
9157 { | |
9158 Dst->SetCondition(var_type - 105, 0); | |
0 | 9159 } |
9160 else | |
9161 { | |
310 | 9162 if ( var_type != VAR_MajorCondition ) |
0 | 9163 { |
310 | 9164 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 9165 { |
310 | 9166 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
9167 byte_5E4C15[var_type] += val; | |
0 | 9168 else |
310 | 9169 byte_5E4C15[var_type] = -1; |
0 | 9170 } |
9171 return; | |
9172 } | |
9173 memset(Dst, 0, 0xA0u); | |
9174 } | |
9175 _play_anim_and_exit: | |
9176 v3 = 1; | |
9177 _play_anim_and_maybe_sound: | |
9178 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
9179 _maybe_play_sound: | |
9180 if ( v3 != 1 ) | |
9181 return; | |
9182 goto _play_sound; | |
9183 } | |
9184 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
|
9185 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9186 && pAutonoteTxt[val-1].pText ) |
0 | 9187 { |
9188 v23 = pPlayers[uPlayerIdx + 1]; | |
9189 v34 = 1; | |
187 | 9190 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
9191 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 9192 bFlashAutonotesBook = 1; |
9193 dword_506568 = v24; | |
9194 } | |
9195 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
9196 v3 = 1; | |
9197 LABEL_173: | |
9198 if ( v34 != 1 ) | |
9199 goto _maybe_play_sound; | |
9200 goto _play_anim_and_maybe_sound; | |
9201 } | |
310 | 9202 if ( var_type > VAR_GoldInBank ) |
9203 { | |
9204 if ( var_type == 307 ) | |
0 | 9205 { |
9206 pParty->uNumDeaths += val; | |
9207 goto LABEL_173; | |
9208 } | |
310 | 9209 switch ( var_type ) |
0 | 9210 { |
9211 case 308: | |
9212 pParty->uNumBountiesCollected += val; | |
9213 break; | |
9214 case 309: | |
9215 pParty->uNumPrisonTerms += val; | |
9216 break; | |
9217 case 310: | |
9218 pParty->uNumArenaPageWins += val; | |
9219 break; | |
9220 case 311: | |
9221 pParty->uNumArenaSquireWins += val; | |
9222 break; | |
9223 case 312: | |
9224 pParty->uNumArenaKnightWins += val; | |
9225 break; | |
9226 case 313: | |
9227 pParty->uNumArenaLordWins += val; | |
9228 break; | |
9229 } | |
9230 } | |
9231 else | |
9232 { | |
310 | 9233 if ( var_type == VAR_GoldInBank ) |
0 | 9234 { |
9235 pParty->uNumGoldInBank += val; | |
9236 return; | |
9237 } | |
310 | 9238 if ( var_type <= VAR_Counter8 ) |
9239 { | |
9240 if ( (signed int)var_type >= 245 ) | |
9241 { | |
9242 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
9243 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 9244 } |
9245 else | |
9246 { | |
310 | 9247 switch ( var_type ) |
0 | 9248 { |
9249 case VAR_MonthEquals|VAR_CurrentSP: | |
9250 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
9251 break; | |
9252 case VAR_NPCs2: | |
9253 pParty->field_709 = 0; | |
9254 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
659 | 9255 Party__CountHirelings(); |
0 | 9256 viewparams->bRedrawGameUI = 1; |
9257 break; | |
9258 case VAR_NumSkillPoints: | |
9259 Dst->uSkillPoints += val; | |
9260 break; | |
9261 } | |
9262 } | |
9263 return; | |
9264 } | |
310 | 9265 if ( var_type < VAR_Counter9 ) |
0 | 9266 return; |
310 | 9267 if ( (signed int)var_type <= 274 ) |
9268 { | |
9269 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
9270 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 9271 goto _play_sound; |
9272 } | |
310 | 9273 if ( var_type != VAR_ReputationInCurrentLocation ) |
9274 { | |
9275 if ( var_type <= VAR_ReputationInCurrentLocation | |
9276 || var_type > VAR_History_28 | |
9277 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
9278 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 9279 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 9280 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 9281 v26) ) |
9282 return; | |
9283 bFlashHistoryBook = 1; | |
9284 _play_sound: | |
9285 v28 = 8 * uPlayerIdx + 400; | |
862 | 9286 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 9287 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
9288 return; | |
9289 } | |
9290 v27 = &pOutdoor->ddm; | |
9291 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9292 v27 = &pIndoor->dlv; | |
9293 v27->uReputation += val; | |
9294 if ( v27->uReputation > 10000 ) | |
9295 v27->uReputation = 10000; | |
9296 } | |
9297 } | |
9298 // 506568: using guessed type int dword_506568; | |
9299 // 507948: using guessed type char bFlashHistoryBook; | |
9300 // 507949: using guessed type char bFlashAutonotesBook; | |
9301 // 50794A: using guessed type char bFlashQuestBook; | |
9302 // 72371C: using guessed type int dword_72371C[]; | |
9303 // 723E80: using guessed type int dword_723E80_award_related[]; | |
9304 | |
9305 | |
9306 | |
9307 | |
9308 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 9309 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 9310 { |
9311 unsigned int v3; // ebx@1 | |
9312 signed int v4; // esi@1 | |
501 | 9313 bool result; // eax@8 |
0 | 9314 int v6; // esi@11 |
9315 int v7; // edi@14 | |
9316 signed int v8; // eax@17 | |
9317 char *v9; // eax@20 | |
9318 char v10; // sf@20 | |
9319 char *v11; // ecx@26 | |
9320 char *v12; // ecx@27 | |
9321 __int64 v13; // qax@27 | |
9322 unsigned __int8 v14; // cf@27 | |
501 | 9323 int *v15; // edx@29 |
0 | 9324 char *v16; // eax@90 |
9325 char *v17; // ecx@94 | |
501 | 9326 int v18; // esi@97 |
0 | 9327 signed int v19; // edx@97 |
9328 char *v20; // ecx@98 | |
9329 int v21; // eax@100 | |
9330 __int16 v22; // dx@112 | |
9331 int v23; // [sp-8h] [bp-14h]@45 | |
9332 signed int v24; // [sp-4h] [bp-10h]@4 | |
9333 int v25; // [sp-4h] [bp-10h]@45 | |
9334 | |
9335 v3 = 0; | |
605 | 9336 v4 = uActiveCharacter - 1; |
501 | 9337 result = false; |
9338 if ( (signed int)VarNum > 222 ) | |
9339 { | |
9340 if ( (signed int)VarNum <= 307 ) | |
9341 { | |
9342 if ( VarNum == 307 ) | |
9343 { | |
9344 pParty->uNumDeaths -= (unsigned int)pValue; | |
9345 return pValue; | |
9346 } | |
9347 if ( VarNum == 223 ) | |
0 | 9348 { |
9349 v11 = (char *)pParty->_autonote_bits; | |
501 | 9350 v22 = (short)pValue - 1; |
0 | 9351 } |
9352 else | |
9353 { | |
501 | 9354 if ( VarNum != 231 ) |
0 | 9355 { |
501 | 9356 switch ( VarNum ) |
0 | 9357 { |
9358 case 232: | |
501 | 9359 VarNum = (VariableType)0; |
602 | 9360 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int)&VarNum); |
501 | 9361 result = (bool) pValue; |
9362 dword_5B65CC = 0; | |
9363 if ( (int)VarNum == pValue ) | |
0 | 9364 { |
501 | 9365 dword_5B65CC = (int)pValue; |
0 | 9366 } |
9367 else | |
9368 { | |
9369 pParty->field_709 = 0; | |
501 | 9370 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
659 | 9371 Party__CountHirelings(); |
0 | 9372 viewparams->bRedrawGameUI = 1; |
9373 } | |
9374 break; | |
9375 case 241: | |
9376 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
9377 { | |
9378 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 9379 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 9380 { |
605 | 9381 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 9382 { |
9383 v21 = *(int *)v20; | |
9384 if ( (char)*(int *)v20 < 0 ) | |
9385 { | |
9386 LOBYTE(v21) = v21 & 0x7F; | |
9387 *(int *)v20 = v21; | |
9388 } | |
9389 } | |
9390 v20 += 76; | |
9391 } | |
9392 } | |
605 | 9393 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 9394 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 9395 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 9396 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
9397 pParty->field_709 = 0; | |
659 | 9398 Party__CountHirelings(); |
0 | 9399 break; |
9400 case 243: | |
9401 v17 = (char *)&this->uSkillPoints; | |
501 | 9402 result = *v17; |
9403 if ( (unsigned int)pValue <= *(int *)v17 ) | |
9404 { | |
9405 *(int *)v17 -= (int)pValue; | |
9406 result = v17; | |
9407 } | |
0 | 9408 else |
9409 *(int *)v17 = 0; | |
9410 break; | |
9411 case 275: | |
9412 v16 = (char *)&pOutdoor->ddm; | |
9413 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9414 v16 = (char *)&pIndoor->dlv; | |
501 | 9415 *((int *)v16 + 2) -= (int)pValue; |
0 | 9416 if ( *((int *)v16 + 2) < -10000 ) |
9417 *((int *)v16 + 2) = -10000; | |
9418 break; | |
9419 case 306: | |
501 | 9420 result = VarNum - 306; |
9421 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9422 { | |
9423 result = (bool)pValue; | |
9424 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9425 } |
0 | 9426 else |
9427 LABEL_88: | |
9428 dword_5B65C4 = 1; | |
9429 break; | |
9430 } | |
501 | 9431 return result; |
0 | 9432 } |
9433 v11 = this->field_1A50; | |
501 | 9434 v22 = (signed __int16)pValue; |
0 | 9435 } |
9436 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9437 return result; |
9438 } | |
9439 switch ( VarNum ) | |
0 | 9440 { |
9441 case 308: | |
501 | 9442 result = (bool)pValue; |
9443 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9444 break; |
9445 case 309: | |
501 | 9446 result = (bool)pValue; |
9447 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9448 break; |
9449 case 310: | |
501 | 9450 result = (bool)pValue; |
9451 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9452 break; |
9453 case 311: | |
501 | 9454 result = (bool)pValue; |
9455 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9456 break; |
9457 case 312: | |
501 | 9458 result = (bool)pValue; |
9459 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9460 break; |
9461 case 313: | |
501 | 9462 result = (bool)pValue; |
9463 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9464 break; |
9465 } | |
9466 } | |
9467 else | |
9468 { | |
501 | 9469 if ( (signed int)VarNum >= 123 ) |
9470 { | |
9471 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9472 } |
9473 else | |
9474 { | |
501 | 9475 switch ( VarNum ) |
0 | 9476 { |
9477 case VAR_RandomGold: | |
501 | 9478 v6 = rand() % (signed int)pValue + 1; |
0 | 9479 if ( v6 > pParty->uNumGold ) |
9480 v6 = pParty->uNumGold; | |
9481 Party::TakeGold(v6); | |
9482 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6); | |
605 | 9483 ShowStatusBarString(pTmpBuf, 2); |
0 | 9484 GameUI_DrawFoodAndGold(); |
501 | 9485 return result; |
0 | 9486 case VAR_RandomFood: |
501 | 9487 v7 = rand() % (signed int)pValue + 1; |
0 | 9488 if ( v7 > pParty->uNumFoodRations ) |
9489 v7 = pParty->uNumFoodRations; | |
9490 Party::TakeFood(v7); | |
9491 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7); | |
9492 ShowStatusBarString(pTmpBuf, 2u); | |
9493 GameUI_DrawFoodAndGold(); | |
605 | 9494 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9495 v8 = 8 * v4 + 400; | |
862 | 9496 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9497 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9498 return result; |
0 | 9499 case VAR_CurrentHP: |
501 | 9500 ReceiveDamage((signed int)pValue, 4); |
605 | 9501 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9502 v8 = 8 * v4 + 400; | |
862 | 9503 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9504 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9505 return result; | |
0 | 9506 case VAR_CurrentSP: |
9507 v9 = (char *)&this->sMana; | |
501 | 9508 v10 = this->sMana - (signed int)pValue < 0; |
9509 *(int *)v9 -= (int)pValue; | |
0 | 9510 if ( v10 ) |
9511 *(int *)v9 = 0; | |
605 | 9512 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9513 v8 = 8 * v4 + 400; | |
862 | 9514 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9515 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9516 return result; | |
0 | 9517 case VAR_ACModifier: |
501 | 9518 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9519 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9520 v8 = 8 * v4 + 400; | |
862 | 9521 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9522 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9523 return result; | |
0 | 9524 case VAR_BaseLevel: |
501 | 9525 this->uLevel -= (unsigned __int8)pValue; |
605 | 9526 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9527 v8 = 8 * v4 + 400; | |
862 | 9528 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9529 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9530 return result; | |
0 | 9531 case VAR_LevelModifier: |
501 | 9532 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9533 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9534 v8 = 8 * v4 + 400; | |
862 | 9535 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9536 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9537 return result; | |
0 | 9538 case VAR_Age: |
501 | 9539 this->sAgeModifier -= (signed __int16)pValue; |
9540 return result; | |
0 | 9541 case VAR_Award: |
605 | 9542 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9543 return result; | |
0 | 9544 case VAR_Experience: |
9545 v12 = (char *)&this->uExperience; | |
501 | 9546 v13 = (signed int)pValue; |
9547 v14 = *(int *)v12 < (unsigned int)pValue; | |
9548 *(int *)v12 -= (int)pValue; | |
0 | 9549 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9550 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9551 v8 = 8 * v4 + 400; | |
862 | 9552 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9553 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9554 return result; | |
0 | 9555 case VAR_QBits_QuestsDone: |
501 | 9556 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9557 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9558 return true; |
0 | 9559 case VAR_PlayerItemInHands: |
501 | 9560 v15 = this->pInventoryIndices; |
0 | 9561 break; |
9562 case VAR_FixedGold: | |
501 | 9563 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9564 goto LABEL_88; |
501 | 9565 Party::TakeGold((unsigned int)pValue); |
9566 return result; | |
0 | 9567 case VAR_MightBonus: |
9568 case VAR_ActualMight: | |
501 | 9569 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9570 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9571 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9572 v8 = 8 * v4 + 400; | |
862 | 9573 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9574 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9575 return result; | |
0 | 9576 case VAR_IntellectBonus: |
9577 case VAR_ActualIntellect: | |
501 | 9578 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9579 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9580 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9581 v8 = 8 * v4 + 400; | |
862 | 9582 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9583 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9584 return result; | |
0 | 9585 case VAR_PersonalityBonus: |
9586 case VAR_ActualPersonality: | |
501 | 9587 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9588 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9589 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9590 v8 = 8 * v4 + 400; | |
862 | 9591 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9592 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9593 return result; | |
0 | 9594 case VAR_EnduranceBonus: |
9595 case VAR_ActualEndurance: | |
501 | 9596 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9597 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9598 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9599 v8 = 8 * v4 + 400; | |
862 | 9600 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9601 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9602 return result; | |
0 | 9603 case VAR_SpeedBonus: |
9604 case VAR_ActualSpeed: | |
501 | 9605 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9606 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9607 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9608 v8 = 8 * v4 + 400; | |
862 | 9609 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9610 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9611 return result; | |
0 | 9612 case VAR_AccuracyBonus: |
9613 case VAR_ActualAccuracy: | |
501 | 9614 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9615 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9616 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9617 v8 = 8 * v4 + 400; | |
862 | 9618 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9619 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9620 return result; | |
0 | 9621 case VAR_LuckBonus: |
9622 case VAR_ActualLuck: | |
501 | 9623 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9624 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9625 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9626 v8 = 8 * v4 + 400; | |
862 | 9627 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9628 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9629 return result; | |
0 | 9630 case VAR_BaseMight: |
501 | 9631 this->uMight -= (unsigned __int16)pValue; |
605 | 9632 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9633 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9634 v8 = 8 * v4 + 400; | |
862 | 9635 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9636 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9637 return result; | |
0 | 9638 case VAR_BaseIntellect: |
501 | 9639 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9640 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9641 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9642 v8 = 8 * v4 + 400; | |
862 | 9643 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9644 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9645 return result; | |
0 | 9646 case VAR_BasePersonality: |
501 | 9647 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9648 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9649 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9650 v8 = 8 * v4 + 400; | |
862 | 9651 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9652 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9653 return result; | |
0 | 9654 case VAR_BaseEndurance: |
501 | 9655 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9656 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9657 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9658 v8 = 8 * v4 + 400; | |
862 | 9659 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9660 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9661 return result; | |
0 | 9662 case VAR_BaseSpeed: |
501 | 9663 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9664 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9665 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9666 v8 = 8 * v4 + 400; | |
862 | 9667 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9668 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9669 return result; | |
0 | 9670 case VAR_BaseAccuracy: |
501 | 9671 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9672 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9673 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9674 v8 = 8 * v4 + 400; | |
862 | 9675 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9676 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9677 return result; | |
0 | 9678 case VAR_BaseLuck: |
501 | 9679 this->uLuck -= (unsigned __int16)pValue; |
605 | 9680 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9681 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9682 v8 = 8 * v4 + 400; | |
862 | 9683 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9684 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9685 return result; | |
0 | 9686 case VAR_FireResistance: |
501 | 9687 this->sResFireBase -= (signed __int16)pValue; |
605 | 9688 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9689 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9690 v8 = 8 * v4 + 400; | |
862 | 9691 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9692 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9693 return result; | |
0 | 9694 case VAR_AirResistance: |
501 | 9695 this->sResAirBase -= (signed __int16)pValue; |
605 | 9696 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9697 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9698 v8 = 8 * v4 + 400; | |
862 | 9699 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9700 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9701 return result; | |
0 | 9702 case VAR_WaterResistance: |
501 | 9703 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9704 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9705 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9706 v8 = 8 * v4 + 400; | |
862 | 9707 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9708 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9709 return result; | |
0 | 9710 case VAR_EarthResistance: |
501 | 9711 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9712 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9713 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9714 v8 = 8 * v4 + 400; | |
862 | 9715 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9716 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9717 return result; | |
0 | 9718 case VAR_SpiritResistance: |
501 | 9719 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9720 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9721 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9722 v8 = 8 * v4 + 400; | |
862 | 9723 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9724 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9725 return result; | |
0 | 9726 case VAR_MindResistance: |
501 | 9727 this->sResMindBase -= (signed __int16)pValue; |
605 | 9728 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9729 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9730 v8 = 8 * v4 + 400; | |
862 | 9731 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9732 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9733 return result; | |
0 | 9734 case VAR_BodyResistance: |
501 | 9735 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9736 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9737 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9738 v8 = 8 * v4 + 400; | |
862 | 9739 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9740 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9741 return result; | |
0 | 9742 case VAR_LightResistance: |
501 | 9743 this->sResLightBase -= (signed __int16)pValue; |
605 | 9744 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9745 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9746 v8 = 8 * v4 + 400; | |
862 | 9747 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9748 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9749 return result; | |
0 | 9750 case VAR_DarkResistance: |
501 | 9751 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9752 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9753 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9754 v8 = 8 * v4 + 400; | |
862 | 9755 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9756 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9757 return result; | |
0 | 9758 case VAR_MagicResistance: |
501 | 9759 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9760 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9761 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9762 v8 = 8 * v4 + 400; | |
862 | 9763 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9764 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9765 return result; | |
0 | 9766 case VAR_FireResistanceBonus: |
501 | 9767 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9768 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9769 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9770 v8 = 8 * v4 + 400; | |
862 | 9771 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9772 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9773 return result; | |
0 | 9774 case VAR_AirResistanceBonus: |
501 | 9775 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9776 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9777 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9778 v8 = 8 * v4 + 400; | |
862 | 9779 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9780 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9781 return result; | |
0 | 9782 case VAR_WaterResistanceBonus: |
501 | 9783 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9784 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9785 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9786 v8 = 8 * v4 + 400; | |
862 | 9787 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9788 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9789 return result; | |
0 | 9790 case VAR_EarthResistanceBonus: |
501 | 9791 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9792 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9793 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9794 v8 = 8 * v4 + 400; | |
862 | 9795 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9796 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9797 return result; | |
0 | 9798 case VAR_SpiritResistanceBonus: |
501 | 9799 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9800 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9801 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9802 v8 = 8 * v4 + 400; | |
862 | 9803 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9804 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9805 return result; | |
0 | 9806 case VAR_MindResistanceBonus: |
501 | 9807 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9808 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9809 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9810 v8 = 8 * v4 + 400; | |
862 | 9811 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9812 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9813 return result; | |
0 | 9814 case VAR_BodyResistanceBonus: |
501 | 9815 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9816 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9817 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9818 v8 = 8 * v4 + 400; | |
862 | 9819 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9820 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9821 return result; | |
0 | 9822 case VAR_LightResistanceBonus: |
501 | 9823 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9824 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9825 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9826 v8 = 8 * v4 + 400; | |
862 | 9827 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9828 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9829 return result; | |
0 | 9830 case VAR_DarkResistanceBonus: |
501 | 9831 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9832 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9833 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9834 v8 = 8 * v4 + 400; | |
862 | 9835 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9836 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9837 return result; | |
0 | 9838 case VAR_MagicResistanceBonus: |
501 | 9839 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9840 v25 = 0; |
187 | 9841 v23 = SPEECH_91; |
9842 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9843 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9844 v8 = 8 * v4 + 400; | |
862 | 9845 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9846 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9847 return result; | |
0 | 9848 case VAR_FixedFood: |
501 | 9849 Party::TakeFood((unsigned int)pValue); |
605 | 9850 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9851 v8 = 8 * v4 + 400; | |
862 | 9852 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9853 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9854 return result; | |
0 | 9855 case VAR_StaffSkill: |
9856 case VAR_SwordSkill: | |
9857 case VAR_DaggerSkill: | |
9858 case VAR_AxeSkill: | |
9859 case VAR_SpearSkill: | |
9860 case VAR_BowSkill: | |
9861 case VAR_MaceSkill: | |
9862 case VAR_BlasterSkill: | |
9863 case VAR_ShieldSkill: | |
9864 case VAR_LeatherSkill: | |
9865 case VAR_SkillChain: | |
9866 case VAR_PlateSkill: | |
9867 case VAR_FireSkill: | |
9868 case VAR_AirSkill: | |
9869 case VAR_WaterSkill: | |
9870 case VAR_EarthSkill: | |
9871 case VAR_SpiritSkill: | |
9872 case VAR_MindSkill: | |
9873 case VAR_BodySkill: | |
9874 case VAR_LightSkill: | |
9875 case VAR_DarkSkill: | |
9876 case VAR_IdentifyItemSkill: | |
9877 case VAR_MerchantSkill: | |
9878 case VAR_RepairSkill: | |
9879 case VAR_BodybuildingSkill: | |
9880 case VAR_MeditationSkill: | |
9881 case VAR_PerceptionSkill: | |
9882 case VAR_DiplomacySkill: | |
9883 case VAR_DisarmTrapSkill: | |
9884 case VAR_LearningSkill: | |
501 | 9885 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9886 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9887 v8 = 8 * v4 + 400; | |
862 | 9888 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9889 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9890 return result; | |
0 | 9891 case VAR_Cursed: |
9892 case VAR_Weak: | |
9893 case VAR_Asleep: | |
9894 case VAR_Afraid: | |
9895 case VAR_Drunk: | |
9896 case VAR_Insane: | |
9897 case VAR_PoisonedGreen: | |
9898 case VAR_DiseasedGreen: | |
9899 case VAR_PoisonedYellow: | |
9900 case VAR_DiseasedYellow: | |
9901 case VAR_PoisonedRed: | |
9902 case VAR_DiseasedRed: | |
9903 case VAR_Paralyzed: | |
9904 case VAR_Unconsious: | |
9905 case VAR_Dead: | |
9906 case VAR_Stoned: | |
9907 case VAR_Eradicated: | |
501 | 9908 *((int *)this + 2 * VarNum - 210) = 0; |
9909 *((int *)this + 2 * result - 209) = 0; | |
0 | 9910 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9911 v8 = 8 * v4 + 400; | |
862 | 9912 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9913 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9914 return result; |
605 | 9915 default: |
9916 return result; | |
9917 } | |
9918 for (v3 = 1; v3 < 126; v3++) | |
9919 { | |
9920 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9921 { |
605 | 9922 RemoveItemAtInventoryIndex(v3); |
501 | 9923 return true; |
0 | 9924 } |
605 | 9925 } |
501 | 9926 if ( pParty->pPickedItem.uItemID == pValue ) |
9927 { | |
605 | 9928 pMouse->RemoveHoldingItem(); |
9929 return true; | |
9930 } | |
9931 return false; | |
0 | 9932 } |
9933 } | |
9934 } | |
9935 // 5B65C4: using guessed type int dword_5B65C4; | |
9936 // 5B65CC: using guessed type int dword_5B65CC; |