Mercurial > mm7
annotate Player.cpp @ 1271:5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
author | Grumpy7 |
---|---|
date | Sat, 15 Jun 2013 02:23:04 +0200 |
parents | 2e4a07ad5243 |
children | 19a4809e1da0 |
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 "Player.h" |
11 #include "PlayerFrameTable.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Party.h" | |
816 | 14 #include "Log.h" |
0 | 15 #include "LOD.h" |
16 #include "GUIWindow.h" | |
17 #include "Viewport.h" | |
18 #include "Actor.h" | |
19 #include "Game.h" | |
20 #include "Mouse.h" | |
21 #include "TurnEngine.h" | |
22 #include "Events.h" | |
23 #include "Events2D.h" | |
24 #include "Outdoor.h" | |
25 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
26 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
27 #include "Awards.h" |
189 | 28 #include "texts.h" |
816 | 29 |
0 | 30 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
31 #include "MM7.h" |
0 | 32 |
33 | |
34 | |
35 | |
36 | |
37 | |
38 /* 381 */ | |
39 #pragma pack(push, 1) | |
290 | 40 struct PlayerCreation_AttributeProps |
0 | 41 { |
42 unsigned __int8 uBaseValue; | |
43 char uMaxValue; | |
44 char uDroppedStep; | |
45 char uBaseStep; | |
46 }; | |
47 #pragma pack(pop) | |
48 | |
49 | |
50 #pragma pack(push, 1) | |
290 | 51 |
52 | |
53 | |
0 | 54 #pragma pack(pop) |
290 | 55 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
56 { | |
57 {{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},}, | |
58 {{ 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},}, | |
59 {{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},}, | |
60 {{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 | 61 }; |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 // available skills per class ( 9 classes X 37 skills ) | |
69 // 0 - not available | |
70 // 1 - available | |
71 // 2 - primary skill | |
72 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
73 { | |
74 {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}, | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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}, | |
79 {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}, | |
80 {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}, | |
81 {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}, | |
82 {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 | |
83 }; | |
84 | |
85 | |
86 | |
87 | |
88 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
89 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
90 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}; | |
91 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}; | |
92 | |
93 unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
94 unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
95 unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; | |
96 unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; | |
97 unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
98 unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; | |
99 unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; | |
100 | |
101 unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; | |
102 unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; | |
103 unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; | |
104 unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; | |
105 unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; | |
106 unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; | |
107 unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; | |
108 | |
1036 | 109 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 110 |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
111 std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}}; |
0 | 112 |
1036 | 113 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 114 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 115 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
116 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 | 117 |
118 | |
1010 | 119 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0}; |
120 | |
0 | 121 |
816 | 122 unsigned short base_recovery_times_per_weapon_type[12] = |
123 { | |
124 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
125 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
126 60, // PLAYER_SKILL_DAGGER | |
127 100, // PLAYER_SKILL_AXE | |
128 80, // PLAYER_SKILL_SPEAR | |
129 100, // PLAYER_SKILL_BOW | |
130 80, // PLAYER_SKILL_MACE | |
131 30, // PLAYER_SKILL_BLASTER | |
132 10, // PLAYER_SKILL_SHIELD | |
133 10, // PLAYER_SKILL_LEATHER | |
134 20, // PLAYER_SKILL_CHAIN | |
135 30 // PLAYER_SKILL_PLATE | |
136 }; | |
137 | |
138 | |
0 | 139 |
140 //----- (00490913) -------------------------------------------------------- | |
141 signed int __cdecl PlayerCreation_ComputeAttributeBonus() | |
142 { | |
143 signed int v0; // edi@1 | |
144 signed int v1; // esi@1 | |
145 int v2; // ebx@2 | |
146 int v3; // ecx@17 | |
147 signed int v4; // eax@17 | |
148 int v5; // edx@18 | |
149 signed int v6; // ecx@18 | |
150 signed int v8; // [sp+Ch] [bp-8h]@1 | |
151 signed int v9; // [sp+10h] [bp-4h]@2 | |
152 | |
153 v8 = 50; | |
154 v0 = 50; | |
155 v1 = 0; | |
156 do | |
157 { | |
158 v9 = 0; | |
159 v2 = 7 * pParty->pPlayers[v1].GetRace(); | |
160 do | |
161 { | |
162 if ( v9 ) | |
163 { | |
164 switch ( v9 ) | |
165 { | |
166 case 1: | |
167 v0 = pParty->pPlayers[v1].uIntelligence; | |
168 break; | |
169 case 2: | |
170 v0 = pParty->pPlayers[v1].uWillpower; | |
171 break; | |
172 case 3: | |
173 v0 = pParty->pPlayers[v1].uEndurance; | |
174 break; | |
175 case 4: | |
176 v0 = pParty->pPlayers[v1].uAccuracy; | |
177 break; | |
178 case 5: | |
179 v0 = pParty->pPlayers[v1].uSpeed; | |
180 break; | |
181 case 6: | |
182 v0 = pParty->pPlayers[v1].uLuck; | |
183 break; | |
184 } | |
185 } | |
186 else | |
187 { | |
188 v0 = pParty->pPlayers[v1].uMight; | |
189 } | |
190 v3 = v2 + v9; | |
290 | 191 v4 = StatTable[0][v3].uBaseValue; |
0 | 192 if ( v0 >= v4 ) |
193 { | |
290 | 194 v5 = StatTable[0][v3].uDroppedStep; |
195 v6 = StatTable[0][v3].uBaseStep; | |
0 | 196 } |
197 else | |
198 { | |
290 | 199 v5 = StatTable[0][v3].uBaseStep; |
200 v6 = StatTable[0][v3].uDroppedStep; | |
0 | 201 } |
202 v8 += v5 * (v4 - v0) / v6; | |
203 ++v9; | |
204 } | |
205 while ( v9 <= 6 ); | |
206 ++v1; | |
207 } | |
208 while ( v1 < 4 ); | |
209 return v8; | |
210 } | |
211 | |
212 | |
213 | |
214 //----- (00427730) -------------------------------------------------------- | |
215 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
216 { | |
488 | 217 if (sMana >= uRequiredMana) |
218 { | |
219 sMana -= uRequiredMana; | |
220 return true; | |
221 } | |
222 | |
223 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
224 return false; | |
0 | 225 } |
226 | |
227 | |
228 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 229 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
230 { | |
0 | 231 float v6; // ST04_4@1 |
1014 | 232 signed int item_value; // eax@1 |
233 signed int sell_price; // ebx@1 | |
234 | |
235 item_value =pOwnItems[item_index].GetValue(); | |
236 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
237 sell_price = GetPriceSell(item_value, v6); | |
238 if ( pOwnItems[item_index].Broken() ) | |
239 sell_price = 1; | |
240 if ( sell_price < 1 ) | |
241 sell_price = 1; | |
242 RemoveItemAtInventoryIndex(inventory_idnx); | |
243 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 244 } |
245 | |
246 | |
247 | |
248 //----- (0043EEF3) -------------------------------------------------------- | |
249 bool Player::_43EEF3() | |
250 { | |
1014 | 251 signed int item_idx; // esi@1 |
252 signed int item_id; // esi@1 | |
253 for (int i=0; i<16;++i) | |
254 { | |
255 item_idx=pEquipment.pIndices[i]; | |
256 if (item_idx) | |
257 { | |
258 item_id=pOwnItems[item_idx-1].uItemID; | |
259 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
260 return false; | |
261 } | |
262 } | |
263 return true; | |
264 } | |
265 | |
0 | 266 |
267 | |
268 | |
269 //----- (004B8040) -------------------------------------------------------- | |
1036 | 270 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
271 { | |
272 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 273 } |
274 | |
275 //----- (004B807C) -------------------------------------------------------- | |
276 int Player::_4B807C(float a2) | |
277 { | |
278 Player *v2; // edi@1 | |
279 unsigned int v3; // eax@1 | |
280 int v4; // esi@1 | |
281 unsigned int v5; // ebx@7 | |
282 int v6; // eax@8 | |
283 signed __int64 v7; // qax@13 | |
284 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
285 signed int v10; // [sp+8h] [bp-8h]@4 | |
286 int v11; // [sp+Ch] [bp-4h]@6 | |
287 | |
288 v2 = this; | |
289 v3 = GetMajorConditionIdx(); | |
290 v4 = 0; | |
291 if ( (signed int)v3 >= 14 ) | |
292 { | |
293 if ( (signed int)v3 <= 15 ) | |
294 { | |
295 v10 = 5; | |
296 v9 = v3; | |
297 goto LABEL_6; | |
298 } | |
299 if ( v3 == 16 ) | |
300 { | |
301 v10 = 10; | |
302 v9 = 16; | |
303 LABEL_6: | |
1036 | 304 v11 = GetConditionDayOfWeek(v9); |
0 | 305 goto LABEL_13; |
306 } | |
307 } | |
308 v10 = 1; | |
309 v5 = 0; | |
310 do | |
311 { | |
1036 | 312 v6 = GetConditionDayOfWeek(v5); |
0 | 313 if ( v6 > v4 ) |
314 v4 = v6; | |
315 ++v5; | |
316 } | |
317 while ( (signed int)v5 <= 13 ); | |
318 v11 = v4; | |
319 if ( !v4 ) | |
320 v11 = 1; | |
321 LABEL_13: | |
322 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
323 if ( (signed int)v7 < 1 ) | |
324 LODWORD(v7) = 1; | |
325 return v7; | |
326 } | |
327 | |
328 //----- (004B8102) -------------------------------------------------------- | |
917 | 329 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 330 { |
331 signed int v3; // esi@1 | |
332 signed int result; // eax@3 | |
333 | |
917 | 334 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
335 if ( v3 > uRealValue ) | |
336 v3 = uRealValue; | |
0 | 337 result = 1; |
338 if ( v3 >= 1 ) | |
339 result = v3; | |
340 return result; | |
341 } | |
342 | |
343 //----- (004B8142) -------------------------------------------------------- | |
749 | 344 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
345 { | |
346 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
347 assert (price > 0); | |
348 | |
349 if (price < uRealValue) | |
350 price = uRealValue; | |
351 return price; | |
0 | 352 } |
353 | |
354 //----- (004B8179) -------------------------------------------------------- | |
916 | 355 int Player::GetPriceIdentification(float a2) |
0 | 356 { |
357 signed int v2; // esi@1 | |
358 int v3; // ecx@1 | |
359 signed int result; // eax@3 | |
360 | |
361 v2 = (signed __int64)(a2 * 50.0); | |
362 v3 = v2 * (100 - GetMerchant()) / 100; | |
363 if ( v3 < v2 / 3 ) | |
364 v3 = v2 / 3; | |
365 result = 1; | |
366 if ( v3 >= 1 ) | |
367 result = v3; | |
368 return result; | |
369 } | |
370 | |
371 //----- (004B81C3) -------------------------------------------------------- | |
916 | 372 int Player::GetPriceRepair(int a2, float a3) |
0 | 373 { |
374 signed int v3; // esi@1 | |
375 int v4; // ecx@1 | |
376 signed int result; // eax@3 | |
377 | |
378 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
379 v4 = v3 * (100 - GetMerchant()) / 100; | |
380 if ( v4 < v3 / 3 ) | |
381 v4 = v3 / 3; | |
382 result = 1; | |
383 if ( v4 >= 1 ) | |
384 result = v4; | |
385 return result; | |
386 } | |
387 | |
388 //----- (004B8213) -------------------------------------------------------- | |
389 int Player::_4B8213(int a2, float a3) | |
390 { | |
391 signed __int64 v3; // qax@1 | |
392 | |
393 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
394 if ( (signed int)v3 < 1 ) | |
395 LODWORD(v3) = 1; | |
396 return v3; | |
397 } | |
398 | |
399 //----- (004B8233) -------------------------------------------------------- | |
400 int Player::_4B8233(int a2, float a3) | |
401 { | |
402 signed __int64 v3; // qax@1 | |
403 | |
404 v3 = (signed __int64)((double)a2 * a3); | |
405 if ( (signed int)v3 < 1 ) | |
406 LODWORD(v3) = 1; | |
407 return v3; | |
408 } | |
409 | |
410 //----- (004B824B) -------------------------------------------------------- | |
411 int Player::_4B824B(float a2) | |
412 { | |
413 signed __int64 v2; // qax@1 | |
414 | |
415 v2 = (signed __int64)(a2 * 50.0); | |
416 if ( (signed int)v2 < 1 ) | |
417 LODWORD(v2) = 1; | |
418 return v2; | |
419 } | |
420 | |
421 //----- (004B8265) -------------------------------------------------------- | |
422 int Player::_4B8265(int a2, float a3) | |
423 { | |
424 signed __int64 v3; // qax@1 | |
425 | |
426 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
427 if ( (signed int)v3 < 1 ) | |
428 LODWORD(v3) = 1; | |
429 return v3; | |
430 } | |
431 | |
432 | |
433 | |
434 | |
435 | |
436 //----- (004B6FF9) -------------------------------------------------------- | |
437 int Player::_4B6FF9() | |
438 { | |
439 Player *v1; // esi@1 | |
440 signed int v2; // eax@1 | |
441 char v3; // zf@4 | |
442 | |
443 v1 = this; | |
336 | 444 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 445 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 446 { |
447 if ( GetMajorConditionIdx() == 18 ) | |
448 goto LABEL_6; | |
449 v3 = GetMajorConditionIdx() == 17; | |
450 } | |
451 else | |
452 { | |
453 v3 = GetMajorConditionIdx() == 18; | |
454 } | |
455 if ( !v3 ) | |
456 return 1; | |
457 LABEL_6: | |
458 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
459 return 1; | |
460 return 0; | |
461 } | |
462 | |
463 | |
464 | |
465 //----- (00421E75) -------------------------------------------------------- | |
1012 | 466 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
467 { | |
468 int item_idx; // eax@1 | |
469 int inv_index; // eax@3 | |
470 | |
471 item_idx = *pitem_index; | |
472 if ( item_idx >125 || item_idx < 0 ) | |
473 { | |
474 return 0; | |
475 } | |
476 | |
477 inv_index = this->pInventoryIndices[item_idx]; | |
478 if ( inv_index < 0 ) | |
479 { | |
480 *pitem_index = -1 - inv_index; | |
481 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
482 } | |
483 | |
484 return inv_index; | |
0 | 485 } |
486 | |
487 | |
488 | |
489 //----- (004160CA) -------------------------------------------------------- | |
1012 | 490 void Player::ItemsEnchant( int enchant_count ) |
491 { | |
492 int avalible_items; // ebx@1 | |
493 int i; // edx@8 | |
494 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
495 | |
496 avalible_items = 0; | |
497 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
498 | |
499 for (i=0; i<138; ++i) | |
500 { | |
501 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
502 item_index_tabl[avalible_items++] = i; | |
503 } | |
504 | |
505 if ( avalible_items ) | |
506 { | |
507 if ( enchant_count ) | |
508 { | |
509 for ( i = 0; i < enchant_count; ++i ) | |
0 | 510 { |
1012 | 511 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
512 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 513 } |
1012 | 514 |
0 | 515 } |
516 else | |
517 { | |
1012 | 518 for ( i = 0; i < avalible_items; ++i ) |
519 { | |
520 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
521 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
522 } | |
523 } | |
524 } | |
525 ; | |
0 | 526 } |
527 | |
528 //----- (004948B1) -------------------------------------------------------- | |
187 | 529 void Player::PlaySound(PlayerSpeech speech, int a3) |
530 { | |
531 //Player *pPlayer; // edi@1 | |
532 //int v4; // eax@4 | |
0 | 533 signed int v5; // esi@4 |
203 | 534 unsigned char *v6; // ebx@4 |
0 | 535 signed int v7; // ecx@5 |
536 unsigned __int8 v8; // al@6 | |
537 int v9; // eax@10 | |
187 | 538 //unsigned int pVoiceID; // ecx@10 |
0 | 539 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
540 //signed int v12; // eax@11 |
0 | 541 signed int v13; // esi@12 |
542 int v14; // eax@12 | |
187 | 543 //int v15; // eax@17 |
248 | 544 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 545 signed int v17; // ecx@19 |
546 char *pSoundID; // edi@20 | |
547 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 548 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 549 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
550 int pSoundId; // [sp+30h] [bp+8h]@4 | |
551 | |
187 | 552 //pPlayer = this; |
553 //pPlayer2 = this; | |
554 | |
0 | 555 pPlayerNum = 1; |
187 | 556 for (int i = 0; i < 4; ++i) |
557 if (&pParty->pPlayers[i] == this) | |
558 { | |
559 pPlayerNum = i + 1; | |
0 | 560 break; |
187 | 561 } |
562 | |
563 //v4 = a2;//102 | |
0 | 564 v5 = 0; |
565 pSoundId = 0; | |
1213 | 566 v6 = SoundSetAction[speech].data();//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
203 | 567 if (uVoicesVolumeMultiplier) |
0 | 568 { |
569 v7 = 0; | |
570 do | |
571 { | |
572 v8 = v6[v7]; | |
573 if ( v8 ) | |
574 v20[v5++] = v8; | |
575 ++v7; | |
576 } | |
577 while ( v7 < 2 ); | |
578 if ( v5 ) | |
579 { | |
580 v9 = rand(); | |
187 | 581 //pVoiceID = uVoiceID; |
0 | 582 v11 = v20[v9 % v5]; |
203 | 583 |
584 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
585 { | |
586 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
587 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 588 } |
589 } | |
590 } | |
203 | 591 |
0 | 592 v13 = 0; |
593 v14 = (int)(v6 + 3); | |
594 do | |
595 { | |
596 if ( *(char *)v14 ) | |
597 v20[v13++] = *(char *)v14; | |
598 ++v14; | |
599 } | |
600 while ( -3 - (signed int)v6 + v14 < 5 ); | |
601 if ( v13 ) | |
602 { | |
603 pPlayerNum = 0; | |
248 | 604 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
605 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 606 { |
607 v17 = 0; | |
764 | 608 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 609 { |
610 LABEL_23: | |
611 v17 = 0; | |
612 } | |
613 else | |
614 { | |
615 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
616 while ( *(int *)pSoundID != pSoundId ) | |
617 { | |
618 ++v17; | |
619 pSoundID += 120; | |
764 | 620 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 621 goto LABEL_23; |
622 } | |
623 } | |
624 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
625 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
626 } | |
248 | 627 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 628 } |
629 //return v14; | |
0 | 630 } |
631 // 4948B1: using guessed type int var_1C[5]; | |
632 | |
633 //----- (00494A25) -------------------------------------------------------- | |
187 | 634 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
635 { | |
636 //signed int v3; // eax@1 | |
637 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 638 signed int v5; // edi@15 |
639 PlayerFrame *v6; // esi@17 | |
640 signed int v7; // eax@20 | |
641 | |
187 | 642 //LOWORD(v3) = this->expression; |
643 //v4 = expr; | |
644 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
645 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
646 { | |
647 int v3 = (unsigned)expression; | |
0 | 648 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
649 { | |
650 if ( v3 <= 7 ) | |
651 goto LABEL_12; | |
652 if ( v3 > 8 ) | |
653 { | |
654 if ( v3 > 11 ) | |
655 { | |
1014 | 656 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 657 return; |
0 | 658 goto LABEL_15; |
659 } | |
660 LABEL_12: | |
187 | 661 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
662 return; | |
0 | 663 goto LABEL_15; |
664 } | |
665 } | |
666 } | |
667 LABEL_15: | |
187 | 668 //LOWORD(v3) = a3; |
0 | 669 v5 = 0; |
670 this->uExpressionTimeLength = a3; | |
671 this->uExpressionTimePassed = 0; | |
672 if ( !a3 ) | |
673 { | |
674 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
675 { | |
676 LABEL_20: | |
677 v7 = 0; | |
678 } | |
679 else | |
680 { | |
681 v6 = pPlayerFrameTable->pFrames; | |
187 | 682 while ( v6->expression != new_expression ) |
0 | 683 { |
684 ++v5; | |
685 ++v6; | |
686 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
687 goto LABEL_20; | |
688 } | |
689 v7 = v5; | |
690 } | |
187 | 691 //v4 = expr; |
692 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
693 } | |
694 expression = new_expression; | |
0 | 695 viewparams->bRedrawGameUI = 1; |
696 } | |
697 | |
698 //----- (0049327B) -------------------------------------------------------- | |
699 int Player::_49327B(unsigned int uClass, int a3) | |
700 { | |
701 Player *v3; // esi@1 | |
702 char v4; // zf@4 | |
703 __int16 v5; // dx@9 | |
704 signed int result; // eax@84 | |
705 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
706 int v8; // [sp-4h] [bp-Ch]@3 | |
707 | |
708 v3 = this; | |
135 | 709 if ( this->classType == uClass ) |
0 | 710 { |
711 LABEL_84: | |
712 result = 1; | |
713 } | |
714 else | |
715 { | |
716 switch ( uClass ) | |
717 { | |
718 case 0u: | |
719 v8 = a3; | |
720 v7 = 1; | |
721 goto LABEL_4; | |
722 case 1u: | |
484 | 723 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 724 || _49327B(2u, a3) ) |
725 goto LABEL_84; | |
726 v8 = a3; | |
727 v7 = 3; | |
728 goto LABEL_4; | |
729 case 2u: | |
730 v5 = 19; | |
731 goto LABEL_82; | |
732 case 3u: | |
733 v5 = 21; | |
734 goto LABEL_82; | |
735 case 4u: | |
736 v8 = a3; | |
737 v7 = 5; | |
738 goto LABEL_4; | |
739 case 5u: | |
484 | 740 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 741 || _49327B(6u, a3) ) |
742 goto LABEL_84; | |
743 v8 = a3; | |
744 v7 = 7; | |
745 goto LABEL_4; | |
746 case 6u: | |
747 if ( !a3 ) | |
748 break; | |
749 v5 = 13; | |
750 goto LABEL_82; | |
751 case 7u: | |
752 if ( !a3 ) | |
753 break; | |
754 v5 = 15; | |
755 goto LABEL_82; | |
756 case 8u: | |
757 v8 = a3; | |
758 v7 = 9; | |
759 goto LABEL_4; | |
760 case 9u: | |
484 | 761 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 762 || _49327B(0xAu, a3) ) |
763 goto LABEL_84; | |
764 v8 = a3; | |
765 v7 = 11; | |
766 goto LABEL_4; | |
767 case 0xAu: | |
768 if ( !a3 ) | |
769 break; | |
770 v5 = 25; | |
771 goto LABEL_82; | |
772 case 0xBu: | |
773 if ( !a3 ) | |
774 break; | |
775 v5 = 27; | |
776 goto LABEL_82; | |
777 case 0xCu: | |
778 v8 = a3; | |
779 v7 = 13; | |
780 goto LABEL_4; | |
781 case 0xDu: | |
484 | 782 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 783 || _49327B(0xEu, a3) ) |
784 goto LABEL_84; | |
785 v8 = a3; | |
786 v7 = 15; | |
787 goto LABEL_4; | |
788 case 0xEu: | |
789 if ( !a3 ) | |
790 break; | |
791 v5 = 43; | |
792 goto LABEL_82; | |
793 case 0xFu: | |
794 if ( !a3 ) | |
795 break; | |
796 v5 = 45; | |
797 goto LABEL_82; | |
798 case 0x10u: | |
799 v8 = a3; | |
800 v7 = 17; | |
801 goto LABEL_4; | |
802 case 0x11u: | |
484 | 803 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 804 || _49327B(0x12u, a3) ) |
805 goto LABEL_84; | |
806 v8 = a3; | |
807 v7 = 19; | |
808 goto LABEL_4; | |
809 case 0x12u: | |
810 if ( !a3 ) | |
811 break; | |
812 v5 = 37; | |
813 goto LABEL_82; | |
814 case 0x13u: | |
815 v5 = 39; | |
816 goto LABEL_82; | |
817 case 0x14u: | |
818 v8 = a3; | |
819 v7 = 21; | |
820 goto LABEL_4; | |
821 case 0x15u: | |
484 | 822 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 823 || _49327B(0x16u, a3) ) |
824 goto LABEL_84; | |
825 v8 = a3; | |
826 v7 = 23; | |
827 goto LABEL_4; | |
828 case 0x16u: | |
829 if ( !a3 ) | |
830 break; | |
831 v5 = 31; | |
832 goto LABEL_82; | |
833 case 0x17u: | |
834 if ( !a3 ) | |
835 break; | |
836 v5 = 33; | |
837 goto LABEL_82; | |
838 case 0x18u: | |
839 if ( !_49327B(0x19u, a3) ) | |
840 goto LABEL_56; | |
841 break; | |
842 case 0x19u: | |
843 LABEL_56: | |
484 | 844 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 845 || _49327B(0x1Au, a3) ) |
846 goto LABEL_84; | |
847 v8 = a3; | |
848 v7 = 27; | |
849 goto LABEL_4; | |
850 case 0x1Au: | |
851 if ( !a3 ) | |
852 break; | |
853 v5 = 65; | |
854 goto LABEL_82; | |
855 case 0x1Bu: | |
856 if ( !a3 ) | |
857 break; | |
858 v5 = 67; | |
859 goto LABEL_82; | |
860 case 0x1Cu: | |
861 v8 = a3; | |
862 v7 = 29; | |
863 goto LABEL_4; | |
864 case 0x1Du: | |
484 | 865 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 866 || _49327B(0x1Eu, a3) ) |
867 goto LABEL_84; | |
868 v8 = a3; | |
869 v7 = 31; | |
870 goto LABEL_4; | |
871 case 0x1Eu: | |
872 if ( !a3 ) | |
873 break; | |
874 v5 = 71; | |
875 goto LABEL_82; | |
876 case 0x1Fu: | |
877 if ( !a3 ) | |
878 break; | |
879 v5 = 73; | |
880 goto LABEL_82; | |
881 case 0x20u: | |
882 v8 = a3; | |
883 v7 = 33; | |
884 goto LABEL_4; | |
885 case 0x21u: | |
484 | 886 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 887 || _49327B(0x22u, a3) ) |
888 goto LABEL_84; | |
889 v8 = a3; | |
890 v7 = 35; | |
891 LABEL_4: | |
892 v4 = _49327B(v7, v8) == 0; | |
893 goto LABEL_83; | |
894 case 0x22u: | |
895 if ( !a3 ) | |
896 break; | |
897 v5 = 77; | |
898 goto LABEL_82; | |
899 case 0x23u: | |
900 if ( a3 ) | |
901 { | |
902 v5 = 79; | |
903 LABEL_82: | |
484 | 904 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 905 LABEL_83: |
906 if ( !v4 ) | |
907 goto LABEL_84; | |
908 } | |
909 break; | |
910 default: | |
911 break; | |
912 } | |
913 result = 0; | |
914 } | |
915 return result; | |
916 } | |
917 | |
918 | |
919 //----- (00492C0B) -------------------------------------------------------- | |
920 bool Player::CanAct() | |
921 { | |
922 bool result; // eax@2 | |
923 | |
924 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
925 result = 0; | |
926 else | |
927 result = 1; | |
928 return result; | |
929 } | |
930 | |
931 //----- (00492C40) -------------------------------------------------------- | |
932 bool Player::CanSteal() | |
933 { | |
934 int v1; // eax@1 | |
935 | |
936 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
937 return v1 != 0; | |
938 } | |
939 | |
940 //----- (00492C4E) -------------------------------------------------------- | |
941 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
942 { | |
943 char v2; // zf@9 | |
944 __int16 v4; // dx@13 | |
945 char v5; // zf@15 | |
946 | |
947 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
948 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
949 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
950 { | |
951 if ( uItemID == 533 ) | |
952 { | |
953 v2 = GetRace() == 1; | |
954 } | |
955 else | |
956 { | |
957 if ( uItemID != 534 ) | |
958 { | |
959 if ( uItemID == 535 ) // | |
960 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
961 { | |
962 switch ( this->uVoiceID ) | |
963 { | |
964 default: | |
965 return 1; | |
966 case 4u: | |
967 case 5u: | |
968 case 6u: | |
969 case 7u: | |
970 case 0xAu: | |
971 case 0xBu: | |
972 case 0xEu: // | |
973 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
974 case 0xFu: | |
975 case 0x12u: | |
976 case 0x13u: | |
977 case 0x15u: | |
978 case 0x18u: | |
979 return 0; | |
980 } | |
981 return 0; | |
982 } | |
983 if ( uItemID == 536 ) // | |
984 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
985 { | |
986 switch ( this->uVoiceID ) | |
987 { | |
988 case 4u: | |
989 case 5u: | |
990 case 6u: | |
991 case 7u: | |
992 case 0xAu: | |
993 case 0xBu: | |
994 case 0xEu: | |
995 case 0xFu: | |
996 case 0x12u: | |
997 case 0x13u: | |
998 case 0x15u: | |
999 case 0x18u: | |
1000 return 1; | |
1001 default: | |
1002 return 0; | |
1003 } | |
1004 return 0; | |
1005 } | |
1006 if ( uItemID != 604 ) // | |
1007 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
1008 return 1; | |
1009 v5 = _43EEF3() == 0; | |
1010 goto LABEL_23; | |
1011 } | |
1012 v2 = GetRace() == 3; // | |
1013 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1014 } | |
1015 } | |
1016 else | |
1017 { | |
1018 if ( uItemID != 532 ) | |
1019 { | |
1020 if ( uItemID != 515 && uItemID != 517 ) // | |
1021 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1022 { | |
1023 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1024 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1025 { | |
1026 LABEL_13: | |
1027 v4 = 99; | |
1028 LABEL_15: | |
484 | 1029 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1030 LABEL_23: |
1031 if ( !v5 ) | |
1032 return 1; | |
1033 return 0; | |
1034 } | |
1035 if ( uItemID != 525 ) | |
1036 { | |
1037 if ( uItemID != 527 ) | |
1038 { | |
1039 if ( uItemID != 531 ) | |
1040 return 1; | |
1041 v2 = GetRace() == 2; | |
1042 goto LABEL_10; | |
1043 } | |
1044 goto LABEL_13; | |
1045 } | |
1046 } | |
1047 v4 = 100; | |
1048 goto LABEL_15; | |
1049 } | |
1050 v2 = GetRace() == 0; | |
1051 } | |
1052 LABEL_10: | |
1053 if ( v2 ) | |
1054 return 1; | |
1055 return 0; | |
1056 } | |
1057 | |
1058 //----- (00492D65) -------------------------------------------------------- | |
1059 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1060 { |
1061 | |
1062 signed int player_sex; // ecx@77 | |
1063 char zombi_face; // al@80 | |
1064 signed int remainig_player; // ebx@82 | |
1065 int players_before; // [sp+10h] [bp-4h]@2 | |
1066 int players_after; // [sp+20h] [bp+Ch]@82 | |
1067 | |
1068 if ( pConditions[uConditionIdx] ) | |
1069 return 0; | |
1070 players_before = 0; | |
1071 for (int i=1;i<5;++i) | |
1072 if ( pPlayers[i]->CanAct() ) | |
1073 ++players_before; | |
1074 | |
0 | 1075 switch ( uConditionIdx ) |
1014 | 1076 { |
1077 case Condition_Cursed: | |
1078 PlaySound((PlayerSpeech)30, 0); | |
1079 break; | |
1080 case Condition_Weak: | |
1167 | 1081 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) |
1082 {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; | |
1083 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1084 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1085 return 0; |
1086 } | |
1087 | |
1088 PlaySound((PlayerSpeech)25, 0); | |
1089 break; | |
1090 case Condition_Sleep: | |
1080 | 1091 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)|| |
1092 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) | |
1014 | 1093 return 0; |
1094 break; | |
1095 | |
1096 case Condition_Fear: | |
1097 PlaySound((PlayerSpeech)26, 0); | |
1098 break; | |
1099 case Condition_Drunk: | |
1100 PlaySound((PlayerSpeech)31, 0); | |
1101 break; | |
1102 | |
1103 case Condition_Insane: | |
0 | 1104 if ( a3 == 1 |
1080 | 1105 && (HasEnchantedItemEquipped(19) || |
1106 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1107 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1108 return 0; |
1109 | |
1110 PlaySound((PlayerSpeech)29, 0); | |
1111 break; | |
1112 case Condition_Poison1: | |
1113 case Condition_Poison2: | |
1114 case Condition_Poison3: | |
1115 if ( a3 == 1 ) | |
1116 { | |
1167 | 1117 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1118 { |
1167 | 1119 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1120 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1121 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1122 } |
1123 if ( HasEnchantedItemEquipped(21) | |
1080 | 1124 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) |
1082 | 1125 || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1126 //goto LABEL_76; |
1127 return 0; | |
1128 } | |
1129 | |
1130 //v23 = 27; | |
1131 PlaySound((PlayerSpeech)27, 0); | |
1132 break; | |
1133 | |
1134 case Condition_Disease1: | |
1135 case Condition_Disease2: | |
1136 case Condition_Disease3: | |
0 | 1137 if ( a3 == 1 ) |
1014 | 1138 { |
1167 | 1139 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1140 { |
1167 | 1141 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1142 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1143 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1144 return 0; |
1145 } | |
1146 | |
1080 | 1147 if ( HasEnchantedItemEquipped(18) || |
1148 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1149 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1150 return 0; |
1151 } | |
1152 PlaySound((PlayerSpeech)28, 0); | |
1153 break; | |
1154 case Condition_Paralyzed: | |
1155 if ( a3 == 1 ) | |
1156 { | |
1167 | 1157 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1158 { |
1167 | 1159 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1160 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1161 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1162 return 0; |
1163 } | |
1164 | |
1080 | 1165 if ( HasEnchantedItemEquipped(20)|| |
1166 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| | |
1167 WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| | |
1082 | 1168 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) |
1014 | 1169 return 0; |
1170 } | |
1171 break; | |
1172 case Condition_Unconcious: | |
1173 PlaySound(SPEECH_32, 0); | |
1174 if ( sHealth > 0 ) | |
1175 sHealth = 0; | |
1176 break; | |
1177 case Condition_Dead: | |
1167 | 1178 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) |
1014 | 1179 { |
1167 | 1180 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1181 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1182 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1183 } |
1184 | |
1185 PlaySound((PlayerSpeech)33, 0); | |
1186 if ( sHealth > 0 ) | |
1187 sHealth = 0; | |
1188 if ( sMana > 0 ) | |
1189 sMana = 0; | |
1190 break; | |
1191 case Condition_Pertified: | |
0 | 1192 if ( a3 == 1 |
1167 | 1193 &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64) |
1080 | 1194 || HasEnchantedItemEquipped(23)|| |
1195 WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || | |
1196 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1197 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1198 |
1199 return 0; | |
1200 PlaySound((PlayerSpeech)34, 0); | |
1201 break; | |
1202 case Condition_Eradicated: | |
1167 | 1203 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) |
1014 | 1204 { |
1167 | 1205 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1206 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1207 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1208 return 0; |
1209 } | |
1210 PlaySound(SPEECH_35, 0); | |
1211 if (sHealth > 0 ) | |
1212 sHealth = 0; | |
1213 if ( sMana > 0 ) | |
1214 sMana = 0; | |
1215 break; | |
1216 case Condition_Zombie: | |
1217 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1218 return 0; | |
1219 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1220 sHealth = GetMaxHealth(); | |
1221 sMana = 0; | |
1222 player_sex = 0; | |
1223 uPrevFace = uCurrentFace; | |
1224 uPrevVoiceID = uVoiceID; | |
1225 switch ( uVoiceID ) | |
1226 { | |
1227 case 0: | |
1228 case 1: | |
1229 case 2: | |
1230 case 3: | |
1231 case 8: | |
1232 case 9: | |
1233 case 12: | |
1234 case 13: | |
1235 case 16: | |
1236 case 17: | |
1237 case 20: | |
1238 case 23: | |
1239 player_sex = 0; | |
1240 break; | |
1241 case 4: | |
1242 case 5: | |
1243 case 6: | |
1244 case 7: | |
1245 case 10: | |
1246 case 11: | |
1247 case 14: | |
1248 case 15: | |
1249 case 18: | |
1250 case 19: | |
1251 case 21: | |
1252 case 24: | |
1253 player_sex = 1; | |
1254 break; | |
1255 default: | |
1256 break; | |
1257 } | |
1258 | |
1259 zombi_face = (player_sex != 0) + 23; | |
1260 uCurrentFace = zombi_face; | |
1261 uVoiceID = zombi_face; | |
1262 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1263 break; | |
0 | 1264 } |
1014 | 1265 |
1266 remainig_player = 0; | |
1267 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1268 players_after = 0; | |
1269 for (int i=1;i<5;++i) | |
0 | 1270 { |
1014 | 1271 |
1272 | |
1273 if ( pPlayers[i]->CanAct() ) | |
1274 { | |
1275 remainig_player=i; | |
1276 ++players_after; | |
1277 } | |
0 | 1278 } |
1014 | 1279 if (( players_before == 2 )&&( players_after == 1 )) |
1280 { | |
1281 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1282 } | |
1283 return 1; | |
1284 } | |
0 | 1285 |
1286 //----- (00492528) -------------------------------------------------------- | |
1287 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1288 { | |
973 | 1289 //unsigned int v3; // eax@1 |
0 | 1290 Texture *v4; // esi@1 |
1291 unsigned int v5; // ebx@1 | |
1292 signed int v6; // edi@5 | |
1293 int *v7; // ecx@6 | |
1294 signed int v8; // edx@7 | |
1295 int *v9; // eax@8 | |
973 | 1296 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1297 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1298 | |
973 | 1299 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1300 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1301 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1302 if ( !areWeLoadingTexture ) | |
1303 { | |
1304 v4->Release(); | |
1006 | 1305 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1306 } |
1307 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1308 { | |
1309 v6 = 0; | |
1310 if ( (signed int)uItemIDa <= 0 ) | |
1311 return 1; | |
973 | 1312 v7 = &pInventoryIndices[uSlot]; |
0 | 1313 while ( 1 ) |
1314 { | |
1315 v8 = 0; | |
1316 if ( (signed int)v5 > 0 ) | |
1317 break; | |
1318 LABEL_11: | |
1319 ++v6; | |
1320 v7 += 14; | |
1321 if ( v6 >= (signed int)uItemIDa ) | |
1322 return 1; | |
1323 } | |
1324 v9 = v7; | |
1325 while ( !*v9 ) | |
1326 { | |
1327 ++v8; | |
1328 ++v9; | |
1329 if ( v8 >= (signed int)v5 ) | |
1330 goto LABEL_11; | |
1331 } | |
1332 } | |
1333 return 0; | |
1334 } | |
1335 // 506128: using guessed type int areWeLoadingTexture; | |
1336 | |
1337 //----- (004925E6) -------------------------------------------------------- | |
1338 unsigned int Player::FindFreeInventorySlot() | |
1339 { | |
1340 unsigned int result; // eax@1 | |
1341 ItemGen *v2; // ecx@1 | |
1342 | |
1343 result = 0; | |
1344 v2 = this->pInventoryItems; | |
1345 while ( v2->uItemID ) | |
1346 { | |
1347 ++result; | |
1348 ++v2; | |
1349 if ( (signed int)result >= 126 ) | |
1350 return -1; | |
1351 } | |
1352 return result; | |
1353 } | |
1354 | |
1355 //----- (00492600) -------------------------------------------------------- | |
1356 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1357 { | |
1358 signed int v3; // edx@1 | |
1359 ItemGen *v4; // eax@1 | |
1360 int result; // eax@8 | |
1361 unsigned int v6; // ebx@10 | |
973 | 1362 //unsigned int v7; // eax@10 |
0 | 1363 Texture *v8; // esi@10 |
1364 void *v9; // esi@13 | |
1365 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1366 Player *v11; // [sp+4h] [bp-8h]@1 | |
1367 signed int v12; // [sp+8h] [bp-4h]@4 | |
1368 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1369 | |
1370 v11 = this; | |
1371 v3 = 0; | |
1372 v4 = this->pInventoryItems; | |
1373 while ( v4->uItemID ) | |
1374 { | |
1375 ++v3; | |
1376 ++v4; | |
1377 if ( v3 >= 126 ) | |
1378 { | |
1379 v12 = -1; | |
1380 goto LABEL_5; | |
1381 } | |
1382 } | |
1383 v12 = v3; | |
1384 LABEL_5: | |
1385 if ( v12 == -1 ) | |
1386 { | |
1387 if ( uActiveCharacter ) | |
201 | 1388 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1389 result = 0; |
1390 } | |
1391 else | |
1392 { | |
1393 v6 = uItemID; | |
973 | 1394 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1395 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1396 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1397 if ( !areWeLoadingTexture ) | |
1398 { | |
1399 v8->Release(); | |
1006 | 1400 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1401 } |
1402 if ( (signed int)uItemIDa > 0 ) | |
1403 { | |
1404 v9 = &v11->pInventoryIndices[uSlot]; | |
1405 do | |
1406 { | |
1407 if ( (signed int)v10 > 0 ) | |
1408 memset32(v9, -1 - uSlot, v10); | |
1409 v9 = (char *)v9 + 56; | |
1410 --uItemIDa; | |
1411 } | |
1412 while ( uItemIDa ); | |
1413 } | |
1414 result = v12 + 1; | |
1415 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1416 v11->pInventoryItems[v12].uItemID = v6; | |
1417 } | |
1418 return result; | |
1419 } | |
1420 // 506128: using guessed type int areWeLoadingTexture; | |
1421 | |
1422 //----- (00492700) -------------------------------------------------------- | |
1423 int Player::HasSkill(unsigned int uSkillType) | |
1424 { | |
1425 signed int result; // eax@3 | |
1426 | |
1427 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1428 { | |
1429 result = 1; | |
1430 } | |
1431 else | |
1432 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1433 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1434 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 1435 result = 0; |
1436 } | |
1437 return result; | |
1438 } | |
1439 | |
1440 //----- (00492745) -------------------------------------------------------- | |
1441 int Player::WearItem(unsigned int uItemID) | |
1442 { | |
1010 | 1443 int item_body_anch; // edi@6 |
1444 int item_indx; | |
1445 //find empty slot | |
1446 for(item_indx=0;item_indx<126;++item_indx) | |
1447 if (pInventoryItems[item_indx].uItemID==0) | |
1448 break; | |
1449 if (item_indx==126) //not found | |
1450 item_indx=-1; | |
1451 | |
1452 if ( item_indx != -1 ) | |
1453 { | |
1454 | |
1455 pInventoryItems[item_indx].uItemID=uItemID; | |
1456 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1457 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1458 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1459 | |
0 | 1460 } |
1461 return 0; | |
1462 } | |
1463 | |
1464 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1465 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1466 { |
1467 signed int v3; // ebx@2 | |
1468 signed int v4; // edi@3 | |
1469 unsigned int v5; // esi@3 | |
1470 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1471 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1472 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1473 | |
1474 thisa = this; | |
1475 if ( uSlot == -1 ) | |
1476 { | |
1477 v3 = 0; | |
1014 | 1478 while ( true ) |
0 | 1479 { |
1480 v4 = 0; | |
1481 v5 = v3; | |
1482 do | |
1483 { | |
1484 if ( CanFitItem(v5, uItemID) ) | |
1485 { | |
1486 v8 = uItemID; | |
1487 v7 = v5; | |
1488 return CreateItemInInventory(v7, v8); | |
1489 } | |
1490 ++v4; | |
1491 v5 += 14; | |
1492 } | |
1493 while ( v4 < 9 ); | |
1494 ++v3; | |
1495 if ( v3 < 14 ) | |
1496 continue; | |
1497 break; | |
1498 } | |
1499 return 0; | |
1500 } | |
1501 if ( !CanFitItem(uSlot, uItemID) ) | |
1502 { | |
1503 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1504 return 0; | |
1505 } | |
1506 v8 = uItemID; | |
1507 v7 = uSlot; | |
1508 return CreateItemInInventory(v7, v8); | |
1509 } | |
1510 | |
1511 //----- (00492826) -------------------------------------------------------- | |
1014 | 1512 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1513 { |
1514 unsigned int v3; // ebx@1 | |
1515 unsigned int v4; // esi@3 | |
1516 signed int v5; // edi@3 | |
1517 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1518 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1519 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1520 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1521 | |
1522 thisa = this; | |
1523 v3 = Src->uItemID; | |
1524 pItemsTable->SetSpecialBonus(Src); | |
1525 if ( uSlot == -1 ) | |
1526 { | |
1527 uSlota = 0; | |
1014 | 1528 while ( true ) |
0 | 1529 { |
1530 v4 = uSlota; | |
1531 v5 = 0; | |
1532 do | |
1533 { | |
1534 if ( CanFitItem(v4, v3) ) | |
1535 { | |
1536 v8 = Src; | |
1537 v7 = v4; | |
1538 return CreateItemInInventory2(v7, v8); | |
1539 } | |
1540 ++v5; | |
1541 v4 += 14; | |
1542 } | |
1543 while ( v5 < 14 ); | |
1544 ++uSlota; | |
1545 if ( uSlota < 9 ) | |
1546 continue; | |
1547 break; | |
1548 } | |
1549 return 0; | |
1550 } | |
1551 if ( !CanFitItem(uSlot, v3) ) | |
1552 return 0; | |
1553 v8 = Src; | |
1554 v7 = uSlot; | |
1555 return CreateItemInInventory2(v7, v8); | |
1556 } | |
1557 | |
1558 //----- (0049289C) -------------------------------------------------------- | |
1559 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1560 { | |
1561 signed int v3; // ebx@1 | |
1562 ItemGen *v4; // eax@1 | |
1563 int result; // eax@6 | |
973 | 1564 //unsigned int v6; // eax@7 |
1014 | 1565 Texture *item_texture; // esi@7 |
0 | 1566 unsigned int v8; // edx@9 |
1014 | 1567 int *pInvPos; // esi@10 |
1568 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1569 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1570 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1571 |
0 | 1572 |
1573 v12 = this; | |
1574 v3 = 0; | |
1575 v4 = this->pInventoryItems; | |
1576 while ( v4->uItemID ) | |
1577 { | |
1578 ++v3; | |
1579 ++v4; | |
1580 if ( v3 >= 126 ) | |
1581 { | |
1582 v3 = -1; | |
1583 break; | |
1584 } | |
1585 } | |
1586 if ( v3 == -1 ) | |
1587 { | |
1588 result = 0; | |
1589 } | |
1590 else | |
1591 { | |
1014 | 1592 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1593 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1594 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1595 if ( !areWeLoadingTexture ) |
1596 { | |
1014 | 1597 item_texture->Release(); |
1006 | 1598 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1599 } |
1014 | 1600 if ( slot_height > 0 ) |
1601 { | |
1602 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1603 do |
1604 { | |
1014 | 1605 if ( slot_width > 0 ) |
1606 memset32(pInvPos, -1 - uSlot, slot_width); | |
1607 pInvPos +=14; | |
1608 --slot_height; | |
1609 } | |
1610 while ( slot_height ); | |
1611 } | |
1612 pInventoryIndices[uSlot] = v3 + 1; | |
1613 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1614 result = v3 + 1; |
1615 } | |
1616 return result; | |
1617 } | |
1618 // 506128: using guessed type int areWeLoadingTexture; | |
1619 | |
1620 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1621 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1622 { | |
973 | 1623 //Player *v4; // ebx@1 |
1624 //unsigned int v5; // eax@1 | |
1014 | 1625 Texture *item_texture; // esi@1 |
1626 int *pInvPos; // esi@4 | |
1627 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1628 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1629 | |
1630 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1631 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1632 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1633 if ( !areWeLoadingTexture ) |
1634 { | |
1014 | 1635 item_texture->Release(); |
1006 | 1636 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1637 } |
1014 | 1638 if ( (signed int)slot_height > 0 ) |
1639 { | |
1640 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1641 do |
1642 { | |
1014 | 1643 if ( (signed int)slot_width > 0 ) |
1644 memset32(pInvPos, -1 - uSlot, slot_width); | |
1645 pInvPos +=14; | |
1646 --slot_height; | |
1647 } | |
1648 while ( slot_height ); | |
1649 } | |
1650 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1651 return 1; |
1652 } | |
278 | 1653 |
0 | 1654 // 506128: using guessed type int areWeLoadingTexture; |
1655 | |
1656 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1657 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1658 { | |
1014 | 1659 |
1660 ItemGen *item_in_slot; // ecx@1 | |
1661 Texture *item_texture; // esi@1 | |
1662 unsigned int slot_height; // ebp@1 | |
1663 int *pInvPos; // edx@4 | |
1664 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1665 | |
1666 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1667 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1668 item_in_slot->Reset(); | |
1669 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1670 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1671 if ( !areWeLoadingTexture ) |
1672 { | |
1014 | 1673 item_texture->Release(); |
1006 | 1674 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1675 } |
1014 | 1676 if ( slot_height > 0 ) |
1677 { | |
1678 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1679 do |
1680 { | |
1014 | 1681 if (slot_width > 0 ) |
1682 memset32(pInvPos, 0, slot_width); | |
1683 pInvPos += 14; | |
1684 --slot_height; | |
1685 } | |
1686 while ( slot_height ); | |
0 | 1687 } |
1006 | 1688 |
0 | 1689 } |
1690 // 506128: using guessed type int areWeLoadingTexture; | |
1691 | |
436 | 1692 //identf |
0 | 1693 //----- (00490EEE) -------------------------------------------------------- |
917 | 1694 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1695 { | |
1696 int pSkillLevel; // eax@1 | |
1697 int NotBuy; // eax@1 | |
1698 int result; | |
1699 signed int pEquipType; // esi@1 | |
1700 float *pPriceMultiplier; // esi@26 | |
1701 int pPriceItemService; // edi@26 | |
1702 | |
1703 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1704 NotBuy = 4; | |
1705 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1706 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1707 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1708 return 5; |
917 | 1709 if ( building_type == BildingType_WeaponShop ) |
1710 { | |
1711 if ( pEquipType > EQUIP_BOW ) | |
1712 return NotBuy; | |
1713 if (pItem->Stolen()) | |
1714 return 6; | |
1715 } | |
1716 if ( building_type == BildingType_ArmorShop ) | |
1717 { | |
1718 if ( pEquipType < 3 && pEquipType > 9 ) | |
1719 return NotBuy; | |
1720 if (pItem->Stolen()) | |
1721 return 6; | |
1722 } | |
1723 if ( building_type == BildingType_MagicShop ) | |
1724 { | |
1725 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1726 { | |
1727 if (pItem->Stolen()) | |
1728 return 6; | |
1729 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1730 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1731 if ( ShopMenuType == 3 )//Sell | |
1732 { | |
1733 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1734 if (!pItem->Broken()) | |
1735 { | |
1736 if ( pSkillLevel ) | |
1737 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1738 else | |
1739 result = 1; | |
1740 return result; | |
1741 } | |
1742 pPriceItemService = 1; | |
1743 if ( pSkillLevel ) | |
1744 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1745 else | |
1746 result = 1; | |
1747 return result; | |
1748 } | |
1749 if ( ShopMenuType == 4 )//Identify | |
1750 { | |
1751 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1752 if ( pSkillLevel ) | |
1753 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1754 else | |
1755 result = 1; | |
1756 return result; | |
1757 } | |
1758 if ( ShopMenuType == 5 )//Repair | |
1759 { | |
1760 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1761 if ( pSkillLevel ) | |
1762 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1763 else | |
1764 result = 1; | |
1765 return result; | |
1766 } | |
1767 if ( ShopMenuType != 6 )//Buy and ??? | |
1768 { | |
1769 if ( pSkillLevel ) | |
1770 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1771 else | |
1772 result = 1; | |
1773 return result; | |
1774 } | |
1775 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1776 if (pItem->Broken()) | |
1777 pPriceItemService = 1; | |
1778 if ( pPriceItemService >= 1 ) | |
1779 { | |
1780 if ( pSkillLevel ) | |
1781 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1782 else | |
1783 result = 1; | |
1784 return result; | |
1785 } | |
1786 pPriceItemService = 1; | |
1787 if ( pSkillLevel ) | |
1788 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1789 else | |
1790 result = 1; | |
0 | 1791 return result; |
917 | 1792 } |
1793 if ( pEquipType != EQUIP_BOOK ) | |
1794 return NotBuy; | |
1795 } | |
1796 if ( building_type == BildingType_AlchemistShop ) | |
1797 { | |
1798 if ( pEquipType < EQUIP_REAGENT ) | |
1799 return NotBuy; | |
1800 if ( pEquipType > EQUIP_POTION ) | |
1801 { | |
1802 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1803 return NotBuy; | |
1804 } | |
1805 if (pItem->Stolen()) | |
1806 return 6; | |
1807 } | |
1808 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1809 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1810 if ( ShopMenuType == 3 )//Sell | |
1811 { | |
1812 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1813 if (!pItem->Broken()) | |
1814 { | |
1815 if ( pSkillLevel ) | |
1816 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1817 else | |
1818 result = 1; | |
0 | 1819 return result; |
917 | 1820 } |
1821 pPriceItemService = 1; | |
1822 if ( pSkillLevel ) | |
1823 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1824 else | |
1825 result = 1; | |
1826 return result; | |
1827 } | |
1828 if ( ShopMenuType == 4 )//Identify | |
1829 { | |
1830 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1831 if ( pSkillLevel ) | |
1832 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1833 else | |
1834 result = 1; | |
1835 return result; | |
1836 } | |
1837 if ( ShopMenuType == 5 )//Repair | |
1838 { | |
1839 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1840 if ( pSkillLevel ) | |
1841 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1842 else | |
1843 result = 1; | |
1844 return result; | |
1845 } | |
1846 if ( ShopMenuType != 6 )//Buy and ??? | |
1847 { | |
1848 if ( pSkillLevel ) | |
1849 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1850 else | |
1851 result = 1; | |
1852 return result; | |
1853 } | |
1854 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1855 if (pItem->Broken()) |
917 | 1856 pPriceItemService = 1; |
1857 if ( pPriceItemService >= 1 ) | |
1858 { | |
1859 if ( pSkillLevel ) | |
1860 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1861 else | |
1862 result = 1; | |
1863 return result; | |
1864 } | |
1865 pPriceItemService = 1; | |
1866 if ( pSkillLevel ) | |
1867 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1868 else |
1869 result = 1; | |
1870 return result; | |
1871 } | |
1872 | |
1873 //----- (0049107D) -------------------------------------------------------- | |
1874 int Player::GetBodybuilding() | |
1875 { | |
1010 | 1876 int v1; // al@1 |
0 | 1877 int v2; // ecx@1 |
1878 int v4; // eax@3 | |
1879 signed int v6; // [sp-4h] [bp-4h]@2 | |
1880 | |
1881 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1882 v2 = v1 & 0x3F; | |
1883 if ( v1 & 0x100 ) | |
1884 { | |
1885 v6 = 5; | |
1886 } | |
1887 else | |
1888 { | |
1008 | 1889 if ( (v1&0xFF) >= 0 ) |
0 | 1890 { |
1891 v4 = ((v1 & 0x40) != 0) + 1; | |
1892 return v2 * v4; | |
1893 } | |
1894 v6 = 3; | |
1895 } | |
1896 v4 = v6; | |
1897 return v2 * v4; | |
1898 } | |
1899 | |
1900 //----- (004910A8) -------------------------------------------------------- | |
607 | 1901 int Player::GetMeditation() |
0 | 1902 { |
1010 | 1903 int v1; // al@1 |
1008 | 1904 int base_level; // ecx@1 |
0 | 1905 int v4; // eax@3 |
1906 signed int v6; // [sp-4h] [bp-4h]@2 | |
1907 | |
1908 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1909 base_level = v1 & 0x3F; |
0 | 1910 if ( v1 & 0x100 ) |
1911 { | |
1912 v6 = 5; | |
1913 } | |
1914 else | |
1915 { | |
1008 | 1916 if ( (v1&0xFF) >= 0 ) |
0 | 1917 { |
1918 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1919 return base_level * v4; |
0 | 1920 } |
1921 v6 = 3; | |
1922 } | |
1923 v4 = v6; | |
1008 | 1924 return base_level * v4; |
0 | 1925 } |
1926 | |
1927 //----- (004910D3) -------------------------------------------------------- | |
1928 int Player::CanIdentify(ItemGen *pItem) | |
1929 { | |
1930 unsigned __int16 v2; // ax@1 | |
1931 unsigned __int16 v3; // bx@1 | |
1932 int uSkillMult; // eax@3 | |
1933 int v5; // edi@7 | |
1934 signed int v6; // ebp@7 | |
1935 char *v7; // esi@7 | |
1936 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1937 |
1938 if (CheckHiredNPCSpeciality(Scholar)) | |
1939 return true; | |
0 | 1940 |
179 | 1941 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1942 v3 = v2; |
179 | 1943 if ( v2 & 1 ) |
0 | 1944 { |
1945 uSkillMultiplier = 5; | |
1946 } | |
1947 else | |
1948 { | |
1949 if ( (v2 & 0x80u) == 0 ) | |
1950 { | |
1951 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1952 v5 = uSkillMult * (v3 & 0x3F); |
1953 v6 = 0; | |
1954 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1955 |
179 | 1956 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1957 v6 = 1; | |
1958 if ( v5 >= (unsigned __int8)v7[46] ) | |
1959 v6 = 1; | |
1960 return v6; | |
0 | 1961 } |
1962 uSkillMultiplier = 3; | |
1963 } | |
1964 uSkillMult = uSkillMultiplier; | |
1965 v5 = uSkillMult * (v3 & 0x3F); | |
1966 v6 = 0; | |
1967 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1968 |
0 | 1969 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1970 v6 = 1; | |
1971 if ( v5 >= (unsigned __int8)v7[46] ) | |
1972 v6 = 1; | |
1973 return v6; | |
1974 } | |
1975 | |
1976 //----- (00491151) -------------------------------------------------------- | |
1977 int Player::CanRepair(ItemGen *a2) | |
1978 { | |
1979 unsigned __int16 v2; // ax@1 | |
1980 unsigned __int16 v3; // bx@1 | |
1981 int v4; // eax@3 | |
1982 int v5; // edi@7 | |
1983 signed int v6; // ebp@7 | |
1984 signed int v10; // [sp-4h] [bp-14h]@2 | |
1985 | |
652 | 1986 |
1987 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1988 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1989 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1990 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1991 return true; | |
1992 | |
1010 | 1993 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1994 v3 = v2; |
1010 | 1995 if (v2 & 0x100 ) |
0 | 1996 { |
1997 v10 = 5; | |
1998 } | |
1999 else | |
2000 { | |
2001 if ( (v2 & 0x80u) == 0 ) | |
2002 { | |
2003 v4 = ((v2 & 0x40) != 0) + 1; | |
2004 goto LABEL_7; | |
2005 } | |
2006 v10 = 3; | |
2007 } | |
2008 v4 = v10; | |
2009 LABEL_7: | |
2010 v5 = v4 * (v3 & 0x3F); | |
2011 v6 = 0; | |
2012 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
2013 return true; | |
2014 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2015 { | |
2016 __debugbreak(); // really odd | |
2017 return true; | |
2018 } | |
2019 return false; | |
2020 } | |
2021 | |
2022 //----- (004911F3) -------------------------------------------------------- | |
2023 int Player::GetMerchant() | |
2024 { | |
2025 Player *v1; // edi@1 | |
2026 unsigned __int16 v2; // ax@1 | |
2027 unsigned __int16 v3; // bx@1 | |
2028 int v4; // esi@1 | |
2029 int v5; // edi@1 | |
2030 int v7; // eax@3 | |
2031 int v8; // ecx@7 | |
2032 signed int v9; // [sp-4h] [bp-10h]@6 | |
2033 | |
2034 v1 = this; | |
607 | 2035 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2036 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2037 v4 = v2 & 0x003F; |
1010 | 2038 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2039 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2040 return 10000; | |
2041 v7 = GetPartyReputation(); | |
2042 if ( !v4 ) | |
2043 return -v7; | |
1010 | 2044 if ( v3 & 0x100 ) |
0 | 2045 { |
2046 v9 = 5; | |
2047 } | |
2048 else | |
2049 { | |
2050 if ( (v3 & 0x80u) == 0 ) | |
2051 { | |
2052 v8 = ((v3 & 0x40) != 0) + 1; | |
2053 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2054 } | |
2055 v9 = 3; | |
2056 } | |
2057 v8 = v9; | |
2058 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2059 } | |
2060 | |
2061 //----- (0049125A) -------------------------------------------------------- | |
2062 int Player::GetPerception() | |
2063 { | |
2064 Player *v1; // edi@1 | |
2065 unsigned __int16 v2; // ax@1 | |
2066 unsigned __int16 v3; // bx@1 | |
2067 int v4; // esi@1 | |
2068 int v5; // edi@1 | |
2069 int v7; // eax@5 | |
2070 signed int v8; // [sp-4h] [bp-10h]@4 | |
2071 | |
2072 v1 = this; | |
1010 | 2073 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2074 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2075 v4 = v2 & 0x3F; |
1010 | 2076 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2077 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2078 return 10000; | |
1010 | 2079 if ( v3 & 0x100 ) |
0 | 2080 { |
2081 v8 = 5; | |
2082 } | |
2083 else | |
2084 { | |
2085 if ( (v3 & 0x80u) == 0 ) | |
2086 { | |
2087 v7 = ((v3 & 0x40) != 0) + 1; | |
2088 return v4 + v5 * (v7 - 1); | |
2089 } | |
2090 v8 = 3; | |
2091 } | |
2092 v7 = v8; | |
2093 return v4 + v5 * (v7 - 1); | |
2094 } | |
2095 | |
2096 //----- (004912B0) -------------------------------------------------------- | |
2097 int Player::GetDisarmTrap() | |
2098 { | |
2099 Player *v1; // ebp@1 | |
2100 unsigned __int16 v2; // ax@1 | |
2101 unsigned __int16 v3; // bx@1 | |
2102 int v4; // esi@1 | |
2103 int v5; // edi@1 | |
2104 int v7; // eax@7 | |
2105 signed int v8; // [sp-4h] [bp-14h]@6 | |
2106 | |
2107 v1 = this; | |
1010 | 2108 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2109 v3 = v1->pActiveSkills[29]; |
2110 v4 = v2 & 0x3F; | |
2111 v5 = v1->pActiveSkills[29] & 0x3F; | |
2112 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2113 return 10000; | |
2114 if ( HasEnchantedItemEquipped(35) ) | |
2115 v4 *= 2; | |
1010 | 2116 if ( v3 & 0x100 ) |
0 | 2117 { |
2118 v8 = 5; | |
2119 } | |
2120 else | |
2121 { | |
2122 if ( (v3 & 0x80u) == 0 ) | |
2123 { | |
2124 v7 = ((v3 & 0x40) != 0) + 1; | |
2125 return v4 + v5 * (v7 - 1); | |
2126 } | |
2127 v8 = 3; | |
2128 } | |
2129 v7 = v8; | |
2130 return v4 + v5 * (v7 - 1); | |
2131 } | |
2132 | |
2133 //----- (00491317) -------------------------------------------------------- | |
2134 char Player::GetLearningPercent() | |
2135 { | |
2136 Player *v1; // esi@1 | |
2137 int v2; // eax@1 | |
2138 unsigned __int16 v3; // bx@1 | |
2139 int v4; // ecx@1 | |
2140 int v5; // eax@4 | |
2141 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2142 | |
2143 v1 = this; | |
1010 | 2144 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2145 v3 = v1->pActiveSkills[36]; |
2146 v4 = v2 & 0x3F; | |
2147 if ( v2 ) | |
2148 { | |
1010 | 2149 if (v3 & 0x100 ) |
0 | 2150 { |
2151 v7 = 5; | |
2152 } | |
2153 else | |
2154 { | |
2155 if ( (v3 & 0x80u) == 0 ) | |
2156 { | |
2157 v5 = ((v3 & 0x40) != 0) + 1; | |
2158 goto LABEL_8; | |
2159 } | |
2160 v7 = 3; | |
2161 } | |
2162 v5 = v7; | |
2163 LABEL_8: | |
2164 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2165 } | |
2166 return v2; | |
2167 } | |
2168 | |
2169 //----- (0048C6AF) -------------------------------------------------------- | |
2170 Player::Player() | |
2171 { | |
2172 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2173 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2174 for (uint i = 0; i < 126; ++i) | |
2175 pInventoryItems[i].Reset(); | |
2176 for (uint i = 0; i < 12; ++i) | |
2177 pEquippedItems[i].Reset(); | |
2178 | |
2179 | |
2180 for (uint i = 0; i < 24; ++i) | |
2181 { | |
2182 pPlayerBuffs[i].uSkill = 0; | |
2183 pPlayerBuffs[i].uSkill = 0; | |
2184 pPlayerBuffs[i].uPower = 0; | |
2185 pPlayerBuffs[i].uExpireTime = 0; | |
2186 pPlayerBuffs[i].uCaster = 0; | |
2187 pPlayerBuffs[i].uFlags = 0; | |
2188 } | |
2189 | |
2190 pName[0] = 0; | |
1014 | 2191 uCurrentFace = 0; |
0 | 2192 uVoiceID = 0; |
2193 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2194 | |
2195 field_BB = 0; | |
2196 | |
2197 uMight = uMightBonus = 0; | |
2198 uIntelligence = uIntelligenceBonus = 0; | |
2199 uWillpower = uWillpowerBonus = 0; | |
2200 uEndurance = uEnduranceBonus = 0; | |
2201 uSpeed = uSpeedBonus = 0; | |
2202 uAccuracy = uAccuracyBonus = 0; | |
2203 uLuck = uLuckBonus = 0; | |
2204 uLevel = sLevelModifier = 0; | |
2205 sAgeModifier = 0; | |
2206 | |
1019 | 2207 // memset(field_1F5, 0, 30); |
2208 pure_luck_used=0; | |
2209 pure_speed_used=0; | |
2210 pure_intellect_used=0; | |
2211 pure_endurance_used=0; | |
2212 pure_willpower_used=0; | |
2213 pure_accuracy_used=0; | |
2214 pure_might_used=0; | |
0 | 2215 |
2216 sResFireBase = sResFireBonus = 0; | |
2217 sResAirBase = sResAirBonus = 0; | |
2218 sResWaterBase = sResWaterBonus = 0; | |
2219 sResEarthBase = sResEarthBonus = 0; | |
2220 sResMagicBase = sResMagicBonus = 0; | |
2221 sResSpiritBase = sResSpiritBonus = 0; | |
2222 sResMindBase = sResMindBonus = 0; | |
2223 sResBodyBase = sResBodyBonus = 0; | |
2224 sResLightBase = sResLightBonus = 0; | |
2225 sResDarkBase = sResDarkBonus = 0; | |
2226 | |
2227 uTimeToRecovery = 0; | |
2228 | |
2229 uSkillPoints = 0; | |
2230 | |
2231 sHealth = 0; | |
2232 uFullHealthBonus = 0; | |
2233 _health_related = 0; | |
2234 | |
2235 sMana = 0; | |
2236 uFullManaBonus = 0; | |
2237 _mana_related = 0; | |
2238 | |
2239 uQuickSpell = 0; | |
2240 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2241 | |
2242 _some_attack_bonus = 0; | |
2243 field_1A91 = 0; | |
2244 _melee_dmg_bonus = 0; | |
2245 field_1A93 = 0; | |
2246 _ranged_atk_bonus = 0; | |
2247 field_1A95 = 0; | |
2248 _ranged_dmg_bonus = 0; | |
2249 field_1A97 = 0; | |
2250 | |
130 | 2251 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2252 uExpressionTimePassed = 0; |
2253 uExpressionTimeLength = 0; | |
2254 | |
2255 uNumDivineInterventionCastsThisDay = 0; | |
2256 uNumArmageddonCasts = 0; | |
2257 uNumFireSpikeCasts = 0; | |
2258 | |
2259 memset(field_1988, 0, 49 * sizeof(int)); | |
2260 memset(field_1A50, 0, 64 * sizeof(char)); | |
2261 | |
2262 field_E0 = 0; | |
2263 field_E4 = 0; | |
2264 field_E8 = 0; | |
2265 field_EC = 0; | |
2266 field_F0 = 0; | |
2267 field_F4 = 0; | |
2268 field_F8 = 0; | |
2269 field_FC = 0; | |
2270 field_100 = 0; | |
2271 field_104 = 0; | |
198 | 2272 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2273 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2274 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2275 |
198 | 2276 lastOpenedSpellbookPage = 0; |
0 | 2277 } |
2278 | |
2279 //----- (0048C6F6) -------------------------------------------------------- | |
2280 bool Party::AddItem(ItemGen *pItem) | |
2281 { | |
2282 unsigned int v2; // eax@1 | |
2283 unsigned int v3; // ecx@4 | |
2284 signed int v4; // edx@4 | |
2285 char *v5; // eax@8 | |
973 | 2286 //unsigned int v6; // eax@10 |
0 | 2287 Texture *v7; // ebx@10 |
2288 signed int v8; // esi@10 | |
2289 Player *v9; // edi@11 | |
2290 int v10; // eax@11 | |
2291 bool result; // eax@15 | |
2292 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2293 |
2294 | |
188 | 2295 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2296 //int v16; // [sp+10h] [bp-18h]@3 | |
2297 //int v17; // [sp+14h] [bp-14h]@3 | |
2298 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2299 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2300 Party *v20; // [sp+20h] [bp-8h]@1 | |
2301 int v21; // [sp+24h] [bp-4h]@10 | |
2302 | |
2303 auto thos = this; | |
2304 | |
2305 v20 = thos; | |
2306 v2 = pItem->uItemID; | |
222 | 2307 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2308 pItem->SetIdentified(); |
188 | 2309 ///v15 = 0; |
2310 //v16 = 1; | |
2311 //v18 = 3; | |
2312 //v17 = 2; | |
0 | 2313 if ( uActiveCharacter ) |
2314 { | |
2315 v3 = uActiveCharacter - 1; | |
2316 v4 = 0; | |
2317 do | |
2318 { | |
188 | 2319 v15[v4++] = v3++; |
0 | 2320 if ( (signed int)v3 >= 4 ) |
2321 v3 = 0; | |
2322 } | |
2323 while ( v4 < 4 ); | |
2324 } | |
2325 v5 = pItemsTable->pItems[v2].pIconName; | |
2326 if ( v5 ) | |
2327 { | |
973 | 2328 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2329 v21 = areWeLoadingTexture; |
2330 v8 = 0; | |
2331 while ( 1 ) | |
2332 { | |
188 | 2333 v9 = &v20->pPlayers[v15[v8]]; |
2334 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2335 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2336 if ( v10 ) |
2337 break; | |
2338 ++v8; | |
2339 if ( v8 >= 4 ) | |
2340 { | |
2341 if ( !v21 ) | |
2342 { | |
2343 v7->Release(); | |
1006 | 2344 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2345 } |
2346 goto LABEL_15; | |
2347 } | |
2348 } | |
232 | 2349 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2350 pItem->Reset(); |
2351 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2352 v19->PlaySound(SPEECH_60, 0); |
0 | 2353 if ( !v21 ) |
2354 { | |
2355 v7->Release(); | |
1006 | 2356 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2357 } |
2358 result = 1; | |
2359 } | |
2360 else | |
2361 { | |
2362 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2363 LABEL_15: | |
2364 result = 0; | |
2365 } | |
2366 return result; | |
2367 } | |
2368 // 506128: using guessed type int areWeLoadingTexture; | |
2369 | |
2370 //----- (0048C855) -------------------------------------------------------- | |
2371 int Player::GetBaseStrength() | |
2372 { | |
2373 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2374 } | |
2375 | |
2376 //----- (0048C86C) -------------------------------------------------------- | |
2377 int Player::GetBaseIntelligence() | |
2378 { | |
2379 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2380 } | |
2381 | |
2382 //----- (0048C883) -------------------------------------------------------- | |
2383 int Player::GetBaseWillpower() | |
2384 { | |
2385 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2386 } | |
2387 | |
2388 //----- (0048C89A) -------------------------------------------------------- | |
2389 int Player::GetBaseEndurance() | |
2390 { | |
2391 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2392 } | |
2393 | |
2394 //----- (0048C8B1) -------------------------------------------------------- | |
2395 int Player::GetBaseAccuracy() | |
2396 { | |
2397 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2398 } | |
2399 | |
2400 //----- (0048C8C8) -------------------------------------------------------- | |
2401 int Player::GetBaseSpeed() | |
2402 { | |
2403 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2404 } | |
2405 | |
2406 //----- (0048C8DF) -------------------------------------------------------- | |
2407 int Player::GetBaseLuck() | |
2408 { | |
2409 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2410 } | |
2411 | |
2412 //----- (0048C8F6) -------------------------------------------------------- | |
2413 int Player::GetBaseLevel() | |
2414 { | |
2415 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2416 } | |
2417 | |
2418 //----- (0048C90D) -------------------------------------------------------- | |
2419 int Player::GetActualLevel() | |
2420 { | |
2421 return uLevel + sLevelModifier + | |
2422 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2423 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2424 } | |
2425 | |
2426 //----- (0048C93C) -------------------------------------------------------- | |
2427 int Player::GetActualMight() | |
2428 { | |
2429 Player *v1; // esi@1 | |
2430 unsigned int v2; // eax@1 | |
2431 signed int v3; // ecx@1 | |
2432 signed int v4; // ebx@4 | |
2433 int v5; // edi@5 | |
2434 int v6; // ST14_4@5 | |
2435 | |
2436 v1 = this; | |
2437 v2 = this->sAgeModifier + GetBaseAge(); | |
2438 v3 = 0; | |
2439 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2440 { | |
2441 ++v3; | |
2442 if ( v3 >= 4 ) | |
2443 { | |
2444 v4 = 100; | |
2445 goto LABEL_5; | |
2446 } | |
2447 } | |
2448 v4 = pAgeingStrengthMultiplier[v3]; | |
2449 LABEL_5: | |
2450 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2451 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2452 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2453 } | |
2454 | |
2455 //----- (0048C9C2) -------------------------------------------------------- | |
2456 int Player::GetActualIntelligence() | |
2457 { | |
2458 Player *v1; // esi@1 | |
2459 unsigned int sAge; // eax@1 | |
2460 signed int uAgeLevel; // ecx@1 | |
2461 signed int v4; // ebx@4 | |
2462 int v5; // edi@5 | |
2463 int v6; // ebp@5 | |
2464 | |
2465 v1 = this; | |
2466 sAge = this->sAgeModifier + GetBaseAge(); | |
2467 uAgeLevel = 0; | |
2468 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2469 { | |
2470 ++uAgeLevel; | |
2471 if ( uAgeLevel >= 4 ) | |
2472 { | |
2473 v4 = 100; | |
2474 goto LABEL_5; | |
2475 } | |
2476 } | |
2477 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2478 LABEL_5: | |
2479 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2480 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2481 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2482 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2483 + v6 | |
2484 + v1->uIntelligenceBonus; | |
2485 } | |
2486 | |
2487 //----- (0048CA3F) -------------------------------------------------------- | |
2488 int Player::GetActualWillpower() | |
2489 { | |
2490 int v5; // edi@5 | |
2491 | |
2492 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2493 uint uAgeingMultiplier = 100; | |
2494 for (uint i = 0; i < 4; ++i) | |
2495 if (uActualAge >= pAgeingTable[i]) | |
2496 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2497 else break; | |
2498 | |
2499 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2500 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2501 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2502 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2503 + uWillpowerBonus; | |
2504 } | |
2505 | |
2506 //----- (0048CABC) -------------------------------------------------------- | |
2507 int Player::GetActualEndurance() | |
2508 { | |
2509 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2510 uint uAgeingMultiplier = 100; | |
2511 for (uint i = 0; i < 4; ++i) | |
2512 if (uActualAge >= pAgeingTable[i]) | |
2513 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2514 else break; | |
2515 | |
2516 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2517 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2518 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2519 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2520 + uItemBonus | |
2521 + uEnduranceBonus; | |
2522 } | |
2523 | |
2524 //----- (0048CB39) -------------------------------------------------------- | |
2525 int Player::GetActualAccuracy() | |
2526 { | |
2527 Player *v1; // esi@1 | |
2528 unsigned int v2; // eax@1 | |
2529 signed int v3; // ecx@1 | |
2530 signed int v4; // ebx@4 | |
2531 int v5; // edi@5 | |
2532 int v6; // ebp@5 | |
2533 | |
2534 v1 = this; | |
2535 v2 = this->sAgeModifier + GetBaseAge(); | |
2536 v3 = 0; | |
2537 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2538 { | |
2539 ++v3; | |
2540 if ( v3 >= 4 ) | |
2541 { | |
2542 v4 = 100; | |
2543 goto LABEL_5; | |
2544 } | |
2545 } | |
2546 v4 = pAgeingAccuracyMultiplier[v3]; | |
2547 LABEL_5: | |
2548 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2549 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2550 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2551 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2552 + v6 | |
2553 + v1->uAccuracyBonus; | |
2554 } | |
2555 | |
2556 //----- (0048CBB6) -------------------------------------------------------- | |
2557 int Player::GetActualSpeed() | |
2558 { | |
2559 Player *v1; // esi@1 | |
2560 unsigned int v2; // eax@1 | |
2561 signed int v3; // ecx@1 | |
2562 signed int v4; // ebx@4 | |
2563 int v5; // edi@5 | |
2564 int v6; // ebp@5 | |
2565 | |
2566 v1 = this; | |
2567 v2 = this->sAgeModifier + GetBaseAge(); | |
2568 v3 = 0; | |
2569 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2570 { | |
2571 ++v3; | |
2572 if ( v3 >= 4 ) | |
2573 { | |
2574 v4 = 100; | |
2575 goto LABEL_5; | |
2576 } | |
2577 } | |
2578 v4 = pAgeingSpeedMultiplier[v3]; | |
2579 LABEL_5: | |
2580 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2581 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2582 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2583 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2584 + v6 | |
2585 + v1->uSpeedBonus; | |
2586 } | |
2587 | |
2588 //----- (0048CC33) -------------------------------------------------------- | |
2589 int Player::GetActualLuck() | |
2590 { | |
1036 | 2591 signed int curr_age; // eax@7 |
2592 signed int i; // ecx@7 | |
2593 signed int age_luck_pc; // ebx@10 | |
2594 int condition_luck_pc; // edi@11 | |
2595 int items_luck_bonus; // ebp@11 | |
2596 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2597 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2598 int full_luck; | |
2599 | |
2600 npc_luck_bonus = 0; | |
652 | 2601 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 2602 npc_luck_bonus = 5; |
652 | 2603 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 2604 npc_luck_bonus += 20; |
652 | 2605 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 2606 npc_luck_bonus += 10; |
2607 curr_age = sAgeModifier + GetBaseAge(); | |
2608 i = 0; | |
2609 while ( curr_age >= pAgeingTable[i] ) | |
2610 { | |
2611 ++i; | |
2612 if ( i >= 4 ) | |
2613 break; | |
2614 } | |
2615 if (i < 4) | |
2616 age_luck_pc = pAgeingLuckMultiplier[i]; | |
2617 else | |
2618 age_luck_pc = 100; | |
2619 | |
2620 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2621 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2622 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); | |
2623 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus | |
2624 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; | |
2625 return full_luck; | |
0 | 2626 } |
2627 | |
2628 //----- (0048CCF5) -------------------------------------------------------- | |
2629 int Player::GetActualAttack(int a2) | |
2630 { | |
2631 Player *v2; // esi@1 | |
2632 int v3; // eax@1 | |
2633 int v4; // edi@1 | |
2634 int v5; // ebx@1 | |
2635 int v6; // ebp@1 | |
2636 | |
2637 v2 = this; | |
2638 v3 = GetActualAccuracy(); | |
1036 | 2639 v4 = GetParameterBonus(v3); |
0 | 2640 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
2641 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2642 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2643 } | |
2644 | |
2645 //----- (0048CD45) -------------------------------------------------------- | |
2646 int Player::GetMeleeDamageMinimal() | |
2647 { | |
2648 Player *v1; // edi@1 | |
2649 int v2; // eax@1 | |
2650 int v3; // esi@1 | |
2651 int v4; // esi@1 | |
2652 int v5; // esi@1 | |
2653 int v6; // esi@1 | |
2654 signed int result; // eax@1 | |
2655 | |
1036 | 2656 |
0 | 2657 v2 = GetActualMight(); |
1036 | 2658 v3 = GetParameterBonus(v2); |
0 | 2659 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
2660 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 2661 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
2662 if ( result < 1 ) | |
2663 result = 1; | |
0 | 2664 return result; |
2665 } | |
2666 | |
2667 //----- (0048CD90) -------------------------------------------------------- | |
2668 int Player::GetMeleeDamageMaximal() | |
2669 { | |
2670 Player *v1; // edi@1 | |
2671 int v2; // eax@1 | |
2672 int v3; // esi@1 | |
2673 int v4; // esi@1 | |
2674 int v5; // esi@1 | |
2675 int v6; // esi@1 | |
2676 signed int result; // eax@1 | |
2677 | |
2678 v1 = this; | |
2679 v2 = GetActualMight(); | |
1036 | 2680 v3 = GetParameterBonus(v2); |
0 | 2681 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
2682 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2683 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2684 result = 1; | |
2685 if ( v6 >= 1 ) | |
2686 result = v6; | |
2687 return result; | |
2688 } | |
2689 | |
2690 //----- (0048CDDB) -------------------------------------------------------- | |
2691 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2692 { | |
2693 int v4; // esi@1 | |
2694 Player *v5; // edi@1 | |
2695 ItemGen *v6; // ebx@4 | |
2696 unsigned int v7; // ebp@4 | |
2697 unsigned int v8; // esi@4 | |
2698 int v9; // eax@4 | |
2699 int v10; // eax@9 | |
2700 char v11; // zf@9 | |
2701 int v12; // esi@10 | |
2702 int v13; // eax@11 | |
2703 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2704 ItemGen *v15; // ebx@35 | |
2705 unsigned int v16; // ebp@35 | |
2706 unsigned int v17; // esi@35 | |
2707 int v18; // edx@38 | |
2708 int v19; // eax@40 | |
2709 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2710 int v21; // esi@62 | |
2711 int v22; // eax@63 | |
2712 int v23; // ebx@63 | |
2713 int v24; // ebx@63 | |
2714 signed int result; // eax@64 | |
2715 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2716 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2717 int v28; // [sp+10h] [bp-10h]@1 | |
2718 int v29; // [sp+10h] [bp-10h]@33 | |
2719 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2720 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2721 int v32; // [sp+18h] [bp-8h]@1 | |
2722 int v33; // [sp+18h] [bp-8h]@8 | |
2723 int v34; // [sp+1Ch] [bp-4h]@1 | |
2724 int v35; // [sp+28h] [bp+8h]@37 | |
2725 | |
2726 v4 = 0; | |
2727 v5 = this; | |
2728 v34 = 0; | |
2729 v32 = 0; | |
2730 v28 = 0; | |
2731 if ( IsUnarmed() == 1 ) | |
2732 { | |
2733 v32 = rand() % 3 + 1; | |
2734 LABEL_61: | |
2735 v34 = v4; | |
2736 goto LABEL_62; | |
2737 } | |
816 | 2738 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2739 { |
232 | 2740 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2741 v7 = v6->uItemID; |
2742 v8 = v6->uItemID; | |
2743 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2744 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2745 ++v9; |
2746 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2747 if ( v9 > 0 ) | |
2748 { | |
2749 v33 = v9; | |
2750 do | |
2751 { | |
2752 v10 = rand(); | |
2753 v11 = v33-- == 1; | |
2754 v28 += v10 % v30 + 1; | |
2755 } | |
2756 while ( !v11 ); | |
2757 } | |
2758 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2759 if ( !uTargetActorID ) | |
2760 goto LABEL_28; | |
377 | 2761 v13 = v6->uSpecEnchantmentType; |
0 | 2762 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2763 { | |
2764 v14 = (MONSTER_SUPERTYPE)1; | |
2765 } | |
2766 else | |
2767 { | |
2768 if ( v13 == 39 ) | |
2769 { | |
2770 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2771 } | |
2772 else | |
2773 { | |
2774 if ( v13 == 40 ) | |
2775 { | |
2776 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2777 } | |
2778 else | |
2779 { | |
2780 if ( v13 == 63 || v7 == 517 ) | |
2781 { | |
2782 v26 = MONSTER_SUPERTYPE_ELF; | |
2783 } | |
2784 else | |
2785 { | |
2786 if ( v13 != 65 ) | |
2787 { | |
2788 LABEL_28: | |
2789 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2790 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2791 && rand() % 100 < 10 ) | |
2792 v12 *= 3; | |
2793 v32 = v12; | |
2794 goto LABEL_33; | |
2795 } | |
2796 v26 = MONSTER_SUPERTYPE_TITAN; | |
2797 } | |
2798 } | |
2799 } | |
2800 v14 = v26; | |
2801 } | |
2802 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2803 v12 *= 2; | |
2804 goto LABEL_28; | |
2805 } | |
2806 LABEL_33: | |
2807 v29 = 0; | |
2808 if ( !a3 ) | |
2809 { | |
2810 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2811 { | |
898 | 2812 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2813 v16 = v15->uItemID; |
2814 v17 = v15->uItemID; | |
2815 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2816 { | |
2817 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2818 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2819 { | |
2820 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2821 do | |
2822 { | |
2823 v18 = rand() % v31; | |
2824 v11 = v35-- == 1; | |
2825 v29 += v18 + 1; | |
2826 } | |
2827 while ( !v11 ); | |
2828 } | |
2829 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2830 if ( !uTargetActorID ) | |
2831 goto LABEL_57; | |
377 | 2832 v19 = v15->uSpecEnchantmentType; |
0 | 2833 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2834 { | |
2835 v20 = (MONSTER_SUPERTYPE)1; | |
2836 } | |
2837 else | |
2838 { | |
2839 if ( v19 == 39 ) | |
2840 { | |
2841 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2842 } | |
2843 else | |
2844 { | |
2845 if ( v19 == 40 ) | |
2846 { | |
2847 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2848 } | |
2849 else | |
2850 { | |
2851 if ( v19 == 63 || v16 == 517 ) | |
2852 { | |
2853 v27 = MONSTER_SUPERTYPE_ELF; | |
2854 } | |
2855 else | |
2856 { | |
2857 if ( v19 != 65 ) | |
2858 { | |
2859 LABEL_57: | |
2860 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2861 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2862 && rand() % 100 < 10 ) | |
2863 v4 *= 3; | |
2864 goto LABEL_61; | |
2865 } | |
2866 v27 = MONSTER_SUPERTYPE_TITAN; | |
2867 } | |
2868 } | |
2869 } | |
2870 v20 = v27; | |
2871 } | |
2872 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2873 v4 *= 2; | |
2874 goto LABEL_57; | |
2875 } | |
2876 } | |
2877 } | |
2878 LABEL_62: | |
2879 v21 = v32 + v34; | |
2880 if ( !a2 ) | |
2881 { | |
2882 v22 = GetActualMight(); | |
1036 | 2883 v23 = GetParameterBonus(v22); |
0 | 2884 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; |
2885 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2886 } | |
2887 result = 1; | |
2888 if ( v21 >= 1 ) | |
2889 result = v21; | |
2890 return result; | |
2891 } | |
2892 | |
2893 //----- (0048D0B9) -------------------------------------------------------- | |
2894 int Player::GetRangedAttack() | |
2895 { | |
2896 Player *v1; // esi@1 | |
2897 int v2; // eax@1 | |
2898 int v3; // edi@3 | |
2899 int v4; // eax@4 | |
2900 int v5; // edi@4 | |
2901 int v6; // edi@4 | |
2902 int v7; // edi@4 | |
2903 | |
2904 v1 = this; | |
232 | 2905 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2906 if ( v2 < 64 || v2 > 65 ) |
2907 { | |
2908 v4 = GetActualAccuracy(); | |
1036 | 2909 v5 = GetParameterBonus(v4); |
0 | 2910 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
2911 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2912 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2913 } | |
2914 else | |
2915 { | |
2916 v3 = GetActualAttack(1); | |
2917 } | |
2918 return v3; | |
2919 } | |
2920 | |
2921 //----- (0048D124) -------------------------------------------------------- | |
2922 int Player::GetRangedDamageMin() | |
2923 { | |
2924 Player *v1; // esi@1 | |
2925 int v2; // edi@1 | |
2926 int v3; // edi@1 | |
2927 int v4; // edi@1 | |
2928 unsigned __int16 v5; // ax@1 | |
2929 int result; // eax@6 | |
2930 | |
2931 v1 = this; | |
1040 | 2932 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
2933 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2934 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2935 v5 = v1->pActiveSkills[5]; |
2936 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2937 v4 += v1->pActiveSkills[5] & 0x3F; | |
2938 if ( v4 >= 1 ) | |
2939 result = v4; | |
2940 else | |
2941 result = 0; | |
2942 return result; | |
2943 } | |
2944 | |
2945 //----- (0048D191) -------------------------------------------------------- | |
2946 int Player::GetRangedDamageMax() | |
2947 { | |
2948 Player *v1; // esi@1 | |
2949 int v2; // edi@1 | |
2950 int v3; // edi@1 | |
2951 int v4; // edi@1 | |
2952 unsigned __int16 v5; // ax@1 | |
2953 int result; // eax@6 | |
2954 | |
2955 v1 = this; | |
1040 | 2956 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
2957 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2958 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2959 v5 = v1->pActiveSkills[5]; |
2960 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2961 v4 += v1->pActiveSkills[5] & 0x3F; | |
2962 if ( v4 >= 1 ) | |
2963 result = v4; | |
2964 else | |
2965 result = 0; | |
2966 return result; | |
2967 } | |
2968 | |
2969 //----- (0048D1FE) -------------------------------------------------------- | |
2970 bool Player::CalculateRangedDamageTo(int a2) | |
2971 { | |
2972 Player *v2; // ebx@1 | |
2973 bool result; // eax@1 | |
2974 ItemGen *v4; // ebx@2 | |
2975 unsigned int v5; // edi@2 | |
2976 unsigned int v6; // esi@2 | |
2977 int v7; // edx@4 | |
2978 char v8; // zf@4 | |
2979 int v9; // esi@5 | |
2980 int v10; // ebx@6 | |
2981 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2982 unsigned __int16 v12; // ax@19 | |
2983 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2984 Player *v14; // [sp+4h] [bp-10h]@1 | |
2985 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2986 int v16; // [sp+Ch] [bp-8h]@3 | |
2987 int v17; // [sp+10h] [bp-4h]@1 | |
2988 | |
2989 v17 = 0; | |
2990 v2 = this; | |
2991 v14 = this; | |
2992 result = HasItemEquipped(EQUIP_BOW); | |
2993 if ( !result ) | |
2994 return result; | |
232 | 2995 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2996 v5 = v4->uItemID; |
2997 v6 = v4->uItemID; | |
2998 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2999 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
3000 { | |
3001 v16 = pItemsTable->pItems[v6].uDamageDice; | |
3002 do | |
3003 { | |
3004 v7 = rand() % v15; | |
3005 v8 = v16-- == 1; | |
3006 v17 += v7 + 1; | |
3007 } | |
3008 while ( !v8 ); | |
3009 } | |
3010 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
3011 if ( a2 ) | |
3012 { | |
377 | 3013 v10 = v4->uSpecEnchantmentType; |
0 | 3014 if ( v10 == 64 ) |
3015 { | |
3016 v11 = (MONSTER_SUPERTYPE)1; | |
3017 goto LABEL_17; | |
3018 } | |
3019 if ( v10 == 39 || v5 == 508 ) | |
3020 { | |
3021 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3022 goto LABEL_16; | |
3023 } | |
3024 if ( v10 == 40 ) | |
3025 { | |
3026 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3027 goto LABEL_16; | |
3028 } | |
3029 if ( v10 == 63 || v5 == 517 ) | |
3030 { | |
3031 v13 = MONSTER_SUPERTYPE_ELF; | |
3032 LABEL_16: | |
3033 v11 = v13; | |
3034 LABEL_17: | |
3035 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3036 v9 *= 2; | |
3037 goto LABEL_19; | |
3038 } | |
3039 } | |
3040 LABEL_19: | |
3041 v12 = v14->pActiveSkills[5]; | |
3042 if ( v12 ) | |
3043 { | |
3044 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3045 v9 += v14->pActiveSkills[5] & 0x3F; | |
3046 } | |
3047 return v9; | |
3048 } | |
3049 | |
3050 //----- (0048D2EA) -------------------------------------------------------- | |
3051 char *Player::GetMeleeDamageString() | |
3052 { | |
1036 | 3053 signed int itemid; // eax@1 |
3054 int min_damage; // edi@3 | |
3055 int max_damage; // eax@3 | |
0 | 3056 |
3057 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3058 | |
1036 | 3059 if ( pEquipment.uMainHand) |
3060 { | |
3061 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3062 if ( itemid < 64 || itemid > 65 ) //blasters | |
3063 { | |
3064 min_damage = GetMeleeDamageMinimal(); | |
3065 max_damage = GetMeleeDamageMaximal(); | |
3066 } | |
3067 else | |
3068 { //for blasters | |
3069 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3070 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3071 } | |
3072 if ( max_damage ) | |
3073 { | |
3074 if ( min_damage == max_damage ) | |
3075 { | |
3076 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
3077 } | |
3078 else | |
3079 { | |
3080 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3081 } | |
3082 } | |
3083 else | |
3084 { | |
3085 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
3086 } | |
3087 | |
3088 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3089 { | |
3090 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3091 } | |
3092 } | |
0 | 3093 else |
1036 | 3094 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
3095 return player__getmeleedamagestring_static_buff; | |
0 | 3096 } |
3097 | |
3098 //----- (0048D396) -------------------------------------------------------- | |
3099 char *Player::GetRangedDamageString() | |
1036 | 3100 { |
3101 signed int itemid; // eax@1 | |
3102 int min_damage; // edi@3 | |
3103 int max_damage; // eax@3 | |
3104 | |
3105 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3106 if ( pEquipment.uMainHand) | |
3107 { | |
3108 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3109 if ( itemid < 64 || itemid > 65 ) //blasters | |
3110 { | |
3111 min_damage = GetRangedDamageMin(); | |
3112 max_damage = GetRangedDamageMax(); | |
3113 } | |
3114 else | |
3115 { //for blasters | |
3116 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3117 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3118 } | |
3119 if ( max_damage ) | |
3120 { | |
3121 if ( min_damage == max_damage ) | |
3122 { | |
3123 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); | |
3124 } | |
3125 else | |
3126 { | |
3127 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3128 } | |
3129 } | |
3130 else | |
3131 { | |
3132 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3133 } | |
3134 | |
3135 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3136 { | |
3137 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3138 } | |
3139 } | |
0 | 3140 else |
1036 | 3141 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
3142 return player__getrangeddamagestring_static_buff; | |
3143 } | |
0 | 3144 |
3145 //----- (0048D45A) -------------------------------------------------------- | |
3146 bool Player::CanTrainToNextLevel() | |
3147 { | |
3148 int v1; // edx@1 | |
3149 int v2; // eax@1 | |
3150 int i; // esi@1 | |
3151 | |
3152 v1 = this->uLevel; | |
3153 v2 = 0; | |
3154 for ( i = 0; i < v1; ++i ) | |
3155 v2 += i + 1; | |
3156 return (signed __int64)this->uExperience >= 1000 * v2; | |
3157 } | |
3158 | |
3159 //----- (0048D498) -------------------------------------------------------- | |
3160 unsigned int Player::GetExperienceDisplayColor() | |
3161 { | |
3162 unsigned int result; // eax@2 | |
3163 | |
3164 if ( CanTrainToNextLevel() ) | |
995 | 3165 result = ui_character_bonus_text_color; |
0 | 3166 else |
995 | 3167 result = ui_character_default_text_color; |
0 | 3168 return result; |
3169 } | |
3170 | |
3171 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 3172 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
3173 { | |
3174 | |
3175 int resist_value; // edi@8 | |
3176 int player_luck; // eax@21 | |
3177 signed int res_rand_divider; // ebx@2 | |
3178 int armor_skill; // eax@29 | |
3179 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
3180 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
3181 | |
3182 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
3183 switch(dmg_type) | |
3184 { | |
3185 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
3186 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
3187 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
3188 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
3189 | |
3190 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
3191 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
3192 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
3193 } | |
3194 if (player_resist) | |
3195 resist_value = GetActualResistance(player_resist); | |
3196 else | |
3197 resist_value = 0; | |
3198 | |
3199 result_amount_dmg = amount; | |
3200 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 3201 return 0; |
1036 | 3202 player_luck = GetActualLuck(); |
3203 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
3204 | |
3205 if ( resist_value ) | |
3206 { | |
3207 if ( rand() % res_rand_divider >= 30 ) | |
3208 { | |
3209 result_amount_dmg = amount >> 1; | |
3210 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3211 { |
1036 | 3212 result_amount_dmg = amount >> 2; |
3213 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3214 { |
1036 | 3215 result_amount_dmg = amount >> 3; |
3216 if ( rand() % res_rand_divider >= 30 ) | |
3217 result_amount_dmg = amount >> 4; | |
0 | 3218 } |
3219 } | |
3220 } | |
3221 } | |
1036 | 3222 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
3223 { | |
3224 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 3225 { |
1036 | 3226 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
3227 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 3228 { |
1036 | 3229 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
3230 return (int)(double)result_amount_dmg * 0.5; | |
0 | 3231 } |
1036 | 3232 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 3233 { |
1036 | 3234 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
3235 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 3236 } |
3237 } | |
1036 | 3238 } |
3239 return result_amount_dmg; | |
0 | 3240 } |
3241 | |
3242 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3243 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3244 { | |
3245 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3246 } |
3247 | |
3248 //----- (0048D651) -------------------------------------------------------- | |
816 | 3249 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3250 { | |
3251 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3252 } |
3253 | |
3254 //----- (0048D676) -------------------------------------------------------- | |
3255 bool Player::IsUnarmed() | |
3256 { | |
1091 | 3257 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
3258 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3259 } |
3260 | |
3261 //----- (0048D6AA) -------------------------------------------------------- | |
3262 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3263 { | |
3264 auto i = pEquipment.pIndices[uEquipIndex]; | |
3265 if (i) | |
1080 | 3266 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 3267 else |
3268 return false; | |
0 | 3269 } |
3270 | |
3271 //----- (0048D6D0) -------------------------------------------------------- | |
3272 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3273 { | |
3274 for (uint i = 0; i < 16; ++i) | |
3275 { | |
3276 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 3277 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 3278 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3279 return true; | |
3280 } | |
3281 return false; | |
3282 } | |
3283 | |
3284 //----- (0048D709) -------------------------------------------------------- | |
1080 | 3285 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
3286 { | |
1010 | 3287 |
0 | 3288 int v6; // esi@5 |
3289 | |
1080 | 3290 if ( equip_type >= 16 ) |
0 | 3291 { |
3292 v6 = 0; | |
3293 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1091 | 3294 || pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 3295 { |
3296 ++v6; | |
3297 if ( (signed int)v6 >= 16 ) | |
3298 return 0; | |
3299 } | |
3300 return 1; | |
3301 } | |
1080 | 3302 if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 3303 return 1; |
3304 return 0; | |
3305 } | |
3306 | |
3307 //----- (0048D76C) -------------------------------------------------------- | |
3308 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3309 { | |
3310 unsigned __int16 v6; // cx@8 | |
3311 int v7; // edi@8 | |
3312 unsigned int v8; // ebx@8 | |
3313 unsigned int v9; // esi@8 | |
3314 int v10; // eax@8 | |
3315 int v11; // edi@12 | |
3316 bool result; // eax@13 | |
3317 | |
3318 if ( !a2 | |
3319 || this->pConditions[16] | |
3320 || this->pConditions[14] | |
3321 || this->pConditions[15] | |
3322 || this->pConditions[4] | |
3323 || this->pConditions[13] | |
3324 || this->pConditions[2] ) | |
3325 { | |
3326 result = 0; | |
3327 } | |
3328 else | |
3329 { | |
3330 v6 = this->pActiveSkills[34]; | |
3331 v7 = v6 & 0x3F; | |
3332 v8 = SkillToMastery(v6); | |
3333 v9 = a2->GetValue(); | |
3334 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3335 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3336 v9 *= 3; | |
3337 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3338 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3339 if ( rand() % 100 >= 5 ) | |
3340 { | |
3341 if ( *a6 > v11 ) | |
3342 result = *a6 - v11 < 500; | |
3343 else | |
3344 result = 2; | |
3345 } | |
3346 else | |
3347 { | |
3348 result = 0; | |
3349 } | |
3350 } | |
3351 return result; | |
3352 } | |
3353 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3354 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3355 | |
3356 //----- (0048D88B) -------------------------------------------------------- | |
3357 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3358 { | |
3359 Player *v4; // esi@1 | |
3360 Actor *v5; // edi@1 | |
3361 unsigned __int16 v6; // cx@10 | |
3362 int v7; // ebx@10 | |
3363 unsigned int v8; // esi@10 | |
3364 int v9; // eax@10 | |
3365 int v10; // esi@10 | |
3366 int v11; // eax@13 | |
3367 signed int v12; // ebx@15 | |
3368 signed int v13; // edx@15 | |
3369 int v14; // ecx@15 | |
3370 unsigned __int16 v15; // si@21 | |
3371 unsigned int v16; // ebx@24 | |
3372 int v17; // esi@24 | |
3373 const void *v18; // eax@29 | |
3374 unsigned int v19; // esi@31 | |
3375 int v20; // eax@34 | |
3376 char v21; // zf@36 | |
3377 unsigned int v22; // ST0C_4@39 | |
3378 char *v23; // esi@39 | |
3379 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3380 int v26; // [sp-8h] [bp-44h]@40 | |
3381 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3382 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3383 int v29; // [sp+30h] [bp-Ch]@10 | |
3384 int v30; // [sp+34h] [bp-8h]@10 | |
3385 Player *v31; // [sp+38h] [bp-4h]@1 | |
3386 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3387 | |
3388 v4 = this; | |
3389 v5 = &pActors[uActorID]; | |
3390 v31 = this; | |
3391 if ( &pActors[uActorID] | |
3392 && !this->pConditions[16] | |
3393 && !this->pConditions[14] | |
3394 && !this->pConditions[15] | |
3395 && !this->pConditions[4] | |
3396 && !this->pConditions[13] | |
3397 && !this->pConditions[2] ) | |
3398 { | |
3399 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3400 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3401 v6 = v4->pActiveSkills[34]; | |
3402 v7 = v6 & 0x3F; | |
3403 v8 = SkillToMastery(v6); | |
3404 v9 = rand(); | |
3405 v28 = 4 * v8; | |
3406 v30 = dword_4EDEA0[v8]; | |
3407 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3408 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3409 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3410 { | |
322 | 3411 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3412 _steal_perma = 0; |
3413 v26 = (int)v31->pName; | |
3414 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3415 } | |
3416 else | |
3417 { | |
3418 v11 = rand(); | |
3419 if ( v11 % 100 >= 40 ) | |
3420 { | |
3421 if ( v11 % 100 >= 70 ) | |
3422 { | |
3423 v19 = 0; | |
3424 if ( v7 > 0 ) | |
3425 { | |
3426 do | |
3427 { | |
3428 --v7; | |
3429 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3430 } | |
3431 while ( v7 ); | |
3432 } | |
3433 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3434 return _steal_perma; | |
377 | 3435 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3436 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3437 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3438 v21 = *(int *)v20 == v19; |
3439 *(int *)v20 -= v19; | |
3440 if ( v21 ) | |
3441 v5->array_000234[3].uItemID = 0; | |
3442 if ( v19 ) | |
3443 { | |
3444 party_finds_gold(v19, 2); | |
3445 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3446 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3447 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 3448 LABEL_43: |
3449 ShowStatusBarString(v23, 2u); | |
3450 return _steal_perma; | |
3451 } | |
3452 } | |
3453 else | |
3454 { | |
3455 v27.Reset(); | |
3456 v12 = 0; | |
3457 v13 = 0; | |
3458 v14 = (int)v5->array_000234; | |
3459 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3460 { | |
3461 ++v13; | |
3462 v14 += 36; | |
3463 if ( v13 >= 4 ) | |
3464 goto LABEL_21; | |
3465 } | |
3466 v12 = 1; | |
3467 LABEL_21: | |
3468 v15 = v5->uCarriedItemID; | |
3469 if ( v15 || v12 ) | |
3470 { | |
3471 v27.Reset(); | |
3472 if ( v15 ) | |
3473 { | |
3474 v16 = (signed __int16)v15; | |
3475 v5->uCarriedItemID = 0; | |
3476 v27.uItemID = (signed __int16)v15; | |
3477 v17 = (signed __int16)v15; | |
3478 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3479 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3480 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3481 { | |
3482 if ( v16 != 220 ) | |
570 | 3483 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3484 } |
3485 } | |
3486 else | |
3487 { | |
3488 v18 = &v5->array_000234[rand() % 4]; | |
3489 memcpy(&v27, v18, sizeof(v27)); | |
3490 ((ItemGen *)v18)->Reset(); | |
3491 v16 = v27.uItemID; | |
3492 } | |
3493 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3494 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3495 pTmpBuf2.data(), |
0 | 3496 pGlobalTXT_LocalizationStrings[304], |
3497 v31->pName, | |
3498 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3499 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 3500 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
3501 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3502 pMouse->SetCursorBitmapFromItemID(v16); | |
3503 return _steal_perma; | |
3504 } | |
3505 } | |
3506 } | |
3507 v26 = (int)v31->pName; | |
3508 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3509 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3510 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3511 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 3512 goto LABEL_43; |
3513 } | |
3514 return 0; | |
3515 } | |
3516 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3517 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3518 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3519 | |
3520 //----- (0048DBB9) -------------------------------------------------------- | |
3521 void Player::Heal(int amount) | |
3522 { | |
1010 | 3523 signed int max_health; // eax@3 |
3524 | |
3525 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3526 { | |
3527 max_health = GetMaxHealth(); | |
3528 if ( pConditions[Condition_Zombie] ) | |
3529 max_health /= 2; | |
3530 sHealth += amount; | |
3531 if ( sHealth > max_health ) | |
3532 sHealth = max_health; | |
3533 if ( pConditions[Condition_Unconcious] ) | |
3534 { | |
3535 if ( sHealth > 0 ) | |
3536 { | |
3537 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3538 } |
3539 } | |
3540 } | |
3541 } | |
3542 | |
3543 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 3544 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
3545 { | |
3546 signed int recieved_dmg; // eax@1 | |
3547 unsigned int armor_indx; // eax@8 | |
3548 bool broke_armor; | |
3549 | |
3550 pConditions[Condition_Sleep] = 0i64; | |
3551 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
3552 sHealth -= recieved_dmg; | |
3553 broke_armor = sHealth <= -10; | |
3554 if ( sHealth < 1 ) // | |
3555 { | |
3556 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
3557 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 3558 { |
1019 | 3559 SetCondition(Condition_Unconcious, 0); |
0 | 3560 } |
3561 else | |
3562 { | |
1019 | 3563 SetCondition(Condition_Dead, 0); |
1036 | 3564 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
3565 if ( sHealth > 0 ) | |
3566 sHealth = 0; | |
3567 } | |
3568 if (broke_armor ) | |
3569 { | |
3570 armor_indx = pEquipment.uArmor; | |
3571 if ( armor_indx ) | |
0 | 3572 { |
1036 | 3573 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 3574 { |
1036 | 3575 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 3576 } |
3577 } | |
3578 } | |
3579 } | |
1036 | 3580 if ( recieved_dmg && CanAct() ) |
187 | 3581 PlaySound(SPEECH_24, 0); |
1036 | 3582 return recieved_dmg; |
0 | 3583 } |
3584 | |
3585 //----- (0048DCF6) -------------------------------------------------------- | |
3586 int Player::_48DCF6(int a2, Actor *pActor) | |
3587 { | |
3588 signed int v3; // edi@1 | |
3589 signed int v4; // ebx@1 | |
3590 Player *v5; // esi@1 | |
3591 int v6; // eax@2 | |
3592 int v7; // eax@5 | |
3593 int v8; // eax@8 | |
3594 int v9; // ebx@8 | |
3595 int v10; // eax@8 | |
3596 int v11; // ebx@8 | |
3597 signed int v12; // edx@9 | |
3598 ItemGen *v13; // eax@9 | |
3599 int v14; // edx@16 | |
3600 unsigned int v15; // edx@17 | |
3601 int v16; // edx@26 | |
3602 unsigned int v17; // edx@27 | |
3603 signed int v19; // edx@38 | |
3604 int *v20; // ecx@38 | |
3605 signed int v21; // eax@40 | |
3606 int v22; // eax@49 | |
3607 signed int v23; // ebx@49 | |
3608 unsigned int v24; // eax@60 | |
3609 int v25; // ecx@61 | |
3610 int v26; // ebx@74 | |
3611 void *v27; // ecx@76 | |
3612 unsigned int v28; // ebx@78 | |
3613 signed int result; // eax@86 | |
3614 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3615 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3616 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3617 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3618 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3619 int v35; // [sp-Ch] [bp-ACh]@56 | |
3620 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3621 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3622 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3623 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3624 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3625 int v41; // [sp-4h] [bp-A4h]@51 | |
3626 int v42; // [sp-4h] [bp-A4h]@56 | |
3627 int v43; // [sp-4h] [bp-A4h]@57 | |
3628 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3629 int v45; // [sp-4h] [bp-A4h]@68 | |
3630 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3631 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3632 int v48; // [sp+9Ch] [bp-4h]@1 | |
3633 | |
3634 v3 = 0; | |
3635 v4 = 0; | |
3636 v5 = this; | |
3637 v47 = 0; | |
3638 v48 = 0; | |
3639 switch ( a2 ) | |
3640 { | |
3641 case 1: | |
3642 v6 = GetActualWillpower(); | |
3643 goto LABEL_46; | |
3644 case 2: | |
3645 case 3: | |
3646 case 4: | |
3647 case 9: | |
3648 case 10: | |
3649 case 11: | |
3650 case 13: | |
3651 case 21: | |
3652 v6 = GetActualEndurance(); | |
3653 goto LABEL_46; | |
3654 case 5: | |
3655 case 12: | |
3656 case 23: | |
3657 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3658 goto LABEL_5; | |
3659 case 15: | |
3660 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3661 goto LABEL_5; | |
3662 case 6: | |
3663 case 7: | |
3664 case 8: | |
3665 case 14: | |
3666 case 16: | |
3667 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3668 LABEL_5: | |
3669 v7 = GetActualResistance(v40); | |
3670 goto LABEL_47; | |
3671 case 22: | |
3672 v8 = GetActualWillpower(); | |
1036 | 3673 v9 = GetParameterBonus(v8); |
0 | 3674 v10 = GetActualIntelligence(); |
1036 | 3675 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 3676 break; |
3677 case 17: | |
3678 v12 = 0; | |
3679 v13 = this->pInventoryItems; | |
3680 do | |
3681 { | |
315 | 3682 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3683 v46[v4++] = v12; |
3684 ++v12; | |
3685 ++v13; | |
3686 } | |
3687 while ( v12 < 138 ); | |
3688 goto LABEL_36; | |
3689 case 18: | |
3690 v14 = 0; | |
3691 do | |
3692 { | |
3693 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3694 { | |
816 | 3695 if ( v15 == EQUIP_ARMOUR ) |
898 | 3696 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3697 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3698 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3699 } |
3700 v14 = v15 + 1; | |
3701 } | |
3702 while ( v14 < 16 ); | |
3703 goto LABEL_36; | |
3704 case 19: | |
3705 v16 = 0; | |
3706 do | |
3707 { | |
3708 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3709 { | |
3710 if ( v17 == 2 ) | |
3711 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3712 if ( (!v17 || v17 == 1) | |
816 | 3713 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3714 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3715 } |
3716 v16 = v17 + 1; | |
3717 } | |
3718 while ( v16 < 16 ); | |
3719 LABEL_36: | |
3720 if ( !v4 ) | |
3721 goto LABEL_87; | |
3722 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3723 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3724 break; | |
3725 case 20: | |
3726 v19 = 0; | |
3727 v20 = this->pInventoryIndices; | |
3728 do | |
3729 { | |
3730 if ( *v20 > 0 ) | |
3731 { | |
232 | 3732 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3733 if ( v21 > 0 ) |
3734 { | |
3735 if ( v21 <= 134 ) | |
3736 v46[v4++] = v19; | |
3737 } | |
3738 } | |
3739 ++v19; | |
3740 ++v20; | |
3741 } | |
3742 while ( v19 < 126 ); | |
3743 if ( !v4 ) | |
3744 goto LABEL_87; | |
3745 v47 = (unsigned __int8)v46[rand() % v4]; | |
3746 v6 = GetActualAccuracy(); | |
3747 LABEL_46: | |
1036 | 3748 v7 = GetParameterBonus(v6); |
0 | 3749 LABEL_47: |
3750 v11 = v7; | |
3751 break; | |
3752 default: | |
3753 v11 = 0; | |
3754 break; | |
3755 } | |
3756 v22 = GetActualLuck(); | |
1036 | 3757 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 3758 if ( rand() % v23 >= 30 ) |
3759 { | |
3760 LABEL_87: | |
3761 result = 0; | |
3762 } | |
3763 else | |
3764 { | |
3765 switch ( a2 ) | |
3766 { | |
3767 case 1: | |
3768 v41 = 1; | |
3769 v36 = 0; | |
3770 goto LABEL_56; | |
3771 case 2: | |
3772 v41 = 1; | |
3773 v36 = 1; | |
3774 goto LABEL_56; | |
3775 case 3: | |
3776 v41 = 1; | |
3777 v36 = 2; | |
3778 goto LABEL_56; | |
3779 case 23: | |
3780 v41 = 1; | |
3781 v36 = 3; | |
3782 goto LABEL_56; | |
3783 case 4: | |
3784 v41 = 1; | |
3785 v36 = 4; | |
3786 LABEL_56: | |
3787 SetCondition(v36, v41); | |
3788 v42 = 0; | |
3789 v37 = 0; | |
3790 v35 = 0; | |
3791 v34 = 0; | |
3792 v33 = -1; | |
3793 v32 = 0; | |
3794 v31 = 0; | |
3795 v30 = (SoundID)221; | |
3796 goto LABEL_83; | |
3797 case 5: | |
3798 v43 = 1; | |
3799 v38 = 5; | |
3800 goto LABEL_70; | |
3801 case 6: | |
3802 case 7: | |
3803 case 8: | |
3804 if ( a2 == 6 ) | |
3805 { | |
3806 v44 = 6; | |
3807 goto LABEL_60; | |
3808 } | |
3809 v25 = 2 * (a2 != 8) + 8; | |
3810 goto LABEL_65; | |
3811 case 9: | |
3812 if ( a2 == 6 ) | |
3813 { | |
3814 v44 = 7; | |
3815 LABEL_60: | |
3816 v24 = v44; | |
3817 } | |
3818 else | |
3819 { | |
3820 v25 = 2 * (a2 != 8) + 9; | |
3821 LABEL_65: | |
3822 v24 = v25; | |
3823 } | |
3824 SetCondition(v24, 1); | |
3825 v42 = 0; | |
3826 v37 = 0; | |
3827 v35 = 0; | |
3828 v34 = 0; | |
3829 v33 = -1; | |
3830 v32 = 0; | |
3831 v31 = 0; | |
3832 v30 = (SoundID)222; | |
3833 LABEL_83: | |
3834 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3835 do | |
3836 { | |
3837 LABEL_84: | |
3838 if ( v5 == pPlayers[v3 + 1] ) | |
3839 break; | |
3840 ++v3; | |
3841 } | |
3842 while ( v3 < 4 ); | |
3843 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3844 result = 1; | |
3845 break; | |
3846 case 12: | |
3847 v43 = 1; | |
3848 v38 = 12; | |
3849 goto LABEL_70; | |
3850 case 15: | |
3851 v45 = 1; | |
3852 v39 = 15; | |
3853 goto LABEL_73; | |
3854 case 13: | |
3855 v43 = 1; | |
3856 v38 = 13; | |
3857 LABEL_70: | |
3858 SetCondition(v38, v43); | |
3859 v42 = 0; | |
3860 v37 = 0; | |
3861 v35 = 0; | |
3862 v34 = 0; | |
3863 v33 = -1; | |
3864 v32 = 0; | |
3865 v31 = 0; | |
3866 v30 = (SoundID)224; | |
3867 goto LABEL_83; | |
3868 case 14: | |
3869 v45 = 1; | |
3870 v39 = 14; | |
3871 goto LABEL_73; | |
3872 case 16: | |
3873 v45 = 1; | |
3874 v39 = 16; | |
3875 LABEL_73: | |
3876 SetCondition(v39, v45); | |
3877 v42 = 0; | |
3878 v37 = 0; | |
3879 v35 = 0; | |
3880 v34 = 0; | |
3881 v33 = -1; | |
3882 v32 = 0; | |
3883 v31 = 0; | |
3884 v30 = (SoundID)225; | |
3885 goto LABEL_83; | |
3886 case 17: | |
3887 case 18: | |
3888 case 19: | |
3889 v26 = v48; | |
3890 if ( *(char *)(v48 + 21) & 2 ) | |
3891 goto LABEL_84; | |
187 | 3892 PlaySound(SPEECH_40, 0); |
0 | 3893 *(int *)(v26 + 20) |= 2u; |
3894 goto LABEL_79; | |
3895 case 20: | |
187 | 3896 PlaySound(SPEECH_40, 0); |
0 | 3897 v27 = pActor->array_000234; |
3898 if ( pActor->array_000234[0].uItemID ) | |
3899 { | |
3900 v27 = &pActor->array_000234[1]; | |
3901 if ( pActor->array_000234[1].uItemID ) | |
3902 goto LABEL_84; | |
3903 } | |
3904 v28 = v47; | |
654 | 3905 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3906 RemoveItemAtInventoryIndex(v28); |
3907 LABEL_79: | |
3908 v42 = 0; | |
3909 v37 = 0; | |
3910 v35 = 0; | |
3911 v34 = 0; | |
3912 v33 = -1; | |
3913 v32 = 0; | |
3914 v31 = 0; | |
3915 v30 = (SoundID)47; | |
3916 goto LABEL_83; | |
3917 case 21: | |
187 | 3918 PlaySound(SPEECH_42, 0); |
0 | 3919 ++v5->sAgeModifier; |
3920 goto LABEL_82; | |
3921 case 22: | |
187 | 3922 PlaySound(SPEECH_41, 0); |
0 | 3923 v5->sMana = 0; |
3924 LABEL_82: | |
3925 v42 = 0; | |
3926 v37 = 0; | |
3927 v35 = 0; | |
3928 v34 = 0; | |
3929 v33 = -1; | |
3930 v32 = 0; | |
3931 v31 = 0; | |
3932 v30 = (SoundID)226; | |
3933 goto LABEL_83; | |
3934 default: | |
3935 goto LABEL_87; | |
3936 } | |
3937 } | |
3938 return result; | |
3939 } | |
324 | 3940 |
0 | 3941 // 48DCF6: using guessed type char var_94[140]; |
3942 | |
3943 //----- (0048E1A3) -------------------------------------------------------- | |
3944 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3945 { | |
1091 | 3946 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 3947 } |
3948 | |
3949 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 3950 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
3951 { | |
3952 ItemGen *weapon = nullptr; | |
3953 ItemDesc *weapon_desc = nullptr; | |
3954 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
3955 if (bRangedAttack) | |
0 | 3956 { |
3957 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3958 goto LABEL_17; | |
816 | 3959 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
3960 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3961 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
3962 goto LABEL_17; | |
3963 } | |
3964 else if ( IsUnarmed() == 1 ) | |
3965 { | |
3966 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
3967 { | |
3968 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 3969 goto LABEL_17; |
3970 } | |
3971 } | |
816 | 3972 |
3973 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
3974 { | |
3975 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
3976 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3977 if (weapon_desc->uEquipType == EQUIP_WAND) | |
3978 { | |
3979 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
3980 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
3981 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
3982 } | |
0 | 3983 else |
816 | 3984 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
3985 } | |
1010 | 3986 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
3987 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 3988 { |
898 | 3989 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3990 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
3991 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
3992 { | |
898 | 3993 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3994 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3995 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
3996 } | |
3997 } | |
3998 | |
0 | 3999 LABEL_17: |
816 | 4000 uint armour_recovery = 0; |
0 | 4001 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
4002 { | |
898 | 4003 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 4004 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
4005 | |
4006 float armour_recovery_multipliers[4]; | |
4007 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
4008 { | |
4009 armour_recovery_multipliers[0] = 1.0f; | |
4010 armour_recovery_multipliers[1] = 0; | |
4011 armour_recovery_multipliers[2] = 0; | |
4012 armour_recovery_multipliers[3] = 0; | |
4013 } | |
4014 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4015 { | |
4016 armour_recovery_multipliers[0] = 1.0f; | |
4017 armour_recovery_multipliers[1] = 0.5f; | |
4018 armour_recovery_multipliers[2] = 0; | |
4019 armour_recovery_multipliers[3] = 0; | |
4020 } | |
4021 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4022 { | |
4023 armour_recovery_multipliers[0] = 1.0f; | |
4024 armour_recovery_multipliers[1] = 0.5f; | |
4025 armour_recovery_multipliers[2] = 0.5f; | |
4026 armour_recovery_multipliers[3] = 0; | |
0 | 4027 } |
4028 else | |
4029 { | |
816 | 4030 assert(false && "Unknown armour type"); // what kind of armour is that? |
4031 armour_recovery_multipliers[0] = 1.0f; | |
4032 armour_recovery_multipliers[1] = 1.0f; | |
4033 armour_recovery_multipliers[2] = 1.0f; | |
4034 armour_recovery_multipliers[3] = 1.0f; | |
4035 } | |
4036 | |
4037 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4038 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4039 } | |
4040 | |
4041 uint shield_recovery = 0; | |
4042 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4043 { | |
4044 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4045 | |
898 | 4046 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4047 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4048 | |
4049 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4050 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4051 } | |
4052 | |
1036 | 4053 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 4054 sword_axe_bow_recovery_reduction = 0; |
4055 bool shooting_laser = false; | |
4056 if (weapon_desc) | |
4057 { | |
4058 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4059 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4060 { | |
4061 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4062 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4063 } | |
4064 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4065 shooting_laser = true; | |
4066 } | |
4067 | |
4068 uint armsmaster_recovery_reduction = 0; | |
4069 if (!bRangedAttack && !shooting_laser) | |
4070 { | |
4071 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4072 { | |
4073 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4074 if (SkillToMastery(armsmaster_level) >= 4) | |
4075 armsmaster_recovery_reduction *= 2; | |
4076 } | |
4077 } | |
4078 | |
4079 uint v41 = 0; | |
4080 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4081 v41 = 25; |
816 | 4082 |
4083 uint weapon_enchantment_recovery_reduction = 0; | |
4084 if ( weapon ) | |
4085 { | |
4086 if (weapon->uSpecEnchantmentType == 59 || | |
4087 weapon->uSpecEnchantmentType == 41 || | |
4088 weapon->uSpecEnchantmentType == 500) | |
4089 weapon_enchantment_recovery_reduction = 20; | |
4090 } | |
4091 | |
4092 | |
4093 int recovery = weapon_recovery + | |
4094 armour_recovery + | |
4095 shield_recovery | |
4096 - armsmaster_recovery_reduction | |
4097 - weapon_enchantment_recovery_reduction | |
4098 - v41 | |
4099 - sword_axe_bow_recovery_reduction | |
4100 - player_speed_recovery_reduction; | |
4101 | |
4102 if (recovery < 0) | |
4103 recovery = 0; | |
4104 return recovery; | |
0 | 4105 } |
4106 | |
4107 //----- (0048E4F8) -------------------------------------------------------- | |
4108 int Player::GetMaxHealth() | |
4109 { | |
4110 int v3; // esi@1 | |
4111 int v4; // esi@1 | |
4112 int v6; // esi@1 | |
4113 | |
1036 | 4114 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 4115 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4116 v6 = uFullHealthBonus |
135 | 4117 + pBaseHealthByClass[classType / 4] |
0 | 4118 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4119 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4120 if (v6 <= 0) | |
4121 return 1; | |
4122 return v6; | |
4123 } | |
4124 | |
4125 //----- (0048E565) -------------------------------------------------------- | |
4126 int Player::GetMaxMana() | |
4127 { | |
4128 int v2; // eax@2 | |
4129 int v3; // esi@4 | |
4130 int v4; // eax@5 | |
4131 int v5; // esi@5 | |
4132 int v6; // eax@5 | |
4133 int v7; // esi@6 | |
4134 int v8; // esi@6 | |
4135 int v9; // esi@6 | |
4136 int result; // eax@7 | |
1116 | 4137 |
135 | 4138 switch (classType) |
0 | 4139 { |
1116 | 4140 case PLAYER_CLASS_ROGUE: |
4141 case PLAYER_CLASS_SPY: | |
4142 case PLAYER_CLASS_ASSASSIN: | |
4143 case PLAYER_CLASS_ARCHER: | |
4144 case PLAYER_CLASS_WARRIOR_MAGE: | |
4145 case PLAYER_CLASS_MASTER_ARCHER: | |
4146 case PLAYER_CLASS_SNIPER: | |
4147 case PLAYER_CLASS_SORCERER: | |
4148 case PLAYER_CLASS_WIZARD: | |
4149 case PLAYER_CLASS_ARCHMAGE: | |
4150 case PLAYER_CLASS_LICH: | |
0 | 4151 v2 = GetActualIntelligence(); |
1036 | 4152 v3 = GetParameterBonus(v2); |
1116 | 4153 break; |
4154 case PLAYER_CLASS_INITIATE: | |
4155 case PLAYER_CLASS_MASTER: | |
4156 case PLAYER_CLASS_NINJA: | |
4157 case PLAYER_CLASS_PALADIN: | |
4158 case PLAYER_CLASS_CRUSADER: | |
4159 case PLAYER_CLASS_HERO: | |
4160 case PLAYER_CLASS_VILLIAN: | |
4161 case PLAYER_CLASS_CLERIC: | |
4162 case PLAYER_CLASS_PRIEST: | |
4163 case PLAYER_CLASS_PRIEST_OF_SUN: | |
4164 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 4165 v2 = GetActualWillpower(); |
1036 | 4166 v3 = GetParameterBonus(v2); |
1116 | 4167 break; |
4168 case PLAYER_CLASS_HUNTER: | |
4169 case PLAYER_CLASS_RANGER_LORD: | |
4170 case PLAYER_CLASS_BOUNTY_HUNTER: | |
4171 case PLAYER_CLASS_DRUID: | |
4172 case PLAYER_CLASS_GREAT_DRUID: | |
4173 case PLAYER_CLASS_ARCH_DRUID: | |
4174 case PLAYER_CLASS_WARLOCK: | |
0 | 4175 v4 = GetActualWillpower(); |
1036 | 4176 v5 = GetParameterBonus(v4); |
0 | 4177 v6 = GetActualIntelligence(); |
1036 | 4178 v3 = GetParameterBonus(v6) + v5; |
0 | 4179 break; |
4180 default: | |
1116 | 4181 return 0; |
0 | 4182 break; |
4183 } | |
1116 | 4184 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
4185 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
4186 v9 = uFullManaBonus | |
4187 + pBaseManaByClass[classType / 4] | |
4188 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
4189 + v8; | |
4190 return max(0,v9); | |
0 | 4191 } |
4192 | |
4193 //----- (0048E656) -------------------------------------------------------- | |
4194 int Player::GetBaseAC() | |
4195 { | |
4196 Player *v1; // edi@1 | |
4197 int v2; // eax@1 | |
4198 int v3; // esi@1 | |
4199 int v4; // esi@1 | |
4200 int v5; // esi@1 | |
4201 int result; // eax@2 | |
4202 | |
4203 v1 = this; | |
4204 v2 = GetActualSpeed(); | |
1036 | 4205 v3 = GetParameterBonus(v2); |
0 | 4206 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4207 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4208 if ( v5 >= 1 ) | |
4209 result = v5; | |
4210 else | |
4211 result = 0; | |
4212 return result; | |
4213 } | |
4214 | |
4215 //----- (0048E68F) -------------------------------------------------------- | |
4216 int Player::GetActualAC() | |
4217 { | |
4218 Player *v1; // edi@1 | |
4219 int v2; // eax@1 | |
4220 int v3; // esi@1 | |
4221 int v4; // esi@1 | |
4222 int v5; // esi@1 | |
4223 int v6; // esi@1 | |
4224 int result; // eax@2 | |
4225 | |
4226 v1 = this; | |
4227 v2 = GetActualSpeed(); | |
1036 | 4228 v3 = GetParameterBonus(v2); |
0 | 4229 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4230 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4231 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4232 if ( v6 >= 1 ) | |
4233 result = v6; | |
4234 else | |
4235 result = 0; | |
4236 return result; | |
4237 } | |
4238 | |
4239 //----- (0048E6DC) -------------------------------------------------------- | |
4240 unsigned int Player::GetBaseAge() | |
4241 { | |
352 | 4242 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4243 } |
4244 | |
4245 //----- (0048E72C) -------------------------------------------------------- | |
4246 unsigned int Player::GetActualAge() | |
4247 { | |
4248 return this->sAgeModifier + GetBaseAge(); | |
4249 } | |
4250 | |
4251 //----- (0048E73F) -------------------------------------------------------- | |
4252 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4253 { | |
4254 Player *v2; // ebx@1 | |
4255 signed int v3; // esi@1 | |
4256 enum CHARACTER_RACE v4; // eax@1 | |
4257 signed int v5; // edi@8 | |
4258 char v6; // zf@9 | |
4259 int v7; // esi@20 | |
4260 int result; // eax@21 | |
4261 signed int v9; // [sp-4h] [bp-10h]@11 | |
4262 | |
4263 v2 = this; | |
4264 v3 = 0; | |
4265 v4 = GetRace(); | |
4266 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4267 { | |
4268 v5 = 0; | |
4269 goto LABEL_16; | |
4270 } | |
4271 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4272 { | |
4273 v5 = 1; | |
4274 LABEL_16: | |
4275 v6 = v4 == 2; | |
4276 goto LABEL_17; | |
4277 } | |
4278 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4279 { | |
4280 v6 = v4 == 3; | |
4281 v5 = 2; | |
4282 goto LABEL_17; | |
4283 } | |
4284 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4285 { | |
4286 v5 = 3; | |
4287 v6 = v4 == 3; | |
4288 goto LABEL_17; | |
4289 } | |
4290 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4291 { | |
4292 v5 = 7; | |
4293 if ( v4 != 1 ) | |
4294 goto LABEL_20; | |
4295 v9 = 10; | |
4296 LABEL_19: | |
4297 v3 = v9; | |
4298 goto LABEL_20; | |
4299 } | |
4300 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4301 { | |
4302 v5 = 8; | |
4303 v6 = v4 == 0; | |
4304 LABEL_17: | |
4305 if ( !v6 ) | |
4306 goto LABEL_20; | |
4307 v9 = 5; | |
4308 goto LABEL_19; | |
4309 } | |
4310 v5 = 0; | |
4311 LABEL_20: | |
4312 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4313 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4314 result = v7 + *(&v2->sResFireBase + v5); |
4315 return result; | |
4316 } | |
4317 | |
4318 //----- (0048E7D0) -------------------------------------------------------- | |
4319 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4320 { | |
4321 signed int v2; // edi@1 | |
4322 Player *v3; // esi@1 | |
4323 enum CHARACTER_RACE v4; // ebx@1 | |
4324 char v6; // zf@18 | |
4325 int v7; // ebx@28 | |
4326 int result; // eax@28 | |
4327 signed int v9; // [sp+10h] [bp-8h]@1 | |
4328 signed int v10; // [sp+14h] [bp-4h]@1 | |
4329 | |
4330 v2 = 0; | |
4331 v3 = this; | |
4332 v10 = 0; | |
4333 v9 = 0; | |
4334 v4 = GetRace(); | |
652 | 4335 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4336 v10 = 20; |
4337 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4338 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4339 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4340 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4341 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4342 && HasItemEquipped(EQUIP_ARMOUR) | |
4343 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4344 v10 += v3->pActiveSkills[9] & 0x3F; | |
4345 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4346 goto LABEL_25; | |
4347 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4348 { | |
4349 v2 = 1; | |
4350 LABEL_25: | |
4351 v6 = v4 == 2; | |
4352 LABEL_26: | |
4353 if ( v6 ) | |
4354 v9 = 5; | |
4355 goto LABEL_28; | |
4356 } | |
4357 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4358 { | |
4359 v6 = v4 == 3; | |
4360 v2 = 2; | |
4361 goto LABEL_26; | |
4362 } | |
4363 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4364 { | |
4365 v2 = 3; | |
4366 if ( v4 == 3 ) | |
4367 v10 += 5; | |
4368 } | |
4369 else | |
4370 { | |
4371 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4372 { | |
4373 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4374 goto LABEL_28; | |
4375 v2 = 8; | |
4376 v6 = v4 == 0; | |
4377 goto LABEL_26; | |
4378 } | |
4379 v2 = 7; | |
4380 if ( v4 == 1 ) | |
4381 v9 = 10; | |
4382 } | |
4383 LABEL_28: | |
4384 v7 = GetItemsBonus(a2, 0); | |
4385 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4386 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4387 { |
4388 if ( result > 200 ) | |
4389 result = 200; | |
4390 } | |
4391 return result; | |
4392 } | |
4393 | |
4394 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4395 bool Player::Recover(int dt) |
4396 { | |
4397 //Player *v2; // esi@1 | |
0 | 4398 signed __int64 v3; // qax@1 |
816 | 4399 //bool result; // eax@4 |
4400 | |
4401 //v2 = this; | |
4402 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4403 | |
4404 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4405 | |
4406 if (uTimeToRecovery > v3) | |
4407 { | |
4408 uTimeToRecovery -= v3; | |
4409 return true; | |
0 | 4410 } |
4411 else | |
4412 { | |
816 | 4413 uTimeToRecovery = 0; |
4414 viewparams->bRedrawGameUI = true; | |
4415 if (!uActiveCharacter) | |
0 | 4416 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4417 return false; |
4418 } | |
0 | 4419 } |
4420 | |
4421 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4422 void Player::SetRecoveryTime(signed int rec) |
4423 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4424 assert(rec >= 0); |
816 | 4425 |
4426 if (rec > uTimeToRecovery) | |
4427 uTimeToRecovery = rec; | |
4428 | |
4429 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4430 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4431 |
4432 viewparams->bRedrawGameUI = true; | |
0 | 4433 } |
4434 // 50C0C4: using guessed type int some_active_character; | |
4435 | |
4436 //----- (0048E9B7) -------------------------------------------------------- | |
4437 void Player::RandomizeName() | |
4438 { | |
4439 if (!uExpressionTimePassed) | |
4440 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4441 } | |
4442 | |
4443 //----- (0048E9F4) -------------------------------------------------------- | |
4444 unsigned int Player::GetMajorConditionIdx() | |
4445 { | |
4446 for (uint i = 0; i < 18; ++i) | |
4447 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4448 return pConditionImportancyTable[i]; | |
4449 | |
4450 return 18; | |
4451 } | |
4452 | |
4453 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 4454 int Player::GetParameterBonus( int player_parameter ) |
4455 { | |
4456 int i; // eax@1 | |
4457 i = 0; | |
4458 while (param_to_bonus_table[i]) | |
4459 { | |
4460 if (player_parameter >= param_to_bonus_table[i]) | |
4461 break; | |
4462 ++i; | |
4463 } | |
4464 return parameter_to_bonus_value[i]; | |
0 | 4465 } |
4466 | |
4467 //----- (0048EA46) -------------------------------------------------------- | |
4468 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4469 { | |
1032 | 4470 int inv_indx; // eax@3 |
4471 | |
4472 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
4473 { | |
4474 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4475 continue; | |
4476 inv_indx = pEquipment.pIndices[i] - 1; | |
4477 if (a2==17) | |
4478 { | |
1097 | 4479 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 4480 return 50; |
4481 } | |
4482 if (a2==24) | |
4483 { | |
4484 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. | |
4485 return 5; | |
4486 } | |
4487 } | |
4488 return 0; | |
0 | 4489 } |
4490 | |
4491 //----- (0048EAAE) -------------------------------------------------------- | |
4492 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4493 { | |
4494 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 4495 // signed int v4; // eax@1 |
0 | 4496 int v5; // edi@1 |
4497 Player *v6; // ebx@1 | |
4498 Player *v8; // ecx@48 | |
4499 int v9; // eax@49 | |
4500 int v10; // edx@49 | |
4501 Player *v11; // ecx@55 | |
4502 int v12; // eax@56 | |
4503 int v13; // edx@56 | |
4504 int v14; // ecx@58 | |
4505 int v15; // eax@58 | |
4506 Player *v16; // ecx@61 | |
4507 int v17; // eax@62 | |
4508 Player *v18; // ecx@66 | |
4509 int v19; // eax@67 | |
4510 int v20; // eax@69 | |
4511 Player *v21; // ecx@75 | |
4512 int v22; // eax@76 | |
4513 int v23; // edx@76 | |
4514 int v24; // eax@79 | |
4515 int v25; // ecx@80 | |
4516 int v26; // edi@80 | |
4517 Player *v27; // ecx@84 | |
4518 int v28; // eax@85 | |
4519 int v29; // edx@85 | |
4520 Player *v30; // ecx@96 | |
4521 int v31; // ebp@97 | |
4522 int v32; // eax@98 | |
4523 unsigned int v33; // eax@100 | |
4524 int v34; // eax@103 | |
4525 char v35; // zf@104 | |
4526 char v36; // zf@107 | |
4527 unsigned __int8 v37; // zf@119 | |
4528 char v38; // sf@119 | |
4529 unsigned __int8 v39; // of@119 | |
4530 char v40; // zf@122 | |
4531 char v41; // zf@145 | |
4532 char v42; // zf@164 | |
4533 char v43; // zf@173 | |
4534 char v44; // zf@189 | |
4535 char v45; // zf@198 | |
4536 char v46; // zf@239 | |
4537 int v47; // eax@268 | |
4538 int v48; // eax@269 | |
4539 int v49; // eax@291 | |
4540 char v50; // zf@295 | |
4541 int v51; // eax@306 | |
4542 int v52; // eax@307 | |
4543 char v53; // zf@312 | |
4544 char v54; // zf@336 | |
4545 char v55; // zf@348 | |
4546 int v56; // eax@365 | |
4547 int v57; // ebx@368 | |
4548 signed int v58; // [sp-4h] [bp-20h]@10 | |
4549 signed int v59; // [sp-4h] [bp-20h]@71 | |
4550 signed int v60; // [sp-4h] [bp-20h]@347 | |
4551 int v61; // [sp+10h] [bp-Ch]@1 | |
4552 int v62; // [sp+14h] [bp-8h]@1 | |
4553 int v63; // [sp+18h] [bp-4h]@101 | |
4554 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4555 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 4556 bool no_skills; |
0 | 4557 |
4558 v3 = attr; | |
4559 v5 = 0; | |
4560 v6 = this; | |
4561 v62 = 0; | |
4562 v61 = 0; | |
4563 | |
1040 | 4564 |
4565 no_skills=false; | |
0 | 4566 switch (attr) |
4567 { | |
1040 | 4568 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
4569 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
4570 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
4571 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
4572 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
4573 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
4574 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
4575 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
4576 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
4577 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
4578 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
4579 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
4580 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
4581 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
4582 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
4583 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
4584 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
4585 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
4586 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
4587 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
4588 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
4589 default: | |
4590 no_skills=true; | |
0 | 4591 } |
1040 | 4592 if (!no_skills) |
0 | 4593 { |
1040 | 4594 if ( !this->pActiveSkills[v58] ) |
4595 return 0; | |
0 | 4596 } |
1040 | 4597 |
0 | 4598 if ( (signed int)attr > 28 ) |
4599 { | |
4600 if ( (signed int)attr < 29 ) | |
4601 return v5 + v62 + v61; | |
1040 | 4602 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 4603 { |
4604 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 4605 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 4606 return v5 + v62 + v61; |
4607 } | |
1040 | 4608 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 4609 { |
4610 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4611 return v5 + v62 + v61; | |
1040 | 4612 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4613 v5 = pItemsTable->pItems[v57].uDamageMod; |
4614 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 4615 v5 += v56; |
4616 return v5 + v62 + v61; | |
4617 } | |
4618 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 4619 { |
4620 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4621 return v5 + v62 + v61; | |
1040 | 4622 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4623 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4624 LABEL_365: | |
4625 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4626 LABEL_366: | |
4627 v5 += v56; | |
4628 return v5 + v62 + v61; | |
4629 } | |
4630 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4631 return v5 + v62 + v61; | |
4632 LABEL_95: | |
4633 v65 = 0; | |
4634 while ( 1 ) | |
4635 { | |
4636 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4637 goto LABEL_361; | |
898 | 4638 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4639 if ( v3 == 9 ) |
4640 { | |
816 | 4641 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4642 if ( v32 >= 3 ) |
4643 { | |
4644 if ( v32 <= 11 ) | |
4645 { | |
4646 v33 = v6->pInventoryItems[v31].uItemID; | |
4647 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4648 } | |
4649 } | |
4650 } | |
4651 v63 = (int)((char *)v6 + 36 * v31); | |
4652 attra = (ItemGen *)(v63 + 532); | |
377 | 4653 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4654 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4655 { |
4656 v34 = attra->uItemID; | |
4657 switch ( attra->uItemID ) | |
4658 { | |
4659 case 0x1F4u: | |
4660 v35 = v3 == 5; | |
4661 goto LABEL_105; | |
4662 case 0x1F5u: | |
4663 v36 = v3 == 0; | |
4664 goto LABEL_108; | |
4665 case 0x1F6u: | |
4666 if ( v3 == 21 ) | |
4667 v61 += 10; | |
4668 v36 = v3 == 2; | |
4669 goto LABEL_108; | |
4670 case 0x1F7u: | |
4671 if ( v3 == 17 ) | |
4672 v61 += 5; | |
4673 if ( v3 == 18 ) | |
4674 v61 += 5; | |
4675 v36 = v3 == 6; | |
4676 goto LABEL_108; | |
4677 case 0x1F8u: | |
4678 goto LABEL_118; | |
4679 case 0x1F9u: | |
4680 v40 = v3 == 3; | |
4681 goto LABEL_123; | |
4682 case 0x1FAu: | |
4683 v35 = v3 == 10; | |
4684 goto LABEL_105; | |
4685 case 0x1FEu: | |
4686 v35 = v3 == 4; | |
4687 goto LABEL_105; | |
4688 case 0x1FFu: | |
4689 if ( v3 == 23 ) | |
4690 v61 += 10; | |
4691 if ( v3 == 22 ) | |
4692 v61 += 10; | |
4693 goto LABEL_361; | |
4694 case 0x200u: | |
4695 if ( v3 == 36 ) | |
4696 { | |
4697 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4698 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4699 } | |
4700 v36 = v3 == 5; | |
4701 LABEL_108: | |
4702 if ( v36 ) | |
4703 v5 += 40; | |
4704 goto LABEL_361; | |
4705 case 0x201u: | |
4706 if ( v3 == 39 ) | |
4707 { | |
4708 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4709 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4710 v62 = v34; | |
4711 } | |
4712 goto LABEL_136; | |
4713 case 0x202u: | |
4714 if ( !v3 ) | |
4715 v5 += 150; | |
4716 if ( v3 == 1 ) | |
4717 v5 -= 40; | |
4718 if ( v3 == 2 ) | |
4719 v5 -= 40; | |
4720 goto LABEL_145; | |
4721 case 0x203u: | |
4722 if ( v3 == 42 ) | |
4723 { | |
4724 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4725 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4726 } | |
4727 if ( v3 == 43 ) | |
4728 v61 += 15; | |
4729 goto LABEL_361; | |
4730 case 0x204u: | |
4731 if ( v3 == 17 ) | |
4732 v61 += 5; | |
4733 if ( v3 == 18 ) | |
4734 v61 += 5; | |
4735 if ( v3 == 6 ) | |
4736 v5 += 50; | |
4737 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4738 goto LABEL_166; | |
4739 v42 = v3 == 15; | |
4740 goto LABEL_165; | |
4741 case 0x205u: | |
4742 if ( v3 == 18 ) | |
4743 v61 += 5; | |
4744 goto LABEL_361; | |
4745 case 0x206u: | |
4746 if ( !v3 ) | |
4747 v5 += 100; | |
4748 if ( v3 == 3 ) | |
4749 v5 += 100; | |
4750 v43 = v3 == 9; | |
4751 goto LABEL_174; | |
4752 case 0x207u: | |
4753 if ( v3 == 45 ) | |
4754 v61 += 5; | |
4755 if ( v3 == 15 ) | |
4756 v5 -= 10; | |
4757 v42 = v3 == 14; | |
4758 LABEL_165: | |
4759 if ( v42 ) | |
4760 LABEL_166: | |
4761 v5 -= 10; | |
4762 goto LABEL_361; | |
4763 case 0x208u: | |
4764 v35 = v3 == 3; | |
4765 goto LABEL_105; | |
4766 case 0x209u: | |
4767 if ( v3 == 2 ) | |
4768 v5 += 15; | |
4769 if ( !v3 ) | |
4770 v5 += 15; | |
4771 v41 = v3 == 6; | |
4772 goto LABEL_146; | |
4773 case 0x20Au: | |
4774 if ( v3 == 46 ) | |
4775 v61 += 15; | |
4776 v44 = v3 == 3; | |
4777 goto LABEL_190; | |
4778 case 0x20Bu: | |
4779 if ( v3 == 34 ) | |
4780 { | |
4781 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4782 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4783 } | |
4784 if ( v3 == 12 ) | |
4785 v5 += 50; | |
4786 if ( v3 == 2 ) | |
4787 v5 += 30; | |
4788 v45 = v3 == 9; | |
4789 goto LABEL_199; | |
4790 case 0x20Cu: | |
4791 if ( !v3 ) | |
4792 v5 += 75; | |
4793 goto LABEL_145; | |
4794 case 0x20Du: | |
4795 if ( v3 == 5 ) | |
4796 v5 += 50; | |
4797 if ( v3 == 6 ) | |
4798 v5 += 50; | |
4799 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4800 goto LABEL_374; | |
4801 v43 = v3 == 15; | |
4802 LABEL_174: | |
4803 if ( v43 ) | |
4804 LABEL_374: | |
4805 v5 -= 15; | |
4806 goto LABEL_361; | |
4807 case 0x20Eu: | |
4808 if ( v3 == 4 ) | |
4809 v5 += 150; | |
4810 if ( v3 == 44 ) | |
4811 v61 += 5; | |
4812 if ( v3 == 9 ) | |
4813 v5 -= 25; | |
4814 goto LABEL_361; | |
4815 case 0x20Fu: | |
4816 if ( v3 == 39 ) | |
4817 { | |
4818 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4819 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4820 v62 = v34; | |
4821 } | |
4822 if ( v3 == 40 ) | |
4823 { | |
4824 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4825 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4826 } | |
4827 LABEL_145: | |
4828 v41 = v3 == 5; | |
4829 LABEL_146: | |
4830 if ( v41 ) | |
4831 v5 -= 40; | |
4832 goto LABEL_361; | |
4833 case 0x210u: | |
4834 if ( v3 == 38 ) | |
4835 { | |
4836 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4837 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4838 } | |
4839 if ( !v3 ) | |
4840 v5 += 75; | |
4841 v44 = v3 == 11; | |
4842 LABEL_190: | |
4843 if ( v44 ) | |
4844 v5 -= 50; | |
4845 goto LABEL_361; | |
4846 case 0x211u: | |
4847 if ( v3 == 5 ) | |
4848 v5 += 100; | |
4849 if ( v3 == 4 ) | |
4850 v5 += 50; | |
4851 v35 = v3 == 11; | |
4852 LABEL_105: | |
4853 if ( v35 ) | |
4854 v5 += 50; | |
4855 goto LABEL_361; | |
4856 case 0x212u: | |
4857 if ( v3 == 1 ) | |
4858 v5 -= 20; | |
4859 v45 = v3 == 2; | |
4860 LABEL_199: | |
4861 if ( v45 ) | |
4862 v5 -= 20; | |
4863 goto LABEL_361; | |
4864 case 0x214u: | |
4865 if ( v3 == 1 ) | |
4866 v5 += 15; | |
4867 v46 = v3 == 2; | |
4868 goto LABEL_240; | |
4869 case 0x215u: | |
4870 if ( v3 == 5 ) | |
4871 v5 += 15; | |
4872 v46 = v3 == 4; | |
4873 goto LABEL_240; | |
4874 case 0x216u: | |
4875 if ( v3 == 10 ) | |
4876 v5 += 30; | |
4877 if ( !v3 ) | |
4878 v5 += 15; | |
4879 goto LABEL_315; | |
4880 case 0x217u: | |
4881 if ( v3 == 21 ) | |
4882 v61 += 5; | |
4883 if ( !v3 ) | |
4884 v5 += 15; | |
4885 goto LABEL_253; | |
4886 case 0x218u: | |
4887 goto LABEL_253; | |
4888 default: | |
4889 goto LABEL_361; | |
4890 } | |
4891 goto LABEL_361; | |
4892 } | |
4893 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
4894 { | |
4895 if ( (signed int)v3 >= 0 ) | |
4896 { | |
4897 if ( (signed int)v3 <= 15 ) | |
4898 { | |
4899 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
4900 } | |
4901 else | |
4902 { | |
4903 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
4904 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
4905 } | |
4906 } | |
4907 goto LABEL_361; | |
4908 } | |
4909 v34 = *(int *)(v63 + 544); | |
4910 if ( v34 > 48 ) | |
4911 { | |
4912 switch ( v34 ) | |
4913 { | |
4914 case 54: | |
4915 goto LABEL_315; | |
4916 case 49: | |
4917 if ( v3 == 6 ) | |
4918 goto LABEL_121; | |
4919 v50 = v3 == 1; | |
4920 goto LABEL_296; | |
4921 case 51: | |
4922 if ( v3 != 5 && v3 != 1 ) | |
4923 goto LABEL_309; | |
4924 goto LABEL_121; | |
4925 case 52: | |
4926 if ( v3 == 3 ) | |
4927 goto LABEL_121; | |
4928 v50 = v3 == 4; | |
4929 goto LABEL_296; | |
4930 case 53: | |
4931 if ( !v3 ) | |
4932 goto LABEL_121; | |
4933 v50 = v3 == 2; | |
4934 goto LABEL_296; | |
4935 case 55: | |
4936 v46 = v3 == 6; | |
4937 goto LABEL_240; | |
4938 case 56: | |
4939 if ( !v3 ) | |
4940 goto LABEL_351; | |
4941 v53 = v3 == 3; | |
4942 goto LABEL_350; | |
4943 case 57: | |
4944 if ( v3 == 1 ) | |
4945 goto LABEL_351; | |
4946 v53 = v3 == 2; | |
4947 goto LABEL_350; | |
4948 case 50: | |
4949 if ( v3 == 10 ) | |
4950 v5 += 30; | |
4951 goto LABEL_361; | |
4952 case 60: | |
4953 if ( v3 != 23 ) | |
4954 goto LABEL_336; | |
4955 if ( v5 >= 3 ) | |
4956 goto LABEL_361; | |
4957 v5 = 3; | |
4958 LABEL_336: | |
4959 v54 = v3 == 22; | |
4960 goto LABEL_345; | |
4961 case 61: | |
4962 if ( v3 != 17 ) | |
4963 goto LABEL_340; | |
4964 if ( v5 >= 3 ) | |
4965 goto LABEL_361; | |
4966 v5 = 3; | |
4967 LABEL_340: | |
4968 v54 = v3 == 18; | |
4969 goto LABEL_345; | |
4970 case 62: | |
4971 if ( v3 != 19 ) | |
4972 goto LABEL_344; | |
4973 if ( v5 >= 3 ) | |
4974 goto LABEL_361; | |
4975 v5 = 3; | |
4976 LABEL_344: | |
4977 v54 = v3 == 20; | |
4978 LABEL_345: | |
4979 if ( !v54 ) | |
4980 goto LABEL_361; | |
4981 if ( v5 >= 3 ) | |
4982 goto LABEL_361; | |
4983 v60 = 3; | |
4984 goto LABEL_360; | |
4985 case 67: | |
4986 v55 = v3 == 18; | |
4987 goto LABEL_357; | |
4988 case 68: | |
4989 v53 = v3 == 9; | |
4990 goto LABEL_350; | |
4991 case 69: | |
4992 if ( v3 == 11 ) | |
4993 v5 += 20; | |
4994 break; | |
4995 case 70: | |
4996 if ( v3 == 12 ) | |
4997 v5 += 10; | |
4998 v55 = v3 == 16; | |
4999 LABEL_357: | |
5000 if ( v55 && v5 < 2 ) | |
5001 { | |
5002 v60 = 2; | |
5003 LABEL_360: | |
5004 v5 = v60; | |
5005 } | |
5006 break; | |
5007 default: | |
5008 goto LABEL_361; | |
5009 } | |
5010 goto LABEL_361; | |
5011 } | |
5012 if ( v34 == 48 ) | |
5013 { | |
5014 if ( v3 == 9 ) | |
5015 v5 += 5; | |
5016 LABEL_315: | |
5017 v46 = v3 == 3; | |
5018 LABEL_240: | |
5019 if ( v46 ) | |
5020 v5 += 15; | |
5021 goto LABEL_361; | |
5022 } | |
5023 if ( v34 > 32 ) | |
5024 { | |
5025 if ( v34 > 44 ) | |
5026 { | |
5027 v51 = v34 - 45; | |
5028 if ( !v51 ) | |
5029 { | |
5030 if ( v3 == 5 ) | |
5031 goto LABEL_351; | |
5032 v53 = v3 == 4; | |
5033 LABEL_350: | |
5034 if ( v53 ) | |
5035 LABEL_351: | |
5036 v5 += 5; | |
5037 goto LABEL_361; | |
5038 } | |
5039 v52 = v51 - 1; | |
5040 if ( !v52 ) | |
5041 { | |
5042 v40 = v3 == 0; | |
5043 LABEL_123: | |
5044 if ( v40 ) | |
5045 v5 += 25; | |
5046 goto LABEL_361; | |
5047 } | |
5048 if ( v52 == 1 ) | |
5049 { | |
5050 LABEL_309: | |
5051 v50 = v3 == 8; | |
5052 goto LABEL_296; | |
5053 } | |
5054 } | |
5055 else | |
5056 { | |
5057 if ( v34 == 44 ) | |
5058 { | |
5059 v50 = v3 == 7; | |
5060 goto LABEL_296; | |
5061 } | |
5062 v34 -= 33; | |
5063 if ( !v34 ) | |
5064 { | |
5065 if ( v3 != 38 ) | |
5066 goto LABEL_361; | |
5067 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5068 goto LABEL_138; | |
5069 } | |
5070 --v34; | |
5071 if ( !v34 ) | |
5072 { | |
5073 if ( v3 != 36 ) | |
5074 goto LABEL_361; | |
5075 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5076 goto LABEL_138; | |
5077 } | |
5078 v49 = v34 - 8; | |
5079 if ( !v49 ) | |
5080 { | |
5081 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5082 ++v5; | |
5083 goto LABEL_361; | |
5084 } | |
5085 if ( v49 == 1 ) | |
5086 { | |
5087 if ( v3 != 3 && v3 != 7 ) | |
5088 { | |
5089 v50 = v3 == 9; | |
5090 LABEL_296: | |
5091 if ( !v50 ) | |
5092 goto LABEL_361; | |
5093 } | |
5094 LABEL_121: | |
5095 v5 += 10; | |
5096 goto LABEL_361; | |
5097 } | |
5098 } | |
5099 } | |
5100 else | |
5101 { | |
5102 if ( v34 == 32 ) | |
5103 { | |
5104 if ( v3 != 39 ) | |
5105 goto LABEL_361; | |
5106 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5107 goto LABEL_138; | |
5108 } | |
5109 if ( v34 > 28 ) | |
5110 { | |
5111 v34 -= 29; | |
5112 if ( v34 ) | |
5113 { | |
5114 --v34; | |
5115 if ( v34 ) | |
5116 { | |
5117 --v34; | |
5118 if ( v34 || v3 != 41 ) | |
5119 goto LABEL_361; | |
5120 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5121 } | |
5122 else | |
5123 { | |
5124 if ( v3 != 34 ) | |
5125 goto LABEL_361; | |
5126 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5127 } | |
5128 } | |
5129 else | |
5130 { | |
5131 if ( v3 != 37 ) | |
5132 goto LABEL_361; | |
5133 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5134 } | |
5135 goto LABEL_138; | |
5136 } | |
5137 if ( v34 == 28 ) | |
5138 { | |
5139 LABEL_136: | |
5140 if ( v3 == 42 ) | |
5141 { | |
5142 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5143 LABEL_138: | |
5144 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5145 goto LABEL_361; | |
5146 } | |
5147 } | |
5148 else | |
5149 { | |
5150 v47 = v34 - 1; | |
5151 if ( v47 ) | |
5152 { | |
5153 v48 = v47 - 1; | |
5154 if ( v48 ) | |
5155 { | |
5156 v34 = v48 - 24; | |
5157 if ( v34 ) | |
5158 { | |
5159 --v34; | |
5160 if ( v34 || v3 != 40 ) | |
5161 goto LABEL_361; | |
5162 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5163 } | |
5164 else | |
5165 { | |
5166 if ( v3 != 35 ) | |
5167 goto LABEL_361; | |
5168 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5169 } | |
5170 goto LABEL_138; | |
5171 } | |
5172 LABEL_118: | |
5173 if ( (signed int)v3 < 0 ) | |
5174 goto LABEL_361; | |
5175 v39 = __OFSUB__((int)v3, 6); | |
5176 v37 = v3 == 6; | |
5177 v38 = v3 - 6 < 0; | |
5178 } | |
5179 else | |
5180 { | |
5181 LABEL_253: | |
5182 if ( (signed int)v3 < 10 ) | |
5183 goto LABEL_361; | |
5184 v39 = __OFSUB__((int)v3, 15); | |
5185 v37 = v3 == 15; | |
5186 v38 = v3 - 15 < 0; | |
5187 } | |
5188 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5189 goto LABEL_121; | |
5190 } | |
5191 } | |
5192 LABEL_361: | |
5193 ++v65; | |
5194 if ( (signed int)v65 >= 16 ) | |
5195 return v5 + v62 + v61; | |
5196 } | |
5197 } | |
1040 | 5198 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 5199 { |
5200 if ( IsUnarmed() != 1 ) | |
5201 { | |
816 | 5202 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5203 { | |
5204 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5205 if ( v22 >= 0 ) |
5206 { | |
5207 if ( v22 <= 2 ) | |
5208 { | |
1040 | 5209 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 5210 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5211 { |
5212 v24 = v23; | |
5213 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5214 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5215 } | |
5216 else | |
5217 { | |
5218 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5219 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5220 } | |
5221 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5222 } | |
5223 } | |
5224 } | |
1040 | 5225 |
5226 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
5227 { | |
5228 | |
5229 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5230 if ((v28 < 0) || v28 > 2 ) | |
5231 return v5 + v62 + v61; | |
5232 } | |
1062 | 5233 v15 = pItemsTable->pItems[v23].uDamageMod; |
5234 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 5235 v5 += v15 + v14; |
1049 | 5236 return v5 + v62 + v61; |
0 | 5237 } |
5238 v59 = 3; | |
5239 LABEL_74: | |
5240 v5 = v59; | |
5241 return v5 + v62 + v61; | |
5242 } | |
5243 if ( (signed int)attr < 0 ) | |
5244 return v5 + v62 + v61; | |
1040 | 5245 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 5246 goto LABEL_95; |
1040 | 5247 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
5248 { | |
5249 if ( !Player::HasEnchantedItemEquipped(25) ) | |
5250 return v5 + v62 + v61; | |
5251 v5 = 5; | |
5252 return v5 + v62 + v61; | |
5253 } | |
5254 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 5255 return v5 + v62 + v61; |
1040 | 5256 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 5257 { |
5258 if ( IsUnarmed() == 1 ) | |
5259 { | |
5260 v5 = 0; | |
5261 return v5 + v62 + v61; | |
5262 } | |
816 | 5263 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5264 { | |
5265 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5266 if ( v17 >= 0 ) |
5267 { | |
5268 if ( v17 <= 2 ) | |
1040 | 5269 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 5270 } |
5271 } | |
865 | 5272 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5273 return v5 + v62 + v61; |
1040 | 5274 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
5275 v56 = pItemsTable->pItems[v20].uDamageMod; | |
5276 v5 += v56; | |
5277 return v5 + v62 + v61; | |
5278 } | |
5279 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 5280 { |
5281 if ( IsUnarmed() == 1 ) | |
5282 { | |
5283 v5 = 1; | |
5284 return v5 + v62 + v61; | |
5285 } | |
816 | 5286 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5287 { | |
5288 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5289 if ( v9 >= 0 ) |
5290 { | |
5291 if ( v9 <= 2 ) | |
5292 { | |
1040 | 5293 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5294 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5295 if ( !v6->pEquipment.uShield ) |
0 | 5296 { |
1040 | 5297 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5298 ++v5; |
5299 } | |
5300 } | |
5301 } | |
5302 } | |
1040 | 5303 |
5304 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
5305 { | |
5306 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5307 if ((v12 < 0) || v12 > 2 ) | |
5308 return v5 + v62 + v61; | |
5309 } | |
5310 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
5311 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5312 LABEL_88: |
5313 v5 += v15 + v14; | |
5314 } | |
5315 return v5 + v62 + v61; | |
5316 } | |
5317 | |
5318 //----- (0048F73C) -------------------------------------------------------- | |
5319 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5320 { | |
5321 int result; // eax@1 | |
5322 int v3; // eax@4 | |
5323 int v4; // ecx@5 | |
5324 | |
5325 switch (a2) | |
5326 { | |
5327 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5328 } | |
5329 | |
5330 result = 0; | |
5331 if ( (signed int)a2 > 10 ) | |
5332 { | |
5333 if ( (signed int)a2 <= 15 ) | |
5334 { | |
5335 switch ( a2 ) | |
5336 { | |
5337 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5338 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 5339 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 5340 break; |
5341 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5342 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 5343 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 5344 break; |
5345 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5346 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 5347 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 5348 break; |
5349 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5350 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 5351 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 5352 break; |
5353 default: | |
5354 if ( a2 != 14 ) | |
5355 return result; | |
5356 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 5357 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 5358 break; |
5359 } | |
5360 return v4 + v3; | |
5361 } | |
5362 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5363 { | |
5364 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5365 { | |
5366 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 5367 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 5368 return v4 + v3; |
5369 } | |
5370 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5371 return result; | |
5372 } | |
5373 return this->pPlayerBuffs[1].uPower; | |
5374 } | |
5375 if ( a2 == 10 ) | |
5376 { | |
5377 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 5378 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 5379 return v4 + v3; |
5380 } | |
5381 switch ( a2 ) | |
5382 { | |
5383 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5384 v3 = pPlayerBuffs[19].uPower; | |
5385 goto LABEL_5; | |
5386 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5387 v3 = pPlayerBuffs[17].uPower; | |
5388 goto LABEL_5; | |
5389 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5390 v3 = pPlayerBuffs[20].uPower; | |
5391 goto LABEL_5; | |
5392 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5393 v3 = pPlayerBuffs[16].uPower; | |
5394 goto LABEL_5; | |
5395 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5396 v3 = pPlayerBuffs[15].uPower; | |
5397 goto LABEL_5; | |
5398 case CHARACTER_ATTRIBUTE_SPEED: | |
5399 v3 = pPlayerBuffs[21].uPower; | |
5400 goto LABEL_5; | |
5401 case CHARACTER_ATTRIBUTE_LUCK: | |
5402 v3 = pPlayerBuffs[18].uPower; | |
5403 LABEL_5: | |
1167 | 5404 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 5405 return v4 + v3; |
5406 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5407 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 5408 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 5409 return v4 + v3; |
5410 default: | |
5411 return result; | |
5412 } | |
5413 return result; | |
5414 } | |
5415 | |
5416 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5417 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5418 { | |
1064 | 5419 signed int bonus_value; // esi@1 |
5420 unsigned __int16 skill_value; // ax@126 | |
5421 int result; // al@127 | |
353 | 5422 |
1064 | 5423 bonus_value = 0; |
353 | 5424 switch (uSkillType) |
5425 { | |
5426 case PLAYER_SKILL_MONSTER_ID: | |
5427 { | |
652 | 5428 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 5429 bonus_value = 6; |
652 | 5430 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 5431 bonus_value += 6; |
5432 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 5433 } |
5434 break; | |
5435 | |
5436 case PLAYER_SKILL_ARMSMASTER: | |
5437 { | |
652 | 5438 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 5439 bonus_value = 2; |
652 | 5440 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 5441 bonus_value += 3; |
5442 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 5443 } |
5444 break; | |
5445 | |
5446 case PLAYER_SKILL_STEALING: | |
5447 { | |
652 | 5448 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 5449 bonus_value = 8; |
5450 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 5451 } |
5452 break; | |
5453 | |
5454 | |
5455 case PLAYER_SKILL_ALCHEMY: | |
5456 { | |
652 | 5457 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 5458 bonus_value = 4; |
652 | 5459 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 5460 bonus_value += 8; |
5461 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 5462 } |
5463 break; | |
5464 | |
5465 case PLAYER_SKILL_LEARNING: | |
5466 { | |
652 | 5467 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 5468 bonus_value = 10; |
652 | 5469 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 5470 bonus_value += 15; |
652 | 5471 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 5472 bonus_value += 5; |
5473 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 5474 } |
5475 break; | |
5476 | |
5477 case PLAYER_SKILL_UNARMED: | |
5478 { | |
652 | 5479 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 5480 bonus_value = 2; |
5481 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 5482 } |
5483 break; | |
5484 | |
5485 case PLAYER_SKILL_DODGE: | |
5486 { | |
652 | 5487 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 5488 bonus_value = 2; |
5489 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 5490 } |
5491 break; | |
5492 | |
5493 case PLAYER_SKILL_BOW: | |
1064 | 5494 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 5495 break; |
5496 case PLAYER_SKILL_SHIELD: | |
1064 | 5497 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 5498 break; |
5499 | |
5500 case PLAYER_SKILL_EARTH: | |
652 | 5501 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5502 bonus_value = 2; |
652 | 5503 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5504 bonus_value += 3; |
652 | 5505 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5506 bonus_value += 4; |
353 | 5507 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5508 bonus_value += 3; |
5509 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 5510 break; |
5511 case PLAYER_SKILL_FIRE: | |
652 | 5512 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5513 bonus_value = 2; |
652 | 5514 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5515 bonus_value += 3; |
652 | 5516 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5517 bonus_value += 4; |
353 | 5518 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5519 bonus_value += 3; |
5520 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 5521 break; |
5522 case PLAYER_SKILL_AIR: | |
652 | 5523 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5524 bonus_value = 2; |
652 | 5525 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5526 bonus_value += 3; |
652 | 5527 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5528 bonus_value += 4; |
353 | 5529 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5530 bonus_value += 3; |
5531 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 5532 break; |
5533 case PLAYER_SKILL_WATER: | |
652 | 5534 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5535 bonus_value = 2; |
652 | 5536 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5537 bonus_value += 3; |
652 | 5538 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5539 bonus_value += 4; |
353 | 5540 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5541 bonus_value += 3; |
5542 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 5543 break; |
5544 case PLAYER_SKILL_SPIRIT: | |
652 | 5545 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5546 bonus_value = 2; |
652 | 5547 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5548 bonus_value += 3; |
652 | 5549 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5550 bonus_value += 4; |
5551 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 5552 break; |
5553 case PLAYER_SKILL_MIND: | |
652 | 5554 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5555 bonus_value = 2; |
652 | 5556 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5557 bonus_value += 3; |
652 | 5558 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5559 bonus_value += 4; |
5560 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 5561 break; |
5562 case PLAYER_SKILL_BODY: | |
652 | 5563 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5564 bonus_value = 2; |
652 | 5565 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5566 bonus_value += 3; |
652 | 5567 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5568 bonus_value += 4; |
5569 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 5570 break; |
5571 case PLAYER_SKILL_LIGHT: | |
1064 | 5572 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 5573 break; |
5574 case PLAYER_SKILL_DARK: | |
5575 { | |
1064 | 5576 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 5577 } |
5578 break; | |
5579 | |
5580 case PLAYER_SKILL_MERCHANT: | |
5581 { | |
652 | 5582 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 5583 bonus_value = 4; |
652 | 5584 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 5585 bonus_value += 6; |
652 | 5586 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 5587 bonus_value += 3; |
652 | 5588 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 5589 bonus_value += 8; |
353 | 5590 } |
5591 break; | |
5592 | |
5593 case PLAYER_SKILL_PERCEPTION: | |
5594 { | |
652 | 5595 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 5596 bonus_value = 6; |
652 | 5597 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 5598 bonus_value += 5; |
353 | 5599 } |
5600 break; | |
5601 | |
0 | 5602 case PLAYER_SKILL_ITEM_ID: |
1064 | 5603 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 5604 break; |
5605 case PLAYER_SKILL_MEDITATION: | |
1064 | 5606 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 5607 break; |
0 | 5608 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5609 { |
652 | 5610 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 5611 bonus_value = 4; |
652 | 5612 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 5613 bonus_value += 6; |
652 | 5614 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 5615 bonus_value += 8; |
5616 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 5617 } |
5618 break; | |
5619 } | |
5620 | |
1064 | 5621 skill_value = pActiveSkills[uSkillType]; |
5622 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
5623 result = bonus_value + skill_value; | |
0 | 5624 else |
1064 | 5625 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 5626 return result; |
5627 } | |
5628 | |
5629 //----- (0048FC00) -------------------------------------------------------- | |
5630 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5631 { | |
1064 | 5632 |
5633 | |
5634 | |
0 | 5635 Player *v2; // esi@1 |
1064 | 5636 int armmaster_skill; // eax@1 |
0 | 5637 char v4; // di@1 |
5638 signed int v5; // ebx@1 | |
1064 | 5639 unsigned int armaster_mastery; // eax@2 |
0 | 5640 unsigned __int8 v7; // sf@5 |
5641 unsigned __int8 v8; // of@5 | |
5642 PlayerEquipment *v9; // ebx@19 | |
5643 Player *v10; // ecx@20 | |
821 | 5644 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5645 int v12; // eax@21 |
5646 int v13; // edi@21 | |
5647 char v14; // di@25 | |
5648 signed int v15; // esi@25 | |
5649 char v16; // al@32 | |
5650 int v18; // eax@36 | |
5651 unsigned int v19; // eax@37 | |
5652 ITEM_EQUIP_TYPE v20; // edi@40 | |
5653 int v21; // edx@41 | |
5654 int v22; // eax@42 | |
821 | 5655 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5656 unsigned __int16 v24; // ax@45 |
5657 unsigned __int16 v25; // bx@45 | |
5658 unsigned int v26; // eax@45 | |
5659 unsigned __int8 v27; // sf@50 | |
5660 unsigned __int8 v28; // of@50 | |
5661 unsigned int v29; // eax@52 | |
5662 int v30; // eax@55 | |
5663 int v31; // eax@58 | |
5664 unsigned int v32; // eax@59 | |
5665 int v33; // eax@65 | |
5666 char v34; // si@65 | |
5667 ITEM_EQUIP_TYPE v35; // edi@69 | |
5668 int v36; // edx@70 | |
5669 int v37; // eax@71 | |
821 | 5670 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5671 int v39; // eax@74 |
5672 int v40; // eax@89 | |
5673 char v41; // si@89 | |
5674 int v42; // eax@96 | |
821 | 5675 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5676 int v44; // eax@97 |
5677 int v45; // eax@98 | |
5678 int v46; // eax@99 | |
5679 int v47; // eax@100 | |
5680 int v48; // eax@101 | |
5681 int v49; // eax@102 | |
5682 unsigned __int16 v50; // ax@113 | |
5683 char v51; // di@113 | |
5684 unsigned int v52; // eax@113 | |
5685 int v53; // edi@113 | |
5686 signed int i; // ecx@113 | |
5687 unsigned __int16 v55; // ax@118 | |
5688 char v56; // si@118 | |
5689 unsigned int v57; // eax@118 | |
5690 int v58; // esi@121 | |
5691 signed int j; // ecx@121 | |
1064 | 5692 int base_value; // edi@126 |
5693 int attrib_modif; // eax@126 | |
0 | 5694 signed int v62; // [sp-4h] [bp-30h]@26 |
5695 signed int v63; // [sp-4h] [bp-30h]@80 | |
5696 int v64; // [sp+Ch] [bp-20h]@104 | |
5697 int v65; // [sp+10h] [bp-1Ch]@104 | |
5698 int v66; // [sp+14h] [bp-18h]@104 | |
5699 int v67; // [sp+18h] [bp-14h]@104 | |
5700 int v68; // [sp+1Ch] [bp-10h]@69 | |
5701 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
1080 | 5702 int skill_bonus; // [sp+24h] [bp-8h]@1 |
0 | 5703 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 |
5704 int a1; // [sp+34h] [bp+8h]@21 | |
5705 int a1a; // [sp+34h] [bp+8h]@74 | |
5706 signed int a1b; // [sp+34h] [bp+8h]@94 | |
1064 | 5707 int multiplier; |
5708 int arm_bonus; | |
5709 int lvl_avl[4]; | |
0 | 5710 |
5711 v2 = this; | |
1080 | 5712 skill_bonus = 0; |
0 | 5713 v69 = 0; |
1064 | 5714 multiplier =0; |
5715 arm_bonus =0; | |
0 | 5716 v71 = (ITEM_EQUIP_TYPE)0; |
1064 | 5717 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
5718 v4 = armmaster_skill; | |
0 | 5719 v5 = 1; |
1064 | 5720 if ( armmaster_skill ) |
5721 { | |
5722 armaster_mastery = SkillToMastery(armmaster_skill); | |
0 | 5723 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
5724 { | |
1064 | 5725 if ( armaster_mastery == 4 ) |
5726 multiplier =2; | |
5727 else if ( armaster_mastery == 3 ) | |
5728 multiplier =1; | |
5729 } | |
5730 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) | |
5731 { | |
5732 if ( armaster_mastery == 4 ) | |
5733 multiplier =2; | |
5734 else if ( armaster_mastery >= 2 ) | |
5735 multiplier =1; | |
5736 } | |
5737 arm_bonus=(armmaster_skill&0x3F)*multiplier; | |
5738 } | |
5739 | |
5740 | |
0 | 5741 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) |
5742 { | |
1064 | 5743 base_value = pBaseHealthPerLevelByClass[classType]; |
5744 attrib_modif = GetBodybuilding(); | |
5745 return base_value * attrib_modif; | |
0 | 5746 } |
5747 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5748 { | |
1064 | 5749 base_value = pBaseManaPerLevelByClass[classType]; |
5750 attrib_modif = GetMeditation(); | |
5751 return base_value * attrib_modif; | |
5752 } | |
5753 if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS ) | |
5754 { | |
5755 a1b = 0; | |
5756 v71 = (ITEM_EQUIP_TYPE)0; | |
5757 | |
5758 for (j=0; j<16; ++j) | |
5759 { | |
5760 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) | |
5761 { | |
5762 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; | |
5763 v44=pItemsTable->pItems[curr_item].uSkillType; | |
5764 switch (v44) | |
5765 { | |
5766 | |
5767 case PLAYER_SKILL_STAFF: | |
5768 | |
5769 lvl_avl[0]=0; | |
5770 lvl_avl[1]=1; | |
5771 lvl_avl[2]=0; | |
5772 lvl_avl[3]=0; | |
5773 break; | |
5774 case PLAYER_SKILL_SWORD: | |
5775 case PLAYER_SKILL_SPEAR: | |
5776 lvl_avl[0]=0; | |
5777 lvl_avl[1]=0; | |
5778 lvl_avl[2]=0; | |
5779 lvl_avl[3]=1; | |
5780 break; | |
5781 case PLAYER_SKILL_SHIELD: | |
5782 a1b = 1; | |
5783 lvl_avl[0]=1; | |
5784 lvl_avl[1]=0; | |
5785 lvl_avl[2]=1; | |
5786 lvl_avl[3]=0; | |
5787 break; | |
5788 case PLAYER_SKILL_LEATHER: | |
5789 v71 = (ITEM_EQUIP_TYPE)1; | |
5790 lvl_avl[0]=1; | |
5791 lvl_avl[1]=0; | |
5792 lvl_avl[2]=1; | |
5793 lvl_avl[3]=0; | |
5794 | |
5795 break; | |
5796 case PLAYER_SKILL_CHAIN: | |
5797 a1b = 1; | |
5798 lvl_avl[0]=1; | |
5799 lvl_avl[1]=0; | |
5800 lvl_avl[2]=0; | |
5801 lvl_avl[3]=0; | |
5802 break; | |
5803 case PLAYER_SKILL_PLATE: | |
5804 a1b = 1; | |
5805 lvl_avl[0]=1; | |
5806 lvl_avl[1]=0; | |
5807 lvl_avl[2]=0; | |
5808 lvl_avl[3]=0; | |
5809 break; | |
5810 default: | |
5811 continue; | |
5812 } | |
5813 | |
5814 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); | |
5815 v51 = v50; | |
5816 v52 = SkillToMastery(v50); | |
5817 v53 = v51 & 0x3F; | |
5818 for ( i = 0; i < (signed int)v52; ++i ) | |
5819 { | |
5820 if ( lvl_avl[i] ) | |
1080 | 5821 skill_bonus += v53; |
1064 | 5822 } |
5823 | |
5824 } | |
5825 } | |
5826 | |
5827 lvl_avl[0]=1; | |
5828 lvl_avl[1]=1; | |
5829 lvl_avl[2]=1; | |
5830 lvl_avl[3]=0; | |
5831 | |
5832 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
5833 v56 = v55; | |
5834 v57 = SkillToMastery(v55); | |
5835 if ( !a1b && (!v71 || v57 == 4) ) | |
5836 { | |
5837 v58 = v56 & 0x3F; | |
5838 for ( j = 0; j < (signed int)v57; ++j ) | |
5839 { | |
1069 | 5840 if ( lvl_avl[j] ) |
1080 | 5841 skill_bonus += v58; |
1064 | 5842 } |
5843 } | |
1080 | 5844 return skill_bonus; |
1064 | 5845 |
5846 | |
5847 } | |
5848 | |
1080 | 5849 if (a2 == CHARACTER_ATTRIBUTE_ATTACK) |
5850 { | |
5851 | |
5852 if ( v2->IsUnarmed() == 1 ) | |
5853 { | |
5854 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5855 v34 = v33; | |
5856 if ( !v33 ) | |
5857 return skill_bonus; | |
5858 if ( SkillToMastery(v33) >= 3 ) | |
5859 multiplier = 2; | |
5860 else | |
5861 multiplier=1; | |
5862 v30 = multiplier * (v34 & 0x3F); | |
5863 return arm_bonus + v30; | |
5864 } | |
5865 v35 = (ITEM_EQUIP_TYPE)0; | |
5866 v68 = 0; | |
5867 for (i=0; i<16 ; ++i) | |
5868 { | |
5869 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5870 { | |
5871 v37 = v2->pEquipment.pIndices[i]-1; | |
5872 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) | |
5873 break; | |
5874 } | |
5875 } | |
5876 if ( i >= 16 ) | |
5877 return skill_bonus; | |
5878 | |
5879 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5880 a1a = v2->GetActualSkillLevel(v38); | |
5881 v39= SkillToMastery(a1a); | |
5882 v71 = (ITEM_EQUIP_TYPE)0; | |
5883 switch (v38) | |
5884 { | |
5885 case PLAYER_SKILL_STAFF: | |
5886 v71 = (ITEM_EQUIP_TYPE)1; | |
5887 if ( v39 == 4 ) | |
5888 { | |
5889 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5890 v41 = v40; | |
5891 | |
5892 if ( v40 ) | |
5893 { | |
5894 if ( SkillToMastery(v40) >= 3 ) | |
5895 multiplier = 2; | |
5896 else | |
5897 multiplier=1; | |
5898 v68 = multiplier * (v41 & 0x3F); | |
5899 } | |
5900 } | |
5901 break; | |
5902 case PLAYER_SKILL_SWORD: | |
5903 case PLAYER_SKILL_DAGGER: | |
5904 case PLAYER_SKILL_AXE: | |
5905 case PLAYER_SKILL_SPEAR: | |
5906 case PLAYER_SKILL_MACE: | |
5907 v71 = (ITEM_EQUIP_TYPE)1; | |
5908 break; | |
5909 case PLAYER_SKILL_BLASTER: | |
5910 | |
5911 switch (v39) | |
5912 { | |
5913 case 0: multiplier=1; break; | |
5914 case 1: multiplier=3; break; | |
5915 case 3: multiplier=3; break; | |
5916 case 4: multiplier=5; break; | |
5917 } | |
5918 v5 = multiplier; | |
5919 return v5 * (a1a & 0x3F); | |
5920 break; | |
5921 } | |
5922 | |
5923 | |
5924 | |
5925 v30 = v68 + v71 * (a1a & 0x3F); | |
5926 return (int)((char *)v69 + v30); | |
5927 | |
5928 } | |
5929 | |
5930 | |
0 | 5931 if ( a2 != 9 ) |
5932 { | |
1080 | 5933 |
0 | 5934 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) |
1080 | 5935 return skill_bonus; |
0 | 5936 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
5937 { | |
5938 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
1080 | 5939 return skill_bonus; |
0 | 5940 v71 = (ITEM_EQUIP_TYPE)0; |
5941 v9 = &v2->pEquipment; | |
5942 while ( 1 ) | |
5943 { | |
5944 if ( v2->HasItemEquipped(v71) ) | |
5945 { | |
118 | 5946 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5947 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5948 a1 = v12; |
5949 SkillToMastery(v12); | |
5950 v13 = v11 - 5; | |
5951 if ( !v13 ) | |
5952 return a1 & 0x3F; | |
5953 if ( v13 == 2 ) | |
5954 break; | |
5955 } | |
5956 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5957 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5958 if ( (signed int)v71 >= 16 ) | |
1080 | 5959 return skill_bonus; |
0 | 5960 } |
5961 v14 = a1; | |
5962 v15 = 1; | |
5963 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5964 { | |
5965 v62 = 5; | |
5966 goto LABEL_31; | |
5967 } | |
5968 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5969 { | |
5970 v62 = 3; | |
5971 goto LABEL_31; | |
5972 } | |
5973 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5974 goto LABEL_32; | |
5975 goto LABEL_30; | |
5976 } | |
5977 if ( v2->IsUnarmed() ) | |
5978 { | |
5979 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5980 v14 = v18; | |
5981 if ( !v18 ) | |
1080 | 5982 return skill_bonus; |
0 | 5983 v15 = 0; |
5984 v19 = SkillToMastery(v18); | |
5985 if ( (signed int)v19 < 3 ) | |
5986 { | |
5987 if ( (signed int)v19 >= 2 ) | |
5988 v15 = 1; | |
5989 LABEL_32: | |
5990 v16 = v14; | |
5991 return v15 * (v16 & 0x3F); | |
5992 } | |
5993 LABEL_30: | |
5994 v62 = 2; | |
5995 LABEL_31: | |
5996 v15 = v62; | |
5997 goto LABEL_32; | |
5998 } | |
5999 v20 = (ITEM_EQUIP_TYPE)0; | |
6000 while ( 1 ) | |
6001 { | |
6002 if ( v2->HasItemEquipped(v20) ) | |
6003 { | |
118 | 6004 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 6005 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
6006 break; | |
6007 } | |
6008 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
6009 if ( (signed int)v20 >= 16 ) | |
1080 | 6010 return skill_bonus; |
0 | 6011 } |
6012 v71 = (ITEM_EQUIP_TYPE)0; | |
6013 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6014 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6015 v25 = v24; | |
6016 v26 = SkillToMastery(v24); | |
6017 if ( !v23 ) | |
6018 { | |
6019 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6020 { | |
6021 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6022 LOBYTE(v25) = v31; | |
6023 if ( v31 ) | |
6024 { | |
6025 v15 = 0; | |
6026 v32 = SkillToMastery(v31); | |
6027 if ( (signed int)v32 < 3 ) | |
6028 { | |
6029 if ( (signed int)v32 >= 2 ) | |
6030 v15 = 1; | |
6031 } | |
6032 else | |
6033 { | |
6034 v15 = 2; | |
6035 } | |
6036 v16 = v25; | |
6037 return v15 * (v16 & 0x3F); | |
6038 } | |
6039 } | |
6040 goto LABEL_55; | |
6041 } | |
6042 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6043 { | |
6044 v29 = SkillToMastery(v25); | |
6045 v28 = __OFSUB__(v29, 4); | |
6046 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6047 } | |
6048 else | |
6049 { | |
6050 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6051 goto LABEL_55; | |
6052 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6053 { | |
6054 if ( v23 == PLAYER_SKILL_MACE ) | |
6055 { | |
6056 v28 = __OFSUB__(v26, 2); | |
118 | 6057 v27 = v26 - 2 < 0; |
0 | 6058 goto LABEL_53; |
6059 } | |
6060 LABEL_55: | |
6061 v30 = v71 * (v25 & 0x3F); | |
6062 return (int)((char *)v69 + v30); | |
6063 } | |
6064 v28 = __OFSUB__(v26, 3); | |
118 | 6065 v27 = v26 - 3 < 0; |
0 | 6066 } |
6067 LABEL_53: | |
6068 if ( !(v27 ^ v28) ) | |
6069 v71 = (ITEM_EQUIP_TYPE)1; | |
6070 goto LABEL_55; | |
6071 } | |
1080 | 6072 |
6073 | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
6074 assert(false && "Unknown attribute!"); |
0 | 6075 } |
6076 | |
6077 //----- (00490109) -------------------------------------------------------- | |
6078 // faces are: 0 1 2 3 human males | |
6079 // 4 5 6 7 human females | |
6080 // 8 9 elf males | |
6081 // 10 11 elf females | |
6082 // 12 13 dwarf males | |
6083 // 14 15 dwarf females | |
6084 // 16 17 goblin males | |
6085 // 18 19 goblin females | |
6086 // 20 lich male | |
6087 // 21 lich female | |
6088 // 22 underwater suits (unused) | |
6089 // 23 zombie male | |
6090 // 24 zombie female | |
6091 enum CHARACTER_RACE Player::GetRace() | |
6092 { | |
1014 | 6093 if ( uCurrentFace > 15 ) |
6094 { | |
6095 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6096 return CHARACTER_RACE_GOBLIN; |
6097 } | |
6098 else | |
6099 { | |
1014 | 6100 if ( uCurrentFace >= 12 ) |
0 | 6101 { |
6102 return CHARACTER_RACE_DWARF; | |
6103 } | |
6104 else | |
6105 { | |
1014 | 6106 |
6107 if ( uCurrentFace <= 7 ) | |
0 | 6108 { |
6109 return CHARACTER_RACE_HUMAN; | |
6110 } | |
6111 else | |
6112 { | |
1014 | 6113 if ( uCurrentFace <= 11 ) |
0 | 6114 return CHARACTER_RACE_ELF; |
6115 } | |
6116 } | |
6117 } | |
6118 return CHARACTER_RACE_HUMAN; | |
6119 } | |
6120 | |
6121 //----- (00490141) -------------------------------------------------------- | |
187 | 6122 PLAYER_SEX Player::GetSexByVoice() |
0 | 6123 { |
6124 signed int result; // eax@1 | |
6125 | |
6126 result = 0; | |
6127 switch ( this->uVoiceID ) | |
6128 { | |
6129 case 0u: | |
6130 case 1u: | |
6131 case 2u: | |
6132 case 3u: | |
6133 case 8u: | |
6134 case 9u: | |
6135 case 0xCu: | |
6136 case 0xDu: | |
6137 case 0x10u: | |
6138 case 0x11u: | |
6139 case 0x14u: | |
6140 case 0x17u: | |
187 | 6141 return SEX_MALE; |
6142 | |
0 | 6143 case 4u: |
6144 case 5u: | |
6145 case 6u: | |
6146 case 7u: | |
6147 case 0xAu: | |
6148 case 0xBu: | |
6149 case 0xEu: | |
6150 case 0xFu: | |
6151 case 0x12u: | |
6152 case 0x13u: | |
6153 case 0x15u: | |
6154 case 0x18u: | |
187 | 6155 return SEX_FEMALE; |
6156 | |
0 | 6157 default: |
187 | 6158 assert(false); |
6159 } | |
0 | 6160 } |
6161 | |
6162 //----- (00490188) -------------------------------------------------------- | |
6163 void Player::SetInitialStats() | |
6164 { | |
6165 auto v1 = GetRace(); | |
290 | 6166 uMight = StatTable[v1][0].uBaseValue; |
6167 uIntelligence = StatTable[v1][1].uBaseValue; | |
6168 uWillpower = StatTable[v1][2].uBaseValue; | |
6169 uEndurance = StatTable[v1][3].uBaseValue; | |
6170 uAccuracy = StatTable[v1][4].uBaseValue; | |
6171 uSpeed = StatTable[v1][5].uBaseValue; | |
6172 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6173 } |
6174 | |
6175 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6176 void Player::SetSexByVoice() |
6177 { | |
6178 switch ( this->uVoiceID) | |
0 | 6179 { |
6180 case 0: | |
6181 case 1: | |
6182 case 2: | |
6183 case 3: | |
6184 case 8: | |
6185 case 9: | |
6186 case 0xC: | |
6187 case 0xD: | |
6188 case 0x10: | |
6189 case 0x11: | |
6190 case 0x14: | |
6191 case 0x17: | |
1021 | 6192 this->uSex = SEX_MALE; |
0 | 6193 break; |
6194 case 4: | |
6195 case 5: | |
6196 case 6: | |
6197 case 7: | |
6198 case 0xA: | |
6199 case 0xB: | |
6200 case 0xE: | |
6201 case 0xF: | |
6202 case 0x12: | |
6203 case 0x13: | |
6204 case 0x15: | |
6205 case 0x18: | |
1021 | 6206 this->uSex = SEX_FEMALE; |
0 | 6207 break; |
6208 default: | |
6209 break; | |
6210 } | |
1021 | 6211 |
0 | 6212 } |
6213 | |
6214 //----- (0049024A) -------------------------------------------------------- | |
135 | 6215 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6216 { |
6217 sLevelModifier = 0; | |
6218 sAgeModifier = 0; | |
6219 | |
135 | 6220 classType = cls; |
0 | 6221 uLuckBonus = 0; |
6222 uSpeedBonus = 0; | |
6223 uAccuracyBonus = 0; | |
6224 uEnduranceBonus = 0; | |
6225 uWillpowerBonus = 0; | |
6226 uIntelligenceBonus = 0; | |
6227 uMightBonus = 0; | |
6228 uLevel = 1; | |
6229 uExperience = 251 + rand() % 100; | |
6230 uBirthYear = 1147 - rand() % 6; | |
6231 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6232 memset(_guilds_member_bits, 0, 64); |
0 | 6233 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6234 | |
6235 for (uint i = 0; i < 37; ++i) | |
6236 { | |
135 | 6237 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6238 continue; |
6239 | |
6240 pActiveSkills[i] = 1; | |
6241 | |
6242 switch (i) | |
6243 { | |
886 | 6244 case PLAYER_SKILL_FIRE: |
6245 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6246 |
6247 extern bool all_magic; | |
6248 if ( all_magic == true ) | |
6249 { | |
6250 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6251 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6252 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6253 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6254 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6255 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6256 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6257 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6258 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6259 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6260 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6261 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6262 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6263 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6264 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6265 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6266 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6267 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6268 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6269 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6270 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6271 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6272 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6273 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6274 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6275 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6276 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6277 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6278 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6279 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6280 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6281 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6282 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6283 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6284 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6285 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6286 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6287 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6288 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6289 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6290 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6291 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6292 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6293 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6294 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6295 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6296 } | |
486 | 6297 break; |
886 | 6298 case PLAYER_SKILL_AIR: |
6299 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6300 break; | |
6301 case PLAYER_SKILL_WATER: | |
6302 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6303 break; | |
6304 case PLAYER_SKILL_EARTH: | |
6305 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6306 break; | |
6307 case PLAYER_SKILL_SPIRIT: | |
6308 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6309 break; | |
6310 case PLAYER_SKILL_MIND: | |
6311 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6312 break; | |
6313 case PLAYER_SKILL_BODY: | |
6314 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6315 |
6316 if ( all_magic == true ) | |
6317 { | |
6318 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6319 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6320 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6321 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6322 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6323 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6324 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6325 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6326 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6327 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6328 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6329 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6330 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6331 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6332 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6333 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6334 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6335 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6336 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6337 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6338 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6339 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6340 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6341 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6342 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6343 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6344 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6345 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6346 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6347 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6348 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6349 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6350 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6351 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6352 } | |
569 | 6353 break; |
886 | 6354 case PLAYER_SKILL_LIGHT: |
6355 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6356 break; | |
6357 case PLAYER_SKILL_DARK: | |
6358 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6359 break; | |
0 | 6360 } |
6361 } | |
6362 | |
6363 sHealth = GetMaxHealth(); | |
6364 sMana = GetMaxMana(); | |
6365 } | |
6366 | |
6367 //----- (004903C9) -------------------------------------------------------- | |
821 | 6368 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6369 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6370 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6371 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6372 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6373 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6374 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6375 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6376 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6377 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6378 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6379 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6380 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6381 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6382 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6383 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6384 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6385 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6386 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6387 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6388 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6389 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6390 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6391 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6392 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6393 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6394 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6395 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6396 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6397 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6398 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6399 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6400 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6401 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6402 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6403 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6404 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6405 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6406 } |
0 | 6407 } |
6408 | |
6409 | |
6410 | |
6411 //----- (0049048D) -------------------------------------------------------- | |
6412 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6413 void Player::DecreaseAttribute(int eAttribute) | |
6414 { | |
6415 int v2; // eax@1 | |
6416 int pBaseValue; // ecx@1 | |
6417 int pDroppedStep; // ebx@1 | |
6418 int pStep; // esi@1 | |
6419 unsigned __int16 result; // ax@7 | |
6420 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6421 | |
6422 v2 = eAttribute + 7 * GetRace(); | |
290 | 6423 pBaseValue = StatTable[0][v2].uBaseValue; |
6424 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6425 uMinValue = pBaseValue - 2; |
290 | 6426 pStep = StatTable[0][v2].uBaseStep; |
0 | 6427 switch ( eAttribute ) |
6428 { | |
1040 | 6429 case CHARACTER_ATTRIBUTE_STRENGTH: |
0 | 6430 if ( this->uMight <= pBaseValue ) |
6431 pStep = pDroppedStep; | |
6432 if ( this->uMight - pStep >= uMinValue ) | |
6433 this->uMight -= pStep; | |
6434 break; | |
1040 | 6435 case CHARACTER_ATTRIBUTE_INTELLIGENCE: |
0 | 6436 if ( this->uIntelligence <= pBaseValue ) |
6437 pStep = pDroppedStep; | |
6438 if ( this->uIntelligence - pStep >= uMinValue ) | |
6439 this->uIntelligence -= pStep; | |
6440 break; | |
1040 | 6441 case CHARACTER_ATTRIBUTE_WILLPOWER: |
0 | 6442 if ( this->uWillpower <= pBaseValue ) |
6443 pStep = pDroppedStep; | |
6444 if ( this->uWillpower - pStep >= uMinValue ) | |
6445 this->uWillpower -= pStep; | |
6446 break; | |
1040 | 6447 case CHARACTER_ATTRIBUTE_ENDURANCE: |
0 | 6448 if ( this->uEndurance <= pBaseValue ) |
6449 pStep = pDroppedStep; | |
6450 if ( this->uEndurance - pStep >= uMinValue ) | |
6451 this->uEndurance -= pStep; | |
6452 break; | |
1040 | 6453 case CHARACTER_ATTRIBUTE_ACCURACY: |
0 | 6454 if ( this->uAccuracy <= pBaseValue ) |
6455 pStep = pDroppedStep; | |
6456 if ( this->uAccuracy - pStep >= uMinValue ) | |
6457 this->uAccuracy -= pStep; | |
6458 break; | |
1040 | 6459 case CHARACTER_ATTRIBUTE_SPEED: |
0 | 6460 if ( this->uSpeed <= pBaseValue ) |
6461 pStep = pDroppedStep; | |
6462 if ( this->uSpeed - pStep >= uMinValue ) | |
6463 this->uSpeed -= pStep; | |
6464 break; | |
1040 | 6465 case CHARACTER_ATTRIBUTE_LUCK: |
0 | 6466 if ( this->uLuck <= pBaseValue ) |
6467 pStep = pDroppedStep; | |
6468 if ( this->uLuck - pStep >= uMinValue ) | |
6469 this->uLuck -= pStep; | |
6470 break; | |
6471 } | |
6472 } | |
6473 | |
6474 //----- (004905F5) -------------------------------------------------------- | |
6475 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6476 int Player::IncreaseAttribute(int eAttribute) | |
6477 { | |
6478 Player *v2; // esi@1 | |
6479 int v3; // eax@1 | |
6480 int v4; // ebx@1 | |
6481 signed int v5; // edi@1 | |
6482 int v6; // eax@8 | |
6483 signed int v7; // eax@17 | |
6484 signed int result; // eax@18 | |
6485 int v9; // [sp+Ch] [bp-8h]@1 | |
6486 signed int v10; // [sp+10h] [bp-4h]@1 | |
6487 | |
6488 v2 = this; | |
6489 v3 = eAttribute + 7 * GetRace(); | |
290 | 6490 v4 = StatTable[0][v3].uMaxValue; |
6491 v5 = StatTable[0][v3].uBaseStep; | |
6492 v9 = StatTable[0][v3].uBaseValue; | |
6493 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6494 PlayerCreation_ComputeAttributeBonus(); |
6495 if ( eAttribute ) | |
6496 { | |
6497 switch ( eAttribute ) | |
6498 { | |
6499 case 1: | |
6500 v6 = v2->uIntelligence; | |
6501 break; | |
6502 case 2: | |
6503 v6 = v2->uWillpower; | |
6504 break; | |
6505 case 3: | |
6506 v6 = v2->uEndurance; | |
6507 break; | |
6508 case 4: | |
6509 v6 = v2->uAccuracy; | |
6510 break; | |
6511 case 5: | |
6512 v6 = v2->uSpeed; | |
6513 break; | |
6514 case 6: | |
6515 v6 = v2->uLuck; | |
6516 break; | |
6517 default: | |
6518 v6 = eAttribute; | |
6519 break; | |
6520 } | |
6521 } | |
6522 else | |
6523 { | |
6524 v6 = v2->uMight; | |
6525 } | |
6526 if ( v6 < v9 ) | |
6527 { | |
6528 v7 = v5; | |
6529 v5 = v10; | |
6530 v10 = v7; | |
6531 } | |
6532 result = PlayerCreation_ComputeAttributeBonus(); | |
6533 if ( result >= v10 ) | |
6534 { | |
6535 if ( eAttribute ) | |
6536 { | |
6537 switch ( eAttribute ) | |
6538 { | |
6539 case 1: | |
6540 result = (signed int)&v2->uIntelligence; | |
6541 break; | |
6542 case 2: | |
6543 result = (signed int)&v2->uWillpower; | |
6544 break; | |
6545 case 3: | |
6546 result = (signed int)&v2->uEndurance; | |
6547 break; | |
6548 case 4: | |
6549 result = (signed int)&v2->uAccuracy; | |
6550 break; | |
6551 case 5: | |
6552 result = (signed int)&v2->uSpeed; | |
6553 break; | |
6554 default: | |
6555 result = eAttribute - 6; | |
6556 if ( eAttribute != 6 ) | |
6557 return result; | |
6558 result = (signed int)&v2->uLuck; | |
6559 break; | |
6560 } | |
6561 } | |
6562 else | |
6563 { | |
6564 result = (signed int)&v2->uMight; | |
6565 } | |
6566 if ( v5 + *(short *)result <= v4 ) | |
6567 *(short *)result += v5; | |
6568 } | |
6569 return result; | |
6570 } | |
6571 | |
6572 //----- (0049070F) -------------------------------------------------------- | |
6573 void Player::Zero() | |
6574 { | |
6575 Player *v1; // esi@1 | |
6576 | |
6577 v1 = this; | |
6578 this->sLevelModifier = 0; | |
6579 this->sACModifier = 0; | |
6580 this->uLuckBonus = 0; | |
6581 this->uAccuracyBonus = 0; | |
6582 this->uSpeedBonus = 0; | |
6583 this->uEnduranceBonus = 0; | |
6584 this->uWillpowerBonus = 0; | |
6585 this->uIntelligenceBonus = 0; | |
6586 this->uMightBonus = 0; | |
6587 this->field_100 = 0; | |
6588 this->field_FC = 0; | |
6589 this->field_F8 = 0; | |
6590 this->field_F4 = 0; | |
6591 this->field_F0 = 0; | |
6592 this->field_EC = 0; | |
6593 this->field_E8 = 0; | |
6594 this->field_E4 = 0; | |
6595 this->field_E0 = 0; | |
766 | 6596 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6597 v1->field_1A97 = 0; |
6598 v1->_ranged_dmg_bonus = 0; | |
6599 v1->field_1A95 = 0; | |
6600 v1->_ranged_atk_bonus = 0; | |
6601 v1->field_1A93 = 0; | |
6602 v1->_melee_dmg_bonus = 0; | |
6603 v1->field_1A91 = 0; | |
6604 v1->_some_attack_bonus = 0; | |
6605 v1->_mana_related = 0; | |
6606 v1->uFullManaBonus = 0; | |
6607 v1->_health_related = 0; | |
6608 v1->uFullHealthBonus = 0; | |
6609 } | |
6610 | |
6611 //----- (004907E7) -------------------------------------------------------- | |
299 | 6612 unsigned int Player::GetStatColor(int uStat) |
0 | 6613 { |
6614 __int16 uWhite; // si@1 | |
290 | 6615 int attribute_value; // edx@1 |
299 | 6616 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6617 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6618 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6619 | |
1014 | 6620 uRed = TargetColor(255, 35, 0); |
6621 uGreen = TargetColor(0, 255, 0); | |
6622 uWhite = TargetColor(255, 255, 255); | |
299 | 6623 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6624 |
0 | 6625 switch (uStat) |
6626 { | |
6627 case 0: attribute_value = uMight; break; | |
6628 case 1: attribute_value = uIntelligence; break; | |
6629 case 2: attribute_value = uWillpower; break; | |
6630 case 3: attribute_value = uEndurance; break; | |
290 | 6631 case 4: attribute_value = uAccuracy; break; |
6632 case 5: attribute_value = uSpeed; break; | |
0 | 6633 case 6: attribute_value = uLuck; break; |
6634 }; | |
6635 | |
299 | 6636 if ( attribute_value == pBaseAttrValue ) |
290 | 6637 return uWhite; |
299 | 6638 else if ( attribute_value > pBaseAttrValue ) |
290 | 6639 return uGreen; |
0 | 6640 else |
290 | 6641 return uRed; |
0 | 6642 } |
6643 | |
6644 //----- (004908A8) -------------------------------------------------------- | |
6645 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6646 { | |
1014 | 6647 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6648 { | |
6649 pConditions[uCondition]=0i64; | |
6650 return true; | |
0 | 6651 } |
6652 else | |
1014 | 6653 return false; |
0 | 6654 } |
6655 | |
6656 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6657 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6658 { |
6659 Player *v3; // esi@1 | |
6660 signed int v5; // eax@17 | |
6661 int v8; // edx@39 | |
6662 char *v13; // eax@45 | |
6663 signed int v15; // edi@68 | |
6664 int v16; // edx@73 | |
6665 unsigned __int16 v17; // edi@73 | |
6666 unsigned int v18; // eax@73 | |
6667 const char *v22; // eax@84 | |
6668 int scroll_id; // esi@96 | |
6669 int v25; // eax@109 | |
6670 int v26; // eax@113 | |
6671 int new_mana_val; // edi@114 | |
6672 signed __int64 v28; // qax@120 | |
6673 __int64 v30; // edi@137 | |
6674 __int64 v32; // ST3C_4@137 | |
6675 __int64 v34; // ST34_4@137 | |
6676 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6677 const char *v66; // [sp-4h] [bp-30h]@69 | |
6678 signed int v67; // [sp-4h] [bp-30h]@77 | |
6679 const char *v68; // [sp-4h] [bp-30h]@89 | |
6680 char v72; // [sp+20h] [bp-Ch]@68 | |
6681 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6682 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6683 Player *thisb; // [sp+28h] [bp-4h]@1 |
6684 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6685 | |
6686 thisb = this; | |
6687 v3 = &pParty->pPlayers[player_num-1]; | |
6688 v73 = 1; | |
6689 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6690 return; | |
6691 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6692 { |
1021 | 6693 if ( pParty->pPickedItem.uItemID == 160 ) |
6694 { | |
6695 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6696 } | |
6697 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6698 { |
1021 | 6699 new_mana_val = v3->sMana; |
6700 new_mana_val += 2; | |
6701 if ( new_mana_val > v3->GetMaxMana() ) | |
6702 new_mana_val = v3->GetMaxMana(); | |
6703 v3->PlaySound(SPEECH_36, 0); | |
6704 } | |
6705 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6706 { | |
6707 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6708 v3->PlaySound(SPEECH_36, 0); |
1021 | 6709 |
6710 } | |
6711 else | |
6712 { | |
6713 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6714 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6715 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 6716 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6717 return; | |
1019 | 6718 } |
1032 | 6719 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6720 | |
6721 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6722 { | |
6723 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6724 } | |
6725 if ( v73 ) | |
6726 { | |
6727 if ( pParty->bTurnBasedModeOn ) | |
6728 { | |
6729 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6730 thisb->SetRecoveryTime(100); | |
6731 pTurnEngine->_40471C(); | |
6732 } | |
6733 else | |
6734 { | |
6735 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6736 } | |
6737 } | |
6738 pMouse->RemoveHoldingItem(); | |
6739 return; | |
6740 | |
1021 | 6741 |
6742 } | |
6743 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6744 { |
1021 | 6745 switch ( pParty->pPickedItem.uItemID ) |
6746 { | |
6747 case 221: //Catalyst | |
6748 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6749 break; | |
6750 case 222: //Cure Wounds | |
6751 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6752 pParty->pPlayers[player_num-1].Heal(v25); | |
6753 v3->PlaySound(SPEECH_36, 0); | |
6754 break; | |
6755 case 223: //Magic Potion | |
6756 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6757 new_mana_val = v3->sMana; | |
6758 new_mana_val += v26; | |
6759 if ( new_mana_val > v3->GetMaxMana() ) | |
6760 new_mana_val = v3->GetMaxMana(); | |
6761 v3->PlaySound(SPEECH_36, 0); | |
6762 break; | |
6763 case 224: //Cure Weakness | |
6764 v3->pConditions[Condition_Weak] = 0i64; | |
6765 v3->PlaySound(SPEECH_36, 0); | |
6766 break; | |
6767 case 225: //Cure Disease | |
6768 v3->pConditions[Condition_Disease3] = 0i64; | |
6769 v3->pConditions[Condition_Disease2] = 0i64; | |
6770 v3->pConditions[Condition_Disease1] = 0i64; | |
6771 v3->PlaySound(SPEECH_36, 0); | |
6772 break; | |
6773 case 226: //Cure Poison | |
6774 v3->pConditions[Condition_Poison3] = 0i64; | |
6775 v3->pConditions[Condition_Poison2] = 0i64; | |
6776 v3->pConditions[Condition_Poison1] = 0i64; | |
6777 v3->PlaySound(SPEECH_36, 0); | |
6778 break; | |
6779 case 227: //Awaken | |
6780 v3->pConditions[Condition_Sleep] = 0i64; | |
6781 v3->PlaySound(SPEECH_36, 0); | |
6782 break; | |
6783 case 228: //Haste | |
6784 if ( !v3->pConditions[Condition_Weak] ) | |
6785 { | |
6786 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6787 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6788 v3->PlaySound(SPEECH_36, 0); | |
6789 } | |
6790 break; | |
6791 case 229: //Heroism | |
6792 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6793 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6794 v3->PlaySound(SPEECH_36, 0); | |
6795 break; | |
6796 case 230: //Bless | |
6797 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6798 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6799 v3->PlaySound(SPEECH_36, 0); | |
6800 break; | |
6801 case 231: //Preservation | |
1032 | 6802 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6803 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6804 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6805 v3->PlaySound(SPEECH_36, 0); | |
6806 break; | |
6807 case 232: //Shield | |
1032 | 6808 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6809 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6810 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6811 v3->PlaySound(SPEECH_36, 0); | |
6812 break; | |
6813 case 234: //Stoneskin | |
6814 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6815 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6816 v3->PlaySound(SPEECH_36, 0); | |
6817 break; | |
6818 case 235: //Water Breathing | |
6819 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6820 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6821 break; | |
6822 case 237: //Remove Fear | |
6823 v3->pConditions[Condition_Fear] = 0i64; | |
6824 v3->PlaySound(SPEECH_36, 0); | |
6825 break; | |
6826 case 238: //Remove Curse | |
6827 v3->pConditions[Condition_Cursed] = 0i64; | |
6828 v3->PlaySound(SPEECH_36, 0); | |
6829 break; | |
6830 case 239: //Cure Insanity | |
6831 v3->pConditions[Condition_Insane] = 0i64; | |
6832 v3->PlaySound(SPEECH_36, 0); | |
6833 break; | |
6834 case 240: //Might Boost | |
1032 | 6835 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6836 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6837 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6838 v3->PlaySound(SPEECH_36, 0); | |
6839 break; | |
6840 case 241: //Intellect Boost | |
1032 | 6841 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6842 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6843 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6844 v3->PlaySound(SPEECH_36, 0); | |
6845 break; | |
6846 case 242: //Personality Boost | |
1032 | 6847 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6848 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6849 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6850 v3->PlaySound(SPEECH_36, 0); | |
6851 break; | |
6852 case 243://Endurance Boost | |
1032 | 6853 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6854 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6855 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6856 v3->PlaySound(SPEECH_36, 0); | |
6857 break; | |
6858 case 244: //Speed Boost | |
1032 | 6859 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6860 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6861 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6862 v3->PlaySound(SPEECH_36, 0); | |
6863 break; | |
6864 case 245: //Accuracy Boost | |
1032 | 6865 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6866 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6867 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6868 v3->PlaySound(SPEECH_36, 0); | |
6869 break; | |
6870 case 251: //Cure Paralysis | |
6871 v3->pConditions[Condition_Paralyzed] = 0i64; | |
6872 v3->PlaySound(SPEECH_36, 0); | |
6873 break; | |
6874 case 252://Divine Restoration | |
6875 v30 = v3->pConditions[Condition_Dead]; | |
6876 v32 = v3->pConditions[Condition_Pertified]; | |
6877 v34 = v3->pConditions[Condition_Eradicated]; | |
6878 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
6879 v3->pConditions[Condition_Dead] = v30; | |
6880 v3->pConditions[Condition_Pertified] = v32; | |
6881 v3->pConditions[Condition_Eradicated] = v34; | |
6882 v3->PlaySound(SPEECH_36, 0); | |
6883 break; | |
6884 case 253: //Divine Cure | |
6885 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6886 pParty->pPlayers[player_num-1].Heal(v25); | |
6887 v3->PlaySound(SPEECH_36, 0); | |
6888 break; | |
6889 case 254: //Divine Power | |
6890 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6891 new_mana_val = v3->sMana; | |
6892 new_mana_val += v26; | |
6893 if ( new_mana_val > v3->GetMaxMana() ) | |
6894 new_mana_val = v3->GetMaxMana(); | |
6895 v3->PlaySound(SPEECH_36, 0); | |
6896 break; | |
6897 case 255: //Luck Boost | |
1032 | 6898 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6899 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6900 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6901 v3->PlaySound(SPEECH_36, 0); | |
6902 break; | |
6903 case 256: //Fire Resistance | |
1032 | 6904 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6905 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6906 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6907 v3->PlaySound(SPEECH_36, 0); | |
1032 | 6908 break; |
1021 | 6909 case 257: //Air Resistance |
1032 | 6910 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6911 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6912 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6913 v3->PlaySound(SPEECH_36, 0); | |
6914 break; | |
6915 case 258: //Water Resistance | |
1032 | 6916 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6917 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6918 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6919 v3->PlaySound(SPEECH_36, 0); | |
6920 break; | |
6921 case 259: //Earth Resistance | |
1032 | 6922 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6923 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6924 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6925 v3->PlaySound(SPEECH_36, 0); | |
6926 break; | |
6927 case 260: //Mind Resistance | |
1032 | 6928 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6929 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6930 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6931 v3->PlaySound(SPEECH_36, 0); | |
6932 break; | |
6933 case 261: //Body Resistance | |
1032 | 6934 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6935 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6936 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6937 v3->PlaySound(SPEECH_36, 0); | |
6938 break; | |
6939 case 262: //Stone to Flesh | |
6940 v3->pConditions[Condition_Pertified] = 0i64; | |
6941 v3->PlaySound(SPEECH_36, 0); | |
6942 break; | |
6943 case 264: //Pure Luck | |
6944 if ( !v3->pure_luck_used ) | |
6945 { | |
6946 v3->uLuck += 50; | |
6947 v3->pure_luck_used = 1; | |
6948 } | |
6949 v3->PlaySound(SPEECH_36, 0); | |
6950 break; | |
6951 case 265: //Pure Speed | |
6952 if ( !v3->pure_speed_used ) | |
6953 { | |
6954 v3->uSpeed += 50; | |
6955 v3->pure_speed_used = 1; | |
6956 } | |
6957 v3->PlaySound(SPEECH_36, 0); | |
6958 break; | |
6959 case 266: //Pure Intellect | |
6960 if ( !v3->pure_intellect_used ) | |
6961 { | |
6962 v3->uIntelligence += 50; | |
6963 v3->pure_intellect_used = 1; | |
6964 } | |
6965 v3->PlaySound(SPEECH_36, 0); | |
6966 break; | |
6967 case 267: //Pure Endurance | |
6968 if ( !v3->pure_endurance_used ) | |
6969 { | |
6970 v3->uEndurance += 50; | |
6971 v3->pure_endurance_used = 1; | |
6972 } | |
6973 v3->PlaySound(SPEECH_36, 0); | |
6974 break; | |
6975 case 268: //Pure Personality | |
6976 if ( !v3->pure_willpower_used ) | |
6977 { | |
6978 v3->uWillpower += 50; | |
6979 v3->pure_willpower_used = 1; | |
6980 } | |
6981 v3->PlaySound(SPEECH_36, 0); | |
6982 break; | |
6983 case 269: //Pure Accuracy | |
6984 if ( !v3->pure_accuracy_used ) | |
6985 { | |
6986 v3->uAccuracy += 50; | |
6987 v3->pure_accuracy_used = 1; | |
6988 } | |
6989 v3->PlaySound(SPEECH_36, 0); | |
6990 break; | |
6991 case 270: //Pure Might | |
6992 if ( !v3->pure_might_used ) | |
6993 { | |
6994 v3->uMight += 50; | |
6995 v3->pure_might_used = 1; | |
6996 } | |
6997 v3->PlaySound(SPEECH_36, 0); | |
6998 break; | |
6999 case 271: //Rejuvenation | |
7000 v3->sAgeModifier = 0; | |
7001 v3->PlaySound(SPEECH_36, 0); | |
7002 break; | |
7003 | |
7004 default: | |
7005 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7006 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7007 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 7008 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
7009 return; | |
1032 | 7010 } |
7011 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
7012 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7013 { | |
7014 if ( !v73 ) | |
7015 { | |
7016 pMouse->RemoveHoldingItem(); | |
7017 return; | |
7018 } | |
7019 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 7020 } |
1032 | 7021 if ( v73 ) |
7022 { | |
7023 if ( pParty->bTurnBasedModeOn ) | |
7024 { | |
7025 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7026 thisb->SetRecoveryTime(100); | |
7027 pTurnEngine->_40471C(); | |
7028 } | |
7029 else | |
7030 { | |
7031 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7032 } | |
7033 } | |
7034 pMouse->RemoveHoldingItem(); | |
7035 return; | |
7036 | |
1021 | 7037 } |
7038 | |
7039 | |
7040 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
7041 { | |
7042 | |
7043 | |
7044 if ( pCurrentScreen == SCREEN_CASTING ) | |
7045 return; | |
7046 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7047 { | |
7048 | |
7049 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7050 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7051 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7052 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7053 return; |
7054 } | |
7055 if ( bUnderwater == 1 ) | |
7056 { | |
1032 | 7057 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
7058 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7059 return; |
7060 } | |
7061 dword_50C9AC = 1; | |
7062 scroll_id = pParty->pPickedItem.uItemID - 299; | |
7063 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
7064 { | |
7065 pMouse->RemoveHoldingItem(); | |
7066 pGUIWindow_CurrentMenu->Release(); | |
7067 pIcons_LOD->_4114F2(); | |
7068 pCurrentScreen = SCREEN_GAME; | |
7069 viewparams->bRedrawGameUI = 1; | |
7070 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7071 } | |
7072 else | |
7073 { | |
7074 _720984_unused = pParty->pPickedItem.uItemID; | |
7075 pMouse->RemoveHoldingItem(); | |
7076 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7077 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7078 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7079 { | |
7080 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7081 } | |
7082 } | |
7083 return; | |
7084 } | |
7085 | |
7086 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7087 | |
7088 { | |
7089 v15 = pParty->pPickedItem.uItemID - 400; | |
7090 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7091 if ( v72 ) | |
7092 { | |
7093 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7094 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7095 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7096 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7097 return; |
7098 } | |
7099 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7100 { | |
7101 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7102 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7103 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7104 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7105 return; |
7106 } | |
7107 v16 = v15 % 11 + 1; | |
7108 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7109 v18 = SkillToMastery(v17) - 1; | |
1032 | 7110 switch (v18) |
7111 { | |
7112 case 0: v67 = 4; break; | |
7113 case 1: v67 = 7; break; | |
7114 case 2: v67 = 10; break; | |
7115 case 3: v67 = 11; break; | |
7116 default: | |
7117 v67 = player_num; | |
7118 } | |
7119 | |
7120 if ( v16 > v67 || !v17 ) | |
1021 | 7121 { |
1032 | 7122 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7123 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7124 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7125 v3->PlaySound((PlayerSpeech)20, 0); |
7126 return; | |
7127 } | |
7128 // v72 = 1; | |
7129 v3->PlaySound(SPEECH_21, 0); | |
7130 v73 = 0; | |
7131 | |
7132 | |
7133 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7134 { | |
7135 if ( !v73 ) | |
1021 | 7136 { |
1032 | 7137 pMouse->RemoveHoldingItem(); |
7138 return; | |
7139 } | |
7140 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7141 } | |
7142 if ( v73 ) | |
7143 { | |
7144 if ( pParty->bTurnBasedModeOn ) | |
7145 { | |
7146 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7147 thisb->SetRecoveryTime(100); | |
7148 pTurnEngine->_40471C(); | |
1021 | 7149 } |
7150 else | |
7151 { | |
1032 | 7152 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7153 } |
7154 } | |
1032 | 7155 pMouse->RemoveHoldingItem(); |
7156 return; | |
7157 | |
1021 | 7158 } |
7159 | |
7160 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7161 | |
7162 { | |
7163 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7164 { | |
7165 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7166 v3->PlaySound(SPEECH_37, 0); |
1021 | 7167 return; |
7168 } | |
7169 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7170 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7171 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7172 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7173 return; |
7174 } | |
7175 else | |
7176 { | |
1019 | 7177 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7178 { |
7179 thisa = pParty->uCurrentMonthWeek + 1; | |
7180 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7181 v74 = NULL; |
1021 | 7182 else |
7183 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7184 switch ( pParty->uCurrentMonth ) | |
7185 { | |
1019 | 7186 case 0: |
1021 | 7187 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7188 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7189 break; |
1019 | 7190 case 1: |
1021 | 7191 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7192 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7193 break; |
1019 | 7194 case 2: |
1021 | 7195 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7196 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7197 break; |
1019 | 7198 case 3: |
1021 | 7199 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7200 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7201 break; |
1019 | 7202 case 4: |
1021 | 7203 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7204 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7205 break; |
1019 | 7206 case 5: |
1021 | 7207 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7208 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7209 break; |
1019 | 7210 case 6: |
1021 | 7211 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7212 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7213 break; |
1019 | 7214 case 7: |
1021 | 7215 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7216 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7217 break; |
1019 | 7218 case 8: |
1021 | 7219 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7220 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7221 break; |
0 | 7222 case 9u: |
1021 | 7223 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7224 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7225 break; |
1019 | 7226 case 10: |
1021 | 7227 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7228 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7229 break; |
1019 | 7230 case 11: |
1021 | 7231 v8 = rand() % 6; |
7232 switch (v8) | |
7233 { | |
7234 case 0: | |
7235 v3->sResFireBase += thisa; | |
7236 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7237 break; | |
7238 case 1: | |
7239 v3->sResAirBase += thisa; | |
7240 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7241 break; | |
7242 case 2: | |
7243 v3->sResWaterBase += thisa; | |
7244 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7245 break; | |
7246 case 3: | |
7247 v3->sResEarthBase += thisa; | |
7248 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7249 break; | |
7250 case 4: | |
7251 v3->sResMindBase += thisa; | |
7252 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7253 break; | |
7254 case 5: | |
7255 v3->sResBodyBase += thisa; | |
7256 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7257 break; |
1021 | 7258 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7259 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7260 break; |
7261 | |
7262 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7263 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 7264 pMouse->RemoveHoldingItem(); |
7265 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7266 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7267 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7268 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7269 { |
1021 | 7270 v3->SetCondition(Condition_Eradicated, 0); |
7271 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7272 } |
1021 | 7273 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7274 { | |
7275 v3->SetCondition(Condition_Dead, 0); | |
7276 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7277 } | |
7278 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7279 { | |
7280 v3->SetCondition(Condition_Pertified, 0); | |
7281 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7282 } | |
1019 | 7283 return; |
1021 | 7284 } |
7285 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7286 { | |
7287 Party::GiveFood(1u); | |
7288 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7289 | |
7290 } | |
7291 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7292 { | |
7293 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7294 return; | |
7295 } | |
7296 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7297 { | |
7298 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7299 return; | |
7300 } | |
7301 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7302 { | |
7303 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7304 return; | |
7305 } | |
1032 | 7306 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7307 { |
7308 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7309 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7310 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7311 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7312 } | |
7313 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7314 { | |
7315 sub_44C28F_open_nwc_dungeon(); | |
7316 return; | |
7317 } | |
0 | 7318 else |
1021 | 7319 { |
7320 | |
7321 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7322 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7323 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7324 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7325 return; |
7326 } | |
1032 | 7327 |
0 | 7328 pMouse->RemoveHoldingItem(); |
7329 return; | |
7330 } | |
1021 | 7331 |
7332 } | |
0 | 7333 |
7334 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7335 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7336 { |
0 | 7337 Player *v3; // esi@1 |
7338 signed int v4; // edi@1 | |
7339 unsigned int v5; // eax@8 | |
7340 int v6; // eax@9 | |
7341 enum CHARACTER_RACE v7; // eax@11 | |
7342 signed int v8; // eax@17 | |
7343 unsigned __int8 v9; // sf@17 | |
7344 unsigned __int8 v10; // of@17 | |
7345 int v11; // eax@19 | |
7346 unsigned int v12; // eax@20 | |
484 | 7347 unsigned int test_bit_value; // eax@25 |
7348 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7349 signed int v15; // ecx@28 |
7350 ItemGen *v16; // eax@28 | |
7351 char v17; // zf@31 | |
7352 int v18; // edi@90 | |
7353 DDM_DLV_Header *v19; // eax@122 | |
7354 char v20; // cl@124 | |
7355 DDM_DLV_Header *v21; // eax@126 | |
7356 unsigned int v22; // edi@129 | |
100 | 7357 Player *v23; // esi@134 |
0 | 7358 ItemGen *v24; // ecx@135 |
7359 signed int v25; // edx@135 | |
7360 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7361 char *v27; // edi@155 | |
7362 int v28; // ebx@161 | |
7363 int v29; // eax@161 | |
7364 | |
469 | 7365 v6 = 0; |
0 | 7366 v3 = this; |
7367 v4 = -1; | |
469 | 7368 if ( VarNum > VAR_AutoNotes ) |
7369 { | |
7370 switch ( VarNum ) | |
0 | 7371 { |
7372 case VAR_Invisible: | |
1167 | 7373 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 7374 return true; |
484 | 7375 return false; |
0 | 7376 case VAR_NumDeaths: |
7377 v4 = pParty->uNumDeaths; | |
469 | 7378 return v4 >= pValue; |
0 | 7379 case VAR_NumBounties: |
7380 v4 = pParty->uNumBountiesCollected; | |
469 | 7381 return v4 >= pValue; |
0 | 7382 case VAR_PrisonTerms: |
7383 v4 = pParty->uNumPrisonTerms; | |
469 | 7384 return v4 >= pValue; |
0 | 7385 case VAR_ArenaWinsPage: |
7386 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7387 return v4 >= pValue; |
0 | 7388 case VAR_ArenaWinsSquire: |
7389 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7390 return v4 >= pValue; |
0 | 7391 case VAR_ArenaWinsKnight: |
7392 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7393 return v4 >= pValue; |
0 | 7394 case VAR_ArenaWinsLord: |
7395 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7396 return v4 >= pValue; |
0 | 7397 case VAR_ReputationInCurrentLocation: |
7398 v19 = &pOutdoor->ddm; | |
7399 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7400 v19 = &pIndoor->dlv; | |
469 | 7401 v6 = v19->uReputation >= pValue; |
7402 return v6; | |
0 | 7403 case VAR_History_28|VAR_Sex: |
7404 v21 = &pOutdoor->ddm; | |
7405 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7406 v21 = &pIndoor->dlv; | |
469 | 7407 v6 = v21->field_C_alert == pValue; |
0 | 7408 return v6; |
7409 case VAR_MonthEquals2|VAR_Sex: | |
7410 case VAR_MonthEquals2|VAR_Class: | |
7411 case VAR_Counter1: | |
7412 case VAR_Counter2: | |
7413 case VAR_Counter3: | |
7414 case VAR_Counter4: | |
7415 case VAR_Counter5: | |
7416 case VAR_Counter6: | |
7417 case VAR_Counter7: | |
7418 case VAR_Counter8: | |
469 | 7419 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7420 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7421 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7422 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7423 return true; | |
7424 return false; | |
0 | 7425 case VAR_NumSkillPoints: |
7426 v4 = this->uSkillPoints; | |
469 | 7427 return v4 >= pValue; |
0 | 7428 case VAR_CircusPrises: |
7429 v4 = 0; | |
100 | 7430 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7431 do |
7432 { | |
469 | 7433 v24 = v23->pInventoryItems; |
0 | 7434 v25 = 138; |
7435 do | |
7436 { | |
7437 switch ( v24->uItemID ) | |
7438 { | |
7439 case 0x1D6u: | |
7440 ++v4; | |
7441 break; | |
7442 case 0x1D7u: | |
7443 v4 += 3; | |
7444 break; | |
7445 case 0x1DDu: | |
7446 v4 += 5; | |
7447 break; | |
7448 } | |
7449 ++v24; | |
7450 --v25; | |
7451 } | |
7452 while ( v25 ); | |
100 | 7453 ++v23; |
0 | 7454 } |
100 | 7455 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7456 return v4 >= pValue; |
0 | 7457 case VAR_MonthEquals2: |
469 | 7458 v6 = pParty->uCurrentMonth == pValue; |
7459 return v6; | |
0 | 7460 case VAR_IsFlying: |
7461 if ( pParty->bFlying | |
1167 | 7462 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 7463 return true; |
7464 return false; | |
0 | 7465 case VAR_HiredNPCHasSpeciality: |
469 | 7466 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7467 return v6; |
7468 case VAR_NPCs2: | |
469 | 7469 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7470 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7471 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7472 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7473 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7474 return v4 >= pValue; |
7475 v4 = pValue; | |
7476 return v4 >= pValue; | |
0 | 7477 case VAR_ItemEquipped: |
7478 v26 = (ITEM_EQUIP_TYPE)0; | |
7479 v27 = (char *)&this->pEquipment; | |
7480 break; | |
7481 case VAR_GoldInBank: | |
7482 v4 = pParty->uNumGoldInBank; | |
469 | 7483 return v4 >= pValue; |
0 | 7484 case VAR_ThieverySkill|0x80: |
7485 v28 = GetActualMight(); | |
7486 v29 = v3->GetBaseStrength(); | |
7487 goto LABEL_168; | |
7488 case VAR_DisarmTrapSkill|0x80: | |
7489 v28 = GetActualIntelligence(); | |
7490 v29 = v3->GetBaseIntelligence(); | |
7491 goto LABEL_168; | |
7492 case VAR_MonthEquals: | |
7493 v28 = GetActualWillpower(); | |
7494 v29 = v3->GetBaseWillpower(); | |
7495 goto LABEL_168; | |
7496 case VAR_MonthEquals|VAR_Sex: | |
7497 v28 = GetActualEndurance(); | |
7498 v29 = v3->GetBaseEndurance(); | |
7499 goto LABEL_168; | |
7500 case VAR_IdentifyMonsterSkill|0x80: | |
7501 v28 = GetActualSpeed(); | |
7502 v29 = v3->GetBaseSpeed(); | |
7503 goto LABEL_168; | |
7504 case VAR_ArmsmasterSkill|0x80: | |
7505 v28 = GetActualAccuracy(); | |
7506 v29 = v3->GetBaseAccuracy(); | |
7507 goto LABEL_168; | |
7508 case VAR_MonthEquals|VAR_MaxHP: | |
7509 v28 = GetActualLuck(); | |
7510 v29 = v3->GetBaseLuck(); | |
7511 LABEL_168: | |
7512 v10 = __OFSUB__(v28, v29); | |
7513 v9 = v28 - v29 < 0; | |
7514 LABEL_169: | |
7515 if ( v9 ^ v10 ) | |
469 | 7516 return v4 >= pValue; |
7517 return true; | |
0 | 7518 default: |
469 | 7519 return v4 >= pValue; |
0 | 7520 } |
7521 while ( !v3->HasItemEquipped(v26) | |
654 | 7522 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7523 { |
7524 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7525 v27 += 4; | |
7526 if ( (signed int)v26 >= 16 ) | |
469 | 7527 return false; |
7528 } | |
7529 return true; | |
7530 } | |
7531 if ( VarNum == VAR_AutoNotes ) | |
0 | 7532 { |
1033 | 7533 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7534 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7535 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7536 return false; | |
7537 return true; | |
469 | 7538 } |
7539 if ( VarNum <= VAR_BaseLuck ) | |
7540 { | |
7541 if ( VarNum != VAR_BaseLuck ) | |
7542 { | |
7543 switch ( VarNum ) | |
0 | 7544 { |
7545 case VAR_Hour: | |
469 | 7546 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7547 return true; | |
7548 return false; | |
0 | 7549 case VAR_DayOfYear: |
469 | 7550 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7551 v6 = v5 == pValue; | |
7552 return v6; | |
0 | 7553 case VAR_DayOfWeek: |
469 | 7554 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7555 v6 = v5 == pValue; | |
0 | 7556 return v6; |
7557 case VAR_Sex: | |
469 | 7558 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7559 return true; | |
7560 return v4 >= pValue; | |
0 | 7561 case VAR_Class: |
135 | 7562 v7 = (CHARACTER_RACE)this->classType; |
469 | 7563 if ( pValue == v7 ) |
7564 return true; | |
7565 return v4 >= pValue; | |
0 | 7566 case VAR_Race: |
7567 v7 = GetRace(); | |
469 | 7568 if ( pValue == v7 ) |
7569 return true; | |
7570 return v4 >= pValue; | |
0 | 7571 case VAR_CurrentHP: |
7572 v4 = this->sHealth; | |
469 | 7573 return v4 >= pValue; |
0 | 7574 case VAR_MaxHP: |
7575 v8 = GetMaxHealth(); | |
7576 v10 = __OFSUB__(v3->sHealth, v8); | |
7577 v9 = v3->sHealth - v8 < 0; | |
7578 goto LABEL_169; | |
7579 case VAR_CurrentSP: | |
7580 v4 = this->sMana; | |
469 | 7581 return v4 >= pValue; |
0 | 7582 case VAR_MaxSP: |
7583 v11 = GetMaxMana(); | |
7584 v10 = __OFSUB__(v3->sMana, v11); | |
7585 v9 = v3->sMana - v11 < 0; | |
7586 goto LABEL_169; | |
7587 case VAR_ActualAC: | |
7588 v12 = GetActualAC(); | |
7589 goto _j_cmp_against_arg; | |
7590 case VAR_ACModifier: | |
7591 v4 = this->sACModifier; | |
469 | 7592 return v4 >= pValue; |
0 | 7593 case VAR_BaseLevel: |
7594 v4 = this->uLevel; | |
469 | 7595 return v4 >= pValue; |
0 | 7596 case VAR_LevelModifier: |
7597 v4 = this->sLevelModifier; | |
469 | 7598 return v4 >= pValue; |
0 | 7599 case VAR_Age: |
7600 v12 = GetActualAge(); | |
7601 goto _j_cmp_against_arg; | |
7602 case VAR_Award: | |
1033 | 7603 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7604 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7605 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7606 return true; | |
7607 return false; | |
0 | 7608 case VAR_Experience: |
7609 v4 = LODWORD(this->uExperience); | |
469 | 7610 return v4 >= pValue; |
0 | 7611 case VAR_QBits_QuestsDone: |
484 | 7612 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7613 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7614 if ( test_bit_value & our_bit_value ) | |
478 | 7615 return true; |
7616 return false; | |
0 | 7617 case VAR_PlayerItemInHands: |
7618 v15 = 0; | |
7619 v16 = v3->pInventoryItems; | |
7620 break; | |
7621 case VAR_FixedGold: | |
7622 v4 = pParty->uNumGold; | |
469 | 7623 return v4 >= pValue; |
0 | 7624 case VAR_MightBonus: |
7625 v4 = this->uMightBonus; | |
469 | 7626 return v4 >= pValue; |
0 | 7627 case VAR_IntellectBonus: |
7628 v4 = this->uIntelligenceBonus; | |
469 | 7629 return v4 >= pValue; |
0 | 7630 case VAR_PersonalityBonus: |
7631 v4 = this->uWillpowerBonus; | |
469 | 7632 return v4 >= pValue; |
0 | 7633 case VAR_EnduranceBonus: |
7634 v4 = this->uEnduranceBonus; | |
469 | 7635 return v4 >= pValue; |
0 | 7636 case VAR_SpeedBonus: |
7637 v4 = this->uSpeedBonus; | |
469 | 7638 return v4 >= pValue; |
0 | 7639 case VAR_AccuracyBonus: |
7640 v4 = this->uAccuracyBonus; | |
469 | 7641 return v4 >= pValue; |
0 | 7642 case VAR_LuckBonus: |
7643 v4 = this->uLuckBonus; | |
469 | 7644 return v4 >= pValue; |
0 | 7645 case VAR_BaseMight: |
7646 v4 = this->uMight; | |
469 | 7647 return v4 >= pValue; |
0 | 7648 case VAR_BaseIntellect: |
7649 v4 = this->uIntelligence; | |
469 | 7650 return v4 >= pValue; |
0 | 7651 case VAR_BasePersonality: |
7652 v4 = this->uWillpower; | |
469 | 7653 return v4 >= pValue; |
0 | 7654 case VAR_BaseEndurance: |
7655 v4 = this->uEndurance; | |
469 | 7656 return v4 >= pValue; |
0 | 7657 case VAR_BaseSpeed: |
7658 v4 = this->uSpeed; | |
469 | 7659 return v4 >= pValue; |
0 | 7660 case VAR_BaseAccuracy: |
7661 v4 = this->uAccuracy; | |
469 | 7662 return v4 >= pValue; |
0 | 7663 case VAR_FixedFood: |
7664 v4 = pParty->uNumFoodRations; | |
469 | 7665 return v4 >= pValue; |
0 | 7666 default: |
469 | 7667 return v4 >= pValue; |
7668 } | |
7669 while ( v16->uItemID != pValue ) | |
0 | 7670 { |
7671 ++v15; | |
7672 ++v16; | |
7673 if ( v15 >= 138 ) | |
7674 { | |
469 | 7675 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7676 return v6; |
7677 } | |
7678 } | |
469 | 7679 return true; |
0 | 7680 } |
7681 v4 = this->uLuck; | |
469 | 7682 return v4 >= pValue; |
7683 } | |
7684 if ( VarNum <= VAR_MagicResistance ) | |
7685 { | |
7686 if ( VarNum == VAR_MagicResistance ) | |
0 | 7687 { |
7688 v4 = this->sResMagicBase; | |
7689 } | |
7690 else | |
7691 { | |
469 | 7692 switch ( VarNum ) |
0 | 7693 { |
7694 case VAR_FireResistance: | |
7695 v4 = this->sResFireBase; | |
469 | 7696 return v4 >= pValue; |
0 | 7697 case VAR_AirResistance: |
7698 v4 = this->sResAirBase; | |
469 | 7699 return v4 >= pValue; |
0 | 7700 case VAR_WaterResistance: |
7701 v4 = this->sResWaterBase; | |
469 | 7702 return v4 >= pValue; |
0 | 7703 case VAR_EarthResistance: |
7704 v4 = this->sResEarthBase; | |
469 | 7705 return v4 >= pValue; |
0 | 7706 case VAR_SpiritResistance: |
7707 v4 = this->sResSpiritBase; | |
469 | 7708 return v4 >= pValue; |
0 | 7709 case VAR_MindResistance: |
7710 v4 = this->sResMindBase; | |
469 | 7711 return v4 >= pValue; |
0 | 7712 case VAR_BodyResistance: |
7713 v4 = this->sResBodyBase; | |
469 | 7714 return v4 >= pValue; |
0 | 7715 case VAR_LightResistance: |
7716 v4 = this->sResLightBase; | |
469 | 7717 return v4 >= pValue; |
0 | 7718 case VAR_DarkResistance: |
7719 v4 = this->sResDarkBase; | |
469 | 7720 return v4 >= pValue; |
0 | 7721 case VAR_ActualMight: |
7722 v12 = GetActualMight(); | |
7723 goto _j_cmp_against_arg; | |
7724 case VAR_ActualIntellect: | |
7725 v12 = GetActualIntelligence(); | |
7726 goto _j_cmp_against_arg; | |
7727 case VAR_ActualPersonality: | |
7728 v12 = GetActualWillpower(); | |
7729 goto _j_cmp_against_arg; | |
7730 case VAR_ActualEndurance: | |
7731 v12 = GetActualEndurance(); | |
7732 goto _j_cmp_against_arg; | |
7733 case VAR_ActualSpeed: | |
7734 v12 = GetActualSpeed(); | |
7735 goto _j_cmp_against_arg; | |
7736 case VAR_ActualAccuracy: | |
7737 v12 = GetActualAccuracy(); | |
7738 goto _j_cmp_against_arg; | |
7739 case VAR_ActualLuck: | |
7740 v12 = GetActualLuck(); | |
7741 _j_cmp_against_arg: | |
7742 v4 = v12; | |
7743 break; | |
7744 default: | |
469 | 7745 return v4 >= pValue; |
7746 } | |
7747 } | |
7748 return v4 >= pValue; | |
7749 } | |
7750 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7751 { | |
7752 if ( VarNum != VAR_DisarmTrapSkill ) | |
7753 { | |
7754 if ( VarNum <= VAR_MindResistanceBonus ) | |
7755 { | |
7756 switch ( VarNum ) | |
0 | 7757 { |
7758 case VAR_MindResistanceBonus: | |
7759 v4 = this->sResMindBonus; | |
7760 break; | |
7761 case VAR_FireResistanceBonus: | |
7762 v4 = this->sResFireBonus; | |
7763 break; | |
7764 case VAR_AirResistanceBonus: | |
7765 v4 = this->sResAirBonus; | |
7766 break; | |
7767 case VAR_WaterResistanceBonus: | |
7768 v4 = this->sResWaterBonus; | |
7769 break; | |
7770 case VAR_EarthResistanceBonus: | |
7771 v4 = this->sResEarthBonus; | |
7772 break; | |
7773 case VAR_SpiritResistanceBonus: | |
7774 v4 = this->sResSpiritBonus; | |
7775 break; | |
7776 } | |
469 | 7777 return v4 >= pValue; |
7778 } | |
7779 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7780 { |
7781 v4 = this->sResBodyBonus; | |
469 | 7782 return v4 >= pValue; |
7783 } | |
7784 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7785 { |
7786 v4 = this->sResLightBonus; | |
469 | 7787 return v4 >= pValue; |
7788 } | |
7789 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7790 { |
7791 v4 = this->sResDarkBonus; | |
469 | 7792 return v4 >= pValue; |
7793 } | |
7794 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7795 { |
7796 v4 = this->sResMagicBonus; | |
469 | 7797 return v4 >= pValue; |
7798 } | |
7799 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7800 return v4 >= pValue; | |
0 | 7801 } |
7802 LABEL_90: | |
469 | 7803 v18 = *((short *)&this->pConditions[16] + VarNum); |
7804 if ( pValue <= 63 ) | |
0 | 7805 v4 = v18 & 0x3F; |
7806 else | |
469 | 7807 v4 = pValue & v18; |
7808 return v4 >= pValue; | |
7809 } | |
7810 if ( VarNum == 104 ) | |
0 | 7811 goto LABEL_90; |
469 | 7812 if ( (signed int)VarNum <= 104 ) |
7813 return v4 >= pValue; | |
7814 if ( (signed int)VarNum > 0x79 ) | |
7815 { | |
7816 if ( VarNum != 122 ) | |
7817 { | |
7818 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7819 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7820 return v4 >= pValue; | |
0 | 7821 } |
7822 v4 = GetMajorConditionIdx(); | |
7823 if ( v4 != 18 ) | |
7824 { | |
469 | 7825 return v4 >= pValue; |
7826 } | |
7827 v4 = pValue; | |
7828 return v4 >= pValue; | |
7829 } | |
1072 | 7830 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 7831 } |
7832 | |
7833 | |
7834 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 7835 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7836 { | |
7837 signed int currPlayerId; // ebx@1 | |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7838 Player *v4_unused; // esi@1 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7839 unsigned int v5_unused; // edi@1 |
0 | 7840 unsigned int v6; // esi@13 |
7841 unsigned int v7; // esi@14 | |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7842 signed int v8_unused; // eax@17 |
0 | 7843 ItemGen *v9; // ecx@17 |
7844 int v10; // eax@21 | |
7845 signed int v11; // eax@30 | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7846 Player *unused12; // ecx@44 |
0 | 7847 char *v13; // ecx@45 |
7848 Player *v14; // ecx@49 | |
7849 int v15; // ecx@86 | |
7850 int v16; // esi@106 | |
7851 char v17; // al@106 | |
7852 int v18; // eax@107 | |
7853 Player *v19; // ecx@112 | |
7854 Player *v20; // ecx@127 | |
7855 int v21; // eax@127 | |
7856 int v22; // eax@145 | |
7857 char v23; // zf@146 | |
7858 DDM_DLV_Header *v24; // ecx@148 | |
7859 signed int v25; // eax@172 | |
7860 int v26; // [sp-8h] [bp-3Ch]@84 | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7861 signed int unused27; // [sp-4h] [bp-38h]@4 |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7862 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 7863 ItemGen item; // [sp+Ch] [bp-28h]@52 |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7864 char v30_unused; // [sp+32h] [bp-2h]@1 |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7865 char v31_unused; // [sp+33h] [bp-1h]@1 |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7866 |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7867 currPlayerId = -1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7868 for (int i = 1; i <= 4; i++) //TODO: add a member variable for playerid in the future |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7869 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7870 if ( this == pPlayers[i] ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7871 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7872 currPlayerId = i - 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7873 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7874 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7875 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7876 assert(currPlayerId != -1); |
492 | 7877 if ( var_type > VAR_AutoNotes ) |
7878 { | |
7879 if ( var_type <= VAR_GoldInBank ) | |
7880 { | |
7881 if ( var_type == VAR_GoldInBank ) | |
7882 { | |
7883 pParty->uNumGoldInBank = var_value; | |
0 | 7884 return; |
7885 } | |
492 | 7886 if ( var_type <= VAR_Counter8 ) |
7887 { | |
7888 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7889 { |
492 | 7890 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7891 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7892 } |
7893 else | |
7894 { | |
492 | 7895 switch ( var_type ) |
0 | 7896 { |
7897 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 7898 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 7899 break; |
7900 case VAR_NPCs2: | |
7901 pParty->field_709 = 0; | |
492 | 7902 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 7903 pParty->CountHirelings(); |
7904 viewparams->bRedrawGameUI = true; | |
0 | 7905 break; |
7906 case VAR_NumSkillPoints: | |
492 | 7907 this->uSkillPoints = var_value; |
0 | 7908 break; |
7909 } | |
7910 } | |
7911 return; | |
7912 } | |
492 | 7913 if ( var_type < VAR_Counter9 ) |
0 | 7914 return; |
492 | 7915 if ( (signed int)var_type <= 0x112 ) |
7916 { | |
7917 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7918 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7919 } |
7920 else | |
7921 { | |
492 | 7922 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 7923 { |
7924 v24 = &pOutdoor->ddm; | |
7925 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7926 v24 = &pIndoor->dlv; | |
492 | 7927 v24->uReputation = var_value; |
7928 if ( var_value > 10000 ) | |
0 | 7929 v24->uReputation = 10000; |
7930 return; | |
7931 } | |
492 | 7932 if ( var_type <= VAR_ReputationInCurrentLocation |
7933 || var_type > VAR_History_28 | |
7934 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
7935 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7936 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 7937 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7938 v23) ) |
7939 return; | |
7940 bFlashHistoryBook = 1; | |
7941 } | |
492 | 7942 v25 = 8 * currPlayerId + 400; |
862 | 7943 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7944 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 7945 return; |
7946 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7947 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7948 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7949 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7950 pParty->uNumDeaths = var_value; |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7951 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7952 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7953 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7954 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7955 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7956 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7957 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7958 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7959 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7960 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7961 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7962 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7963 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7964 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7965 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7966 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7967 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7968 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7969 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7970 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7971 return; |
0 | 7972 } |
492 | 7973 if ( var_type == VAR_AutoNotes ) |
7974 { | |
7975 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
|
7976 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 7977 && pAutonoteTxt[var_value-1].pText ) |
7978 { | |
7979 v20 = pPlayers[currPlayerId + 1]; | |
187 | 7980 v20->PlaySound(SPEECH_96, 0); |
492 | 7981 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 7982 bFlashAutonotesBook = 1; |
981 | 7983 _506568_autonote_type = v21; |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7984 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 7985 } |
492 | 7986 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7987 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7988 return; |
0 | 7989 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7990 if ( var_type <= VAR_BaseLuck ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7991 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7992 switch ( var_type ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7993 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7994 case VAR_Sex: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7995 this->uSex = (PLAYER_SEX)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7996 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7997 case VAR_Class: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7998 this->classType = (PLAYER_CLASS_TYPE)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7999 if ( (char)var_value == PLAYER_CLASS_LICH ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8000 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8001 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8002 for (int i = 0; i < 138; i++) |
0 | 8003 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8004 v9 = &this->pInventoryItems[i]; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8005 if (v9->uItemID == 615) |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8006 break; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8007 } |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8008 if (v9 != NULL || v9->uItemID != 615) |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8009 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8010 v10 = (int)((char *)this + 36 * 138); //originally 36 * v8. the code got to this condition only if v8 was equal to 138 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8011 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8012 *(char *)(v10 + 558) = currPlayerId + 1; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8013 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8014 if ( this->sResFireBase < 20 ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8015 this->sResFireBase = 20; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8016 if ( this->sResAirBase < 20 ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8017 this->sResAirBase = 20; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8018 if ( this->sResWaterBase < 20 ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8019 this->sResWaterBase = 20; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8020 if ( this->sResEarthBase < 20 ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8021 this->sResEarthBase = 20; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8022 this->sResMindBase = 200; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8023 this->sResBodyBase = 200; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8024 v11 = this->GetSexByVoice(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8025 this->uPrevVoiceID = this->uVoiceID; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8026 this->uPrevFace = this->uCurrentFace; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8027 if ( v11 ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8028 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8029 this->uCurrentFace = 21; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8030 this->uVoiceID = 21; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8031 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8032 else |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8033 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8034 this->uCurrentFace = 20; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8035 this->uVoiceID = 20; |
0 | 8036 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8037 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8038 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8039 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8040 case VAR_CurrentHP: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8041 this->sHealth = var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8042 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8043 case VAR_MaxHP: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8044 this->sHealth = GetMaxHealth(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8045 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8046 case VAR_CurrentSP: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8047 this->sMana = var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8048 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8049 case VAR_MaxSP: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8050 this->sMana = GetMaxMana(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8051 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8052 case VAR_ACModifier: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8053 this->sACModifier = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8054 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8055 case VAR_BaseLevel: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8056 this->uLevel = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8057 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8058 case VAR_LevelModifier: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8059 this->sLevelModifier = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8060 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8061 case VAR_Age: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8062 this->sAgeModifier = var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8063 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8064 case VAR_Award: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8065 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8066 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8067 //&& dword_723E80_award_related[2 * a3] ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8068 && pAwards[var_value].pText ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8069 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8070 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8071 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8072 PlaySoundBasedOnCondition(currPlayerId); |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8073 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8074 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, var_value, 1u); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8075 return; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8076 case VAR_Experience: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8077 this->uExperience = var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8078 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8079 case VAR_QBits_QuestsDone: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8080 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8081 // && (&dword_722F10)[4 * a3] ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8082 && pQuestTable[var_value-1] ) |
0 | 8083 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8084 v14 = pPlayers[currPlayerId + 1]; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8085 bFlashQuestBook = 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8086 v14->PlaySound(SPEECH_93, 0); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8087 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8088 PlaySoundBasedOnCondition(currPlayerId); |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8089 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8090 v13 = (char *)pParty->_quest_bits; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8091 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8092 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8093 case VAR_PlayerItemInHands: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8094 item.Reset(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8095 item.Reset(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8096 item.uItemID = var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8097 item.uAttributes = 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8098 pParty->SetHoldingItem(&item); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8099 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8100 pParty->pIsArtifactFound[var_value-500] = 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8101 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8102 case VAR_FixedGold: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8103 Party::SetGold(var_value); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8104 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8105 case VAR_RandomGold: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8106 v6 = rand() % var_value + 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8107 Party::SetGold(v6); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8108 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8109 ShowStatusBarString(pTmpBuf.data(), 2u); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8110 GameUI_DrawFoodAndGold(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8111 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8112 case VAR_FixedFood: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8113 Party::SetFood(var_value); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8114 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8115 case VAR_RandomFood: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8116 v7 = rand() % var_value + 1; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8117 Party::SetFood(v7); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8118 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8119 ShowStatusBarString(pTmpBuf.data(), 2u); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8120 GameUI_DrawFoodAndGold(); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8121 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8122 case VAR_MightBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8123 goto LABEL_64; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8124 case VAR_IntellectBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8125 goto LABEL_68; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8126 case VAR_PersonalityBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8127 goto LABEL_69; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8128 case VAR_EnduranceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8129 goto LABEL_70; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8130 case VAR_SpeedBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8131 goto LABEL_71; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8132 case VAR_AccuracyBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8133 goto LABEL_72; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8134 case VAR_LuckBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8135 goto LABEL_73; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8136 case VAR_BaseMight: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8137 this->uMight = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8138 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8139 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8140 case VAR_BaseIntellect: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8141 this->uIntelligence = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8142 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8143 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8144 case VAR_BasePersonality: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8145 this->uWillpower = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8146 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8147 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8148 case VAR_BaseEndurance: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8149 this->uEndurance = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8150 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8151 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8152 case VAR_BaseSpeed: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8153 this->uSpeed = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8154 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8155 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8156 case VAR_BaseAccuracy: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8157 this->uAccuracy = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8158 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8159 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8160 case VAR_BaseLuck: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8161 this->uLuck = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8162 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8163 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8164 default: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8165 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8166 } |
0 | 8167 LABEL_111: |
187 | 8168 v26 = SPEECH_91; |
0 | 8169 LABEL_112: |
492 | 8170 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8171 v19->PlaySound((PlayerSpeech)v26, 0); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8172 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8173 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8174 return; |
0 | 8175 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8176 if ( var_type <= VAR_MagicResistance ) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8177 { |
492 | 8178 switch ( var_type ) |
0 | 8179 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8180 case VAR_ActualMight: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8181 LABEL_64: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8182 this->uMightBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8183 goto LABEL_111; |
0 | 8184 case VAR_ActualIntellect: |
8185 LABEL_68: | |
492 | 8186 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8187 goto LABEL_111; |
8188 case VAR_ActualPersonality: | |
8189 LABEL_69: | |
492 | 8190 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8191 goto LABEL_111; |
8192 case VAR_ActualEndurance: | |
8193 LABEL_70: | |
492 | 8194 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8195 goto LABEL_111; |
8196 case VAR_ActualSpeed: | |
8197 LABEL_71: | |
492 | 8198 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8199 goto LABEL_111; |
8200 case VAR_ActualAccuracy: | |
8201 LABEL_72: | |
492 | 8202 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8203 goto LABEL_111; |
8204 case VAR_ActualLuck: | |
8205 LABEL_73: | |
492 | 8206 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8207 goto LABEL_111; |
8208 case VAR_FireResistance: | |
492 | 8209 this->sResFireBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8210 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8211 goto LABEL_112; |
0 | 8212 case VAR_AirResistance: |
492 | 8213 this->sResAirBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8214 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8215 goto LABEL_112; |
0 | 8216 case VAR_WaterResistance: |
492 | 8217 this->sResWaterBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8218 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8219 goto LABEL_112; |
0 | 8220 case VAR_EarthResistance: |
492 | 8221 this->sResEarthBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8222 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8223 goto LABEL_112; |
0 | 8224 case VAR_SpiritResistance: |
492 | 8225 this->sResSpiritBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8226 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8227 goto LABEL_112; |
0 | 8228 case VAR_MindResistance: |
492 | 8229 this->sResMindBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8230 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8231 goto LABEL_112; |
0 | 8232 case VAR_BodyResistance: |
492 | 8233 this->sResBodyBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8234 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8235 goto LABEL_112; |
0 | 8236 case VAR_LightResistance: |
492 | 8237 this->sResLightBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8238 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8239 goto LABEL_112; |
0 | 8240 case VAR_DarkResistance: |
492 | 8241 this->sResDarkBase = (unsigned __int8)var_value; |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8242 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8243 goto LABEL_112; |
0 | 8244 case VAR_MagicResistance: |
492 | 8245 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8246 v26 = 92; |
8247 goto LABEL_112; | |
8248 default: | |
8249 return; | |
8250 } | |
8251 return; | |
8252 } | |
8253 HIWORD(v15) = 0; | |
492 | 8254 if ( var_type > VAR_DisarmTrapSkill ) |
8255 { | |
8256 if ( var_type != VAR_LearningSkill ) | |
8257 { | |
8258 if ( var_type <= VAR_LearningSkill ) | |
0 | 8259 return; |
492 | 8260 if ( var_type <= VAR_Eradicated ) |
8261 { | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8262 this->SetCondition(var_type - 105, 1); |
0 | 8263 } |
8264 else | |
8265 { | |
492 | 8266 if ( var_type != VAR_MajorCondition ) |
0 | 8267 { |
492 | 8268 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8269 byte_5E4C15[var_type] = var_value; | |
0 | 8270 return; |
8271 } | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8272 memset(this, 0, 0xA0u); |
0 | 8273 } |
8274 } | |
8275 else | |
8276 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8277 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8278 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8279 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8280 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8281 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8282 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8283 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8284 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8285 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8286 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8287 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8288 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8289 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8290 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8291 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8292 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8293 return; |
0 | 8294 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8295 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 8296 { |
8297 switch ( var_type ) | |
0 | 8298 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8299 case VAR_FireResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8300 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 8301 break; |
8302 case VAR_AirResistanceBonus: | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8303 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 8304 break; |
8305 case VAR_WaterResistanceBonus: | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8306 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8307 break; |
8308 case VAR_EarthResistanceBonus: | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8309 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8310 break; |
8311 case VAR_SpiritResistanceBonus: | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8312 this->sResSpiritBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8313 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8314 case VAR_MindResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8315 this->sResMindBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8316 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8317 case VAR_BodyResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8318 this->sResBodyBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8319 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8320 case VAR_LightResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8321 this->sResLightBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8322 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8323 case VAR_DarkResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8324 this->sResDarkBonus = (unsigned __int8)var_value; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8325 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8326 case VAR_PhysicalResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8327 assert("VAR_PhysicalResistanceBonus variable unsupported" && false); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8328 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8329 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8330 case VAR_MagicResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8331 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 8332 break; |
8333 default: | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8334 assert("Unexpected var_type" && false); |
0 | 8335 return; |
8336 break; | |
8337 } | |
8338 goto LABEL_111; | |
8339 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8340 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill || var_type == VAR_DisarmTrapSkill) //VAR_ThieverySkill wasn't present in the original function |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8341 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8342 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8343 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8344 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8345 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8346 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8347 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8348 void Player::PlaySoundBasedOnCondition(int currPlayerId) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8349 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8350 signed int v25 = 8 * currPlayerId + 400; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8351 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8352 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8353 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8354 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8355 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8356 void Player::DrawPlayerBuffAnimBasedOnCondition(int currPlayerId) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8357 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8358 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8359 } |
0 | 8360 |
8361 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8362 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8363 { |
8364 char v3; // bl@1 | |
8365 Player *v4; // esi@1 | |
8366 signed int uPlayerIdx; // edi@1 | |
8367 int v6; // eax@15 | |
8368 unsigned int v7; // esi@18 | |
8369 int *v8; // ebx@21 | |
8370 int v9; // eax@22 | |
8371 signed int v10; // eax@24 | |
8372 int v11; // eax@27 | |
8373 __int16 *v12; // esi@28 | |
8374 Player *v13; // ecx@34 | |
8375 Player *v14; // ecx@36 | |
8376 char *v15; // ecx@37 | |
8377 unsigned __int8 v16; // cf@38 | |
8378 Player *v17; // ecx@42 | |
8379 __int16 *v18; // esi@53 | |
8380 __int16 *v19; // esi@62 | |
8381 char *v20; // esi@107 | |
8382 __int16 v21; // dx@107 | |
8383 int v22; // ecx@107 | |
8384 Player *v23; // ecx@132 | |
8385 int v24; // eax@132 | |
8386 int v25; // eax@150 | |
8387 char v26; // zf@151 | |
8388 DDM_DLV_Header *v27; // eax@153 | |
8389 signed int v28; // eax@176 | |
8390 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8391 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8392 int v31; // [sp-4h] [bp-3Ch]@84 |
8393 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8394 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8395 char v34; // [sp+37h] [bp-1h]@1 | |
8396 | |
8397 auto Dst = this; | |
8398 v3 = 0; | |
8399 v34 = 0; | |
8400 v4 = Dst; | |
8401 uPlayerIdx = 0; | |
8402 if ( Dst == pPlayers[2] ) | |
8403 uPlayerIdx = 1; | |
310 | 8404 else if ( Dst == pPlayers[3] ) |
8405 uPlayerIdx = 2; | |
8406 else if ( Dst == pPlayers[4] ) | |
8407 uPlayerIdx = 3; | |
8408 | |
8409 if ( var_type <= VAR_AutoNotes ) | |
8410 { | |
8411 if ( var_type != VAR_AutoNotes ) | |
8412 { | |
8413 if ( var_type <= VAR_ActualMight ) | |
8414 { | |
8415 if ( var_type != VAR_ActualMight ) | |
0 | 8416 { |
310 | 8417 switch ( var_type ) |
0 | 8418 { |
8419 case VAR_RandomGold: | |
8420 if ( !val ) | |
8421 val = 1; | |
8422 v6 = rand(); | |
8423 party_finds_gold(v6 % val + 1, 1); | |
8424 GameUI_DrawFoodAndGold(); | |
8425 return; | |
8426 case VAR_RandomFood: | |
8427 if ( !val ) | |
8428 val = 1; | |
8429 v7 = rand() % val + 1; | |
8430 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8431 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8432 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8433 GameUI_DrawFoodAndGold(); |
8434 goto _play_sound; | |
8435 case VAR_Sex: | |
8436 Dst->uSex = (PLAYER_SEX)val; | |
8437 goto _play_anim_and_exit; | |
8438 case VAR_Class: | |
135 | 8439 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8440 goto _play_anim_and_exit; |
8441 case VAR_CurrentHP: | |
8442 v8 = &Dst->sHealth; | |
8443 *v8 += val; | |
8444 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8445 goto _play_anim_and_exit; | |
8446 v9 = v4->GetMaxHealth(); | |
8447 goto LABEL_23; | |
8448 case VAR_MaxHP: | |
8449 v10 = Dst->GetMaxHealth(); | |
8450 v4->_health_related = 0; | |
8451 v4->uFullHealthBonus = 0; | |
8452 v4->sHealth = v10; | |
8453 return; | |
8454 case VAR_CurrentSP: | |
8455 v8 = &Dst->sMana; | |
8456 *v8 += val; | |
8457 if ( Dst->sMana > GetMaxMana() ) | |
8458 { | |
8459 v9 = v4->GetMaxMana(); | |
8460 LABEL_23: | |
8461 *v8 = v9; | |
8462 } | |
8463 goto _play_anim_and_exit; | |
8464 case VAR_MaxSP: | |
8465 v11 = GetMaxMana(); | |
8466 v4->_mana_related = 0; | |
8467 v4->uFullManaBonus = 0; | |
8468 v4->sMana = v11; | |
8469 return; | |
8470 case VAR_ACModifier: | |
8471 v12 = &Dst->sACModifier; | |
8472 goto LABEL_29; | |
8473 case VAR_BaseLevel: | |
8474 v12 = (__int16 *)&Dst->uLevel; | |
8475 goto LABEL_29; | |
8476 case VAR_LevelModifier: | |
8477 v12 = &Dst->sLevelModifier; | |
8478 LABEL_29: | |
8479 *v12 += val; | |
8480 if ( *v12 > 255 ) | |
8481 *v12 = 255; | |
8482 goto _play_anim_and_exit; | |
8483 case VAR_Age: | |
8484 Dst->sAgeModifier += val; | |
8485 return; | |
8486 case VAR_Award: | |
8487 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8488 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8489 | |
492 | 8490 && pAwards[val].pText ) |
0 | 8491 { |
8492 v14 = pPlayers[uPlayerIdx + 1]; | |
8493 v34 = 1; | |
8494 v3 = 1; | |
187 | 8495 v14->PlaySound(SPEECH_96, 0); |
0 | 8496 } |
735 | 8497 v15 = (char *)v4->_guilds_member_bits; |
0 | 8498 goto LABEL_44; |
8499 case VAR_Experience: | |
8500 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8501 LODWORD(Dst->uExperience) += val; | |
8502 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8503 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8504 Dst->uExperience = 4000000000i64; | |
8505 goto _play_anim_and_exit; | |
8506 case VAR_QBits_QuestsDone: | |
484 | 8507 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
|
8508 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8509 && pQuestTable[val-1] ) |
0 | 8510 { |
501 | 8511 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8512 bFlashQuestBook = 1; |
8513 v34 = 1; | |
8514 v3 = 1; | |
501 | 8515 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8516 } |
484 | 8517 v15 = (char *)pParty->_quest_bits; |
0 | 8518 LABEL_44: |
8519 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8520 goto LABEL_173; | |
8521 case VAR_PlayerItemInHands: | |
8522 item.Reset(); | |
8523 item.Reset(); | |
8524 item.uAttributes = 1; | |
8525 item.uItemID = val; | |
8526 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8527 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8528 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8529 { | |
8530 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8531 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8532 } | |
8533 pParty->SetHoldingItem(&item); | |
8534 return; | |
8535 case VAR_FixedGold: | |
8536 party_finds_gold(val, 1); | |
8537 return; | |
8538 case VAR_BaseMight: | |
8539 v18 = (__int16 *)&Dst->uMight; | |
8540 goto LABEL_82; | |
8541 case VAR_BaseIntellect: | |
8542 v18 = (__int16 *)&Dst->uIntelligence; | |
8543 goto LABEL_82; | |
8544 case VAR_BasePersonality: | |
8545 v18 = (__int16 *)&Dst->uWillpower; | |
8546 goto LABEL_82; | |
8547 case VAR_BaseEndurance: | |
8548 v18 = (__int16 *)&Dst->uEndurance; | |
8549 goto LABEL_82; | |
8550 case VAR_BaseSpeed: | |
8551 v18 = (__int16 *)&Dst->uSpeed; | |
8552 goto LABEL_82; | |
8553 case VAR_BaseAccuracy: | |
8554 v18 = (__int16 *)&Dst->uAccuracy; | |
8555 goto LABEL_82; | |
8556 case VAR_BaseLuck: | |
8557 v18 = (__int16 *)&Dst->uLuck; | |
8558 goto LABEL_82; | |
8559 case VAR_FixedFood: | |
8560 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8561 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8562 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8563 if ( pParty->uNumFoodRations > 0xFFFF ) |
8564 Party::SetFood(0xFFFFu); | |
8565 goto _play_sound; | |
8566 case VAR_MightBonus: | |
8567 goto LABEL_62; | |
8568 case VAR_IntellectBonus: | |
8569 goto LABEL_66; | |
8570 case VAR_PersonalityBonus: | |
8571 goto LABEL_67; | |
8572 case VAR_EnduranceBonus: | |
8573 goto LABEL_68; | |
8574 case VAR_SpeedBonus: | |
8575 goto LABEL_69; | |
8576 case VAR_AccuracyBonus: | |
8577 goto LABEL_70; | |
8578 case VAR_LuckBonus: | |
8579 goto LABEL_71; | |
8580 default: | |
8581 return; | |
8582 } | |
8583 return; | |
8584 } | |
8585 LABEL_62: | |
8586 v19 = (__int16 *)&Dst->uMightBonus; | |
8587 goto LABEL_113; | |
8588 } | |
310 | 8589 if ( var_type <= VAR_FireResistanceBonus ) |
8590 { | |
8591 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8592 { |
310 | 8593 switch ( var_type ) |
0 | 8594 { |
8595 case VAR_ActualIntellect: | |
8596 LABEL_66: | |
8597 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8598 goto LABEL_113; | |
8599 case VAR_ActualPersonality: | |
8600 LABEL_67: | |
8601 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8602 goto LABEL_113; | |
8603 case VAR_ActualEndurance: | |
8604 LABEL_68: | |
8605 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8606 goto LABEL_113; | |
8607 case VAR_ActualSpeed: | |
8608 LABEL_69: | |
8609 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8610 goto LABEL_113; | |
8611 case VAR_ActualAccuracy: | |
8612 LABEL_70: | |
8613 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8614 goto LABEL_113; | |
8615 case VAR_ActualLuck: | |
8616 LABEL_71: | |
8617 v19 = (__int16 *)&Dst->uLuckBonus; | |
8618 goto LABEL_113; | |
8619 case VAR_FireResistance: | |
8620 v18 = &Dst->sResFireBase; | |
8621 goto LABEL_82; | |
8622 case VAR_AirResistance: | |
8623 v18 = &Dst->sResAirBase; | |
8624 goto LABEL_82; | |
8625 case VAR_WaterResistance: | |
8626 v18 = &Dst->sResWaterBase; | |
8627 goto LABEL_82; | |
8628 case VAR_EarthResistance: | |
8629 v18 = &Dst->sResEarthBase; | |
8630 goto LABEL_82; | |
8631 case VAR_SpiritResistance: | |
8632 v18 = &Dst->sResSpiritBase; | |
8633 goto LABEL_82; | |
8634 case VAR_MindResistance: | |
8635 v18 = &Dst->sResMindBase; | |
8636 goto LABEL_82; | |
8637 case VAR_BodyResistance: | |
8638 v18 = &Dst->sResBodyBase; | |
8639 goto LABEL_82; | |
8640 case VAR_LightResistance: | |
8641 v18 = &Dst->sResLightBase; | |
8642 goto LABEL_82; | |
8643 case VAR_DarkResistance: | |
8644 v18 = &Dst->sResDarkBase; | |
8645 goto LABEL_82; | |
8646 case VAR_MagicResistance: | |
8647 v18 = &Dst->sResMagicBase; | |
8648 LABEL_82: | |
8649 *v18 += val; | |
8650 if ( *v18 > 255 ) | |
8651 *v18 = 255; | |
8652 v31 = 0; | |
8653 v29 = 92; | |
8654 goto LABEL_116; | |
8655 default: | |
8656 return; | |
8657 } | |
8658 return; | |
8659 } | |
8660 v19 = &Dst->sResFireBonus; | |
8661 LABEL_113: | |
8662 *v19 += val; | |
8663 if ( *v19 > 255 ) | |
8664 *v19 = 255; | |
8665 v31 = 0; | |
187 | 8666 v29 = SPEECH_91; |
0 | 8667 LABEL_116: |
8668 v3 = 1; | |
187 | 8669 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8670 goto _play_anim_and_maybe_sound; |
8671 } | |
310 | 8672 if ( var_type <= VAR_DisarmTrapSkill ) |
8673 { | |
8674 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8675 { |
310 | 8676 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8677 { |
310 | 8678 switch ( var_type ) |
0 | 8679 { |
8680 case VAR_BodyResistanceBonus: | |
8681 v19 = &Dst->sResBodyBonus; | |
8682 break; | |
8683 case VAR_AirResistanceBonus: | |
8684 v19 = &Dst->sResAirBonus; | |
8685 break; | |
8686 case VAR_WaterResistanceBonus: | |
8687 v19 = &Dst->sResWaterBonus; | |
8688 break; | |
8689 case VAR_EarthResistanceBonus: | |
8690 v19 = &Dst->sResEarthBonus; | |
8691 break; | |
8692 case VAR_SpiritResistanceBonus: | |
8693 v19 = &Dst->sResSpiritBonus; | |
8694 break; | |
8695 default: | |
310 | 8696 if ( var_type != 62 ) |
0 | 8697 return; |
8698 v19 = &Dst->sResMindBonus; | |
8699 break; | |
8700 } | |
8701 goto LABEL_113; | |
8702 } | |
310 | 8703 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8704 { |
8705 v19 = &Dst->sResLightBonus; | |
8706 goto LABEL_113; | |
8707 } | |
310 | 8708 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8709 { |
8710 v19 = &Dst->sResDarkBonus; | |
8711 goto LABEL_113; | |
8712 } | |
310 | 8713 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8714 { |
8715 v19 = &Dst->sResMagicBonus; | |
8716 goto LABEL_113; | |
8717 } | |
310 | 8718 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8719 return; |
8720 } | |
8721 goto LABEL_106; | |
8722 } | |
310 | 8723 if ( var_type == VAR_LearningSkill ) |
0 | 8724 { |
8725 LABEL_106: | |
8726 if ( val <= VAR_BodyResistanceBonus ) | |
8727 { | |
310 | 8728 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8729 } |
8730 else | |
8731 { | |
310 | 8732 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8733 v21 = *(short *)v20; |
8734 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8735 if ( v22 > 60 ) | |
8736 LOWORD(v22) = 60; | |
8737 LOBYTE(v21) = v21 & 0xC0; | |
8738 *(short *)v20 = v22 | v21; | |
8739 } | |
8740 goto _play_anim_and_exit; | |
8741 } | |
310 | 8742 if ( var_type <= VAR_LearningSkill ) |
0 | 8743 return; |
310 | 8744 if ( var_type <= VAR_Eradicated ) |
8745 { | |
8746 Dst->SetCondition(var_type - 105, 0); | |
0 | 8747 } |
8748 else | |
8749 { | |
310 | 8750 if ( var_type != VAR_MajorCondition ) |
0 | 8751 { |
310 | 8752 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8753 { |
310 | 8754 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8755 byte_5E4C15[var_type] += val; | |
0 | 8756 else |
310 | 8757 byte_5E4C15[var_type] = -1; |
0 | 8758 } |
8759 return; | |
8760 } | |
8761 memset(Dst, 0, 0xA0u); | |
8762 } | |
8763 _play_anim_and_exit: | |
8764 v3 = 1; | |
8765 _play_anim_and_maybe_sound: | |
8766 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8767 _maybe_play_sound: | |
8768 if ( v3 != 1 ) | |
8769 return; | |
8770 goto _play_sound; | |
8771 } | |
8772 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
|
8773 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8774 && pAutonoteTxt[val-1].pText ) |
0 | 8775 { |
8776 v23 = pPlayers[uPlayerIdx + 1]; | |
8777 v34 = 1; | |
187 | 8778 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8779 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8780 bFlashAutonotesBook = 1; |
981 | 8781 _506568_autonote_type = v24; |
0 | 8782 } |
8783 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8784 v3 = 1; | |
8785 LABEL_173: | |
8786 if ( v34 != 1 ) | |
8787 goto _maybe_play_sound; | |
8788 goto _play_anim_and_maybe_sound; | |
8789 } | |
310 | 8790 if ( var_type > VAR_GoldInBank ) |
8791 { | |
8792 if ( var_type == 307 ) | |
0 | 8793 { |
8794 pParty->uNumDeaths += val; | |
8795 goto LABEL_173; | |
8796 } | |
310 | 8797 switch ( var_type ) |
0 | 8798 { |
8799 case 308: | |
8800 pParty->uNumBountiesCollected += val; | |
8801 break; | |
8802 case 309: | |
8803 pParty->uNumPrisonTerms += val; | |
8804 break; | |
8805 case 310: | |
8806 pParty->uNumArenaPageWins += val; | |
8807 break; | |
8808 case 311: | |
8809 pParty->uNumArenaSquireWins += val; | |
8810 break; | |
8811 case 312: | |
8812 pParty->uNumArenaKnightWins += val; | |
8813 break; | |
8814 case 313: | |
8815 pParty->uNumArenaLordWins += val; | |
8816 break; | |
8817 } | |
8818 } | |
8819 else | |
8820 { | |
310 | 8821 if ( var_type == VAR_GoldInBank ) |
0 | 8822 { |
8823 pParty->uNumGoldInBank += val; | |
8824 return; | |
8825 } | |
310 | 8826 if ( var_type <= VAR_Counter8 ) |
8827 { | |
8828 if ( (signed int)var_type >= 245 ) | |
8829 { | |
8830 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
8831 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8832 } |
8833 else | |
8834 { | |
310 | 8835 switch ( var_type ) |
0 | 8836 { |
8837 case VAR_MonthEquals|VAR_CurrentSP: | |
8838 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
8839 break; | |
8840 case VAR_NPCs2: | |
8841 pParty->field_709 = 0; | |
8842 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 8843 pParty->CountHirelings(); |
8844 viewparams->bRedrawGameUI = true; | |
0 | 8845 break; |
8846 case VAR_NumSkillPoints: | |
8847 Dst->uSkillPoints += val; | |
8848 break; | |
8849 } | |
8850 } | |
8851 return; | |
8852 } | |
310 | 8853 if ( var_type < VAR_Counter9 ) |
0 | 8854 return; |
310 | 8855 if ( (signed int)var_type <= 274 ) |
8856 { | |
8857 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8858 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8859 goto _play_sound; |
8860 } | |
310 | 8861 if ( var_type != VAR_ReputationInCurrentLocation ) |
8862 { | |
8863 if ( var_type <= VAR_ReputationInCurrentLocation | |
8864 || var_type > VAR_History_28 | |
8865 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
8866 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8867 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 8868 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8869 v26) ) |
8870 return; | |
8871 bFlashHistoryBook = 1; | |
8872 _play_sound: | |
8873 v28 = 8 * uPlayerIdx + 400; | |
862 | 8874 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 8875 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
8876 return; | |
8877 } | |
8878 v27 = &pOutdoor->ddm; | |
8879 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8880 v27 = &pIndoor->dlv; | |
8881 v27->uReputation += val; | |
8882 if ( v27->uReputation > 10000 ) | |
8883 v27->uReputation = 10000; | |
8884 } | |
8885 } | |
8886 // 506568: using guessed type int dword_506568; | |
8887 // 507948: using guessed type char bFlashHistoryBook; | |
8888 // 507949: using guessed type char bFlashAutonotesBook; | |
8889 // 50794A: using guessed type char bFlashQuestBook; | |
8890 // 72371C: using guessed type int dword_72371C[]; | |
8891 // 723E80: using guessed type int dword_723E80_award_related[]; | |
8892 | |
8893 | |
8894 | |
8895 | |
8896 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 8897 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 8898 { |
8899 unsigned int v3; // ebx@1 | |
8900 signed int v4; // esi@1 | |
501 | 8901 bool result; // eax@8 |
0 | 8902 int v6; // esi@11 |
8903 int v7; // edi@14 | |
8904 signed int v8; // eax@17 | |
8905 char *v9; // eax@20 | |
8906 char v10; // sf@20 | |
8907 char *v11; // ecx@26 | |
8908 char *v12; // ecx@27 | |
8909 __int64 v13; // qax@27 | |
8910 unsigned __int8 v14; // cf@27 | |
501 | 8911 int *v15; // edx@29 |
0 | 8912 char *v16; // eax@90 |
8913 char *v17; // ecx@94 | |
501 | 8914 int v18; // esi@97 |
0 | 8915 signed int v19; // edx@97 |
8916 char *v20; // ecx@98 | |
8917 int v21; // eax@100 | |
8918 __int16 v22; // dx@112 | |
8919 int v23; // [sp-8h] [bp-14h]@45 | |
8920 signed int v24; // [sp-4h] [bp-10h]@4 | |
8921 int v25; // [sp-4h] [bp-10h]@45 | |
8922 | |
8923 v3 = 0; | |
605 | 8924 v4 = uActiveCharacter - 1; |
501 | 8925 result = false; |
8926 if ( (signed int)VarNum > 222 ) | |
8927 { | |
8928 if ( (signed int)VarNum <= 307 ) | |
8929 { | |
8930 if ( VarNum == 307 ) | |
8931 { | |
8932 pParty->uNumDeaths -= (unsigned int)pValue; | |
8933 return pValue; | |
8934 } | |
8935 if ( VarNum == 223 ) | |
0 | 8936 { |
8937 v11 = (char *)pParty->_autonote_bits; | |
501 | 8938 v22 = (short)pValue - 1; |
0 | 8939 } |
8940 else | |
8941 { | |
501 | 8942 if ( VarNum != 231 ) |
0 | 8943 { |
501 | 8944 switch ( VarNum ) |
0 | 8945 { |
8946 case 232: | |
501 | 8947 VarNum = (VariableType)0; |
1094 | 8948 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 8949 result = (bool) pValue; |
8950 dword_5B65CC = 0; | |
8951 if ( (int)VarNum == pValue ) | |
0 | 8952 { |
501 | 8953 dword_5B65CC = (int)pValue; |
0 | 8954 } |
8955 else | |
8956 { | |
8957 pParty->field_709 = 0; | |
501 | 8958 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 8959 pParty->CountHirelings(); |
8960 viewparams->bRedrawGameUI = true; | |
0 | 8961 } |
8962 break; | |
8963 case 241: | |
8964 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8965 { | |
8966 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 8967 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 8968 { |
605 | 8969 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 8970 { |
8971 v21 = *(int *)v20; | |
8972 if ( (char)*(int *)v20 < 0 ) | |
8973 { | |
8974 LOBYTE(v21) = v21 & 0x7F; | |
8975 *(int *)v20 = v21; | |
8976 } | |
8977 } | |
8978 v20 += 76; | |
8979 } | |
8980 } | |
605 | 8981 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 8982 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 8983 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 8984 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
8985 pParty->field_709 = 0; | |
1035 | 8986 pParty->CountHirelings(); |
0 | 8987 break; |
8988 case 243: | |
8989 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8990 result = *v17 != NULL; |
501 | 8991 if ( (unsigned int)pValue <= *(int *)v17 ) |
8992 { | |
8993 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8994 result = (v17 != NULL); |
501 | 8995 } |
0 | 8996 else |
8997 *(int *)v17 = 0; | |
8998 break; | |
8999 case 275: | |
9000 v16 = (char *)&pOutdoor->ddm; | |
9001 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
9002 v16 = (char *)&pIndoor->dlv; | |
501 | 9003 *((int *)v16 + 2) -= (int)pValue; |
0 | 9004 if ( *((int *)v16 + 2) < -10000 ) |
9005 *((int *)v16 + 2) = -10000; | |
9006 break; | |
9007 case 306: | |
501 | 9008 result = VarNum - 306; |
9009 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
9010 { | |
9011 result = (bool)pValue; | |
9012 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 9013 } |
0 | 9014 else |
9015 LABEL_88: | |
9016 dword_5B65C4 = 1; | |
9017 break; | |
9018 } | |
501 | 9019 return result; |
0 | 9020 } |
9021 v11 = this->field_1A50; | |
501 | 9022 v22 = (signed __int16)pValue; |
0 | 9023 } |
9024 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9025 return result; |
9026 } | |
9027 switch ( VarNum ) | |
0 | 9028 { |
9029 case 308: | |
501 | 9030 result = (bool)pValue; |
9031 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9032 break; |
9033 case 309: | |
501 | 9034 result = (bool)pValue; |
9035 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9036 break; |
9037 case 310: | |
501 | 9038 result = (bool)pValue; |
9039 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9040 break; |
9041 case 311: | |
501 | 9042 result = (bool)pValue; |
9043 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9044 break; |
9045 case 312: | |
501 | 9046 result = (bool)pValue; |
9047 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9048 break; |
9049 case 313: | |
501 | 9050 result = (bool)pValue; |
9051 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9052 break; |
9053 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
9054 assert(false && "Function not returning any value!"); |
0 | 9055 } |
9056 else | |
9057 { | |
501 | 9058 if ( (signed int)VarNum >= 123 ) |
9059 { | |
9060 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9061 } |
9062 else | |
9063 { | |
501 | 9064 switch ( VarNum ) |
0 | 9065 { |
9066 case VAR_RandomGold: | |
501 | 9067 v6 = rand() % (signed int)pValue + 1; |
0 | 9068 if ( v6 > pParty->uNumGold ) |
9069 v6 = pParty->uNumGold; | |
9070 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9071 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9072 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 9073 GameUI_DrawFoodAndGold(); |
501 | 9074 return result; |
0 | 9075 case VAR_RandomFood: |
501 | 9076 v7 = rand() % (signed int)pValue + 1; |
0 | 9077 if ( v7 > pParty->uNumFoodRations ) |
9078 v7 = pParty->uNumFoodRations; | |
9079 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9080 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9081 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 9082 GameUI_DrawFoodAndGold(); |
605 | 9083 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9084 v8 = 8 * v4 + 400; | |
862 | 9085 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9086 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9087 return result; |
0 | 9088 case VAR_CurrentHP: |
1036 | 9089 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 9090 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9091 v8 = 8 * v4 + 400; | |
862 | 9092 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9093 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9094 return result; | |
0 | 9095 case VAR_CurrentSP: |
9096 v9 = (char *)&this->sMana; | |
501 | 9097 v10 = this->sMana - (signed int)pValue < 0; |
9098 *(int *)v9 -= (int)pValue; | |
0 | 9099 if ( v10 ) |
9100 *(int *)v9 = 0; | |
605 | 9101 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9102 v8 = 8 * v4 + 400; | |
862 | 9103 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9104 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9105 return result; | |
0 | 9106 case VAR_ACModifier: |
501 | 9107 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9108 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9109 v8 = 8 * v4 + 400; | |
862 | 9110 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9111 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9112 return result; | |
0 | 9113 case VAR_BaseLevel: |
501 | 9114 this->uLevel -= (unsigned __int8)pValue; |
605 | 9115 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9116 v8 = 8 * v4 + 400; | |
862 | 9117 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9118 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9119 return result; | |
0 | 9120 case VAR_LevelModifier: |
501 | 9121 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9122 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9123 v8 = 8 * v4 + 400; | |
862 | 9124 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9125 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9126 return result; | |
0 | 9127 case VAR_Age: |
501 | 9128 this->sAgeModifier -= (signed __int16)pValue; |
9129 return result; | |
0 | 9130 case VAR_Award: |
605 | 9131 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9132 return result; | |
0 | 9133 case VAR_Experience: |
9134 v12 = (char *)&this->uExperience; | |
501 | 9135 v13 = (signed int)pValue; |
9136 v14 = *(int *)v12 < (unsigned int)pValue; | |
9137 *(int *)v12 -= (int)pValue; | |
0 | 9138 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9139 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9140 v8 = 8 * v4 + 400; | |
862 | 9141 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9142 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9143 return result; | |
0 | 9144 case VAR_QBits_QuestsDone: |
501 | 9145 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9146 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9147 return true; |
0 | 9148 case VAR_PlayerItemInHands: |
501 | 9149 v15 = this->pInventoryIndices; |
0 | 9150 break; |
9151 case VAR_FixedGold: | |
501 | 9152 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9153 goto LABEL_88; |
501 | 9154 Party::TakeGold((unsigned int)pValue); |
9155 return result; | |
0 | 9156 case VAR_MightBonus: |
9157 case VAR_ActualMight: | |
501 | 9158 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9159 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9160 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9161 v8 = 8 * v4 + 400; | |
862 | 9162 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9163 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9164 return result; | |
0 | 9165 case VAR_IntellectBonus: |
9166 case VAR_ActualIntellect: | |
501 | 9167 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9168 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9169 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9170 v8 = 8 * v4 + 400; | |
862 | 9171 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9172 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9173 return result; | |
0 | 9174 case VAR_PersonalityBonus: |
9175 case VAR_ActualPersonality: | |
501 | 9176 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9177 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9178 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9179 v8 = 8 * v4 + 400; | |
862 | 9180 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9181 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9182 return result; | |
0 | 9183 case VAR_EnduranceBonus: |
9184 case VAR_ActualEndurance: | |
501 | 9185 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9186 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9187 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9188 v8 = 8 * v4 + 400; | |
862 | 9189 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9190 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9191 return result; | |
0 | 9192 case VAR_SpeedBonus: |
9193 case VAR_ActualSpeed: | |
501 | 9194 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9195 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9196 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9197 v8 = 8 * v4 + 400; | |
862 | 9198 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9199 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9200 return result; | |
0 | 9201 case VAR_AccuracyBonus: |
9202 case VAR_ActualAccuracy: | |
501 | 9203 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9204 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9205 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9206 v8 = 8 * v4 + 400; | |
862 | 9207 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9208 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9209 return result; | |
0 | 9210 case VAR_LuckBonus: |
9211 case VAR_ActualLuck: | |
501 | 9212 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9213 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9214 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9215 v8 = 8 * v4 + 400; | |
862 | 9216 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9217 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9218 return result; | |
0 | 9219 case VAR_BaseMight: |
501 | 9220 this->uMight -= (unsigned __int16)pValue; |
605 | 9221 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_BaseIntellect: |
501 | 9228 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9229 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9230 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9231 v8 = 8 * v4 + 400; | |
862 | 9232 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9233 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9234 return result; | |
0 | 9235 case VAR_BasePersonality: |
501 | 9236 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9237 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9238 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9239 v8 = 8 * v4 + 400; | |
862 | 9240 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9241 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9242 return result; | |
0 | 9243 case VAR_BaseEndurance: |
501 | 9244 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9245 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9246 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9247 v8 = 8 * v4 + 400; | |
862 | 9248 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9249 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9250 return result; | |
0 | 9251 case VAR_BaseSpeed: |
501 | 9252 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9253 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9254 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9255 v8 = 8 * v4 + 400; | |
862 | 9256 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9257 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9258 return result; | |
0 | 9259 case VAR_BaseAccuracy: |
501 | 9260 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9261 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9262 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9263 v8 = 8 * v4 + 400; | |
862 | 9264 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9265 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9266 return result; | |
0 | 9267 case VAR_BaseLuck: |
501 | 9268 this->uLuck -= (unsigned __int16)pValue; |
605 | 9269 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9270 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9271 v8 = 8 * v4 + 400; | |
862 | 9272 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9273 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9274 return result; | |
0 | 9275 case VAR_FireResistance: |
501 | 9276 this->sResFireBase -= (signed __int16)pValue; |
605 | 9277 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9278 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9279 v8 = 8 * v4 + 400; | |
862 | 9280 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9281 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9282 return result; | |
0 | 9283 case VAR_AirResistance: |
501 | 9284 this->sResAirBase -= (signed __int16)pValue; |
605 | 9285 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9286 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9287 v8 = 8 * v4 + 400; | |
862 | 9288 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9289 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9290 return result; | |
0 | 9291 case VAR_WaterResistance: |
501 | 9292 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9293 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9294 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9295 v8 = 8 * v4 + 400; | |
862 | 9296 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9297 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9298 return result; | |
0 | 9299 case VAR_EarthResistance: |
501 | 9300 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9301 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9302 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9303 v8 = 8 * v4 + 400; | |
862 | 9304 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9305 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9306 return result; | |
0 | 9307 case VAR_SpiritResistance: |
501 | 9308 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9309 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9310 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9311 v8 = 8 * v4 + 400; | |
862 | 9312 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9313 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9314 return result; | |
0 | 9315 case VAR_MindResistance: |
501 | 9316 this->sResMindBase -= (signed __int16)pValue; |
605 | 9317 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9318 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9319 v8 = 8 * v4 + 400; | |
862 | 9320 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9321 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9322 return result; | |
0 | 9323 case VAR_BodyResistance: |
501 | 9324 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9325 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9326 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9327 v8 = 8 * v4 + 400; | |
862 | 9328 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9329 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9330 return result; | |
0 | 9331 case VAR_LightResistance: |
501 | 9332 this->sResLightBase -= (signed __int16)pValue; |
605 | 9333 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9334 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9335 v8 = 8 * v4 + 400; | |
862 | 9336 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9337 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9338 return result; | |
0 | 9339 case VAR_DarkResistance: |
501 | 9340 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9341 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9342 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9343 v8 = 8 * v4 + 400; | |
862 | 9344 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9345 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9346 return result; | |
0 | 9347 case VAR_MagicResistance: |
501 | 9348 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9349 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9350 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9351 v8 = 8 * v4 + 400; | |
862 | 9352 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9353 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9354 return result; | |
0 | 9355 case VAR_FireResistanceBonus: |
501 | 9356 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9357 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9358 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9359 v8 = 8 * v4 + 400; | |
862 | 9360 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9361 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9362 return result; | |
0 | 9363 case VAR_AirResistanceBonus: |
501 | 9364 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9365 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9366 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9367 v8 = 8 * v4 + 400; | |
862 | 9368 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9369 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9370 return result; | |
0 | 9371 case VAR_WaterResistanceBonus: |
501 | 9372 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9373 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9374 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9375 v8 = 8 * v4 + 400; | |
862 | 9376 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9377 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9378 return result; | |
0 | 9379 case VAR_EarthResistanceBonus: |
501 | 9380 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9381 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9382 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9383 v8 = 8 * v4 + 400; | |
862 | 9384 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9385 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9386 return result; | |
0 | 9387 case VAR_SpiritResistanceBonus: |
501 | 9388 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9389 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9390 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9391 v8 = 8 * v4 + 400; | |
862 | 9392 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9393 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9394 return result; | |
0 | 9395 case VAR_MindResistanceBonus: |
501 | 9396 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9397 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9398 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9399 v8 = 8 * v4 + 400; | |
862 | 9400 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9401 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9402 return result; | |
0 | 9403 case VAR_BodyResistanceBonus: |
501 | 9404 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9405 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9406 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9407 v8 = 8 * v4 + 400; | |
862 | 9408 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9409 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9410 return result; | |
0 | 9411 case VAR_LightResistanceBonus: |
501 | 9412 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9413 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9414 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9415 v8 = 8 * v4 + 400; | |
862 | 9416 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9417 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9418 return result; | |
0 | 9419 case VAR_DarkResistanceBonus: |
501 | 9420 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9421 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9422 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9423 v8 = 8 * v4 + 400; | |
862 | 9424 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9425 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9426 return result; | |
0 | 9427 case VAR_MagicResistanceBonus: |
501 | 9428 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9429 v25 = 0; |
187 | 9430 v23 = SPEECH_91; |
9431 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9432 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9433 v8 = 8 * v4 + 400; | |
862 | 9434 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9435 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9436 return result; | |
0 | 9437 case VAR_FixedFood: |
501 | 9438 Party::TakeFood((unsigned int)pValue); |
605 | 9439 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9440 v8 = 8 * v4 + 400; | |
862 | 9441 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9442 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9443 return result; | |
0 | 9444 case VAR_StaffSkill: |
9445 case VAR_SwordSkill: | |
9446 case VAR_DaggerSkill: | |
9447 case VAR_AxeSkill: | |
9448 case VAR_SpearSkill: | |
9449 case VAR_BowSkill: | |
9450 case VAR_MaceSkill: | |
9451 case VAR_BlasterSkill: | |
9452 case VAR_ShieldSkill: | |
9453 case VAR_LeatherSkill: | |
9454 case VAR_SkillChain: | |
9455 case VAR_PlateSkill: | |
9456 case VAR_FireSkill: | |
9457 case VAR_AirSkill: | |
9458 case VAR_WaterSkill: | |
9459 case VAR_EarthSkill: | |
9460 case VAR_SpiritSkill: | |
9461 case VAR_MindSkill: | |
9462 case VAR_BodySkill: | |
9463 case VAR_LightSkill: | |
9464 case VAR_DarkSkill: | |
9465 case VAR_IdentifyItemSkill: | |
9466 case VAR_MerchantSkill: | |
9467 case VAR_RepairSkill: | |
9468 case VAR_BodybuildingSkill: | |
9469 case VAR_MeditationSkill: | |
9470 case VAR_PerceptionSkill: | |
9471 case VAR_DiplomacySkill: | |
9472 case VAR_DisarmTrapSkill: | |
9473 case VAR_LearningSkill: | |
501 | 9474 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 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_Cursed: |
9481 case VAR_Weak: | |
9482 case VAR_Asleep: | |
9483 case VAR_Afraid: | |
9484 case VAR_Drunk: | |
9485 case VAR_Insane: | |
9486 case VAR_PoisonedGreen: | |
9487 case VAR_DiseasedGreen: | |
9488 case VAR_PoisonedYellow: | |
9489 case VAR_DiseasedYellow: | |
9490 case VAR_PoisonedRed: | |
9491 case VAR_DiseasedRed: | |
9492 case VAR_Paralyzed: | |
9493 case VAR_Unconsious: | |
9494 case VAR_Dead: | |
9495 case VAR_Stoned: | |
9496 case VAR_Eradicated: | |
1071 | 9497 //*((int *)this + 2 * VarNum - 210) = 0; |
9498 //*((int *)this + 2 * result - 209) = 0; | |
9499 this->pConditions[VarNum] = 0; | |
0 | 9500 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9501 v8 = 8 * v4 + 400; | |
862 | 9502 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9503 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9504 return result; |
605 | 9505 default: |
9506 return result; | |
9507 } | |
9508 for (v3 = 1; v3 < 126; v3++) | |
9509 { | |
9510 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9511 { |
605 | 9512 RemoveItemAtInventoryIndex(v3); |
501 | 9513 return true; |
0 | 9514 } |
605 | 9515 } |
501 | 9516 if ( pParty->pPickedItem.uItemID == pValue ) |
9517 { | |
605 | 9518 pMouse->RemoveHoldingItem(); |
9519 return true; | |
9520 } | |
9521 return false; | |
0 | 9522 } |
9523 } | |
9524 } | |
9525 // 5B65C4: using guessed type int dword_5B65C4; | |
9526 // 5B65CC: using guessed type int dword_5B65CC; |