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