Mercurial > mm7
annotate Player.cpp @ 1272:19a4809e1da0
Player::DecreaseAttribute cleanup
author | Grumpy7 |
---|---|
date | Sat, 15 Jun 2013 02:31:27 +0200 |
parents | 5a3f48b370d5 |
children | fbb7428fa58c |
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; |
1272 | 6427 unsigned short* AttrToChange = nullptr; |
6428 switch ( eAttribute ) | |
6429 { | |
6430 case CHARACTER_ATTRIBUTE_STRENGTH: | |
6431 AttrToChange = &this->uMight; | |
6432 break; | |
6433 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
6434 AttrToChange = &this->uIntelligence; | |
6435 break; | |
6436 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
6437 AttrToChange = &this->uWillpower; | |
6438 break; | |
6439 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
6440 AttrToChange = &this->uEndurance; | |
6441 break; | |
6442 case CHARACTER_ATTRIBUTE_ACCURACY: | |
6443 AttrToChange = &this->uAccuracy; | |
6444 break; | |
6445 case CHARACTER_ATTRIBUTE_SPEED: | |
6446 AttrToChange = &this->uSpeed; | |
6447 break; | |
6448 case CHARACTER_ATTRIBUTE_LUCK: | |
6449 AttrToChange = &this->uLuck; | |
6450 break; | |
6451 } | |
6452 if ( *AttrToChange <= pBaseValue ) | |
6453 pStep = pDroppedStep; | |
6454 if ( *AttrToChange - pStep >= uMinValue ) | |
6455 *AttrToChange -= pStep; | |
0 | 6456 } |
6457 | |
6458 //----- (004905F5) -------------------------------------------------------- | |
6459 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
6460 int Player::IncreaseAttribute(int eAttribute) | |
6461 { | |
6462 Player *v2; // esi@1 | |
6463 int v3; // eax@1 | |
6464 int v4; // ebx@1 | |
6465 signed int v5; // edi@1 | |
6466 int v6; // eax@8 | |
6467 signed int v7; // eax@17 | |
6468 signed int result; // eax@18 | |
6469 int v9; // [sp+Ch] [bp-8h]@1 | |
6470 signed int v10; // [sp+10h] [bp-4h]@1 | |
6471 | |
6472 v2 = this; | |
6473 v3 = eAttribute + 7 * GetRace(); | |
290 | 6474 v4 = StatTable[0][v3].uMaxValue; |
6475 v5 = StatTable[0][v3].uBaseStep; | |
6476 v9 = StatTable[0][v3].uBaseValue; | |
6477 v10 = StatTable[0][v3].uDroppedStep; | |
0 | 6478 PlayerCreation_ComputeAttributeBonus(); |
6479 if ( eAttribute ) | |
6480 { | |
6481 switch ( eAttribute ) | |
6482 { | |
6483 case 1: | |
6484 v6 = v2->uIntelligence; | |
6485 break; | |
6486 case 2: | |
6487 v6 = v2->uWillpower; | |
6488 break; | |
6489 case 3: | |
6490 v6 = v2->uEndurance; | |
6491 break; | |
6492 case 4: | |
6493 v6 = v2->uAccuracy; | |
6494 break; | |
6495 case 5: | |
6496 v6 = v2->uSpeed; | |
6497 break; | |
6498 case 6: | |
6499 v6 = v2->uLuck; | |
6500 break; | |
6501 default: | |
6502 v6 = eAttribute; | |
6503 break; | |
6504 } | |
6505 } | |
6506 else | |
6507 { | |
6508 v6 = v2->uMight; | |
6509 } | |
6510 if ( v6 < v9 ) | |
6511 { | |
6512 v7 = v5; | |
6513 v5 = v10; | |
6514 v10 = v7; | |
6515 } | |
6516 result = PlayerCreation_ComputeAttributeBonus(); | |
6517 if ( result >= v10 ) | |
6518 { | |
6519 if ( eAttribute ) | |
6520 { | |
6521 switch ( eAttribute ) | |
6522 { | |
6523 case 1: | |
6524 result = (signed int)&v2->uIntelligence; | |
6525 break; | |
6526 case 2: | |
6527 result = (signed int)&v2->uWillpower; | |
6528 break; | |
6529 case 3: | |
6530 result = (signed int)&v2->uEndurance; | |
6531 break; | |
6532 case 4: | |
6533 result = (signed int)&v2->uAccuracy; | |
6534 break; | |
6535 case 5: | |
6536 result = (signed int)&v2->uSpeed; | |
6537 break; | |
6538 default: | |
6539 result = eAttribute - 6; | |
6540 if ( eAttribute != 6 ) | |
6541 return result; | |
6542 result = (signed int)&v2->uLuck; | |
6543 break; | |
6544 } | |
6545 } | |
6546 else | |
6547 { | |
6548 result = (signed int)&v2->uMight; | |
6549 } | |
6550 if ( v5 + *(short *)result <= v4 ) | |
6551 *(short *)result += v5; | |
6552 } | |
6553 return result; | |
6554 } | |
6555 | |
6556 //----- (0049070F) -------------------------------------------------------- | |
6557 void Player::Zero() | |
6558 { | |
6559 Player *v1; // esi@1 | |
6560 | |
6561 v1 = this; | |
6562 this->sLevelModifier = 0; | |
6563 this->sACModifier = 0; | |
6564 this->uLuckBonus = 0; | |
6565 this->uAccuracyBonus = 0; | |
6566 this->uSpeedBonus = 0; | |
6567 this->uEnduranceBonus = 0; | |
6568 this->uWillpowerBonus = 0; | |
6569 this->uIntelligenceBonus = 0; | |
6570 this->uMightBonus = 0; | |
6571 this->field_100 = 0; | |
6572 this->field_FC = 0; | |
6573 this->field_F8 = 0; | |
6574 this->field_F4 = 0; | |
6575 this->field_F0 = 0; | |
6576 this->field_EC = 0; | |
6577 this->field_E8 = 0; | |
6578 this->field_E4 = 0; | |
6579 this->field_E0 = 0; | |
766 | 6580 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6581 v1->field_1A97 = 0; |
6582 v1->_ranged_dmg_bonus = 0; | |
6583 v1->field_1A95 = 0; | |
6584 v1->_ranged_atk_bonus = 0; | |
6585 v1->field_1A93 = 0; | |
6586 v1->_melee_dmg_bonus = 0; | |
6587 v1->field_1A91 = 0; | |
6588 v1->_some_attack_bonus = 0; | |
6589 v1->_mana_related = 0; | |
6590 v1->uFullManaBonus = 0; | |
6591 v1->_health_related = 0; | |
6592 v1->uFullHealthBonus = 0; | |
6593 } | |
6594 | |
6595 //----- (004907E7) -------------------------------------------------------- | |
299 | 6596 unsigned int Player::GetStatColor(int uStat) |
0 | 6597 { |
6598 __int16 uWhite; // si@1 | |
290 | 6599 int attribute_value; // edx@1 |
299 | 6600 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6601 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6602 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6603 | |
1014 | 6604 uRed = TargetColor(255, 35, 0); |
6605 uGreen = TargetColor(0, 255, 0); | |
6606 uWhite = TargetColor(255, 255, 255); | |
299 | 6607 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6608 |
0 | 6609 switch (uStat) |
6610 { | |
6611 case 0: attribute_value = uMight; break; | |
6612 case 1: attribute_value = uIntelligence; break; | |
6613 case 2: attribute_value = uWillpower; break; | |
6614 case 3: attribute_value = uEndurance; break; | |
290 | 6615 case 4: attribute_value = uAccuracy; break; |
6616 case 5: attribute_value = uSpeed; break; | |
0 | 6617 case 6: attribute_value = uLuck; break; |
6618 }; | |
6619 | |
299 | 6620 if ( attribute_value == pBaseAttrValue ) |
290 | 6621 return uWhite; |
299 | 6622 else if ( attribute_value > pBaseAttrValue ) |
290 | 6623 return uGreen; |
0 | 6624 else |
290 | 6625 return uRed; |
0 | 6626 } |
6627 | |
6628 //----- (004908A8) -------------------------------------------------------- | |
6629 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6630 { | |
1014 | 6631 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6632 { | |
6633 pConditions[uCondition]=0i64; | |
6634 return true; | |
0 | 6635 } |
6636 else | |
1014 | 6637 return false; |
0 | 6638 } |
6639 | |
6640 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6641 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6642 { |
6643 Player *v3; // esi@1 | |
6644 signed int v5; // eax@17 | |
6645 int v8; // edx@39 | |
6646 char *v13; // eax@45 | |
6647 signed int v15; // edi@68 | |
6648 int v16; // edx@73 | |
6649 unsigned __int16 v17; // edi@73 | |
6650 unsigned int v18; // eax@73 | |
6651 const char *v22; // eax@84 | |
6652 int scroll_id; // esi@96 | |
6653 int v25; // eax@109 | |
6654 int v26; // eax@113 | |
6655 int new_mana_val; // edi@114 | |
6656 signed __int64 v28; // qax@120 | |
6657 __int64 v30; // edi@137 | |
6658 __int64 v32; // ST3C_4@137 | |
6659 __int64 v34; // ST34_4@137 | |
6660 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6661 const char *v66; // [sp-4h] [bp-30h]@69 | |
6662 signed int v67; // [sp-4h] [bp-30h]@77 | |
6663 const char *v68; // [sp-4h] [bp-30h]@89 | |
6664 char v72; // [sp+20h] [bp-Ch]@68 | |
6665 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6666 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6667 Player *thisb; // [sp+28h] [bp-4h]@1 |
6668 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6669 | |
6670 thisb = this; | |
6671 v3 = &pParty->pPlayers[player_num-1]; | |
6672 v73 = 1; | |
6673 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6674 return; | |
6675 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6676 { |
1021 | 6677 if ( pParty->pPickedItem.uItemID == 160 ) |
6678 { | |
6679 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6680 } | |
6681 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6682 { |
1021 | 6683 new_mana_val = v3->sMana; |
6684 new_mana_val += 2; | |
6685 if ( new_mana_val > v3->GetMaxMana() ) | |
6686 new_mana_val = v3->GetMaxMana(); | |
6687 v3->PlaySound(SPEECH_36, 0); | |
6688 } | |
6689 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6690 { | |
6691 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6692 v3->PlaySound(SPEECH_36, 0); |
1021 | 6693 |
6694 } | |
6695 else | |
6696 { | |
6697 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6698 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
|
6699 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 6700 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6701 return; | |
1019 | 6702 } |
1032 | 6703 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6704 | |
6705 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6706 { | |
6707 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6708 } | |
6709 if ( v73 ) | |
6710 { | |
6711 if ( pParty->bTurnBasedModeOn ) | |
6712 { | |
6713 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6714 thisb->SetRecoveryTime(100); | |
6715 pTurnEngine->_40471C(); | |
6716 } | |
6717 else | |
6718 { | |
6719 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6720 } | |
6721 } | |
6722 pMouse->RemoveHoldingItem(); | |
6723 return; | |
6724 | |
1021 | 6725 |
6726 } | |
6727 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6728 { |
1021 | 6729 switch ( pParty->pPickedItem.uItemID ) |
6730 { | |
6731 case 221: //Catalyst | |
6732 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6733 break; | |
6734 case 222: //Cure Wounds | |
6735 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6736 pParty->pPlayers[player_num-1].Heal(v25); | |
6737 v3->PlaySound(SPEECH_36, 0); | |
6738 break; | |
6739 case 223: //Magic Potion | |
6740 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6741 new_mana_val = v3->sMana; | |
6742 new_mana_val += v26; | |
6743 if ( new_mana_val > v3->GetMaxMana() ) | |
6744 new_mana_val = v3->GetMaxMana(); | |
6745 v3->PlaySound(SPEECH_36, 0); | |
6746 break; | |
6747 case 224: //Cure Weakness | |
6748 v3->pConditions[Condition_Weak] = 0i64; | |
6749 v3->PlaySound(SPEECH_36, 0); | |
6750 break; | |
6751 case 225: //Cure Disease | |
6752 v3->pConditions[Condition_Disease3] = 0i64; | |
6753 v3->pConditions[Condition_Disease2] = 0i64; | |
6754 v3->pConditions[Condition_Disease1] = 0i64; | |
6755 v3->PlaySound(SPEECH_36, 0); | |
6756 break; | |
6757 case 226: //Cure Poison | |
6758 v3->pConditions[Condition_Poison3] = 0i64; | |
6759 v3->pConditions[Condition_Poison2] = 0i64; | |
6760 v3->pConditions[Condition_Poison1] = 0i64; | |
6761 v3->PlaySound(SPEECH_36, 0); | |
6762 break; | |
6763 case 227: //Awaken | |
6764 v3->pConditions[Condition_Sleep] = 0i64; | |
6765 v3->PlaySound(SPEECH_36, 0); | |
6766 break; | |
6767 case 228: //Haste | |
6768 if ( !v3->pConditions[Condition_Weak] ) | |
6769 { | |
6770 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6771 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6772 v3->PlaySound(SPEECH_36, 0); | |
6773 } | |
6774 break; | |
6775 case 229: //Heroism | |
6776 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6777 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6778 v3->PlaySound(SPEECH_36, 0); | |
6779 break; | |
6780 case 230: //Bless | |
6781 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6782 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6783 v3->PlaySound(SPEECH_36, 0); | |
6784 break; | |
6785 case 231: //Preservation | |
1032 | 6786 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6787 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6788 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6789 v3->PlaySound(SPEECH_36, 0); | |
6790 break; | |
6791 case 232: //Shield | |
1032 | 6792 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6793 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6794 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6795 v3->PlaySound(SPEECH_36, 0); | |
6796 break; | |
6797 case 234: //Stoneskin | |
6798 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6799 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6800 v3->PlaySound(SPEECH_36, 0); | |
6801 break; | |
6802 case 235: //Water Breathing | |
6803 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6804 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6805 break; | |
6806 case 237: //Remove Fear | |
6807 v3->pConditions[Condition_Fear] = 0i64; | |
6808 v3->PlaySound(SPEECH_36, 0); | |
6809 break; | |
6810 case 238: //Remove Curse | |
6811 v3->pConditions[Condition_Cursed] = 0i64; | |
6812 v3->PlaySound(SPEECH_36, 0); | |
6813 break; | |
6814 case 239: //Cure Insanity | |
6815 v3->pConditions[Condition_Insane] = 0i64; | |
6816 v3->PlaySound(SPEECH_36, 0); | |
6817 break; | |
6818 case 240: //Might Boost | |
1032 | 6819 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6820 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6821 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6822 v3->PlaySound(SPEECH_36, 0); | |
6823 break; | |
6824 case 241: //Intellect Boost | |
1032 | 6825 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6826 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6827 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6828 v3->PlaySound(SPEECH_36, 0); | |
6829 break; | |
6830 case 242: //Personality Boost | |
1032 | 6831 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6832 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6833 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6834 v3->PlaySound(SPEECH_36, 0); | |
6835 break; | |
6836 case 243://Endurance Boost | |
1032 | 6837 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6838 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6839 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6840 v3->PlaySound(SPEECH_36, 0); | |
6841 break; | |
6842 case 244: //Speed Boost | |
1032 | 6843 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6844 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6845 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6846 v3->PlaySound(SPEECH_36, 0); | |
6847 break; | |
6848 case 245: //Accuracy Boost | |
1032 | 6849 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6850 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6851 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6852 v3->PlaySound(SPEECH_36, 0); | |
6853 break; | |
6854 case 251: //Cure Paralysis | |
6855 v3->pConditions[Condition_Paralyzed] = 0i64; | |
6856 v3->PlaySound(SPEECH_36, 0); | |
6857 break; | |
6858 case 252://Divine Restoration | |
6859 v30 = v3->pConditions[Condition_Dead]; | |
6860 v32 = v3->pConditions[Condition_Pertified]; | |
6861 v34 = v3->pConditions[Condition_Eradicated]; | |
6862 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
6863 v3->pConditions[Condition_Dead] = v30; | |
6864 v3->pConditions[Condition_Pertified] = v32; | |
6865 v3->pConditions[Condition_Eradicated] = v34; | |
6866 v3->PlaySound(SPEECH_36, 0); | |
6867 break; | |
6868 case 253: //Divine Cure | |
6869 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6870 pParty->pPlayers[player_num-1].Heal(v25); | |
6871 v3->PlaySound(SPEECH_36, 0); | |
6872 break; | |
6873 case 254: //Divine Power | |
6874 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6875 new_mana_val = v3->sMana; | |
6876 new_mana_val += v26; | |
6877 if ( new_mana_val > v3->GetMaxMana() ) | |
6878 new_mana_val = v3->GetMaxMana(); | |
6879 v3->PlaySound(SPEECH_36, 0); | |
6880 break; | |
6881 case 255: //Luck Boost | |
1032 | 6882 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6883 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6884 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6885 v3->PlaySound(SPEECH_36, 0); | |
6886 break; | |
6887 case 256: //Fire Resistance | |
1032 | 6888 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6889 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6890 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6891 v3->PlaySound(SPEECH_36, 0); | |
1032 | 6892 break; |
1021 | 6893 case 257: //Air Resistance |
1032 | 6894 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6895 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6896 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6897 v3->PlaySound(SPEECH_36, 0); | |
6898 break; | |
6899 case 258: //Water Resistance | |
1032 | 6900 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6901 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6902 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6903 v3->PlaySound(SPEECH_36, 0); | |
6904 break; | |
6905 case 259: //Earth Resistance | |
1032 | 6906 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6907 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6908 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6909 v3->PlaySound(SPEECH_36, 0); | |
6910 break; | |
6911 case 260: //Mind Resistance | |
1032 | 6912 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6913 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6914 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6915 v3->PlaySound(SPEECH_36, 0); | |
6916 break; | |
6917 case 261: //Body Resistance | |
1032 | 6918 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6919 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6920 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6921 v3->PlaySound(SPEECH_36, 0); | |
6922 break; | |
6923 case 262: //Stone to Flesh | |
6924 v3->pConditions[Condition_Pertified] = 0i64; | |
6925 v3->PlaySound(SPEECH_36, 0); | |
6926 break; | |
6927 case 264: //Pure Luck | |
6928 if ( !v3->pure_luck_used ) | |
6929 { | |
6930 v3->uLuck += 50; | |
6931 v3->pure_luck_used = 1; | |
6932 } | |
6933 v3->PlaySound(SPEECH_36, 0); | |
6934 break; | |
6935 case 265: //Pure Speed | |
6936 if ( !v3->pure_speed_used ) | |
6937 { | |
6938 v3->uSpeed += 50; | |
6939 v3->pure_speed_used = 1; | |
6940 } | |
6941 v3->PlaySound(SPEECH_36, 0); | |
6942 break; | |
6943 case 266: //Pure Intellect | |
6944 if ( !v3->pure_intellect_used ) | |
6945 { | |
6946 v3->uIntelligence += 50; | |
6947 v3->pure_intellect_used = 1; | |
6948 } | |
6949 v3->PlaySound(SPEECH_36, 0); | |
6950 break; | |
6951 case 267: //Pure Endurance | |
6952 if ( !v3->pure_endurance_used ) | |
6953 { | |
6954 v3->uEndurance += 50; | |
6955 v3->pure_endurance_used = 1; | |
6956 } | |
6957 v3->PlaySound(SPEECH_36, 0); | |
6958 break; | |
6959 case 268: //Pure Personality | |
6960 if ( !v3->pure_willpower_used ) | |
6961 { | |
6962 v3->uWillpower += 50; | |
6963 v3->pure_willpower_used = 1; | |
6964 } | |
6965 v3->PlaySound(SPEECH_36, 0); | |
6966 break; | |
6967 case 269: //Pure Accuracy | |
6968 if ( !v3->pure_accuracy_used ) | |
6969 { | |
6970 v3->uAccuracy += 50; | |
6971 v3->pure_accuracy_used = 1; | |
6972 } | |
6973 v3->PlaySound(SPEECH_36, 0); | |
6974 break; | |
6975 case 270: //Pure Might | |
6976 if ( !v3->pure_might_used ) | |
6977 { | |
6978 v3->uMight += 50; | |
6979 v3->pure_might_used = 1; | |
6980 } | |
6981 v3->PlaySound(SPEECH_36, 0); | |
6982 break; | |
6983 case 271: //Rejuvenation | |
6984 v3->sAgeModifier = 0; | |
6985 v3->PlaySound(SPEECH_36, 0); | |
6986 break; | |
6987 | |
6988 default: | |
6989 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6990 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
|
6991 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 6992 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6993 return; | |
1032 | 6994 } |
6995 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
6996 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6997 { | |
6998 if ( !v73 ) | |
6999 { | |
7000 pMouse->RemoveHoldingItem(); | |
7001 return; | |
7002 } | |
7003 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 7004 } |
1032 | 7005 if ( v73 ) |
7006 { | |
7007 if ( pParty->bTurnBasedModeOn ) | |
7008 { | |
7009 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7010 thisb->SetRecoveryTime(100); | |
7011 pTurnEngine->_40471C(); | |
7012 } | |
7013 else | |
7014 { | |
7015 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
7016 } | |
7017 } | |
7018 pMouse->RemoveHoldingItem(); | |
7019 return; | |
7020 | |
1021 | 7021 } |
7022 | |
7023 | |
7024 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
7025 { | |
7026 | |
7027 | |
7028 if ( pCurrentScreen == SCREEN_CASTING ) | |
7029 return; | |
7030 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7031 { | |
7032 | |
7033 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7034 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7035 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7036 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7037 return; |
7038 } | |
7039 if ( bUnderwater == 1 ) | |
7040 { | |
1032 | 7041 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
7042 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 7043 return; |
7044 } | |
7045 dword_50C9AC = 1; | |
7046 scroll_id = pParty->pPickedItem.uItemID - 299; | |
7047 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
7048 { | |
7049 pMouse->RemoveHoldingItem(); | |
7050 pGUIWindow_CurrentMenu->Release(); | |
7051 pIcons_LOD->_4114F2(); | |
7052 pCurrentScreen = SCREEN_GAME; | |
7053 viewparams->bRedrawGameUI = 1; | |
7054 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7055 } | |
7056 else | |
7057 { | |
7058 _720984_unused = pParty->pPickedItem.uItemID; | |
7059 pMouse->RemoveHoldingItem(); | |
7060 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7061 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7062 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7063 { | |
7064 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7065 } | |
7066 } | |
7067 return; | |
7068 } | |
7069 | |
7070 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7071 | |
7072 { | |
7073 v15 = pParty->pPickedItem.uItemID - 400; | |
7074 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7075 if ( v72 ) | |
7076 { | |
7077 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7078 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
|
7079 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7080 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7081 return; |
7082 } | |
7083 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7084 { | |
7085 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7086 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
|
7087 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7088 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7089 return; |
7090 } | |
7091 v16 = v15 % 11 + 1; | |
7092 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7093 v18 = SkillToMastery(v17) - 1; | |
1032 | 7094 switch (v18) |
7095 { | |
7096 case 0: v67 = 4; break; | |
7097 case 1: v67 = 7; break; | |
7098 case 2: v67 = 10; break; | |
7099 case 3: v67 = 11; break; | |
7100 default: | |
7101 v67 = player_num; | |
7102 } | |
7103 | |
7104 if ( v16 > v67 || !v17 ) | |
1021 | 7105 { |
1032 | 7106 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7107 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
|
7108 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7109 v3->PlaySound((PlayerSpeech)20, 0); |
7110 return; | |
7111 } | |
7112 // v72 = 1; | |
7113 v3->PlaySound(SPEECH_21, 0); | |
7114 v73 = 0; | |
7115 | |
7116 | |
7117 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7118 { | |
7119 if ( !v73 ) | |
1021 | 7120 { |
1032 | 7121 pMouse->RemoveHoldingItem(); |
7122 return; | |
7123 } | |
7124 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7125 } | |
7126 if ( v73 ) | |
7127 { | |
7128 if ( pParty->bTurnBasedModeOn ) | |
7129 { | |
7130 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7131 thisb->SetRecoveryTime(100); | |
7132 pTurnEngine->_40471C(); | |
1021 | 7133 } |
7134 else | |
7135 { | |
1032 | 7136 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7137 } |
7138 } | |
1032 | 7139 pMouse->RemoveHoldingItem(); |
7140 return; | |
7141 | |
1021 | 7142 } |
7143 | |
7144 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7145 | |
7146 { | |
7147 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7148 { | |
7149 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7150 v3->PlaySound(SPEECH_37, 0); |
1021 | 7151 return; |
7152 } | |
7153 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7154 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7155 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7156 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7157 return; |
7158 } | |
7159 else | |
7160 { | |
1019 | 7161 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7162 { |
7163 thisa = pParty->uCurrentMonthWeek + 1; | |
7164 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7165 v74 = NULL; |
1021 | 7166 else |
7167 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7168 switch ( pParty->uCurrentMonth ) | |
7169 { | |
1019 | 7170 case 0: |
1021 | 7171 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7172 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7173 break; |
1019 | 7174 case 1: |
1021 | 7175 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7176 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7177 break; |
1019 | 7178 case 2: |
1021 | 7179 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7180 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7181 break; |
1019 | 7182 case 3: |
1021 | 7183 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7184 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7185 break; |
1019 | 7186 case 4: |
1021 | 7187 v3->uAccuracy += 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 5: |
1021 | 7191 v3->uSpeed += 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 6: |
1021 | 7195 v3->uLuck += 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 7: |
1021 | 7199 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7200 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7201 break; |
1019 | 7202 case 8: |
1021 | 7203 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7204 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7205 break; |
0 | 7206 case 9u: |
1021 | 7207 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7208 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7209 break; |
1019 | 7210 case 10: |
1021 | 7211 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7212 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7213 break; |
1019 | 7214 case 11: |
1021 | 7215 v8 = rand() % 6; |
7216 switch (v8) | |
7217 { | |
7218 case 0: | |
7219 v3->sResFireBase += thisa; | |
7220 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7221 break; | |
7222 case 1: | |
7223 v3->sResAirBase += thisa; | |
7224 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7225 break; | |
7226 case 2: | |
7227 v3->sResWaterBase += thisa; | |
7228 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7229 break; | |
7230 case 3: | |
7231 v3->sResEarthBase += thisa; | |
7232 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7233 break; | |
7234 case 4: | |
7235 v3->sResMindBase += thisa; | |
7236 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7237 break; | |
7238 case 5: | |
7239 v3->sResBodyBase += thisa; | |
7240 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7241 break; |
1021 | 7242 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7243 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7244 break; |
7245 | |
7246 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7247 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 7248 pMouse->RemoveHoldingItem(); |
7249 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7250 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7251 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7252 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7253 { |
1021 | 7254 v3->SetCondition(Condition_Eradicated, 0); |
7255 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7256 } |
1021 | 7257 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7258 { | |
7259 v3->SetCondition(Condition_Dead, 0); | |
7260 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7261 } | |
7262 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7263 { | |
7264 v3->SetCondition(Condition_Pertified, 0); | |
7265 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7266 } | |
1019 | 7267 return; |
1021 | 7268 } |
7269 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7270 { | |
7271 Party::GiveFood(1u); | |
7272 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7273 | |
7274 } | |
7275 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7276 { | |
7277 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7278 return; | |
7279 } | |
7280 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7281 { | |
7282 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7283 return; | |
7284 } | |
7285 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7286 { | |
7287 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7288 return; | |
7289 } | |
1032 | 7290 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7291 { |
7292 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7293 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7294 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7295 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7296 } | |
7297 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7298 { | |
7299 sub_44C28F_open_nwc_dungeon(); | |
7300 return; | |
7301 } | |
0 | 7302 else |
1021 | 7303 { |
7304 | |
7305 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7306 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
|
7307 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7308 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7309 return; |
7310 } | |
1032 | 7311 |
0 | 7312 pMouse->RemoveHoldingItem(); |
7313 return; | |
7314 } | |
1021 | 7315 |
7316 } | |
0 | 7317 |
7318 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7319 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7320 { |
0 | 7321 Player *v3; // esi@1 |
7322 signed int v4; // edi@1 | |
7323 unsigned int v5; // eax@8 | |
7324 int v6; // eax@9 | |
7325 enum CHARACTER_RACE v7; // eax@11 | |
7326 signed int v8; // eax@17 | |
7327 unsigned __int8 v9; // sf@17 | |
7328 unsigned __int8 v10; // of@17 | |
7329 int v11; // eax@19 | |
7330 unsigned int v12; // eax@20 | |
484 | 7331 unsigned int test_bit_value; // eax@25 |
7332 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7333 signed int v15; // ecx@28 |
7334 ItemGen *v16; // eax@28 | |
7335 char v17; // zf@31 | |
7336 int v18; // edi@90 | |
7337 DDM_DLV_Header *v19; // eax@122 | |
7338 char v20; // cl@124 | |
7339 DDM_DLV_Header *v21; // eax@126 | |
7340 unsigned int v22; // edi@129 | |
100 | 7341 Player *v23; // esi@134 |
0 | 7342 ItemGen *v24; // ecx@135 |
7343 signed int v25; // edx@135 | |
7344 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7345 char *v27; // edi@155 | |
7346 int v28; // ebx@161 | |
7347 int v29; // eax@161 | |
7348 | |
469 | 7349 v6 = 0; |
0 | 7350 v3 = this; |
7351 v4 = -1; | |
469 | 7352 if ( VarNum > VAR_AutoNotes ) |
7353 { | |
7354 switch ( VarNum ) | |
0 | 7355 { |
7356 case VAR_Invisible: | |
1167 | 7357 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 7358 return true; |
484 | 7359 return false; |
0 | 7360 case VAR_NumDeaths: |
7361 v4 = pParty->uNumDeaths; | |
469 | 7362 return v4 >= pValue; |
0 | 7363 case VAR_NumBounties: |
7364 v4 = pParty->uNumBountiesCollected; | |
469 | 7365 return v4 >= pValue; |
0 | 7366 case VAR_PrisonTerms: |
7367 v4 = pParty->uNumPrisonTerms; | |
469 | 7368 return v4 >= pValue; |
0 | 7369 case VAR_ArenaWinsPage: |
7370 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7371 return v4 >= pValue; |
0 | 7372 case VAR_ArenaWinsSquire: |
7373 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7374 return v4 >= pValue; |
0 | 7375 case VAR_ArenaWinsKnight: |
7376 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7377 return v4 >= pValue; |
0 | 7378 case VAR_ArenaWinsLord: |
7379 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7380 return v4 >= pValue; |
0 | 7381 case VAR_ReputationInCurrentLocation: |
7382 v19 = &pOutdoor->ddm; | |
7383 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7384 v19 = &pIndoor->dlv; | |
469 | 7385 v6 = v19->uReputation >= pValue; |
7386 return v6; | |
0 | 7387 case VAR_History_28|VAR_Sex: |
7388 v21 = &pOutdoor->ddm; | |
7389 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7390 v21 = &pIndoor->dlv; | |
469 | 7391 v6 = v21->field_C_alert == pValue; |
0 | 7392 return v6; |
7393 case VAR_MonthEquals2|VAR_Sex: | |
7394 case VAR_MonthEquals2|VAR_Class: | |
7395 case VAR_Counter1: | |
7396 case VAR_Counter2: | |
7397 case VAR_Counter3: | |
7398 case VAR_Counter4: | |
7399 case VAR_Counter5: | |
7400 case VAR_Counter6: | |
7401 case VAR_Counter7: | |
7402 case VAR_Counter8: | |
469 | 7403 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7404 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7405 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7406 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7407 return true; | |
7408 return false; | |
0 | 7409 case VAR_NumSkillPoints: |
7410 v4 = this->uSkillPoints; | |
469 | 7411 return v4 >= pValue; |
0 | 7412 case VAR_CircusPrises: |
7413 v4 = 0; | |
100 | 7414 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7415 do |
7416 { | |
469 | 7417 v24 = v23->pInventoryItems; |
0 | 7418 v25 = 138; |
7419 do | |
7420 { | |
7421 switch ( v24->uItemID ) | |
7422 { | |
7423 case 0x1D6u: | |
7424 ++v4; | |
7425 break; | |
7426 case 0x1D7u: | |
7427 v4 += 3; | |
7428 break; | |
7429 case 0x1DDu: | |
7430 v4 += 5; | |
7431 break; | |
7432 } | |
7433 ++v24; | |
7434 --v25; | |
7435 } | |
7436 while ( v25 ); | |
100 | 7437 ++v23; |
0 | 7438 } |
100 | 7439 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7440 return v4 >= pValue; |
0 | 7441 case VAR_MonthEquals2: |
469 | 7442 v6 = pParty->uCurrentMonth == pValue; |
7443 return v6; | |
0 | 7444 case VAR_IsFlying: |
7445 if ( pParty->bFlying | |
1167 | 7446 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 7447 return true; |
7448 return false; | |
0 | 7449 case VAR_HiredNPCHasSpeciality: |
469 | 7450 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7451 return v6; |
7452 case VAR_NPCs2: | |
469 | 7453 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7454 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7455 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7456 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7457 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7458 return v4 >= pValue; |
7459 v4 = pValue; | |
7460 return v4 >= pValue; | |
0 | 7461 case VAR_ItemEquipped: |
7462 v26 = (ITEM_EQUIP_TYPE)0; | |
7463 v27 = (char *)&this->pEquipment; | |
7464 break; | |
7465 case VAR_GoldInBank: | |
7466 v4 = pParty->uNumGoldInBank; | |
469 | 7467 return v4 >= pValue; |
0 | 7468 case VAR_ThieverySkill|0x80: |
7469 v28 = GetActualMight(); | |
7470 v29 = v3->GetBaseStrength(); | |
7471 goto LABEL_168; | |
7472 case VAR_DisarmTrapSkill|0x80: | |
7473 v28 = GetActualIntelligence(); | |
7474 v29 = v3->GetBaseIntelligence(); | |
7475 goto LABEL_168; | |
7476 case VAR_MonthEquals: | |
7477 v28 = GetActualWillpower(); | |
7478 v29 = v3->GetBaseWillpower(); | |
7479 goto LABEL_168; | |
7480 case VAR_MonthEquals|VAR_Sex: | |
7481 v28 = GetActualEndurance(); | |
7482 v29 = v3->GetBaseEndurance(); | |
7483 goto LABEL_168; | |
7484 case VAR_IdentifyMonsterSkill|0x80: | |
7485 v28 = GetActualSpeed(); | |
7486 v29 = v3->GetBaseSpeed(); | |
7487 goto LABEL_168; | |
7488 case VAR_ArmsmasterSkill|0x80: | |
7489 v28 = GetActualAccuracy(); | |
7490 v29 = v3->GetBaseAccuracy(); | |
7491 goto LABEL_168; | |
7492 case VAR_MonthEquals|VAR_MaxHP: | |
7493 v28 = GetActualLuck(); | |
7494 v29 = v3->GetBaseLuck(); | |
7495 LABEL_168: | |
7496 v10 = __OFSUB__(v28, v29); | |
7497 v9 = v28 - v29 < 0; | |
7498 LABEL_169: | |
7499 if ( v9 ^ v10 ) | |
469 | 7500 return v4 >= pValue; |
7501 return true; | |
0 | 7502 default: |
469 | 7503 return v4 >= pValue; |
0 | 7504 } |
7505 while ( !v3->HasItemEquipped(v26) | |
654 | 7506 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7507 { |
7508 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7509 v27 += 4; | |
7510 if ( (signed int)v26 >= 16 ) | |
469 | 7511 return false; |
7512 } | |
7513 return true; | |
7514 } | |
7515 if ( VarNum == VAR_AutoNotes ) | |
0 | 7516 { |
1033 | 7517 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7518 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7519 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7520 return false; | |
7521 return true; | |
469 | 7522 } |
7523 if ( VarNum <= VAR_BaseLuck ) | |
7524 { | |
7525 if ( VarNum != VAR_BaseLuck ) | |
7526 { | |
7527 switch ( VarNum ) | |
0 | 7528 { |
7529 case VAR_Hour: | |
469 | 7530 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7531 return true; | |
7532 return false; | |
0 | 7533 case VAR_DayOfYear: |
469 | 7534 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7535 v6 = v5 == pValue; | |
7536 return v6; | |
0 | 7537 case VAR_DayOfWeek: |
469 | 7538 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7539 v6 = v5 == pValue; | |
0 | 7540 return v6; |
7541 case VAR_Sex: | |
469 | 7542 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7543 return true; | |
7544 return v4 >= pValue; | |
0 | 7545 case VAR_Class: |
135 | 7546 v7 = (CHARACTER_RACE)this->classType; |
469 | 7547 if ( pValue == v7 ) |
7548 return true; | |
7549 return v4 >= pValue; | |
0 | 7550 case VAR_Race: |
7551 v7 = GetRace(); | |
469 | 7552 if ( pValue == v7 ) |
7553 return true; | |
7554 return v4 >= pValue; | |
0 | 7555 case VAR_CurrentHP: |
7556 v4 = this->sHealth; | |
469 | 7557 return v4 >= pValue; |
0 | 7558 case VAR_MaxHP: |
7559 v8 = GetMaxHealth(); | |
7560 v10 = __OFSUB__(v3->sHealth, v8); | |
7561 v9 = v3->sHealth - v8 < 0; | |
7562 goto LABEL_169; | |
7563 case VAR_CurrentSP: | |
7564 v4 = this->sMana; | |
469 | 7565 return v4 >= pValue; |
0 | 7566 case VAR_MaxSP: |
7567 v11 = GetMaxMana(); | |
7568 v10 = __OFSUB__(v3->sMana, v11); | |
7569 v9 = v3->sMana - v11 < 0; | |
7570 goto LABEL_169; | |
7571 case VAR_ActualAC: | |
7572 v12 = GetActualAC(); | |
7573 goto _j_cmp_against_arg; | |
7574 case VAR_ACModifier: | |
7575 v4 = this->sACModifier; | |
469 | 7576 return v4 >= pValue; |
0 | 7577 case VAR_BaseLevel: |
7578 v4 = this->uLevel; | |
469 | 7579 return v4 >= pValue; |
0 | 7580 case VAR_LevelModifier: |
7581 v4 = this->sLevelModifier; | |
469 | 7582 return v4 >= pValue; |
0 | 7583 case VAR_Age: |
7584 v12 = GetActualAge(); | |
7585 goto _j_cmp_against_arg; | |
7586 case VAR_Award: | |
1033 | 7587 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7588 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7589 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7590 return true; | |
7591 return false; | |
0 | 7592 case VAR_Experience: |
7593 v4 = LODWORD(this->uExperience); | |
469 | 7594 return v4 >= pValue; |
0 | 7595 case VAR_QBits_QuestsDone: |
484 | 7596 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7597 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7598 if ( test_bit_value & our_bit_value ) | |
478 | 7599 return true; |
7600 return false; | |
0 | 7601 case VAR_PlayerItemInHands: |
7602 v15 = 0; | |
7603 v16 = v3->pInventoryItems; | |
7604 break; | |
7605 case VAR_FixedGold: | |
7606 v4 = pParty->uNumGold; | |
469 | 7607 return v4 >= pValue; |
0 | 7608 case VAR_MightBonus: |
7609 v4 = this->uMightBonus; | |
469 | 7610 return v4 >= pValue; |
0 | 7611 case VAR_IntellectBonus: |
7612 v4 = this->uIntelligenceBonus; | |
469 | 7613 return v4 >= pValue; |
0 | 7614 case VAR_PersonalityBonus: |
7615 v4 = this->uWillpowerBonus; | |
469 | 7616 return v4 >= pValue; |
0 | 7617 case VAR_EnduranceBonus: |
7618 v4 = this->uEnduranceBonus; | |
469 | 7619 return v4 >= pValue; |
0 | 7620 case VAR_SpeedBonus: |
7621 v4 = this->uSpeedBonus; | |
469 | 7622 return v4 >= pValue; |
0 | 7623 case VAR_AccuracyBonus: |
7624 v4 = this->uAccuracyBonus; | |
469 | 7625 return v4 >= pValue; |
0 | 7626 case VAR_LuckBonus: |
7627 v4 = this->uLuckBonus; | |
469 | 7628 return v4 >= pValue; |
0 | 7629 case VAR_BaseMight: |
7630 v4 = this->uMight; | |
469 | 7631 return v4 >= pValue; |
0 | 7632 case VAR_BaseIntellect: |
7633 v4 = this->uIntelligence; | |
469 | 7634 return v4 >= pValue; |
0 | 7635 case VAR_BasePersonality: |
7636 v4 = this->uWillpower; | |
469 | 7637 return v4 >= pValue; |
0 | 7638 case VAR_BaseEndurance: |
7639 v4 = this->uEndurance; | |
469 | 7640 return v4 >= pValue; |
0 | 7641 case VAR_BaseSpeed: |
7642 v4 = this->uSpeed; | |
469 | 7643 return v4 >= pValue; |
0 | 7644 case VAR_BaseAccuracy: |
7645 v4 = this->uAccuracy; | |
469 | 7646 return v4 >= pValue; |
0 | 7647 case VAR_FixedFood: |
7648 v4 = pParty->uNumFoodRations; | |
469 | 7649 return v4 >= pValue; |
0 | 7650 default: |
469 | 7651 return v4 >= pValue; |
7652 } | |
7653 while ( v16->uItemID != pValue ) | |
0 | 7654 { |
7655 ++v15; | |
7656 ++v16; | |
7657 if ( v15 >= 138 ) | |
7658 { | |
469 | 7659 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7660 return v6; |
7661 } | |
7662 } | |
469 | 7663 return true; |
0 | 7664 } |
7665 v4 = this->uLuck; | |
469 | 7666 return v4 >= pValue; |
7667 } | |
7668 if ( VarNum <= VAR_MagicResistance ) | |
7669 { | |
7670 if ( VarNum == VAR_MagicResistance ) | |
0 | 7671 { |
7672 v4 = this->sResMagicBase; | |
7673 } | |
7674 else | |
7675 { | |
469 | 7676 switch ( VarNum ) |
0 | 7677 { |
7678 case VAR_FireResistance: | |
7679 v4 = this->sResFireBase; | |
469 | 7680 return v4 >= pValue; |
0 | 7681 case VAR_AirResistance: |
7682 v4 = this->sResAirBase; | |
469 | 7683 return v4 >= pValue; |
0 | 7684 case VAR_WaterResistance: |
7685 v4 = this->sResWaterBase; | |
469 | 7686 return v4 >= pValue; |
0 | 7687 case VAR_EarthResistance: |
7688 v4 = this->sResEarthBase; | |
469 | 7689 return v4 >= pValue; |
0 | 7690 case VAR_SpiritResistance: |
7691 v4 = this->sResSpiritBase; | |
469 | 7692 return v4 >= pValue; |
0 | 7693 case VAR_MindResistance: |
7694 v4 = this->sResMindBase; | |
469 | 7695 return v4 >= pValue; |
0 | 7696 case VAR_BodyResistance: |
7697 v4 = this->sResBodyBase; | |
469 | 7698 return v4 >= pValue; |
0 | 7699 case VAR_LightResistance: |
7700 v4 = this->sResLightBase; | |
469 | 7701 return v4 >= pValue; |
0 | 7702 case VAR_DarkResistance: |
7703 v4 = this->sResDarkBase; | |
469 | 7704 return v4 >= pValue; |
0 | 7705 case VAR_ActualMight: |
7706 v12 = GetActualMight(); | |
7707 goto _j_cmp_against_arg; | |
7708 case VAR_ActualIntellect: | |
7709 v12 = GetActualIntelligence(); | |
7710 goto _j_cmp_against_arg; | |
7711 case VAR_ActualPersonality: | |
7712 v12 = GetActualWillpower(); | |
7713 goto _j_cmp_against_arg; | |
7714 case VAR_ActualEndurance: | |
7715 v12 = GetActualEndurance(); | |
7716 goto _j_cmp_against_arg; | |
7717 case VAR_ActualSpeed: | |
7718 v12 = GetActualSpeed(); | |
7719 goto _j_cmp_against_arg; | |
7720 case VAR_ActualAccuracy: | |
7721 v12 = GetActualAccuracy(); | |
7722 goto _j_cmp_against_arg; | |
7723 case VAR_ActualLuck: | |
7724 v12 = GetActualLuck(); | |
7725 _j_cmp_against_arg: | |
7726 v4 = v12; | |
7727 break; | |
7728 default: | |
469 | 7729 return v4 >= pValue; |
7730 } | |
7731 } | |
7732 return v4 >= pValue; | |
7733 } | |
7734 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7735 { | |
7736 if ( VarNum != VAR_DisarmTrapSkill ) | |
7737 { | |
7738 if ( VarNum <= VAR_MindResistanceBonus ) | |
7739 { | |
7740 switch ( VarNum ) | |
0 | 7741 { |
7742 case VAR_MindResistanceBonus: | |
7743 v4 = this->sResMindBonus; | |
7744 break; | |
7745 case VAR_FireResistanceBonus: | |
7746 v4 = this->sResFireBonus; | |
7747 break; | |
7748 case VAR_AirResistanceBonus: | |
7749 v4 = this->sResAirBonus; | |
7750 break; | |
7751 case VAR_WaterResistanceBonus: | |
7752 v4 = this->sResWaterBonus; | |
7753 break; | |
7754 case VAR_EarthResistanceBonus: | |
7755 v4 = this->sResEarthBonus; | |
7756 break; | |
7757 case VAR_SpiritResistanceBonus: | |
7758 v4 = this->sResSpiritBonus; | |
7759 break; | |
7760 } | |
469 | 7761 return v4 >= pValue; |
7762 } | |
7763 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7764 { |
7765 v4 = this->sResBodyBonus; | |
469 | 7766 return v4 >= pValue; |
7767 } | |
7768 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7769 { |
7770 v4 = this->sResLightBonus; | |
469 | 7771 return v4 >= pValue; |
7772 } | |
7773 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7774 { |
7775 v4 = this->sResDarkBonus; | |
469 | 7776 return v4 >= pValue; |
7777 } | |
7778 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7779 { |
7780 v4 = this->sResMagicBonus; | |
469 | 7781 return v4 >= pValue; |
7782 } | |
7783 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7784 return v4 >= pValue; | |
0 | 7785 } |
7786 LABEL_90: | |
469 | 7787 v18 = *((short *)&this->pConditions[16] + VarNum); |
7788 if ( pValue <= 63 ) | |
0 | 7789 v4 = v18 & 0x3F; |
7790 else | |
469 | 7791 v4 = pValue & v18; |
7792 return v4 >= pValue; | |
7793 } | |
7794 if ( VarNum == 104 ) | |
0 | 7795 goto LABEL_90; |
469 | 7796 if ( (signed int)VarNum <= 104 ) |
7797 return v4 >= pValue; | |
7798 if ( (signed int)VarNum > 0x79 ) | |
7799 { | |
7800 if ( VarNum != 122 ) | |
7801 { | |
7802 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7803 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7804 return v4 >= pValue; | |
0 | 7805 } |
7806 v4 = GetMajorConditionIdx(); | |
7807 if ( v4 != 18 ) | |
7808 { | |
469 | 7809 return v4 >= pValue; |
7810 } | |
7811 v4 = pValue; | |
7812 return v4 >= pValue; | |
7813 } | |
1072 | 7814 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 7815 } |
7816 | |
7817 | |
7818 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 7819 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7820 { | |
7821 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
|
7822 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
|
7823 unsigned int v5_unused; // edi@1 |
0 | 7824 unsigned int v6; // esi@13 |
7825 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
|
7826 signed int v8_unused; // eax@17 |
0 | 7827 ItemGen *v9; // ecx@17 |
7828 int v10; // eax@21 | |
7829 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
|
7830 Player *unused12; // ecx@44 |
0 | 7831 char *v13; // ecx@45 |
7832 Player *v14; // ecx@49 | |
7833 int v15; // ecx@86 | |
7834 int v16; // esi@106 | |
7835 char v17; // al@106 | |
7836 int v18; // eax@107 | |
7837 Player *v19; // ecx@112 | |
7838 Player *v20; // ecx@127 | |
7839 int v21; // eax@127 | |
7840 int v22; // eax@145 | |
7841 char v23; // zf@146 | |
7842 DDM_DLV_Header *v24; // ecx@148 | |
7843 signed int v25; // eax@172 | |
7844 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
|
7845 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
|
7846 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 7847 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
|
7848 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
|
7849 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
|
7850 |
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
|
7851 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
|
7852 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
|
7853 { |
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
|
7854 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
|
7855 { |
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
|
7856 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
|
7857 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
|
7858 } |
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
|
7859 } |
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
|
7860 assert(currPlayerId != -1); |
492 | 7861 if ( var_type > VAR_AutoNotes ) |
7862 { | |
7863 if ( var_type <= VAR_GoldInBank ) | |
7864 { | |
7865 if ( var_type == VAR_GoldInBank ) | |
7866 { | |
7867 pParty->uNumGoldInBank = var_value; | |
0 | 7868 return; |
7869 } | |
492 | 7870 if ( var_type <= VAR_Counter8 ) |
7871 { | |
7872 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7873 { |
492 | 7874 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7875 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7876 } |
7877 else | |
7878 { | |
492 | 7879 switch ( var_type ) |
0 | 7880 { |
7881 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 7882 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 7883 break; |
7884 case VAR_NPCs2: | |
7885 pParty->field_709 = 0; | |
492 | 7886 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 7887 pParty->CountHirelings(); |
7888 viewparams->bRedrawGameUI = true; | |
0 | 7889 break; |
7890 case VAR_NumSkillPoints: | |
492 | 7891 this->uSkillPoints = var_value; |
0 | 7892 break; |
7893 } | |
7894 } | |
7895 return; | |
7896 } | |
492 | 7897 if ( var_type < VAR_Counter9 ) |
0 | 7898 return; |
492 | 7899 if ( (signed int)var_type <= 0x112 ) |
7900 { | |
7901 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7902 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7903 } |
7904 else | |
7905 { | |
492 | 7906 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 7907 { |
7908 v24 = &pOutdoor->ddm; | |
7909 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7910 v24 = &pIndoor->dlv; | |
492 | 7911 v24->uReputation = var_value; |
7912 if ( var_value > 10000 ) | |
0 | 7913 v24->uReputation = 10000; |
7914 return; | |
7915 } | |
492 | 7916 if ( var_type <= VAR_ReputationInCurrentLocation |
7917 || var_type > VAR_History_28 | |
7918 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
7919 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7920 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 7921 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7922 v23) ) |
7923 return; | |
7924 bFlashHistoryBook = 1; | |
7925 } | |
492 | 7926 v25 = 8 * currPlayerId + 400; |
862 | 7927 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
|
7928 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 7929 return; |
7930 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7931 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7932 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7933 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7934 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
|
7935 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7936 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7937 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7938 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7939 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7940 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7941 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7942 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7943 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7944 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7945 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7946 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7947 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7948 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7949 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7950 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7951 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7952 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7953 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7954 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7955 return; |
0 | 7956 } |
492 | 7957 if ( var_type == VAR_AutoNotes ) |
7958 { | |
7959 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
|
7960 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 7961 && pAutonoteTxt[var_value-1].pText ) |
7962 { | |
7963 v20 = pPlayers[currPlayerId + 1]; | |
187 | 7964 v20->PlaySound(SPEECH_96, 0); |
492 | 7965 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 7966 bFlashAutonotesBook = 1; |
981 | 7967 _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
|
7968 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 7969 } |
492 | 7970 _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
|
7971 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7972 return; |
0 | 7973 } |
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
|
7974 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
|
7975 { |
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
|
7976 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
|
7977 { |
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
|
7978 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
|
7979 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
|
7980 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
|
7981 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
|
7982 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
|
7983 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
|
7984 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7985 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7986 for (int i = 0; i < 138; i++) |
0 | 7987 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7988 v9 = &this->pInventoryItems[i]; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7989 if (v9->uItemID == 615) |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7990 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
|
7991 } |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7992 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
|
7993 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7994 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
|
7995 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7996 *(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
|
7997 } |
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
|
7998 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
|
7999 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
|
8000 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
|
8001 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
|
8002 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
|
8003 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
|
8004 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
|
8005 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
|
8006 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
|
8007 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
|
8008 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
|
8009 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
|
8010 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
|
8011 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
|
8012 { |
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
|
8013 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
|
8014 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
|
8015 } |
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 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
|
8017 { |
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 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
|
8019 this->uVoiceID = 20; |
0 | 8020 } |
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
|
8021 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
|
8022 } |
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 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
|
8024 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
|
8025 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
|
8026 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
|
8027 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
|
8028 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
|
8029 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
|
8030 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
|
8031 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
|
8032 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
|
8033 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
|
8034 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
|
8035 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
|
8036 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
|
8037 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
|
8038 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
|
8039 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
|
8040 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
|
8041 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
|
8042 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
|
8043 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
|
8044 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
|
8045 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
|
8046 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
|
8047 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
|
8048 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
|
8049 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
|
8050 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
|
8051 //&& 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
|
8052 && 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
|
8053 { |
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 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
|
8055 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8056 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
|
8057 } |
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 _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
|
8059 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
|
8060 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
|
8061 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
|
8062 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
|
8063 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
|
8064 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
|
8065 // && (&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
|
8066 && pQuestTable[var_value-1] ) |
0 | 8067 { |
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
|
8068 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
|
8069 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
|
8070 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
|
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 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
|
8075 _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
|
8076 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
|
8077 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
|
8078 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
|
8079 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
|
8080 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
|
8081 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
|
8082 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
|
8083 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
|
8084 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
|
8085 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
|
8086 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
|
8087 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
|
8088 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
|
8089 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
|
8090 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
|
8091 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
|
8092 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
|
8093 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
|
8094 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
|
8095 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
|
8096 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
|
8097 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
|
8098 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
|
8099 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
|
8100 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
|
8101 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
|
8102 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
|
8103 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
|
8104 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
|
8105 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
|
8106 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
|
8107 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
|
8108 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
|
8109 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
|
8110 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
|
8111 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
|
8112 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
|
8113 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
|
8114 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
|
8115 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
|
8116 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
|
8117 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
|
8118 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
|
8119 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
|
8120 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
|
8121 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
|
8122 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8123 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
|
8124 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
|
8125 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
|
8126 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8127 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
|
8128 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
|
8129 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
|
8130 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8131 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
|
8132 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
|
8133 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
|
8134 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8135 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
|
8136 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
|
8137 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
|
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_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
|
8141 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
|
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_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
|
8145 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
|
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 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
|
8149 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
|
8150 } |
0 | 8151 LABEL_111: |
187 | 8152 v26 = SPEECH_91; |
0 | 8153 LABEL_112: |
492 | 8154 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8155 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
|
8156 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8157 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8158 return; |
0 | 8159 } |
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 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
|
8161 { |
492 | 8162 switch ( var_type ) |
0 | 8163 { |
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 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
|
8165 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
|
8166 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
|
8167 goto LABEL_111; |
0 | 8168 case VAR_ActualIntellect: |
8169 LABEL_68: | |
492 | 8170 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8171 goto LABEL_111; |
8172 case VAR_ActualPersonality: | |
8173 LABEL_69: | |
492 | 8174 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8175 goto LABEL_111; |
8176 case VAR_ActualEndurance: | |
8177 LABEL_70: | |
492 | 8178 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8179 goto LABEL_111; |
8180 case VAR_ActualSpeed: | |
8181 LABEL_71: | |
492 | 8182 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8183 goto LABEL_111; |
8184 case VAR_ActualAccuracy: | |
8185 LABEL_72: | |
492 | 8186 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8187 goto LABEL_111; |
8188 case VAR_ActualLuck: | |
8189 LABEL_73: | |
492 | 8190 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8191 goto LABEL_111; |
8192 case VAR_FireResistance: | |
492 | 8193 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
|
8194 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8195 goto LABEL_112; |
0 | 8196 case VAR_AirResistance: |
492 | 8197 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
|
8198 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8199 goto LABEL_112; |
0 | 8200 case VAR_WaterResistance: |
492 | 8201 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
|
8202 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8203 goto LABEL_112; |
0 | 8204 case VAR_EarthResistance: |
492 | 8205 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
|
8206 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8207 goto LABEL_112; |
0 | 8208 case VAR_SpiritResistance: |
492 | 8209 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
|
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_MindResistance: |
492 | 8213 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
|
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_BodyResistance: |
492 | 8217 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
|
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_LightResistance: |
492 | 8221 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
|
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_DarkResistance: |
492 | 8225 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
|
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_MagicResistance: |
492 | 8229 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8230 v26 = 92; |
8231 goto LABEL_112; | |
8232 default: | |
8233 return; | |
8234 } | |
8235 return; | |
8236 } | |
8237 HIWORD(v15) = 0; | |
492 | 8238 if ( var_type > VAR_DisarmTrapSkill ) |
8239 { | |
8240 if ( var_type != VAR_LearningSkill ) | |
8241 { | |
8242 if ( var_type <= VAR_LearningSkill ) | |
0 | 8243 return; |
492 | 8244 if ( var_type <= VAR_Eradicated ) |
8245 { | |
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
|
8246 this->SetCondition(var_type - 105, 1); |
0 | 8247 } |
8248 else | |
8249 { | |
492 | 8250 if ( var_type != VAR_MajorCondition ) |
0 | 8251 { |
492 | 8252 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8253 byte_5E4C15[var_type] = var_value; | |
0 | 8254 return; |
8255 } | |
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
|
8256 memset(this, 0, 0xA0u); |
0 | 8257 } |
8258 } | |
8259 else | |
8260 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8261 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
|
8262 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8263 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8264 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8265 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8266 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8267 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8268 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8269 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8270 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
|
8271 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8272 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8273 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8274 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8275 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8276 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8277 return; |
0 | 8278 } |
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
|
8279 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 8280 { |
8281 switch ( var_type ) | |
0 | 8282 { |
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
|
8283 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
|
8284 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 8285 break; |
8286 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
|
8287 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 8288 break; |
8289 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
|
8290 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8291 break; |
8292 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
|
8293 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8294 break; |
8295 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
|
8296 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
|
8297 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
|
8298 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
|
8299 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
|
8300 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
|
8301 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
|
8302 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
|
8303 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
|
8304 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
|
8305 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
|
8306 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
|
8307 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
|
8308 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
|
8309 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
|
8310 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
|
8311 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
|
8312 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
|
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_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
|
8315 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 8316 break; |
8317 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
|
8318 assert("Unexpected var_type" && false); |
0 | 8319 return; |
8320 break; | |
8321 } | |
8322 goto LABEL_111; | |
8323 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8324 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
|
8325 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8326 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8327 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8328 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8329 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8330 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8331 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8332 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
|
8333 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8334 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
|
8335 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
|
8336 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
|
8337 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8338 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8339 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8340 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
|
8341 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8342 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
|
8343 } |
0 | 8344 |
8345 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8346 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8347 { |
8348 char v3; // bl@1 | |
8349 Player *v4; // esi@1 | |
8350 signed int uPlayerIdx; // edi@1 | |
8351 int v6; // eax@15 | |
8352 unsigned int v7; // esi@18 | |
8353 int *v8; // ebx@21 | |
8354 int v9; // eax@22 | |
8355 signed int v10; // eax@24 | |
8356 int v11; // eax@27 | |
8357 __int16 *v12; // esi@28 | |
8358 Player *v13; // ecx@34 | |
8359 Player *v14; // ecx@36 | |
8360 char *v15; // ecx@37 | |
8361 unsigned __int8 v16; // cf@38 | |
8362 Player *v17; // ecx@42 | |
8363 __int16 *v18; // esi@53 | |
8364 __int16 *v19; // esi@62 | |
8365 char *v20; // esi@107 | |
8366 __int16 v21; // dx@107 | |
8367 int v22; // ecx@107 | |
8368 Player *v23; // ecx@132 | |
8369 int v24; // eax@132 | |
8370 int v25; // eax@150 | |
8371 char v26; // zf@151 | |
8372 DDM_DLV_Header *v27; // eax@153 | |
8373 signed int v28; // eax@176 | |
8374 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8375 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8376 int v31; // [sp-4h] [bp-3Ch]@84 |
8377 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8378 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8379 char v34; // [sp+37h] [bp-1h]@1 | |
8380 | |
8381 auto Dst = this; | |
8382 v3 = 0; | |
8383 v34 = 0; | |
8384 v4 = Dst; | |
8385 uPlayerIdx = 0; | |
8386 if ( Dst == pPlayers[2] ) | |
8387 uPlayerIdx = 1; | |
310 | 8388 else if ( Dst == pPlayers[3] ) |
8389 uPlayerIdx = 2; | |
8390 else if ( Dst == pPlayers[4] ) | |
8391 uPlayerIdx = 3; | |
8392 | |
8393 if ( var_type <= VAR_AutoNotes ) | |
8394 { | |
8395 if ( var_type != VAR_AutoNotes ) | |
8396 { | |
8397 if ( var_type <= VAR_ActualMight ) | |
8398 { | |
8399 if ( var_type != VAR_ActualMight ) | |
0 | 8400 { |
310 | 8401 switch ( var_type ) |
0 | 8402 { |
8403 case VAR_RandomGold: | |
8404 if ( !val ) | |
8405 val = 1; | |
8406 v6 = rand(); | |
8407 party_finds_gold(v6 % val + 1, 1); | |
8408 GameUI_DrawFoodAndGold(); | |
8409 return; | |
8410 case VAR_RandomFood: | |
8411 if ( !val ) | |
8412 val = 1; | |
8413 v7 = rand() % val + 1; | |
8414 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8415 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
|
8416 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8417 GameUI_DrawFoodAndGold(); |
8418 goto _play_sound; | |
8419 case VAR_Sex: | |
8420 Dst->uSex = (PLAYER_SEX)val; | |
8421 goto _play_anim_and_exit; | |
8422 case VAR_Class: | |
135 | 8423 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8424 goto _play_anim_and_exit; |
8425 case VAR_CurrentHP: | |
8426 v8 = &Dst->sHealth; | |
8427 *v8 += val; | |
8428 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8429 goto _play_anim_and_exit; | |
8430 v9 = v4->GetMaxHealth(); | |
8431 goto LABEL_23; | |
8432 case VAR_MaxHP: | |
8433 v10 = Dst->GetMaxHealth(); | |
8434 v4->_health_related = 0; | |
8435 v4->uFullHealthBonus = 0; | |
8436 v4->sHealth = v10; | |
8437 return; | |
8438 case VAR_CurrentSP: | |
8439 v8 = &Dst->sMana; | |
8440 *v8 += val; | |
8441 if ( Dst->sMana > GetMaxMana() ) | |
8442 { | |
8443 v9 = v4->GetMaxMana(); | |
8444 LABEL_23: | |
8445 *v8 = v9; | |
8446 } | |
8447 goto _play_anim_and_exit; | |
8448 case VAR_MaxSP: | |
8449 v11 = GetMaxMana(); | |
8450 v4->_mana_related = 0; | |
8451 v4->uFullManaBonus = 0; | |
8452 v4->sMana = v11; | |
8453 return; | |
8454 case VAR_ACModifier: | |
8455 v12 = &Dst->sACModifier; | |
8456 goto LABEL_29; | |
8457 case VAR_BaseLevel: | |
8458 v12 = (__int16 *)&Dst->uLevel; | |
8459 goto LABEL_29; | |
8460 case VAR_LevelModifier: | |
8461 v12 = &Dst->sLevelModifier; | |
8462 LABEL_29: | |
8463 *v12 += val; | |
8464 if ( *v12 > 255 ) | |
8465 *v12 = 255; | |
8466 goto _play_anim_and_exit; | |
8467 case VAR_Age: | |
8468 Dst->sAgeModifier += val; | |
8469 return; | |
8470 case VAR_Award: | |
8471 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8472 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8473 | |
492 | 8474 && pAwards[val].pText ) |
0 | 8475 { |
8476 v14 = pPlayers[uPlayerIdx + 1]; | |
8477 v34 = 1; | |
8478 v3 = 1; | |
187 | 8479 v14->PlaySound(SPEECH_96, 0); |
0 | 8480 } |
735 | 8481 v15 = (char *)v4->_guilds_member_bits; |
0 | 8482 goto LABEL_44; |
8483 case VAR_Experience: | |
8484 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8485 LODWORD(Dst->uExperience) += val; | |
8486 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8487 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8488 Dst->uExperience = 4000000000i64; | |
8489 goto _play_anim_and_exit; | |
8490 case VAR_QBits_QuestsDone: | |
484 | 8491 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
|
8492 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8493 && pQuestTable[val-1] ) |
0 | 8494 { |
501 | 8495 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8496 bFlashQuestBook = 1; |
8497 v34 = 1; | |
8498 v3 = 1; | |
501 | 8499 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8500 } |
484 | 8501 v15 = (char *)pParty->_quest_bits; |
0 | 8502 LABEL_44: |
8503 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8504 goto LABEL_173; | |
8505 case VAR_PlayerItemInHands: | |
8506 item.Reset(); | |
8507 item.Reset(); | |
8508 item.uAttributes = 1; | |
8509 item.uItemID = val; | |
8510 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8511 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8512 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8513 { | |
8514 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8515 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8516 } | |
8517 pParty->SetHoldingItem(&item); | |
8518 return; | |
8519 case VAR_FixedGold: | |
8520 party_finds_gold(val, 1); | |
8521 return; | |
8522 case VAR_BaseMight: | |
8523 v18 = (__int16 *)&Dst->uMight; | |
8524 goto LABEL_82; | |
8525 case VAR_BaseIntellect: | |
8526 v18 = (__int16 *)&Dst->uIntelligence; | |
8527 goto LABEL_82; | |
8528 case VAR_BasePersonality: | |
8529 v18 = (__int16 *)&Dst->uWillpower; | |
8530 goto LABEL_82; | |
8531 case VAR_BaseEndurance: | |
8532 v18 = (__int16 *)&Dst->uEndurance; | |
8533 goto LABEL_82; | |
8534 case VAR_BaseSpeed: | |
8535 v18 = (__int16 *)&Dst->uSpeed; | |
8536 goto LABEL_82; | |
8537 case VAR_BaseAccuracy: | |
8538 v18 = (__int16 *)&Dst->uAccuracy; | |
8539 goto LABEL_82; | |
8540 case VAR_BaseLuck: | |
8541 v18 = (__int16 *)&Dst->uLuck; | |
8542 goto LABEL_82; | |
8543 case VAR_FixedFood: | |
8544 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8545 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8546 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8547 if ( pParty->uNumFoodRations > 0xFFFF ) |
8548 Party::SetFood(0xFFFFu); | |
8549 goto _play_sound; | |
8550 case VAR_MightBonus: | |
8551 goto LABEL_62; | |
8552 case VAR_IntellectBonus: | |
8553 goto LABEL_66; | |
8554 case VAR_PersonalityBonus: | |
8555 goto LABEL_67; | |
8556 case VAR_EnduranceBonus: | |
8557 goto LABEL_68; | |
8558 case VAR_SpeedBonus: | |
8559 goto LABEL_69; | |
8560 case VAR_AccuracyBonus: | |
8561 goto LABEL_70; | |
8562 case VAR_LuckBonus: | |
8563 goto LABEL_71; | |
8564 default: | |
8565 return; | |
8566 } | |
8567 return; | |
8568 } | |
8569 LABEL_62: | |
8570 v19 = (__int16 *)&Dst->uMightBonus; | |
8571 goto LABEL_113; | |
8572 } | |
310 | 8573 if ( var_type <= VAR_FireResistanceBonus ) |
8574 { | |
8575 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8576 { |
310 | 8577 switch ( var_type ) |
0 | 8578 { |
8579 case VAR_ActualIntellect: | |
8580 LABEL_66: | |
8581 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8582 goto LABEL_113; | |
8583 case VAR_ActualPersonality: | |
8584 LABEL_67: | |
8585 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8586 goto LABEL_113; | |
8587 case VAR_ActualEndurance: | |
8588 LABEL_68: | |
8589 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8590 goto LABEL_113; | |
8591 case VAR_ActualSpeed: | |
8592 LABEL_69: | |
8593 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8594 goto LABEL_113; | |
8595 case VAR_ActualAccuracy: | |
8596 LABEL_70: | |
8597 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8598 goto LABEL_113; | |
8599 case VAR_ActualLuck: | |
8600 LABEL_71: | |
8601 v19 = (__int16 *)&Dst->uLuckBonus; | |
8602 goto LABEL_113; | |
8603 case VAR_FireResistance: | |
8604 v18 = &Dst->sResFireBase; | |
8605 goto LABEL_82; | |
8606 case VAR_AirResistance: | |
8607 v18 = &Dst->sResAirBase; | |
8608 goto LABEL_82; | |
8609 case VAR_WaterResistance: | |
8610 v18 = &Dst->sResWaterBase; | |
8611 goto LABEL_82; | |
8612 case VAR_EarthResistance: | |
8613 v18 = &Dst->sResEarthBase; | |
8614 goto LABEL_82; | |
8615 case VAR_SpiritResistance: | |
8616 v18 = &Dst->sResSpiritBase; | |
8617 goto LABEL_82; | |
8618 case VAR_MindResistance: | |
8619 v18 = &Dst->sResMindBase; | |
8620 goto LABEL_82; | |
8621 case VAR_BodyResistance: | |
8622 v18 = &Dst->sResBodyBase; | |
8623 goto LABEL_82; | |
8624 case VAR_LightResistance: | |
8625 v18 = &Dst->sResLightBase; | |
8626 goto LABEL_82; | |
8627 case VAR_DarkResistance: | |
8628 v18 = &Dst->sResDarkBase; | |
8629 goto LABEL_82; | |
8630 case VAR_MagicResistance: | |
8631 v18 = &Dst->sResMagicBase; | |
8632 LABEL_82: | |
8633 *v18 += val; | |
8634 if ( *v18 > 255 ) | |
8635 *v18 = 255; | |
8636 v31 = 0; | |
8637 v29 = 92; | |
8638 goto LABEL_116; | |
8639 default: | |
8640 return; | |
8641 } | |
8642 return; | |
8643 } | |
8644 v19 = &Dst->sResFireBonus; | |
8645 LABEL_113: | |
8646 *v19 += val; | |
8647 if ( *v19 > 255 ) | |
8648 *v19 = 255; | |
8649 v31 = 0; | |
187 | 8650 v29 = SPEECH_91; |
0 | 8651 LABEL_116: |
8652 v3 = 1; | |
187 | 8653 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8654 goto _play_anim_and_maybe_sound; |
8655 } | |
310 | 8656 if ( var_type <= VAR_DisarmTrapSkill ) |
8657 { | |
8658 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8659 { |
310 | 8660 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8661 { |
310 | 8662 switch ( var_type ) |
0 | 8663 { |
8664 case VAR_BodyResistanceBonus: | |
8665 v19 = &Dst->sResBodyBonus; | |
8666 break; | |
8667 case VAR_AirResistanceBonus: | |
8668 v19 = &Dst->sResAirBonus; | |
8669 break; | |
8670 case VAR_WaterResistanceBonus: | |
8671 v19 = &Dst->sResWaterBonus; | |
8672 break; | |
8673 case VAR_EarthResistanceBonus: | |
8674 v19 = &Dst->sResEarthBonus; | |
8675 break; | |
8676 case VAR_SpiritResistanceBonus: | |
8677 v19 = &Dst->sResSpiritBonus; | |
8678 break; | |
8679 default: | |
310 | 8680 if ( var_type != 62 ) |
0 | 8681 return; |
8682 v19 = &Dst->sResMindBonus; | |
8683 break; | |
8684 } | |
8685 goto LABEL_113; | |
8686 } | |
310 | 8687 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8688 { |
8689 v19 = &Dst->sResLightBonus; | |
8690 goto LABEL_113; | |
8691 } | |
310 | 8692 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8693 { |
8694 v19 = &Dst->sResDarkBonus; | |
8695 goto LABEL_113; | |
8696 } | |
310 | 8697 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8698 { |
8699 v19 = &Dst->sResMagicBonus; | |
8700 goto LABEL_113; | |
8701 } | |
310 | 8702 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8703 return; |
8704 } | |
8705 goto LABEL_106; | |
8706 } | |
310 | 8707 if ( var_type == VAR_LearningSkill ) |
0 | 8708 { |
8709 LABEL_106: | |
8710 if ( val <= VAR_BodyResistanceBonus ) | |
8711 { | |
310 | 8712 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8713 } |
8714 else | |
8715 { | |
310 | 8716 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8717 v21 = *(short *)v20; |
8718 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8719 if ( v22 > 60 ) | |
8720 LOWORD(v22) = 60; | |
8721 LOBYTE(v21) = v21 & 0xC0; | |
8722 *(short *)v20 = v22 | v21; | |
8723 } | |
8724 goto _play_anim_and_exit; | |
8725 } | |
310 | 8726 if ( var_type <= VAR_LearningSkill ) |
0 | 8727 return; |
310 | 8728 if ( var_type <= VAR_Eradicated ) |
8729 { | |
8730 Dst->SetCondition(var_type - 105, 0); | |
0 | 8731 } |
8732 else | |
8733 { | |
310 | 8734 if ( var_type != VAR_MajorCondition ) |
0 | 8735 { |
310 | 8736 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8737 { |
310 | 8738 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8739 byte_5E4C15[var_type] += val; | |
0 | 8740 else |
310 | 8741 byte_5E4C15[var_type] = -1; |
0 | 8742 } |
8743 return; | |
8744 } | |
8745 memset(Dst, 0, 0xA0u); | |
8746 } | |
8747 _play_anim_and_exit: | |
8748 v3 = 1; | |
8749 _play_anim_and_maybe_sound: | |
8750 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8751 _maybe_play_sound: | |
8752 if ( v3 != 1 ) | |
8753 return; | |
8754 goto _play_sound; | |
8755 } | |
8756 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
|
8757 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8758 && pAutonoteTxt[val-1].pText ) |
0 | 8759 { |
8760 v23 = pPlayers[uPlayerIdx + 1]; | |
8761 v34 = 1; | |
187 | 8762 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8763 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8764 bFlashAutonotesBook = 1; |
981 | 8765 _506568_autonote_type = v24; |
0 | 8766 } |
8767 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8768 v3 = 1; | |
8769 LABEL_173: | |
8770 if ( v34 != 1 ) | |
8771 goto _maybe_play_sound; | |
8772 goto _play_anim_and_maybe_sound; | |
8773 } | |
310 | 8774 if ( var_type > VAR_GoldInBank ) |
8775 { | |
8776 if ( var_type == 307 ) | |
0 | 8777 { |
8778 pParty->uNumDeaths += val; | |
8779 goto LABEL_173; | |
8780 } | |
310 | 8781 switch ( var_type ) |
0 | 8782 { |
8783 case 308: | |
8784 pParty->uNumBountiesCollected += val; | |
8785 break; | |
8786 case 309: | |
8787 pParty->uNumPrisonTerms += val; | |
8788 break; | |
8789 case 310: | |
8790 pParty->uNumArenaPageWins += val; | |
8791 break; | |
8792 case 311: | |
8793 pParty->uNumArenaSquireWins += val; | |
8794 break; | |
8795 case 312: | |
8796 pParty->uNumArenaKnightWins += val; | |
8797 break; | |
8798 case 313: | |
8799 pParty->uNumArenaLordWins += val; | |
8800 break; | |
8801 } | |
8802 } | |
8803 else | |
8804 { | |
310 | 8805 if ( var_type == VAR_GoldInBank ) |
0 | 8806 { |
8807 pParty->uNumGoldInBank += val; | |
8808 return; | |
8809 } | |
310 | 8810 if ( var_type <= VAR_Counter8 ) |
8811 { | |
8812 if ( (signed int)var_type >= 245 ) | |
8813 { | |
8814 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
8815 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8816 } |
8817 else | |
8818 { | |
310 | 8819 switch ( var_type ) |
0 | 8820 { |
8821 case VAR_MonthEquals|VAR_CurrentSP: | |
8822 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
8823 break; | |
8824 case VAR_NPCs2: | |
8825 pParty->field_709 = 0; | |
8826 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 8827 pParty->CountHirelings(); |
8828 viewparams->bRedrawGameUI = true; | |
0 | 8829 break; |
8830 case VAR_NumSkillPoints: | |
8831 Dst->uSkillPoints += val; | |
8832 break; | |
8833 } | |
8834 } | |
8835 return; | |
8836 } | |
310 | 8837 if ( var_type < VAR_Counter9 ) |
0 | 8838 return; |
310 | 8839 if ( (signed int)var_type <= 274 ) |
8840 { | |
8841 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8842 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8843 goto _play_sound; |
8844 } | |
310 | 8845 if ( var_type != VAR_ReputationInCurrentLocation ) |
8846 { | |
8847 if ( var_type <= VAR_ReputationInCurrentLocation | |
8848 || var_type > VAR_History_28 | |
8849 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
8850 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8851 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 8852 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8853 v26) ) |
8854 return; | |
8855 bFlashHistoryBook = 1; | |
8856 _play_sound: | |
8857 v28 = 8 * uPlayerIdx + 400; | |
862 | 8858 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 8859 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
8860 return; | |
8861 } | |
8862 v27 = &pOutdoor->ddm; | |
8863 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8864 v27 = &pIndoor->dlv; | |
8865 v27->uReputation += val; | |
8866 if ( v27->uReputation > 10000 ) | |
8867 v27->uReputation = 10000; | |
8868 } | |
8869 } | |
8870 // 506568: using guessed type int dword_506568; | |
8871 // 507948: using guessed type char bFlashHistoryBook; | |
8872 // 507949: using guessed type char bFlashAutonotesBook; | |
8873 // 50794A: using guessed type char bFlashQuestBook; | |
8874 // 72371C: using guessed type int dword_72371C[]; | |
8875 // 723E80: using guessed type int dword_723E80_award_related[]; | |
8876 | |
8877 | |
8878 | |
8879 | |
8880 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 8881 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 8882 { |
8883 unsigned int v3; // ebx@1 | |
8884 signed int v4; // esi@1 | |
501 | 8885 bool result; // eax@8 |
0 | 8886 int v6; // esi@11 |
8887 int v7; // edi@14 | |
8888 signed int v8; // eax@17 | |
8889 char *v9; // eax@20 | |
8890 char v10; // sf@20 | |
8891 char *v11; // ecx@26 | |
8892 char *v12; // ecx@27 | |
8893 __int64 v13; // qax@27 | |
8894 unsigned __int8 v14; // cf@27 | |
501 | 8895 int *v15; // edx@29 |
0 | 8896 char *v16; // eax@90 |
8897 char *v17; // ecx@94 | |
501 | 8898 int v18; // esi@97 |
0 | 8899 signed int v19; // edx@97 |
8900 char *v20; // ecx@98 | |
8901 int v21; // eax@100 | |
8902 __int16 v22; // dx@112 | |
8903 int v23; // [sp-8h] [bp-14h]@45 | |
8904 signed int v24; // [sp-4h] [bp-10h]@4 | |
8905 int v25; // [sp-4h] [bp-10h]@45 | |
8906 | |
8907 v3 = 0; | |
605 | 8908 v4 = uActiveCharacter - 1; |
501 | 8909 result = false; |
8910 if ( (signed int)VarNum > 222 ) | |
8911 { | |
8912 if ( (signed int)VarNum <= 307 ) | |
8913 { | |
8914 if ( VarNum == 307 ) | |
8915 { | |
8916 pParty->uNumDeaths -= (unsigned int)pValue; | |
8917 return pValue; | |
8918 } | |
8919 if ( VarNum == 223 ) | |
0 | 8920 { |
8921 v11 = (char *)pParty->_autonote_bits; | |
501 | 8922 v22 = (short)pValue - 1; |
0 | 8923 } |
8924 else | |
8925 { | |
501 | 8926 if ( VarNum != 231 ) |
0 | 8927 { |
501 | 8928 switch ( VarNum ) |
0 | 8929 { |
8930 case 232: | |
501 | 8931 VarNum = (VariableType)0; |
1094 | 8932 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 8933 result = (bool) pValue; |
8934 dword_5B65CC = 0; | |
8935 if ( (int)VarNum == pValue ) | |
0 | 8936 { |
501 | 8937 dword_5B65CC = (int)pValue; |
0 | 8938 } |
8939 else | |
8940 { | |
8941 pParty->field_709 = 0; | |
501 | 8942 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 8943 pParty->CountHirelings(); |
8944 viewparams->bRedrawGameUI = true; | |
0 | 8945 } |
8946 break; | |
8947 case 241: | |
8948 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8949 { | |
8950 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 8951 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 8952 { |
605 | 8953 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 8954 { |
8955 v21 = *(int *)v20; | |
8956 if ( (char)*(int *)v20 < 0 ) | |
8957 { | |
8958 LOBYTE(v21) = v21 & 0x7F; | |
8959 *(int *)v20 = v21; | |
8960 } | |
8961 } | |
8962 v20 += 76; | |
8963 } | |
8964 } | |
605 | 8965 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 8966 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 8967 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 8968 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
8969 pParty->field_709 = 0; | |
1035 | 8970 pParty->CountHirelings(); |
0 | 8971 break; |
8972 case 243: | |
8973 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8974 result = *v17 != NULL; |
501 | 8975 if ( (unsigned int)pValue <= *(int *)v17 ) |
8976 { | |
8977 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8978 result = (v17 != NULL); |
501 | 8979 } |
0 | 8980 else |
8981 *(int *)v17 = 0; | |
8982 break; | |
8983 case 275: | |
8984 v16 = (char *)&pOutdoor->ddm; | |
8985 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8986 v16 = (char *)&pIndoor->dlv; | |
501 | 8987 *((int *)v16 + 2) -= (int)pValue; |
0 | 8988 if ( *((int *)v16 + 2) < -10000 ) |
8989 *((int *)v16 + 2) = -10000; | |
8990 break; | |
8991 case 306: | |
501 | 8992 result = VarNum - 306; |
8993 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
8994 { | |
8995 result = (bool)pValue; | |
8996 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 8997 } |
0 | 8998 else |
8999 LABEL_88: | |
9000 dword_5B65C4 = 1; | |
9001 break; | |
9002 } | |
501 | 9003 return result; |
0 | 9004 } |
9005 v11 = this->field_1A50; | |
501 | 9006 v22 = (signed __int16)pValue; |
0 | 9007 } |
9008 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 9009 return result; |
9010 } | |
9011 switch ( VarNum ) | |
0 | 9012 { |
9013 case 308: | |
501 | 9014 result = (bool)pValue; |
9015 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 9016 break; |
9017 case 309: | |
501 | 9018 result = (bool)pValue; |
9019 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 9020 break; |
9021 case 310: | |
501 | 9022 result = (bool)pValue; |
9023 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 9024 break; |
9025 case 311: | |
501 | 9026 result = (bool)pValue; |
9027 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 9028 break; |
9029 case 312: | |
501 | 9030 result = (bool)pValue; |
9031 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 9032 break; |
9033 case 313: | |
501 | 9034 result = (bool)pValue; |
9035 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 9036 break; |
9037 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
9038 assert(false && "Function not returning any value!"); |
0 | 9039 } |
9040 else | |
9041 { | |
501 | 9042 if ( (signed int)VarNum >= 123 ) |
9043 { | |
9044 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 9045 } |
9046 else | |
9047 { | |
501 | 9048 switch ( VarNum ) |
0 | 9049 { |
9050 case VAR_RandomGold: | |
501 | 9051 v6 = rand() % (signed int)pValue + 1; |
0 | 9052 if ( v6 > pParty->uNumGold ) |
9053 v6 = pParty->uNumGold; | |
9054 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9055 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9056 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 9057 GameUI_DrawFoodAndGold(); |
501 | 9058 return result; |
0 | 9059 case VAR_RandomFood: |
501 | 9060 v7 = rand() % (signed int)pValue + 1; |
0 | 9061 if ( v7 > pParty->uNumFoodRations ) |
9062 v7 = pParty->uNumFoodRations; | |
9063 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9064 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9065 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 9066 GameUI_DrawFoodAndGold(); |
605 | 9067 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9068 v8 = 8 * v4 + 400; | |
862 | 9069 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9070 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9071 return result; |
0 | 9072 case VAR_CurrentHP: |
1036 | 9073 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 9074 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9075 v8 = 8 * v4 + 400; | |
862 | 9076 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9077 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9078 return result; | |
0 | 9079 case VAR_CurrentSP: |
9080 v9 = (char *)&this->sMana; | |
501 | 9081 v10 = this->sMana - (signed int)pValue < 0; |
9082 *(int *)v9 -= (int)pValue; | |
0 | 9083 if ( v10 ) |
9084 *(int *)v9 = 0; | |
605 | 9085 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9086 v8 = 8 * v4 + 400; | |
862 | 9087 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9088 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9089 return result; | |
0 | 9090 case VAR_ACModifier: |
501 | 9091 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9092 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9093 v8 = 8 * v4 + 400; | |
862 | 9094 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9095 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9096 return result; | |
0 | 9097 case VAR_BaseLevel: |
501 | 9098 this->uLevel -= (unsigned __int8)pValue; |
605 | 9099 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9100 v8 = 8 * v4 + 400; | |
862 | 9101 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9102 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9103 return result; | |
0 | 9104 case VAR_LevelModifier: |
501 | 9105 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9106 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9107 v8 = 8 * v4 + 400; | |
862 | 9108 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9109 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9110 return result; | |
0 | 9111 case VAR_Age: |
501 | 9112 this->sAgeModifier -= (signed __int16)pValue; |
9113 return result; | |
0 | 9114 case VAR_Award: |
605 | 9115 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9116 return result; | |
0 | 9117 case VAR_Experience: |
9118 v12 = (char *)&this->uExperience; | |
501 | 9119 v13 = (signed int)pValue; |
9120 v14 = *(int *)v12 < (unsigned int)pValue; | |
9121 *(int *)v12 -= (int)pValue; | |
0 | 9122 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9123 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9124 v8 = 8 * v4 + 400; | |
862 | 9125 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9126 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9127 return result; | |
0 | 9128 case VAR_QBits_QuestsDone: |
501 | 9129 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9130 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9131 return true; |
0 | 9132 case VAR_PlayerItemInHands: |
501 | 9133 v15 = this->pInventoryIndices; |
0 | 9134 break; |
9135 case VAR_FixedGold: | |
501 | 9136 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9137 goto LABEL_88; |
501 | 9138 Party::TakeGold((unsigned int)pValue); |
9139 return result; | |
0 | 9140 case VAR_MightBonus: |
9141 case VAR_ActualMight: | |
501 | 9142 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9143 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9144 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9145 v8 = 8 * v4 + 400; | |
862 | 9146 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9147 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9148 return result; | |
0 | 9149 case VAR_IntellectBonus: |
9150 case VAR_ActualIntellect: | |
501 | 9151 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9152 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9153 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9154 v8 = 8 * v4 + 400; | |
862 | 9155 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9156 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9157 return result; | |
0 | 9158 case VAR_PersonalityBonus: |
9159 case VAR_ActualPersonality: | |
501 | 9160 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9161 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9162 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9163 v8 = 8 * v4 + 400; | |
862 | 9164 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9165 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9166 return result; | |
0 | 9167 case VAR_EnduranceBonus: |
9168 case VAR_ActualEndurance: | |
501 | 9169 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9170 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9171 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9172 v8 = 8 * v4 + 400; | |
862 | 9173 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9174 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9175 return result; | |
0 | 9176 case VAR_SpeedBonus: |
9177 case VAR_ActualSpeed: | |
501 | 9178 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9179 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9180 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9181 v8 = 8 * v4 + 400; | |
862 | 9182 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9183 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9184 return result; | |
0 | 9185 case VAR_AccuracyBonus: |
9186 case VAR_ActualAccuracy: | |
501 | 9187 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9188 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9189 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9190 v8 = 8 * v4 + 400; | |
862 | 9191 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9192 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9193 return result; | |
0 | 9194 case VAR_LuckBonus: |
9195 case VAR_ActualLuck: | |
501 | 9196 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9197 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9198 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9199 v8 = 8 * v4 + 400; | |
862 | 9200 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9201 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9202 return result; | |
0 | 9203 case VAR_BaseMight: |
501 | 9204 this->uMight -= (unsigned __int16)pValue; |
605 | 9205 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9206 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9207 v8 = 8 * v4 + 400; | |
862 | 9208 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9209 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9210 return result; | |
0 | 9211 case VAR_BaseIntellect: |
501 | 9212 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9213 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_BasePersonality: |
501 | 9220 this->uWillpower -= (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_BaseEndurance: |
501 | 9228 this->uEndurance -= (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_BaseSpeed: |
501 | 9236 this->uSpeed -= (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_BaseAccuracy: |
501 | 9244 this->uAccuracy -= (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_BaseLuck: |
501 | 9252 this->uLuck -= (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_FireResistance: |
501 | 9260 this->sResFireBase -= (signed __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_AirResistance: |
501 | 9268 this->sResAirBase -= (signed __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_WaterResistance: |
501 | 9276 this->sResWaterBase -= (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_EarthResistance: |
501 | 9284 this->sResEarthBase -= (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_SpiritResistance: |
501 | 9292 this->sResSpiritBase -= (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_MindResistance: |
501 | 9300 this->sResMindBase -= (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_BodyResistance: |
501 | 9308 this->sResBodyBase -= (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_LightResistance: |
501 | 9316 this->sResLightBase -= (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_DarkResistance: |
501 | 9324 this->sResDarkBase -= (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_MagicResistance: |
501 | 9332 this->sResMagicBase -= (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_FireResistanceBonus: |
501 | 9340 this->sResFireBonus -= (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_AirResistanceBonus: |
501 | 9348 this->sResAirBonus -= (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_WaterResistanceBonus: |
501 | 9356 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9357 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 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_EarthResistanceBonus: |
501 | 9364 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9365 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 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_SpiritResistanceBonus: |
501 | 9372 this->sResSpiritBonus -= (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_MindResistanceBonus: |
501 | 9380 this->sResMindBonus -= (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_BodyResistanceBonus: |
501 | 9388 this->sResBodyBonus -= (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_LightResistanceBonus: |
501 | 9396 this->sResLightBonus -= (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_DarkResistanceBonus: |
501 | 9404 this->sResDarkBonus -= (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_MagicResistanceBonus: |
501 | 9412 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9413 v25 = 0; |
187 | 9414 v23 = SPEECH_91; |
9415 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9416 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9417 v8 = 8 * v4 + 400; | |
862 | 9418 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9419 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9420 return result; | |
0 | 9421 case VAR_FixedFood: |
501 | 9422 Party::TakeFood((unsigned int)pValue); |
605 | 9423 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9424 v8 = 8 * v4 + 400; | |
862 | 9425 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9426 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9427 return result; | |
0 | 9428 case VAR_StaffSkill: |
9429 case VAR_SwordSkill: | |
9430 case VAR_DaggerSkill: | |
9431 case VAR_AxeSkill: | |
9432 case VAR_SpearSkill: | |
9433 case VAR_BowSkill: | |
9434 case VAR_MaceSkill: | |
9435 case VAR_BlasterSkill: | |
9436 case VAR_ShieldSkill: | |
9437 case VAR_LeatherSkill: | |
9438 case VAR_SkillChain: | |
9439 case VAR_PlateSkill: | |
9440 case VAR_FireSkill: | |
9441 case VAR_AirSkill: | |
9442 case VAR_WaterSkill: | |
9443 case VAR_EarthSkill: | |
9444 case VAR_SpiritSkill: | |
9445 case VAR_MindSkill: | |
9446 case VAR_BodySkill: | |
9447 case VAR_LightSkill: | |
9448 case VAR_DarkSkill: | |
9449 case VAR_IdentifyItemSkill: | |
9450 case VAR_MerchantSkill: | |
9451 case VAR_RepairSkill: | |
9452 case VAR_BodybuildingSkill: | |
9453 case VAR_MeditationSkill: | |
9454 case VAR_PerceptionSkill: | |
9455 case VAR_DiplomacySkill: | |
9456 case VAR_DisarmTrapSkill: | |
9457 case VAR_LearningSkill: | |
501 | 9458 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9459 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9460 v8 = 8 * v4 + 400; | |
862 | 9461 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9462 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9463 return result; | |
0 | 9464 case VAR_Cursed: |
9465 case VAR_Weak: | |
9466 case VAR_Asleep: | |
9467 case VAR_Afraid: | |
9468 case VAR_Drunk: | |
9469 case VAR_Insane: | |
9470 case VAR_PoisonedGreen: | |
9471 case VAR_DiseasedGreen: | |
9472 case VAR_PoisonedYellow: | |
9473 case VAR_DiseasedYellow: | |
9474 case VAR_PoisonedRed: | |
9475 case VAR_DiseasedRed: | |
9476 case VAR_Paralyzed: | |
9477 case VAR_Unconsious: | |
9478 case VAR_Dead: | |
9479 case VAR_Stoned: | |
9480 case VAR_Eradicated: | |
1071 | 9481 //*((int *)this + 2 * VarNum - 210) = 0; |
9482 //*((int *)this + 2 * result - 209) = 0; | |
9483 this->pConditions[VarNum] = 0; | |
0 | 9484 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9485 v8 = 8 * v4 + 400; | |
862 | 9486 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9487 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9488 return result; |
605 | 9489 default: |
9490 return result; | |
9491 } | |
9492 for (v3 = 1; v3 < 126; v3++) | |
9493 { | |
9494 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9495 { |
605 | 9496 RemoveItemAtInventoryIndex(v3); |
501 | 9497 return true; |
0 | 9498 } |
605 | 9499 } |
501 | 9500 if ( pParty->pPickedItem.uItemID == pValue ) |
9501 { | |
605 | 9502 pMouse->RemoveHoldingItem(); |
9503 return true; | |
9504 } | |
9505 return false; | |
0 | 9506 } |
9507 } | |
9508 } | |
9509 // 5B65C4: using guessed type int dword_5B65C4; | |
9510 // 5B65CC: using guessed type int dword_5B65CC; |