Mercurial > mm7
annotate Player.cpp @ 1273:fbb7428fa58c
PlayerCreation_ComputeAttributeBonus cleanup
Player::IncreaseAttribute cleanup
author | Grumpy7 |
---|---|
date | Sat, 15 Jun 2013 03:00:36 +0200 |
parents | 19a4809e1da0 |
children | 351bc06722f2 |
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) -------------------------------------------------------- | |
1273 | 141 signed int __cdecl PlayerCreation_GetUnspentAttributePointCount() |
0 | 142 { |
143 signed int v0; // edi@1 | |
1273 | 144 int raceId; // ebx@2 |
0 | 145 signed int v4; // eax@17 |
146 int v5; // edx@18 | |
147 signed int v6; // ecx@18 | |
1273 | 148 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 |
149 | |
150 remainingStatPoints = 50; | |
0 | 151 v0 = 50; |
1273 | 152 for (int playerNum = 0; playerNum < 4; playerNum++) |
153 { | |
154 raceId = pParty->pPlayers[playerNum].GetRace(); | |
155 for (int statNum = 0; statNum <= 6; statNum++) | |
156 { | |
157 switch ( statNum ) | |
0 | 158 { |
1273 | 159 case 0: |
160 v0 = pParty->pPlayers[playerNum].uMight; | |
161 break; | |
162 case 1: | |
163 v0 = pParty->pPlayers[playerNum].uIntelligence; | |
164 break; | |
165 case 2: | |
166 v0 = pParty->pPlayers[playerNum].uWillpower; | |
167 break; | |
168 case 3: | |
169 v0 = pParty->pPlayers[playerNum].uEndurance; | |
170 break; | |
171 case 4: | |
172 v0 = pParty->pPlayers[playerNum].uAccuracy; | |
173 break; | |
174 case 5: | |
175 v0 = pParty->pPlayers[playerNum].uSpeed; | |
176 break; | |
177 case 6: | |
178 v0 = pParty->pPlayers[playerNum].uLuck; | |
179 break; | |
180 } | |
181 v4 = StatTable[raceId][statNum].uBaseValue; | |
182 if ( v0 >= v4 ) | |
183 { | |
184 v5 = StatTable[raceId][statNum].uDroppedStep; | |
185 v6 = StatTable[raceId][statNum].uBaseStep; | |
0 | 186 } |
187 else | |
188 { | |
1273 | 189 v5 = StatTable[raceId][statNum].uBaseStep; |
190 v6 = StatTable[raceId][statNum].uDroppedStep; | |
0 | 191 } |
1273 | 192 remainingStatPoints += v5 * (v4 - v0) / v6; |
193 } | |
194 } | |
195 return remainingStatPoints; | |
0 | 196 } |
197 | |
198 | |
199 | |
200 //----- (00427730) -------------------------------------------------------- | |
201 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
202 { | |
488 | 203 if (sMana >= uRequiredMana) |
204 { | |
205 sMana -= uRequiredMana; | |
206 return true; | |
207 } | |
208 | |
209 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
210 return false; | |
0 | 211 } |
212 | |
213 | |
214 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 215 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
216 { | |
0 | 217 float v6; // ST04_4@1 |
1014 | 218 signed int item_value; // eax@1 |
219 signed int sell_price; // ebx@1 | |
220 | |
221 item_value =pOwnItems[item_index].GetValue(); | |
222 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
223 sell_price = GetPriceSell(item_value, v6); | |
224 if ( pOwnItems[item_index].Broken() ) | |
225 sell_price = 1; | |
226 if ( sell_price < 1 ) | |
227 sell_price = 1; | |
228 RemoveItemAtInventoryIndex(inventory_idnx); | |
229 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 230 } |
231 | |
232 | |
233 | |
234 //----- (0043EEF3) -------------------------------------------------------- | |
235 bool Player::_43EEF3() | |
236 { | |
1014 | 237 signed int item_idx; // esi@1 |
238 signed int item_id; // esi@1 | |
239 for (int i=0; i<16;++i) | |
240 { | |
241 item_idx=pEquipment.pIndices[i]; | |
242 if (item_idx) | |
243 { | |
244 item_id=pOwnItems[item_idx-1].uItemID; | |
245 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle | |
246 return false; | |
247 } | |
248 } | |
249 return true; | |
250 } | |
251 | |
0 | 252 |
253 | |
254 | |
255 //----- (004B8040) -------------------------------------------------------- | |
1036 | 256 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
257 { | |
258 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 259 } |
260 | |
261 //----- (004B807C) -------------------------------------------------------- | |
262 int Player::_4B807C(float a2) | |
263 { | |
264 Player *v2; // edi@1 | |
265 unsigned int v3; // eax@1 | |
266 int v4; // esi@1 | |
267 unsigned int v5; // ebx@7 | |
268 int v6; // eax@8 | |
269 signed __int64 v7; // qax@13 | |
270 unsigned int v9; // [sp-4h] [bp-14h]@4 | |
271 signed int v10; // [sp+8h] [bp-8h]@4 | |
272 int v11; // [sp+Ch] [bp-4h]@6 | |
273 | |
274 v2 = this; | |
275 v3 = GetMajorConditionIdx(); | |
276 v4 = 0; | |
277 if ( (signed int)v3 >= 14 ) | |
278 { | |
279 if ( (signed int)v3 <= 15 ) | |
280 { | |
281 v10 = 5; | |
282 v9 = v3; | |
283 goto LABEL_6; | |
284 } | |
285 if ( v3 == 16 ) | |
286 { | |
287 v10 = 10; | |
288 v9 = 16; | |
289 LABEL_6: | |
1036 | 290 v11 = GetConditionDayOfWeek(v9); |
0 | 291 goto LABEL_13; |
292 } | |
293 } | |
294 v10 = 1; | |
295 v5 = 0; | |
296 do | |
297 { | |
1036 | 298 v6 = GetConditionDayOfWeek(v5); |
0 | 299 if ( v6 > v4 ) |
300 v4 = v6; | |
301 ++v5; | |
302 } | |
303 while ( (signed int)v5 <= 13 ); | |
304 v11 = v4; | |
305 if ( !v4 ) | |
306 v11 = 1; | |
307 LABEL_13: | |
308 v7 = (signed __int64)((double)v11 * (double)v10 * a2); | |
309 if ( (signed int)v7 < 1 ) | |
310 LODWORD(v7) = 1; | |
311 return v7; | |
312 } | |
313 | |
314 //----- (004B8102) -------------------------------------------------------- | |
917 | 315 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 316 { |
317 signed int v3; // esi@1 | |
318 signed int result; // eax@3 | |
319 | |
917 | 320 v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; |
321 if ( v3 > uRealValue ) | |
322 v3 = uRealValue; | |
0 | 323 result = 1; |
324 if ( v3 >= 1 ) | |
325 result = v3; | |
326 return result; | |
327 } | |
328 | |
329 //----- (004B8142) -------------------------------------------------------- | |
749 | 330 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
331 { | |
332 uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; | |
333 assert (price > 0); | |
334 | |
335 if (price < uRealValue) | |
336 price = uRealValue; | |
337 return price; | |
0 | 338 } |
339 | |
340 //----- (004B8179) -------------------------------------------------------- | |
916 | 341 int Player::GetPriceIdentification(float a2) |
0 | 342 { |
343 signed int v2; // esi@1 | |
344 int v3; // ecx@1 | |
345 signed int result; // eax@3 | |
346 | |
347 v2 = (signed __int64)(a2 * 50.0); | |
348 v3 = v2 * (100 - GetMerchant()) / 100; | |
349 if ( v3 < v2 / 3 ) | |
350 v3 = v2 / 3; | |
351 result = 1; | |
352 if ( v3 >= 1 ) | |
353 result = v3; | |
354 return result; | |
355 } | |
356 | |
357 //----- (004B81C3) -------------------------------------------------------- | |
916 | 358 int Player::GetPriceRepair(int a2, float a3) |
0 | 359 { |
360 signed int v3; // esi@1 | |
361 int v4; // ecx@1 | |
362 signed int result; // eax@3 | |
363 | |
364 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
365 v4 = v3 * (100 - GetMerchant()) / 100; | |
366 if ( v4 < v3 / 3 ) | |
367 v4 = v3 / 3; | |
368 result = 1; | |
369 if ( v4 >= 1 ) | |
370 result = v4; | |
371 return result; | |
372 } | |
373 | |
374 //----- (004B8213) -------------------------------------------------------- | |
375 int Player::_4B8213(int a2, float a3) | |
376 { | |
377 signed __int64 v3; // qax@1 | |
378 | |
379 v3 = (signed __int64)((double)a2 / (a3 + 2.0)); | |
380 if ( (signed int)v3 < 1 ) | |
381 LODWORD(v3) = 1; | |
382 return v3; | |
383 } | |
384 | |
385 //----- (004B8233) -------------------------------------------------------- | |
386 int Player::_4B8233(int a2, float a3) | |
387 { | |
388 signed __int64 v3; // qax@1 | |
389 | |
390 v3 = (signed __int64)((double)a2 * a3); | |
391 if ( (signed int)v3 < 1 ) | |
392 LODWORD(v3) = 1; | |
393 return v3; | |
394 } | |
395 | |
396 //----- (004B824B) -------------------------------------------------------- | |
397 int Player::_4B824B(float a2) | |
398 { | |
399 signed __int64 v2; // qax@1 | |
400 | |
401 v2 = (signed __int64)(a2 * 50.0); | |
402 if ( (signed int)v2 < 1 ) | |
403 LODWORD(v2) = 1; | |
404 return v2; | |
405 } | |
406 | |
407 //----- (004B8265) -------------------------------------------------------- | |
408 int Player::_4B8265(int a2, float a3) | |
409 { | |
410 signed __int64 v3; // qax@1 | |
411 | |
412 v3 = (signed __int64)((double)a2 / (6.0 - a3)); | |
413 if ( (signed int)v3 < 1 ) | |
414 LODWORD(v3) = 1; | |
415 return v3; | |
416 } | |
417 | |
418 | |
419 | |
420 | |
421 | |
422 //----- (004B6FF9) -------------------------------------------------------- | |
423 int Player::_4B6FF9() | |
424 { | |
425 Player *v1; // esi@1 | |
426 signed int v2; // eax@1 | |
427 char v3; // zf@4 | |
428 | |
429 v1 = this; | |
336 | 430 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1014 | 431 if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) |
0 | 432 { |
433 if ( GetMajorConditionIdx() == 18 ) | |
434 goto LABEL_6; | |
435 v3 = GetMajorConditionIdx() == 17; | |
436 } | |
437 else | |
438 { | |
439 v3 = GetMajorConditionIdx() == 18; | |
440 } | |
441 if ( !v3 ) | |
442 return 1; | |
443 LABEL_6: | |
444 if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) | |
445 return 1; | |
446 return 0; | |
447 } | |
448 | |
449 | |
450 | |
451 //----- (00421E75) -------------------------------------------------------- | |
1012 | 452 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
453 { | |
454 int item_idx; // eax@1 | |
455 int inv_index; // eax@3 | |
456 | |
457 item_idx = *pitem_index; | |
458 if ( item_idx >125 || item_idx < 0 ) | |
459 { | |
460 return 0; | |
461 } | |
462 | |
463 inv_index = this->pInventoryIndices[item_idx]; | |
464 if ( inv_index < 0 ) | |
465 { | |
466 *pitem_index = -1 - inv_index; | |
467 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
468 } | |
469 | |
470 return inv_index; | |
0 | 471 } |
472 | |
473 | |
474 | |
475 //----- (004160CA) -------------------------------------------------------- | |
1012 | 476 void Player::ItemsEnchant( int enchant_count ) |
477 { | |
478 int avalible_items; // ebx@1 | |
479 int i; // edx@8 | |
480 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
481 | |
482 avalible_items = 0; | |
483 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
484 | |
485 for (i=0; i<138; ++i) | |
486 { | |
487 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
488 item_index_tabl[avalible_items++] = i; | |
489 } | |
490 | |
491 if ( avalible_items ) | |
492 { | |
493 if ( enchant_count ) | |
494 { | |
495 for ( i = 0; i < enchant_count; ++i ) | |
0 | 496 { |
1012 | 497 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
498 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 499 } |
1012 | 500 |
0 | 501 } |
502 else | |
503 { | |
1012 | 504 for ( i = 0; i < avalible_items; ++i ) |
505 { | |
506 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
507 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
508 } | |
509 } | |
510 } | |
511 ; | |
0 | 512 } |
513 | |
514 //----- (004948B1) -------------------------------------------------------- | |
187 | 515 void Player::PlaySound(PlayerSpeech speech, int a3) |
516 { | |
517 //Player *pPlayer; // edi@1 | |
518 //int v4; // eax@4 | |
0 | 519 signed int v5; // esi@4 |
203 | 520 unsigned char *v6; // ebx@4 |
0 | 521 signed int v7; // ecx@5 |
522 unsigned __int8 v8; // al@6 | |
523 int v9; // eax@10 | |
187 | 524 //unsigned int pVoiceID; // ecx@10 |
0 | 525 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
526 //signed int v12; // eax@11 |
0 | 527 signed int v13; // esi@12 |
528 int v14; // eax@12 | |
187 | 529 //int v15; // eax@17 |
248 | 530 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 531 signed int v17; // ecx@19 |
532 char *pSoundID; // edi@20 | |
533 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 534 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 535 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
536 int pSoundId; // [sp+30h] [bp+8h]@4 | |
537 | |
187 | 538 //pPlayer = this; |
539 //pPlayer2 = this; | |
540 | |
0 | 541 pPlayerNum = 1; |
187 | 542 for (int i = 0; i < 4; ++i) |
543 if (&pParty->pPlayers[i] == this) | |
544 { | |
545 pPlayerNum = i + 1; | |
0 | 546 break; |
187 | 547 } |
548 | |
549 //v4 = a2;//102 | |
0 | 550 v5 = 0; |
551 pSoundId = 0; | |
1213 | 552 v6 = SoundSetAction[speech].data();//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
203 | 553 if (uVoicesVolumeMultiplier) |
0 | 554 { |
555 v7 = 0; | |
556 do | |
557 { | |
558 v8 = v6[v7]; | |
559 if ( v8 ) | |
560 v20[v5++] = v8; | |
561 ++v7; | |
562 } | |
563 while ( v7 < 2 ); | |
564 if ( v5 ) | |
565 { | |
566 v9 = rand(); | |
187 | 567 //pVoiceID = uVoiceID; |
0 | 568 v11 = v20[v9 % v5]; |
203 | 569 |
570 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
571 { | |
572 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
573 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 574 } |
575 } | |
576 } | |
203 | 577 |
0 | 578 v13 = 0; |
579 v14 = (int)(v6 + 3); | |
580 do | |
581 { | |
582 if ( *(char *)v14 ) | |
583 v20[v13++] = *(char *)v14; | |
584 ++v14; | |
585 } | |
586 while ( -3 - (signed int)v6 + v14 < 5 ); | |
587 if ( v13 ) | |
588 { | |
589 pPlayerNum = 0; | |
248 | 590 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
591 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 592 { |
593 v17 = 0; | |
764 | 594 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 595 { |
596 LABEL_23: | |
597 v17 = 0; | |
598 } | |
599 else | |
600 { | |
601 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
602 while ( *(int *)pSoundID != pSoundId ) | |
603 { | |
604 ++v17; | |
605 pSoundID += 120; | |
764 | 606 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 607 goto LABEL_23; |
608 } | |
609 } | |
610 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
611 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
612 } | |
248 | 613 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 614 } |
615 //return v14; | |
0 | 616 } |
617 // 4948B1: using guessed type int var_1C[5]; | |
618 | |
619 //----- (00494A25) -------------------------------------------------------- | |
187 | 620 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
621 { | |
622 //signed int v3; // eax@1 | |
623 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 624 signed int v5; // edi@15 |
625 PlayerFrame *v6; // esi@17 | |
626 signed int v7; // eax@20 | |
627 | |
187 | 628 //LOWORD(v3) = this->expression; |
629 //v4 = expr; | |
630 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
631 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
632 { | |
633 int v3 = (unsigned)expression; | |
0 | 634 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
635 { | |
636 if ( v3 <= 7 ) | |
637 goto LABEL_12; | |
638 if ( v3 > 8 ) | |
639 { | |
640 if ( v3 > 11 ) | |
641 { | |
1014 | 642 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 643 return; |
0 | 644 goto LABEL_15; |
645 } | |
646 LABEL_12: | |
187 | 647 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
648 return; | |
0 | 649 goto LABEL_15; |
650 } | |
651 } | |
652 } | |
653 LABEL_15: | |
187 | 654 //LOWORD(v3) = a3; |
0 | 655 v5 = 0; |
656 this->uExpressionTimeLength = a3; | |
657 this->uExpressionTimePassed = 0; | |
658 if ( !a3 ) | |
659 { | |
660 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
661 { | |
662 LABEL_20: | |
663 v7 = 0; | |
664 } | |
665 else | |
666 { | |
667 v6 = pPlayerFrameTable->pFrames; | |
187 | 668 while ( v6->expression != new_expression ) |
0 | 669 { |
670 ++v5; | |
671 ++v6; | |
672 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
673 goto LABEL_20; | |
674 } | |
675 v7 = v5; | |
676 } | |
187 | 677 //v4 = expr; |
678 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
679 } | |
680 expression = new_expression; | |
0 | 681 viewparams->bRedrawGameUI = 1; |
682 } | |
683 | |
684 //----- (0049327B) -------------------------------------------------------- | |
685 int Player::_49327B(unsigned int uClass, int a3) | |
686 { | |
687 Player *v3; // esi@1 | |
688 char v4; // zf@4 | |
689 __int16 v5; // dx@9 | |
690 signed int result; // eax@84 | |
691 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
692 int v8; // [sp-4h] [bp-Ch]@3 | |
693 | |
694 v3 = this; | |
135 | 695 if ( this->classType == uClass ) |
0 | 696 { |
697 LABEL_84: | |
698 result = 1; | |
699 } | |
700 else | |
701 { | |
702 switch ( uClass ) | |
703 { | |
704 case 0u: | |
705 v8 = a3; | |
706 v7 = 1; | |
707 goto LABEL_4; | |
708 case 1u: | |
484 | 709 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 710 || _49327B(2u, a3) ) |
711 goto LABEL_84; | |
712 v8 = a3; | |
713 v7 = 3; | |
714 goto LABEL_4; | |
715 case 2u: | |
716 v5 = 19; | |
717 goto LABEL_82; | |
718 case 3u: | |
719 v5 = 21; | |
720 goto LABEL_82; | |
721 case 4u: | |
722 v8 = a3; | |
723 v7 = 5; | |
724 goto LABEL_4; | |
725 case 5u: | |
484 | 726 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 727 || _49327B(6u, a3) ) |
728 goto LABEL_84; | |
729 v8 = a3; | |
730 v7 = 7; | |
731 goto LABEL_4; | |
732 case 6u: | |
733 if ( !a3 ) | |
734 break; | |
735 v5 = 13; | |
736 goto LABEL_82; | |
737 case 7u: | |
738 if ( !a3 ) | |
739 break; | |
740 v5 = 15; | |
741 goto LABEL_82; | |
742 case 8u: | |
743 v8 = a3; | |
744 v7 = 9; | |
745 goto LABEL_4; | |
746 case 9u: | |
484 | 747 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 748 || _49327B(0xAu, a3) ) |
749 goto LABEL_84; | |
750 v8 = a3; | |
751 v7 = 11; | |
752 goto LABEL_4; | |
753 case 0xAu: | |
754 if ( !a3 ) | |
755 break; | |
756 v5 = 25; | |
757 goto LABEL_82; | |
758 case 0xBu: | |
759 if ( !a3 ) | |
760 break; | |
761 v5 = 27; | |
762 goto LABEL_82; | |
763 case 0xCu: | |
764 v8 = a3; | |
765 v7 = 13; | |
766 goto LABEL_4; | |
767 case 0xDu: | |
484 | 768 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 769 || _49327B(0xEu, a3) ) |
770 goto LABEL_84; | |
771 v8 = a3; | |
772 v7 = 15; | |
773 goto LABEL_4; | |
774 case 0xEu: | |
775 if ( !a3 ) | |
776 break; | |
777 v5 = 43; | |
778 goto LABEL_82; | |
779 case 0xFu: | |
780 if ( !a3 ) | |
781 break; | |
782 v5 = 45; | |
783 goto LABEL_82; | |
784 case 0x10u: | |
785 v8 = a3; | |
786 v7 = 17; | |
787 goto LABEL_4; | |
788 case 0x11u: | |
484 | 789 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 790 || _49327B(0x12u, a3) ) |
791 goto LABEL_84; | |
792 v8 = a3; | |
793 v7 = 19; | |
794 goto LABEL_4; | |
795 case 0x12u: | |
796 if ( !a3 ) | |
797 break; | |
798 v5 = 37; | |
799 goto LABEL_82; | |
800 case 0x13u: | |
801 v5 = 39; | |
802 goto LABEL_82; | |
803 case 0x14u: | |
804 v8 = a3; | |
805 v7 = 21; | |
806 goto LABEL_4; | |
807 case 0x15u: | |
484 | 808 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 809 || _49327B(0x16u, a3) ) |
810 goto LABEL_84; | |
811 v8 = a3; | |
812 v7 = 23; | |
813 goto LABEL_4; | |
814 case 0x16u: | |
815 if ( !a3 ) | |
816 break; | |
817 v5 = 31; | |
818 goto LABEL_82; | |
819 case 0x17u: | |
820 if ( !a3 ) | |
821 break; | |
822 v5 = 33; | |
823 goto LABEL_82; | |
824 case 0x18u: | |
825 if ( !_49327B(0x19u, a3) ) | |
826 goto LABEL_56; | |
827 break; | |
828 case 0x19u: | |
829 LABEL_56: | |
484 | 830 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 831 || _49327B(0x1Au, a3) ) |
832 goto LABEL_84; | |
833 v8 = a3; | |
834 v7 = 27; | |
835 goto LABEL_4; | |
836 case 0x1Au: | |
837 if ( !a3 ) | |
838 break; | |
839 v5 = 65; | |
840 goto LABEL_82; | |
841 case 0x1Bu: | |
842 if ( !a3 ) | |
843 break; | |
844 v5 = 67; | |
845 goto LABEL_82; | |
846 case 0x1Cu: | |
847 v8 = a3; | |
848 v7 = 29; | |
849 goto LABEL_4; | |
850 case 0x1Du: | |
484 | 851 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 852 || _49327B(0x1Eu, a3) ) |
853 goto LABEL_84; | |
854 v8 = a3; | |
855 v7 = 31; | |
856 goto LABEL_4; | |
857 case 0x1Eu: | |
858 if ( !a3 ) | |
859 break; | |
860 v5 = 71; | |
861 goto LABEL_82; | |
862 case 0x1Fu: | |
863 if ( !a3 ) | |
864 break; | |
865 v5 = 73; | |
866 goto LABEL_82; | |
867 case 0x20u: | |
868 v8 = a3; | |
869 v7 = 33; | |
870 goto LABEL_4; | |
871 case 0x21u: | |
484 | 872 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 873 || _49327B(0x22u, a3) ) |
874 goto LABEL_84; | |
875 v8 = a3; | |
876 v7 = 35; | |
877 LABEL_4: | |
878 v4 = _49327B(v7, v8) == 0; | |
879 goto LABEL_83; | |
880 case 0x22u: | |
881 if ( !a3 ) | |
882 break; | |
883 v5 = 77; | |
884 goto LABEL_82; | |
885 case 0x23u: | |
886 if ( a3 ) | |
887 { | |
888 v5 = 79; | |
889 LABEL_82: | |
484 | 890 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 891 LABEL_83: |
892 if ( !v4 ) | |
893 goto LABEL_84; | |
894 } | |
895 break; | |
896 default: | |
897 break; | |
898 } | |
899 result = 0; | |
900 } | |
901 return result; | |
902 } | |
903 | |
904 | |
905 //----- (00492C0B) -------------------------------------------------------- | |
906 bool Player::CanAct() | |
907 { | |
908 bool result; // eax@2 | |
909 | |
910 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
911 result = 0; | |
912 else | |
913 result = 1; | |
914 return result; | |
915 } | |
916 | |
917 //----- (00492C40) -------------------------------------------------------- | |
918 bool Player::CanSteal() | |
919 { | |
920 int v1; // eax@1 | |
921 | |
922 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
923 return v1 != 0; | |
924 } | |
925 | |
926 //----- (00492C4E) -------------------------------------------------------- | |
927 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
928 { | |
929 char v2; // zf@9 | |
930 __int16 v4; // dx@13 | |
931 char v5; // zf@15 | |
932 | |
933 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
934 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
935 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
936 { | |
937 if ( uItemID == 533 ) | |
938 { | |
939 v2 = GetRace() == 1; | |
940 } | |
941 else | |
942 { | |
943 if ( uItemID != 534 ) | |
944 { | |
945 if ( uItemID == 535 ) // | |
946 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
947 { | |
948 switch ( this->uVoiceID ) | |
949 { | |
950 default: | |
951 return 1; | |
952 case 4u: | |
953 case 5u: | |
954 case 6u: | |
955 case 7u: | |
956 case 0xAu: | |
957 case 0xBu: | |
958 case 0xEu: // | |
959 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
960 case 0xFu: | |
961 case 0x12u: | |
962 case 0x13u: | |
963 case 0x15u: | |
964 case 0x18u: | |
965 return 0; | |
966 } | |
967 return 0; | |
968 } | |
969 if ( uItemID == 536 ) // | |
970 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
971 { | |
972 switch ( this->uVoiceID ) | |
973 { | |
974 case 4u: | |
975 case 5u: | |
976 case 6u: | |
977 case 7u: | |
978 case 0xAu: | |
979 case 0xBu: | |
980 case 0xEu: | |
981 case 0xFu: | |
982 case 0x12u: | |
983 case 0x13u: | |
984 case 0x15u: | |
985 case 0x18u: | |
986 return 1; | |
987 default: | |
988 return 0; | |
989 } | |
990 return 0; | |
991 } | |
992 if ( uItemID != 604 ) // | |
993 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
994 return 1; | |
995 v5 = _43EEF3() == 0; | |
996 goto LABEL_23; | |
997 } | |
998 v2 = GetRace() == 3; // | |
999 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
1000 } | |
1001 } | |
1002 else | |
1003 { | |
1004 if ( uItemID != 532 ) | |
1005 { | |
1006 if ( uItemID != 515 && uItemID != 517 ) // | |
1007 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
1008 { | |
1009 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
1010 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1011 { | |
1012 LABEL_13: | |
1013 v4 = 99; | |
1014 LABEL_15: | |
484 | 1015 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1016 LABEL_23: |
1017 if ( !v5 ) | |
1018 return 1; | |
1019 return 0; | |
1020 } | |
1021 if ( uItemID != 525 ) | |
1022 { | |
1023 if ( uItemID != 527 ) | |
1024 { | |
1025 if ( uItemID != 531 ) | |
1026 return 1; | |
1027 v2 = GetRace() == 2; | |
1028 goto LABEL_10; | |
1029 } | |
1030 goto LABEL_13; | |
1031 } | |
1032 } | |
1033 v4 = 100; | |
1034 goto LABEL_15; | |
1035 } | |
1036 v2 = GetRace() == 0; | |
1037 } | |
1038 LABEL_10: | |
1039 if ( v2 ) | |
1040 return 1; | |
1041 return 0; | |
1042 } | |
1043 | |
1044 //----- (00492D65) -------------------------------------------------------- | |
1045 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1046 { |
1047 | |
1048 signed int player_sex; // ecx@77 | |
1049 char zombi_face; // al@80 | |
1050 signed int remainig_player; // ebx@82 | |
1051 int players_before; // [sp+10h] [bp-4h]@2 | |
1052 int players_after; // [sp+20h] [bp+Ch]@82 | |
1053 | |
1054 if ( pConditions[uConditionIdx] ) | |
1055 return 0; | |
1056 players_before = 0; | |
1057 for (int i=1;i<5;++i) | |
1058 if ( pPlayers[i]->CanAct() ) | |
1059 ++players_before; | |
1060 | |
0 | 1061 switch ( uConditionIdx ) |
1014 | 1062 { |
1063 case Condition_Cursed: | |
1064 PlaySound((PlayerSpeech)30, 0); | |
1065 break; | |
1066 case Condition_Weak: | |
1167 | 1067 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) |
1068 {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; | |
1069 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1070 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1071 return 0; |
1072 } | |
1073 | |
1074 PlaySound((PlayerSpeech)25, 0); | |
1075 break; | |
1076 case Condition_Sleep: | |
1080 | 1077 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)|| |
1078 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) | |
1014 | 1079 return 0; |
1080 break; | |
1081 | |
1082 case Condition_Fear: | |
1083 PlaySound((PlayerSpeech)26, 0); | |
1084 break; | |
1085 case Condition_Drunk: | |
1086 PlaySound((PlayerSpeech)31, 0); | |
1087 break; | |
1088 | |
1089 case Condition_Insane: | |
0 | 1090 if ( a3 == 1 |
1080 | 1091 && (HasEnchantedItemEquipped(19) || |
1092 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1093 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1094 return 0; |
1095 | |
1096 PlaySound((PlayerSpeech)29, 0); | |
1097 break; | |
1098 case Condition_Poison1: | |
1099 case Condition_Poison2: | |
1100 case Condition_Poison3: | |
1101 if ( a3 == 1 ) | |
1102 { | |
1167 | 1103 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1104 { |
1167 | 1105 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1106 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1107 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1108 } |
1109 if ( HasEnchantedItemEquipped(21) | |
1080 | 1110 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) |
1082 | 1111 || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1112 //goto LABEL_76; |
1113 return 0; | |
1114 } | |
1115 | |
1116 //v23 = 27; | |
1117 PlaySound((PlayerSpeech)27, 0); | |
1118 break; | |
1119 | |
1120 case Condition_Disease1: | |
1121 case Condition_Disease2: | |
1122 case Condition_Disease3: | |
0 | 1123 if ( a3 == 1 ) |
1014 | 1124 { |
1167 | 1125 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1126 { |
1167 | 1127 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1128 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1129 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1130 return 0; |
1131 } | |
1132 | |
1080 | 1133 if ( HasEnchantedItemEquipped(18) || |
1134 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1135 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1136 return 0; |
1137 } | |
1138 PlaySound((PlayerSpeech)28, 0); | |
1139 break; | |
1140 case Condition_Paralyzed: | |
1141 if ( a3 == 1 ) | |
1142 { | |
1167 | 1143 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1144 { |
1167 | 1145 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1146 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1147 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1148 return 0; |
1149 } | |
1150 | |
1080 | 1151 if ( HasEnchantedItemEquipped(20)|| |
1152 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| | |
1153 WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| | |
1082 | 1154 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) |
1014 | 1155 return 0; |
1156 } | |
1157 break; | |
1158 case Condition_Unconcious: | |
1159 PlaySound(SPEECH_32, 0); | |
1160 if ( sHealth > 0 ) | |
1161 sHealth = 0; | |
1162 break; | |
1163 case Condition_Dead: | |
1167 | 1164 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) |
1014 | 1165 { |
1167 | 1166 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1167 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1168 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1169 } |
1170 | |
1171 PlaySound((PlayerSpeech)33, 0); | |
1172 if ( sHealth > 0 ) | |
1173 sHealth = 0; | |
1174 if ( sMana > 0 ) | |
1175 sMana = 0; | |
1176 break; | |
1177 case Condition_Pertified: | |
0 | 1178 if ( a3 == 1 |
1167 | 1179 &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64) |
1080 | 1180 || HasEnchantedItemEquipped(23)|| |
1181 WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || | |
1182 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1183 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1184 |
1185 return 0; | |
1186 PlaySound((PlayerSpeech)34, 0); | |
1187 break; | |
1188 case Condition_Eradicated: | |
1167 | 1189 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) |
1014 | 1190 { |
1167 | 1191 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1192 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1193 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1194 return 0; |
1195 } | |
1196 PlaySound(SPEECH_35, 0); | |
1197 if (sHealth > 0 ) | |
1198 sHealth = 0; | |
1199 if ( sMana > 0 ) | |
1200 sMana = 0; | |
1201 break; | |
1202 case Condition_Zombie: | |
1203 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1204 return 0; | |
1205 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1206 sHealth = GetMaxHealth(); | |
1207 sMana = 0; | |
1208 player_sex = 0; | |
1209 uPrevFace = uCurrentFace; | |
1210 uPrevVoiceID = uVoiceID; | |
1211 switch ( uVoiceID ) | |
1212 { | |
1213 case 0: | |
1214 case 1: | |
1215 case 2: | |
1216 case 3: | |
1217 case 8: | |
1218 case 9: | |
1219 case 12: | |
1220 case 13: | |
1221 case 16: | |
1222 case 17: | |
1223 case 20: | |
1224 case 23: | |
1225 player_sex = 0; | |
1226 break; | |
1227 case 4: | |
1228 case 5: | |
1229 case 6: | |
1230 case 7: | |
1231 case 10: | |
1232 case 11: | |
1233 case 14: | |
1234 case 15: | |
1235 case 18: | |
1236 case 19: | |
1237 case 21: | |
1238 case 24: | |
1239 player_sex = 1; | |
1240 break; | |
1241 default: | |
1242 break; | |
1243 } | |
1244 | |
1245 zombi_face = (player_sex != 0) + 23; | |
1246 uCurrentFace = zombi_face; | |
1247 uVoiceID = zombi_face; | |
1248 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1249 break; | |
0 | 1250 } |
1014 | 1251 |
1252 remainig_player = 0; | |
1253 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1254 players_after = 0; | |
1255 for (int i=1;i<5;++i) | |
0 | 1256 { |
1014 | 1257 |
1258 | |
1259 if ( pPlayers[i]->CanAct() ) | |
1260 { | |
1261 remainig_player=i; | |
1262 ++players_after; | |
1263 } | |
0 | 1264 } |
1014 | 1265 if (( players_before == 2 )&&( players_after == 1 )) |
1266 { | |
1267 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1268 } | |
1269 return 1; | |
1270 } | |
0 | 1271 |
1272 //----- (00492528) -------------------------------------------------------- | |
1273 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1274 { | |
973 | 1275 //unsigned int v3; // eax@1 |
0 | 1276 Texture *v4; // esi@1 |
1277 unsigned int v5; // ebx@1 | |
1278 signed int v6; // edi@5 | |
1279 int *v7; // ecx@6 | |
1280 signed int v8; // edx@7 | |
1281 int *v9; // eax@8 | |
973 | 1282 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1283 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1284 | |
973 | 1285 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1286 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1287 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1288 if ( !areWeLoadingTexture ) | |
1289 { | |
1290 v4->Release(); | |
1006 | 1291 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1292 } |
1293 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1294 { | |
1295 v6 = 0; | |
1296 if ( (signed int)uItemIDa <= 0 ) | |
1297 return 1; | |
973 | 1298 v7 = &pInventoryIndices[uSlot]; |
0 | 1299 while ( 1 ) |
1300 { | |
1301 v8 = 0; | |
1302 if ( (signed int)v5 > 0 ) | |
1303 break; | |
1304 LABEL_11: | |
1305 ++v6; | |
1306 v7 += 14; | |
1307 if ( v6 >= (signed int)uItemIDa ) | |
1308 return 1; | |
1309 } | |
1310 v9 = v7; | |
1311 while ( !*v9 ) | |
1312 { | |
1313 ++v8; | |
1314 ++v9; | |
1315 if ( v8 >= (signed int)v5 ) | |
1316 goto LABEL_11; | |
1317 } | |
1318 } | |
1319 return 0; | |
1320 } | |
1321 // 506128: using guessed type int areWeLoadingTexture; | |
1322 | |
1323 //----- (004925E6) -------------------------------------------------------- | |
1324 unsigned int Player::FindFreeInventorySlot() | |
1325 { | |
1326 unsigned int result; // eax@1 | |
1327 ItemGen *v2; // ecx@1 | |
1328 | |
1329 result = 0; | |
1330 v2 = this->pInventoryItems; | |
1331 while ( v2->uItemID ) | |
1332 { | |
1333 ++result; | |
1334 ++v2; | |
1335 if ( (signed int)result >= 126 ) | |
1336 return -1; | |
1337 } | |
1338 return result; | |
1339 } | |
1340 | |
1341 //----- (00492600) -------------------------------------------------------- | |
1342 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1343 { | |
1344 signed int v3; // edx@1 | |
1345 ItemGen *v4; // eax@1 | |
1346 int result; // eax@8 | |
1347 unsigned int v6; // ebx@10 | |
973 | 1348 //unsigned int v7; // eax@10 |
0 | 1349 Texture *v8; // esi@10 |
1350 void *v9; // esi@13 | |
1351 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1352 Player *v11; // [sp+4h] [bp-8h]@1 | |
1353 signed int v12; // [sp+8h] [bp-4h]@4 | |
1354 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1355 | |
1356 v11 = this; | |
1357 v3 = 0; | |
1358 v4 = this->pInventoryItems; | |
1359 while ( v4->uItemID ) | |
1360 { | |
1361 ++v3; | |
1362 ++v4; | |
1363 if ( v3 >= 126 ) | |
1364 { | |
1365 v12 = -1; | |
1366 goto LABEL_5; | |
1367 } | |
1368 } | |
1369 v12 = v3; | |
1370 LABEL_5: | |
1371 if ( v12 == -1 ) | |
1372 { | |
1373 if ( uActiveCharacter ) | |
201 | 1374 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1375 result = 0; |
1376 } | |
1377 else | |
1378 { | |
1379 v6 = uItemID; | |
973 | 1380 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1381 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1382 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1383 if ( !areWeLoadingTexture ) | |
1384 { | |
1385 v8->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1388 if ( (signed int)uItemIDa > 0 ) | |
1389 { | |
1390 v9 = &v11->pInventoryIndices[uSlot]; | |
1391 do | |
1392 { | |
1393 if ( (signed int)v10 > 0 ) | |
1394 memset32(v9, -1 - uSlot, v10); | |
1395 v9 = (char *)v9 + 56; | |
1396 --uItemIDa; | |
1397 } | |
1398 while ( uItemIDa ); | |
1399 } | |
1400 result = v12 + 1; | |
1401 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1402 v11->pInventoryItems[v12].uItemID = v6; | |
1403 } | |
1404 return result; | |
1405 } | |
1406 // 506128: using guessed type int areWeLoadingTexture; | |
1407 | |
1408 //----- (00492700) -------------------------------------------------------- | |
1409 int Player::HasSkill(unsigned int uSkillType) | |
1410 { | |
1411 signed int result; // eax@3 | |
1412 | |
1413 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1414 { | |
1415 result = 1; | |
1416 } | |
1417 else | |
1418 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1419 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1420 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 1421 result = 0; |
1422 } | |
1423 return result; | |
1424 } | |
1425 | |
1426 //----- (00492745) -------------------------------------------------------- | |
1427 int Player::WearItem(unsigned int uItemID) | |
1428 { | |
1010 | 1429 int item_body_anch; // edi@6 |
1430 int item_indx; | |
1431 //find empty slot | |
1432 for(item_indx=0;item_indx<126;++item_indx) | |
1433 if (pInventoryItems[item_indx].uItemID==0) | |
1434 break; | |
1435 if (item_indx==126) //not found | |
1436 item_indx=-1; | |
1437 | |
1438 if ( item_indx != -1 ) | |
1439 { | |
1440 | |
1441 pInventoryItems[item_indx].uItemID=uItemID; | |
1442 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1443 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1444 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1445 | |
0 | 1446 } |
1447 return 0; | |
1448 } | |
1449 | |
1450 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1451 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1452 { |
1453 signed int v3; // ebx@2 | |
1454 signed int v4; // edi@3 | |
1455 unsigned int v5; // esi@3 | |
1456 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1457 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1458 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1459 | |
1460 thisa = this; | |
1461 if ( uSlot == -1 ) | |
1462 { | |
1463 v3 = 0; | |
1014 | 1464 while ( true ) |
0 | 1465 { |
1466 v4 = 0; | |
1467 v5 = v3; | |
1468 do | |
1469 { | |
1470 if ( CanFitItem(v5, uItemID) ) | |
1471 { | |
1472 v8 = uItemID; | |
1473 v7 = v5; | |
1474 return CreateItemInInventory(v7, v8); | |
1475 } | |
1476 ++v4; | |
1477 v5 += 14; | |
1478 } | |
1479 while ( v4 < 9 ); | |
1480 ++v3; | |
1481 if ( v3 < 14 ) | |
1482 continue; | |
1483 break; | |
1484 } | |
1485 return 0; | |
1486 } | |
1487 if ( !CanFitItem(uSlot, uItemID) ) | |
1488 { | |
1489 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1490 return 0; | |
1491 } | |
1492 v8 = uItemID; | |
1493 v7 = uSlot; | |
1494 return CreateItemInInventory(v7, v8); | |
1495 } | |
1496 | |
1497 //----- (00492826) -------------------------------------------------------- | |
1014 | 1498 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1499 { |
1500 unsigned int v3; // ebx@1 | |
1501 unsigned int v4; // esi@3 | |
1502 signed int v5; // edi@3 | |
1503 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1504 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1505 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1506 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1507 | |
1508 thisa = this; | |
1509 v3 = Src->uItemID; | |
1510 pItemsTable->SetSpecialBonus(Src); | |
1511 if ( uSlot == -1 ) | |
1512 { | |
1513 uSlota = 0; | |
1014 | 1514 while ( true ) |
0 | 1515 { |
1516 v4 = uSlota; | |
1517 v5 = 0; | |
1518 do | |
1519 { | |
1520 if ( CanFitItem(v4, v3) ) | |
1521 { | |
1522 v8 = Src; | |
1523 v7 = v4; | |
1524 return CreateItemInInventory2(v7, v8); | |
1525 } | |
1526 ++v5; | |
1527 v4 += 14; | |
1528 } | |
1529 while ( v5 < 14 ); | |
1530 ++uSlota; | |
1531 if ( uSlota < 9 ) | |
1532 continue; | |
1533 break; | |
1534 } | |
1535 return 0; | |
1536 } | |
1537 if ( !CanFitItem(uSlot, v3) ) | |
1538 return 0; | |
1539 v8 = Src; | |
1540 v7 = uSlot; | |
1541 return CreateItemInInventory2(v7, v8); | |
1542 } | |
1543 | |
1544 //----- (0049289C) -------------------------------------------------------- | |
1545 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1546 { | |
1547 signed int v3; // ebx@1 | |
1548 ItemGen *v4; // eax@1 | |
1549 int result; // eax@6 | |
973 | 1550 //unsigned int v6; // eax@7 |
1014 | 1551 Texture *item_texture; // esi@7 |
0 | 1552 unsigned int v8; // edx@9 |
1014 | 1553 int *pInvPos; // esi@10 |
1554 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1555 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1556 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1557 |
0 | 1558 |
1559 v12 = this; | |
1560 v3 = 0; | |
1561 v4 = this->pInventoryItems; | |
1562 while ( v4->uItemID ) | |
1563 { | |
1564 ++v3; | |
1565 ++v4; | |
1566 if ( v3 >= 126 ) | |
1567 { | |
1568 v3 = -1; | |
1569 break; | |
1570 } | |
1571 } | |
1572 if ( v3 == -1 ) | |
1573 { | |
1574 result = 0; | |
1575 } | |
1576 else | |
1577 { | |
1014 | 1578 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1579 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1580 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1581 if ( !areWeLoadingTexture ) |
1582 { | |
1014 | 1583 item_texture->Release(); |
1006 | 1584 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1585 } |
1014 | 1586 if ( slot_height > 0 ) |
1587 { | |
1588 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1589 do |
1590 { | |
1014 | 1591 if ( slot_width > 0 ) |
1592 memset32(pInvPos, -1 - uSlot, slot_width); | |
1593 pInvPos +=14; | |
1594 --slot_height; | |
1595 } | |
1596 while ( slot_height ); | |
1597 } | |
1598 pInventoryIndices[uSlot] = v3 + 1; | |
1599 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1600 result = v3 + 1; |
1601 } | |
1602 return result; | |
1603 } | |
1604 // 506128: using guessed type int areWeLoadingTexture; | |
1605 | |
1606 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1607 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1608 { | |
973 | 1609 //Player *v4; // ebx@1 |
1610 //unsigned int v5; // eax@1 | |
1014 | 1611 Texture *item_texture; // esi@1 |
1612 int *pInvPos; // esi@4 | |
1613 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1614 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1615 | |
1616 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1617 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1618 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1619 if ( !areWeLoadingTexture ) |
1620 { | |
1014 | 1621 item_texture->Release(); |
1006 | 1622 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1623 } |
1014 | 1624 if ( (signed int)slot_height > 0 ) |
1625 { | |
1626 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1627 do |
1628 { | |
1014 | 1629 if ( (signed int)slot_width > 0 ) |
1630 memset32(pInvPos, -1 - uSlot, slot_width); | |
1631 pInvPos +=14; | |
1632 --slot_height; | |
1633 } | |
1634 while ( slot_height ); | |
1635 } | |
1636 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1637 return 1; |
1638 } | |
278 | 1639 |
0 | 1640 // 506128: using guessed type int areWeLoadingTexture; |
1641 | |
1642 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1643 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1644 { | |
1014 | 1645 |
1646 ItemGen *item_in_slot; // ecx@1 | |
1647 Texture *item_texture; // esi@1 | |
1648 unsigned int slot_height; // ebp@1 | |
1649 int *pInvPos; // edx@4 | |
1650 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1651 | |
1652 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1653 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1654 item_in_slot->Reset(); | |
1655 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1656 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1657 if ( !areWeLoadingTexture ) |
1658 { | |
1014 | 1659 item_texture->Release(); |
1006 | 1660 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1661 } |
1014 | 1662 if ( slot_height > 0 ) |
1663 { | |
1664 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1665 do |
1666 { | |
1014 | 1667 if (slot_width > 0 ) |
1668 memset32(pInvPos, 0, slot_width); | |
1669 pInvPos += 14; | |
1670 --slot_height; | |
1671 } | |
1672 while ( slot_height ); | |
0 | 1673 } |
1006 | 1674 |
0 | 1675 } |
1676 // 506128: using guessed type int areWeLoadingTexture; | |
1677 | |
436 | 1678 //identf |
0 | 1679 //----- (00490EEE) -------------------------------------------------------- |
917 | 1680 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1681 { | |
1682 int pSkillLevel; // eax@1 | |
1683 int NotBuy; // eax@1 | |
1684 int result; | |
1685 signed int pEquipType; // esi@1 | |
1686 float *pPriceMultiplier; // esi@26 | |
1687 int pPriceItemService; // edi@26 | |
1688 | |
1689 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1690 NotBuy = 4; | |
1691 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1692 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1693 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1694 return 5; |
917 | 1695 if ( building_type == BildingType_WeaponShop ) |
1696 { | |
1697 if ( pEquipType > EQUIP_BOW ) | |
1698 return NotBuy; | |
1699 if (pItem->Stolen()) | |
1700 return 6; | |
1701 } | |
1702 if ( building_type == BildingType_ArmorShop ) | |
1703 { | |
1704 if ( pEquipType < 3 && pEquipType > 9 ) | |
1705 return NotBuy; | |
1706 if (pItem->Stolen()) | |
1707 return 6; | |
1708 } | |
1709 if ( building_type == BildingType_MagicShop ) | |
1710 { | |
1711 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1712 { | |
1713 if (pItem->Stolen()) | |
1714 return 6; | |
1715 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1716 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1717 if ( ShopMenuType == 3 )//Sell | |
1718 { | |
1719 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1720 if (!pItem->Broken()) | |
1721 { | |
1722 if ( pSkillLevel ) | |
1723 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1724 else | |
1725 result = 1; | |
1726 return result; | |
1727 } | |
1728 pPriceItemService = 1; | |
1729 if ( pSkillLevel ) | |
1730 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1731 else | |
1732 result = 1; | |
1733 return result; | |
1734 } | |
1735 if ( ShopMenuType == 4 )//Identify | |
1736 { | |
1737 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1738 if ( pSkillLevel ) | |
1739 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1740 else | |
1741 result = 1; | |
1742 return result; | |
1743 } | |
1744 if ( ShopMenuType == 5 )//Repair | |
1745 { | |
1746 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1747 if ( pSkillLevel ) | |
1748 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1749 else | |
1750 result = 1; | |
1751 return result; | |
1752 } | |
1753 if ( ShopMenuType != 6 )//Buy and ??? | |
1754 { | |
1755 if ( pSkillLevel ) | |
1756 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1757 else | |
1758 result = 1; | |
1759 return result; | |
1760 } | |
1761 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1762 if (pItem->Broken()) | |
1763 pPriceItemService = 1; | |
1764 if ( pPriceItemService >= 1 ) | |
1765 { | |
1766 if ( pSkillLevel ) | |
1767 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1768 else | |
1769 result = 1; | |
1770 return result; | |
1771 } | |
1772 pPriceItemService = 1; | |
1773 if ( pSkillLevel ) | |
1774 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1775 else | |
1776 result = 1; | |
0 | 1777 return result; |
917 | 1778 } |
1779 if ( pEquipType != EQUIP_BOOK ) | |
1780 return NotBuy; | |
1781 } | |
1782 if ( building_type == BildingType_AlchemistShop ) | |
1783 { | |
1784 if ( pEquipType < EQUIP_REAGENT ) | |
1785 return NotBuy; | |
1786 if ( pEquipType > EQUIP_POTION ) | |
1787 { | |
1788 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1789 return NotBuy; | |
1790 } | |
1791 if (pItem->Stolen()) | |
1792 return 6; | |
1793 } | |
1794 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1795 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1796 if ( ShopMenuType == 3 )//Sell | |
1797 { | |
1798 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1799 if (!pItem->Broken()) | |
1800 { | |
1801 if ( pSkillLevel ) | |
1802 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1803 else | |
1804 result = 1; | |
0 | 1805 return result; |
917 | 1806 } |
1807 pPriceItemService = 1; | |
1808 if ( pSkillLevel ) | |
1809 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1810 else | |
1811 result = 1; | |
1812 return result; | |
1813 } | |
1814 if ( ShopMenuType == 4 )//Identify | |
1815 { | |
1816 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1817 if ( pSkillLevel ) | |
1818 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1819 else | |
1820 result = 1; | |
1821 return result; | |
1822 } | |
1823 if ( ShopMenuType == 5 )//Repair | |
1824 { | |
1825 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1826 if ( pSkillLevel ) | |
1827 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1828 else | |
1829 result = 1; | |
1830 return result; | |
1831 } | |
1832 if ( ShopMenuType != 6 )//Buy and ??? | |
1833 { | |
1834 if ( pSkillLevel ) | |
1835 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1836 else | |
1837 result = 1; | |
1838 return result; | |
1839 } | |
1840 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1841 if (pItem->Broken()) |
917 | 1842 pPriceItemService = 1; |
1843 if ( pPriceItemService >= 1 ) | |
1844 { | |
1845 if ( pSkillLevel ) | |
1846 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1847 else | |
1848 result = 1; | |
1849 return result; | |
1850 } | |
1851 pPriceItemService = 1; | |
1852 if ( pSkillLevel ) | |
1853 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1854 else |
1855 result = 1; | |
1856 return result; | |
1857 } | |
1858 | |
1859 //----- (0049107D) -------------------------------------------------------- | |
1860 int Player::GetBodybuilding() | |
1861 { | |
1010 | 1862 int v1; // al@1 |
0 | 1863 int v2; // ecx@1 |
1864 int v4; // eax@3 | |
1865 signed int v6; // [sp-4h] [bp-4h]@2 | |
1866 | |
1867 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1868 v2 = v1 & 0x3F; | |
1869 if ( v1 & 0x100 ) | |
1870 { | |
1871 v6 = 5; | |
1872 } | |
1873 else | |
1874 { | |
1008 | 1875 if ( (v1&0xFF) >= 0 ) |
0 | 1876 { |
1877 v4 = ((v1 & 0x40) != 0) + 1; | |
1878 return v2 * v4; | |
1879 } | |
1880 v6 = 3; | |
1881 } | |
1882 v4 = v6; | |
1883 return v2 * v4; | |
1884 } | |
1885 | |
1886 //----- (004910A8) -------------------------------------------------------- | |
607 | 1887 int Player::GetMeditation() |
0 | 1888 { |
1010 | 1889 int v1; // al@1 |
1008 | 1890 int base_level; // ecx@1 |
0 | 1891 int v4; // eax@3 |
1892 signed int v6; // [sp-4h] [bp-4h]@2 | |
1893 | |
1894 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1895 base_level = v1 & 0x3F; |
0 | 1896 if ( v1 & 0x100 ) |
1897 { | |
1898 v6 = 5; | |
1899 } | |
1900 else | |
1901 { | |
1008 | 1902 if ( (v1&0xFF) >= 0 ) |
0 | 1903 { |
1904 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1905 return base_level * v4; |
0 | 1906 } |
1907 v6 = 3; | |
1908 } | |
1909 v4 = v6; | |
1008 | 1910 return base_level * v4; |
0 | 1911 } |
1912 | |
1913 //----- (004910D3) -------------------------------------------------------- | |
1914 int Player::CanIdentify(ItemGen *pItem) | |
1915 { | |
1916 unsigned __int16 v2; // ax@1 | |
1917 unsigned __int16 v3; // bx@1 | |
1918 int uSkillMult; // eax@3 | |
1919 int v5; // edi@7 | |
1920 signed int v6; // ebp@7 | |
1921 char *v7; // esi@7 | |
1922 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1923 |
1924 if (CheckHiredNPCSpeciality(Scholar)) | |
1925 return true; | |
0 | 1926 |
179 | 1927 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1928 v3 = v2; |
179 | 1929 if ( v2 & 1 ) |
0 | 1930 { |
1931 uSkillMultiplier = 5; | |
1932 } | |
1933 else | |
1934 { | |
1935 if ( (v2 & 0x80u) == 0 ) | |
1936 { | |
1937 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1938 v5 = uSkillMult * (v3 & 0x3F); |
1939 v6 = 0; | |
1940 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1941 |
179 | 1942 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1943 v6 = 1; | |
1944 if ( v5 >= (unsigned __int8)v7[46] ) | |
1945 v6 = 1; | |
1946 return v6; | |
0 | 1947 } |
1948 uSkillMultiplier = 3; | |
1949 } | |
1950 uSkillMult = uSkillMultiplier; | |
1951 v5 = uSkillMult * (v3 & 0x3F); | |
1952 v6 = 0; | |
1953 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1954 |
0 | 1955 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1956 v6 = 1; | |
1957 if ( v5 >= (unsigned __int8)v7[46] ) | |
1958 v6 = 1; | |
1959 return v6; | |
1960 } | |
1961 | |
1962 //----- (00491151) -------------------------------------------------------- | |
1963 int Player::CanRepair(ItemGen *a2) | |
1964 { | |
1965 unsigned __int16 v2; // ax@1 | |
1966 unsigned __int16 v3; // bx@1 | |
1967 int v4; // eax@3 | |
1968 int v5; // edi@7 | |
1969 signed int v6; // ebp@7 | |
1970 signed int v10; // [sp-4h] [bp-14h]@2 | |
1971 | |
652 | 1972 |
1973 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1974 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1975 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1976 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1977 return true; | |
1978 | |
1010 | 1979 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1980 v3 = v2; |
1010 | 1981 if (v2 & 0x100 ) |
0 | 1982 { |
1983 v10 = 5; | |
1984 } | |
1985 else | |
1986 { | |
1987 if ( (v2 & 0x80u) == 0 ) | |
1988 { | |
1989 v4 = ((v2 & 0x40) != 0) + 1; | |
1990 goto LABEL_7; | |
1991 } | |
1992 v10 = 3; | |
1993 } | |
1994 v4 = v10; | |
1995 LABEL_7: | |
1996 v5 = v4 * (v3 & 0x3F); | |
1997 v6 = 0; | |
1998 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1999 return true; | |
2000 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
2001 { | |
2002 __debugbreak(); // really odd | |
2003 return true; | |
2004 } | |
2005 return false; | |
2006 } | |
2007 | |
2008 //----- (004911F3) -------------------------------------------------------- | |
2009 int Player::GetMerchant() | |
2010 { | |
2011 Player *v1; // edi@1 | |
2012 unsigned __int16 v2; // ax@1 | |
2013 unsigned __int16 v3; // bx@1 | |
2014 int v4; // esi@1 | |
2015 int v5; // edi@1 | |
2016 int v7; // eax@3 | |
2017 int v8; // ecx@7 | |
2018 signed int v9; // [sp-4h] [bp-10h]@6 | |
2019 | |
2020 v1 = this; | |
607 | 2021 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2022 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2023 v4 = v2 & 0x003F; |
1010 | 2024 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2025 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2026 return 10000; | |
2027 v7 = GetPartyReputation(); | |
2028 if ( !v4 ) | |
2029 return -v7; | |
1010 | 2030 if ( v3 & 0x100 ) |
0 | 2031 { |
2032 v9 = 5; | |
2033 } | |
2034 else | |
2035 { | |
2036 if ( (v3 & 0x80u) == 0 ) | |
2037 { | |
2038 v8 = ((v3 & 0x40) != 0) + 1; | |
2039 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2040 } | |
2041 v9 = 3; | |
2042 } | |
2043 v8 = v9; | |
2044 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2045 } | |
2046 | |
2047 //----- (0049125A) -------------------------------------------------------- | |
2048 int Player::GetPerception() | |
2049 { | |
2050 Player *v1; // edi@1 | |
2051 unsigned __int16 v2; // ax@1 | |
2052 unsigned __int16 v3; // bx@1 | |
2053 int v4; // esi@1 | |
2054 int v5; // edi@1 | |
2055 int v7; // eax@5 | |
2056 signed int v8; // [sp-4h] [bp-10h]@4 | |
2057 | |
2058 v1 = this; | |
1010 | 2059 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2060 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2061 v4 = v2 & 0x3F; |
1010 | 2062 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2063 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2064 return 10000; | |
1010 | 2065 if ( v3 & 0x100 ) |
0 | 2066 { |
2067 v8 = 5; | |
2068 } | |
2069 else | |
2070 { | |
2071 if ( (v3 & 0x80u) == 0 ) | |
2072 { | |
2073 v7 = ((v3 & 0x40) != 0) + 1; | |
2074 return v4 + v5 * (v7 - 1); | |
2075 } | |
2076 v8 = 3; | |
2077 } | |
2078 v7 = v8; | |
2079 return v4 + v5 * (v7 - 1); | |
2080 } | |
2081 | |
2082 //----- (004912B0) -------------------------------------------------------- | |
2083 int Player::GetDisarmTrap() | |
2084 { | |
2085 Player *v1; // ebp@1 | |
2086 unsigned __int16 v2; // ax@1 | |
2087 unsigned __int16 v3; // bx@1 | |
2088 int v4; // esi@1 | |
2089 int v5; // edi@1 | |
2090 int v7; // eax@7 | |
2091 signed int v8; // [sp-4h] [bp-14h]@6 | |
2092 | |
2093 v1 = this; | |
1010 | 2094 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2095 v3 = v1->pActiveSkills[29]; |
2096 v4 = v2 & 0x3F; | |
2097 v5 = v1->pActiveSkills[29] & 0x3F; | |
2098 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2099 return 10000; | |
2100 if ( HasEnchantedItemEquipped(35) ) | |
2101 v4 *= 2; | |
1010 | 2102 if ( v3 & 0x100 ) |
0 | 2103 { |
2104 v8 = 5; | |
2105 } | |
2106 else | |
2107 { | |
2108 if ( (v3 & 0x80u) == 0 ) | |
2109 { | |
2110 v7 = ((v3 & 0x40) != 0) + 1; | |
2111 return v4 + v5 * (v7 - 1); | |
2112 } | |
2113 v8 = 3; | |
2114 } | |
2115 v7 = v8; | |
2116 return v4 + v5 * (v7 - 1); | |
2117 } | |
2118 | |
2119 //----- (00491317) -------------------------------------------------------- | |
2120 char Player::GetLearningPercent() | |
2121 { | |
2122 Player *v1; // esi@1 | |
2123 int v2; // eax@1 | |
2124 unsigned __int16 v3; // bx@1 | |
2125 int v4; // ecx@1 | |
2126 int v5; // eax@4 | |
2127 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2128 | |
2129 v1 = this; | |
1010 | 2130 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2131 v3 = v1->pActiveSkills[36]; |
2132 v4 = v2 & 0x3F; | |
2133 if ( v2 ) | |
2134 { | |
1010 | 2135 if (v3 & 0x100 ) |
0 | 2136 { |
2137 v7 = 5; | |
2138 } | |
2139 else | |
2140 { | |
2141 if ( (v3 & 0x80u) == 0 ) | |
2142 { | |
2143 v5 = ((v3 & 0x40) != 0) + 1; | |
2144 goto LABEL_8; | |
2145 } | |
2146 v7 = 3; | |
2147 } | |
2148 v5 = v7; | |
2149 LABEL_8: | |
2150 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2151 } | |
2152 return v2; | |
2153 } | |
2154 | |
2155 //----- (0048C6AF) -------------------------------------------------------- | |
2156 Player::Player() | |
2157 { | |
2158 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2159 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2160 for (uint i = 0; i < 126; ++i) | |
2161 pInventoryItems[i].Reset(); | |
2162 for (uint i = 0; i < 12; ++i) | |
2163 pEquippedItems[i].Reset(); | |
2164 | |
2165 | |
2166 for (uint i = 0; i < 24; ++i) | |
2167 { | |
2168 pPlayerBuffs[i].uSkill = 0; | |
2169 pPlayerBuffs[i].uSkill = 0; | |
2170 pPlayerBuffs[i].uPower = 0; | |
2171 pPlayerBuffs[i].uExpireTime = 0; | |
2172 pPlayerBuffs[i].uCaster = 0; | |
2173 pPlayerBuffs[i].uFlags = 0; | |
2174 } | |
2175 | |
2176 pName[0] = 0; | |
1014 | 2177 uCurrentFace = 0; |
0 | 2178 uVoiceID = 0; |
2179 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2180 | |
2181 field_BB = 0; | |
2182 | |
2183 uMight = uMightBonus = 0; | |
2184 uIntelligence = uIntelligenceBonus = 0; | |
2185 uWillpower = uWillpowerBonus = 0; | |
2186 uEndurance = uEnduranceBonus = 0; | |
2187 uSpeed = uSpeedBonus = 0; | |
2188 uAccuracy = uAccuracyBonus = 0; | |
2189 uLuck = uLuckBonus = 0; | |
2190 uLevel = sLevelModifier = 0; | |
2191 sAgeModifier = 0; | |
2192 | |
1019 | 2193 // memset(field_1F5, 0, 30); |
2194 pure_luck_used=0; | |
2195 pure_speed_used=0; | |
2196 pure_intellect_used=0; | |
2197 pure_endurance_used=0; | |
2198 pure_willpower_used=0; | |
2199 pure_accuracy_used=0; | |
2200 pure_might_used=0; | |
0 | 2201 |
2202 sResFireBase = sResFireBonus = 0; | |
2203 sResAirBase = sResAirBonus = 0; | |
2204 sResWaterBase = sResWaterBonus = 0; | |
2205 sResEarthBase = sResEarthBonus = 0; | |
2206 sResMagicBase = sResMagicBonus = 0; | |
2207 sResSpiritBase = sResSpiritBonus = 0; | |
2208 sResMindBase = sResMindBonus = 0; | |
2209 sResBodyBase = sResBodyBonus = 0; | |
2210 sResLightBase = sResLightBonus = 0; | |
2211 sResDarkBase = sResDarkBonus = 0; | |
2212 | |
2213 uTimeToRecovery = 0; | |
2214 | |
2215 uSkillPoints = 0; | |
2216 | |
2217 sHealth = 0; | |
2218 uFullHealthBonus = 0; | |
2219 _health_related = 0; | |
2220 | |
2221 sMana = 0; | |
2222 uFullManaBonus = 0; | |
2223 _mana_related = 0; | |
2224 | |
2225 uQuickSpell = 0; | |
2226 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2227 | |
2228 _some_attack_bonus = 0; | |
2229 field_1A91 = 0; | |
2230 _melee_dmg_bonus = 0; | |
2231 field_1A93 = 0; | |
2232 _ranged_atk_bonus = 0; | |
2233 field_1A95 = 0; | |
2234 _ranged_dmg_bonus = 0; | |
2235 field_1A97 = 0; | |
2236 | |
130 | 2237 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2238 uExpressionTimePassed = 0; |
2239 uExpressionTimeLength = 0; | |
2240 | |
2241 uNumDivineInterventionCastsThisDay = 0; | |
2242 uNumArmageddonCasts = 0; | |
2243 uNumFireSpikeCasts = 0; | |
2244 | |
2245 memset(field_1988, 0, 49 * sizeof(int)); | |
2246 memset(field_1A50, 0, 64 * sizeof(char)); | |
2247 | |
2248 field_E0 = 0; | |
2249 field_E4 = 0; | |
2250 field_E8 = 0; | |
2251 field_EC = 0; | |
2252 field_F0 = 0; | |
2253 field_F4 = 0; | |
2254 field_F8 = 0; | |
2255 field_FC = 0; | |
2256 field_100 = 0; | |
2257 field_104 = 0; | |
198 | 2258 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2259 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2260 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2261 |
198 | 2262 lastOpenedSpellbookPage = 0; |
0 | 2263 } |
2264 | |
2265 //----- (0048C6F6) -------------------------------------------------------- | |
2266 bool Party::AddItem(ItemGen *pItem) | |
2267 { | |
2268 unsigned int v2; // eax@1 | |
2269 unsigned int v3; // ecx@4 | |
2270 signed int v4; // edx@4 | |
2271 char *v5; // eax@8 | |
973 | 2272 //unsigned int v6; // eax@10 |
0 | 2273 Texture *v7; // ebx@10 |
2274 signed int v8; // esi@10 | |
2275 Player *v9; // edi@11 | |
2276 int v10; // eax@11 | |
2277 bool result; // eax@15 | |
2278 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2279 |
2280 | |
188 | 2281 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2282 //int v16; // [sp+10h] [bp-18h]@3 | |
2283 //int v17; // [sp+14h] [bp-14h]@3 | |
2284 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2285 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2286 Party *v20; // [sp+20h] [bp-8h]@1 | |
2287 int v21; // [sp+24h] [bp-4h]@10 | |
2288 | |
2289 auto thos = this; | |
2290 | |
2291 v20 = thos; | |
2292 v2 = pItem->uItemID; | |
222 | 2293 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2294 pItem->SetIdentified(); |
188 | 2295 ///v15 = 0; |
2296 //v16 = 1; | |
2297 //v18 = 3; | |
2298 //v17 = 2; | |
0 | 2299 if ( uActiveCharacter ) |
2300 { | |
2301 v3 = uActiveCharacter - 1; | |
2302 v4 = 0; | |
2303 do | |
2304 { | |
188 | 2305 v15[v4++] = v3++; |
0 | 2306 if ( (signed int)v3 >= 4 ) |
2307 v3 = 0; | |
2308 } | |
2309 while ( v4 < 4 ); | |
2310 } | |
2311 v5 = pItemsTable->pItems[v2].pIconName; | |
2312 if ( v5 ) | |
2313 { | |
973 | 2314 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2315 v21 = areWeLoadingTexture; |
2316 v8 = 0; | |
2317 while ( 1 ) | |
2318 { | |
188 | 2319 v9 = &v20->pPlayers[v15[v8]]; |
2320 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2321 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2322 if ( v10 ) |
2323 break; | |
2324 ++v8; | |
2325 if ( v8 >= 4 ) | |
2326 { | |
2327 if ( !v21 ) | |
2328 { | |
2329 v7->Release(); | |
1006 | 2330 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2331 } |
2332 goto LABEL_15; | |
2333 } | |
2334 } | |
232 | 2335 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2336 pItem->Reset(); |
2337 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2338 v19->PlaySound(SPEECH_60, 0); |
0 | 2339 if ( !v21 ) |
2340 { | |
2341 v7->Release(); | |
1006 | 2342 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2343 } |
2344 result = 1; | |
2345 } | |
2346 else | |
2347 { | |
2348 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2349 LABEL_15: | |
2350 result = 0; | |
2351 } | |
2352 return result; | |
2353 } | |
2354 // 506128: using guessed type int areWeLoadingTexture; | |
2355 | |
2356 //----- (0048C855) -------------------------------------------------------- | |
2357 int Player::GetBaseStrength() | |
2358 { | |
2359 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2360 } | |
2361 | |
2362 //----- (0048C86C) -------------------------------------------------------- | |
2363 int Player::GetBaseIntelligence() | |
2364 { | |
2365 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2366 } | |
2367 | |
2368 //----- (0048C883) -------------------------------------------------------- | |
2369 int Player::GetBaseWillpower() | |
2370 { | |
2371 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2372 } | |
2373 | |
2374 //----- (0048C89A) -------------------------------------------------------- | |
2375 int Player::GetBaseEndurance() | |
2376 { | |
2377 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2378 } | |
2379 | |
2380 //----- (0048C8B1) -------------------------------------------------------- | |
2381 int Player::GetBaseAccuracy() | |
2382 { | |
2383 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2384 } | |
2385 | |
2386 //----- (0048C8C8) -------------------------------------------------------- | |
2387 int Player::GetBaseSpeed() | |
2388 { | |
2389 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2390 } | |
2391 | |
2392 //----- (0048C8DF) -------------------------------------------------------- | |
2393 int Player::GetBaseLuck() | |
2394 { | |
2395 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2396 } | |
2397 | |
2398 //----- (0048C8F6) -------------------------------------------------------- | |
2399 int Player::GetBaseLevel() | |
2400 { | |
2401 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2402 } | |
2403 | |
2404 //----- (0048C90D) -------------------------------------------------------- | |
2405 int Player::GetActualLevel() | |
2406 { | |
2407 return uLevel + sLevelModifier + | |
2408 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2409 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2410 } | |
2411 | |
2412 //----- (0048C93C) -------------------------------------------------------- | |
2413 int Player::GetActualMight() | |
2414 { | |
2415 Player *v1; // esi@1 | |
2416 unsigned int v2; // eax@1 | |
2417 signed int v3; // ecx@1 | |
2418 signed int v4; // ebx@4 | |
2419 int v5; // edi@5 | |
2420 int v6; // ST14_4@5 | |
2421 | |
2422 v1 = this; | |
2423 v2 = this->sAgeModifier + GetBaseAge(); | |
2424 v3 = 0; | |
2425 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2426 { | |
2427 ++v3; | |
2428 if ( v3 >= 4 ) | |
2429 { | |
2430 v4 = 100; | |
2431 goto LABEL_5; | |
2432 } | |
2433 } | |
2434 v4 = pAgeingStrengthMultiplier[v3]; | |
2435 LABEL_5: | |
2436 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2437 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2438 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2439 } | |
2440 | |
2441 //----- (0048C9C2) -------------------------------------------------------- | |
2442 int Player::GetActualIntelligence() | |
2443 { | |
2444 Player *v1; // esi@1 | |
2445 unsigned int sAge; // eax@1 | |
2446 signed int uAgeLevel; // ecx@1 | |
2447 signed int v4; // ebx@4 | |
2448 int v5; // edi@5 | |
2449 int v6; // ebp@5 | |
2450 | |
2451 v1 = this; | |
2452 sAge = this->sAgeModifier + GetBaseAge(); | |
2453 uAgeLevel = 0; | |
2454 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2455 { | |
2456 ++uAgeLevel; | |
2457 if ( uAgeLevel >= 4 ) | |
2458 { | |
2459 v4 = 100; | |
2460 goto LABEL_5; | |
2461 } | |
2462 } | |
2463 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2464 LABEL_5: | |
2465 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2466 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2467 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2468 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2469 + v6 | |
2470 + v1->uIntelligenceBonus; | |
2471 } | |
2472 | |
2473 //----- (0048CA3F) -------------------------------------------------------- | |
2474 int Player::GetActualWillpower() | |
2475 { | |
2476 int v5; // edi@5 | |
2477 | |
2478 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2479 uint uAgeingMultiplier = 100; | |
2480 for (uint i = 0; i < 4; ++i) | |
2481 if (uActualAge >= pAgeingTable[i]) | |
2482 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2483 else break; | |
2484 | |
2485 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2486 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2487 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2488 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2489 + uWillpowerBonus; | |
2490 } | |
2491 | |
2492 //----- (0048CABC) -------------------------------------------------------- | |
2493 int Player::GetActualEndurance() | |
2494 { | |
2495 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2496 uint uAgeingMultiplier = 100; | |
2497 for (uint i = 0; i < 4; ++i) | |
2498 if (uActualAge >= pAgeingTable[i]) | |
2499 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2500 else break; | |
2501 | |
2502 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2503 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2504 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2505 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2506 + uItemBonus | |
2507 + uEnduranceBonus; | |
2508 } | |
2509 | |
2510 //----- (0048CB39) -------------------------------------------------------- | |
2511 int Player::GetActualAccuracy() | |
2512 { | |
2513 Player *v1; // esi@1 | |
2514 unsigned int v2; // eax@1 | |
2515 signed int v3; // ecx@1 | |
2516 signed int v4; // ebx@4 | |
2517 int v5; // edi@5 | |
2518 int v6; // ebp@5 | |
2519 | |
2520 v1 = this; | |
2521 v2 = this->sAgeModifier + GetBaseAge(); | |
2522 v3 = 0; | |
2523 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2524 { | |
2525 ++v3; | |
2526 if ( v3 >= 4 ) | |
2527 { | |
2528 v4 = 100; | |
2529 goto LABEL_5; | |
2530 } | |
2531 } | |
2532 v4 = pAgeingAccuracyMultiplier[v3]; | |
2533 LABEL_5: | |
2534 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2535 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2536 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2537 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2538 + v6 | |
2539 + v1->uAccuracyBonus; | |
2540 } | |
2541 | |
2542 //----- (0048CBB6) -------------------------------------------------------- | |
2543 int Player::GetActualSpeed() | |
2544 { | |
2545 Player *v1; // esi@1 | |
2546 unsigned int v2; // eax@1 | |
2547 signed int v3; // ecx@1 | |
2548 signed int v4; // ebx@4 | |
2549 int v5; // edi@5 | |
2550 int v6; // ebp@5 | |
2551 | |
2552 v1 = this; | |
2553 v2 = this->sAgeModifier + GetBaseAge(); | |
2554 v3 = 0; | |
2555 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2556 { | |
2557 ++v3; | |
2558 if ( v3 >= 4 ) | |
2559 { | |
2560 v4 = 100; | |
2561 goto LABEL_5; | |
2562 } | |
2563 } | |
2564 v4 = pAgeingSpeedMultiplier[v3]; | |
2565 LABEL_5: | |
2566 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2567 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2568 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2569 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2570 + v6 | |
2571 + v1->uSpeedBonus; | |
2572 } | |
2573 | |
2574 //----- (0048CC33) -------------------------------------------------------- | |
2575 int Player::GetActualLuck() | |
2576 { | |
1036 | 2577 signed int curr_age; // eax@7 |
2578 signed int i; // ecx@7 | |
2579 signed int age_luck_pc; // ebx@10 | |
2580 int condition_luck_pc; // edi@11 | |
2581 int items_luck_bonus; // ebp@11 | |
2582 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2583 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2584 int full_luck; | |
2585 | |
2586 npc_luck_bonus = 0; | |
652 | 2587 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 2588 npc_luck_bonus = 5; |
652 | 2589 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 2590 npc_luck_bonus += 20; |
652 | 2591 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 2592 npc_luck_bonus += 10; |
2593 curr_age = sAgeModifier + GetBaseAge(); | |
2594 i = 0; | |
2595 while ( curr_age >= pAgeingTable[i] ) | |
2596 { | |
2597 ++i; | |
2598 if ( i >= 4 ) | |
2599 break; | |
2600 } | |
2601 if (i < 4) | |
2602 age_luck_pc = pAgeingLuckMultiplier[i]; | |
2603 else | |
2604 age_luck_pc = 100; | |
2605 | |
2606 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2607 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2608 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); | |
2609 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus | |
2610 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; | |
2611 return full_luck; | |
0 | 2612 } |
2613 | |
2614 //----- (0048CCF5) -------------------------------------------------------- | |
2615 int Player::GetActualAttack(int a2) | |
2616 { | |
2617 Player *v2; // esi@1 | |
2618 int v3; // eax@1 | |
2619 int v4; // edi@1 | |
2620 int v5; // ebx@1 | |
2621 int v6; // ebp@1 | |
2622 | |
2623 v2 = this; | |
2624 v3 = GetActualAccuracy(); | |
1036 | 2625 v4 = GetParameterBonus(v3); |
0 | 2626 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
2627 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2628 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2629 } | |
2630 | |
2631 //----- (0048CD45) -------------------------------------------------------- | |
2632 int Player::GetMeleeDamageMinimal() | |
2633 { | |
2634 Player *v1; // edi@1 | |
2635 int v2; // eax@1 | |
2636 int v3; // esi@1 | |
2637 int v4; // esi@1 | |
2638 int v5; // esi@1 | |
2639 int v6; // esi@1 | |
2640 signed int result; // eax@1 | |
2641 | |
1036 | 2642 |
0 | 2643 v2 = GetActualMight(); |
1036 | 2644 v3 = GetParameterBonus(v2); |
0 | 2645 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
2646 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 2647 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
2648 if ( result < 1 ) | |
2649 result = 1; | |
0 | 2650 return result; |
2651 } | |
2652 | |
2653 //----- (0048CD90) -------------------------------------------------------- | |
2654 int Player::GetMeleeDamageMaximal() | |
2655 { | |
2656 Player *v1; // edi@1 | |
2657 int v2; // eax@1 | |
2658 int v3; // esi@1 | |
2659 int v4; // esi@1 | |
2660 int v5; // esi@1 | |
2661 int v6; // esi@1 | |
2662 signed int result; // eax@1 | |
2663 | |
2664 v1 = this; | |
2665 v2 = GetActualMight(); | |
1036 | 2666 v3 = GetParameterBonus(v2); |
0 | 2667 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
2668 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2669 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2670 result = 1; | |
2671 if ( v6 >= 1 ) | |
2672 result = v6; | |
2673 return result; | |
2674 } | |
2675 | |
2676 //----- (0048CDDB) -------------------------------------------------------- | |
2677 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2678 { | |
2679 int v4; // esi@1 | |
2680 Player *v5; // edi@1 | |
2681 ItemGen *v6; // ebx@4 | |
2682 unsigned int v7; // ebp@4 | |
2683 unsigned int v8; // esi@4 | |
2684 int v9; // eax@4 | |
2685 int v10; // eax@9 | |
2686 char v11; // zf@9 | |
2687 int v12; // esi@10 | |
2688 int v13; // eax@11 | |
2689 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2690 ItemGen *v15; // ebx@35 | |
2691 unsigned int v16; // ebp@35 | |
2692 unsigned int v17; // esi@35 | |
2693 int v18; // edx@38 | |
2694 int v19; // eax@40 | |
2695 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2696 int v21; // esi@62 | |
2697 int v22; // eax@63 | |
2698 int v23; // ebx@63 | |
2699 int v24; // ebx@63 | |
2700 signed int result; // eax@64 | |
2701 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2702 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2703 int v28; // [sp+10h] [bp-10h]@1 | |
2704 int v29; // [sp+10h] [bp-10h]@33 | |
2705 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2706 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2707 int v32; // [sp+18h] [bp-8h]@1 | |
2708 int v33; // [sp+18h] [bp-8h]@8 | |
2709 int v34; // [sp+1Ch] [bp-4h]@1 | |
2710 int v35; // [sp+28h] [bp+8h]@37 | |
2711 | |
2712 v4 = 0; | |
2713 v5 = this; | |
2714 v34 = 0; | |
2715 v32 = 0; | |
2716 v28 = 0; | |
2717 if ( IsUnarmed() == 1 ) | |
2718 { | |
2719 v32 = rand() % 3 + 1; | |
2720 LABEL_61: | |
2721 v34 = v4; | |
2722 goto LABEL_62; | |
2723 } | |
816 | 2724 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2725 { |
232 | 2726 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2727 v7 = v6->uItemID; |
2728 v8 = v6->uItemID; | |
2729 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2730 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2731 ++v9; |
2732 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2733 if ( v9 > 0 ) | |
2734 { | |
2735 v33 = v9; | |
2736 do | |
2737 { | |
2738 v10 = rand(); | |
2739 v11 = v33-- == 1; | |
2740 v28 += v10 % v30 + 1; | |
2741 } | |
2742 while ( !v11 ); | |
2743 } | |
2744 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2745 if ( !uTargetActorID ) | |
2746 goto LABEL_28; | |
377 | 2747 v13 = v6->uSpecEnchantmentType; |
0 | 2748 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2749 { | |
2750 v14 = (MONSTER_SUPERTYPE)1; | |
2751 } | |
2752 else | |
2753 { | |
2754 if ( v13 == 39 ) | |
2755 { | |
2756 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2757 } | |
2758 else | |
2759 { | |
2760 if ( v13 == 40 ) | |
2761 { | |
2762 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2763 } | |
2764 else | |
2765 { | |
2766 if ( v13 == 63 || v7 == 517 ) | |
2767 { | |
2768 v26 = MONSTER_SUPERTYPE_ELF; | |
2769 } | |
2770 else | |
2771 { | |
2772 if ( v13 != 65 ) | |
2773 { | |
2774 LABEL_28: | |
2775 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2776 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2777 && rand() % 100 < 10 ) | |
2778 v12 *= 3; | |
2779 v32 = v12; | |
2780 goto LABEL_33; | |
2781 } | |
2782 v26 = MONSTER_SUPERTYPE_TITAN; | |
2783 } | |
2784 } | |
2785 } | |
2786 v14 = v26; | |
2787 } | |
2788 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2789 v12 *= 2; | |
2790 goto LABEL_28; | |
2791 } | |
2792 LABEL_33: | |
2793 v29 = 0; | |
2794 if ( !a3 ) | |
2795 { | |
2796 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2797 { | |
898 | 2798 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2799 v16 = v15->uItemID; |
2800 v17 = v15->uItemID; | |
2801 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2802 { | |
2803 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2804 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2805 { | |
2806 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2807 do | |
2808 { | |
2809 v18 = rand() % v31; | |
2810 v11 = v35-- == 1; | |
2811 v29 += v18 + 1; | |
2812 } | |
2813 while ( !v11 ); | |
2814 } | |
2815 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2816 if ( !uTargetActorID ) | |
2817 goto LABEL_57; | |
377 | 2818 v19 = v15->uSpecEnchantmentType; |
0 | 2819 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2820 { | |
2821 v20 = (MONSTER_SUPERTYPE)1; | |
2822 } | |
2823 else | |
2824 { | |
2825 if ( v19 == 39 ) | |
2826 { | |
2827 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2828 } | |
2829 else | |
2830 { | |
2831 if ( v19 == 40 ) | |
2832 { | |
2833 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2834 } | |
2835 else | |
2836 { | |
2837 if ( v19 == 63 || v16 == 517 ) | |
2838 { | |
2839 v27 = MONSTER_SUPERTYPE_ELF; | |
2840 } | |
2841 else | |
2842 { | |
2843 if ( v19 != 65 ) | |
2844 { | |
2845 LABEL_57: | |
2846 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2847 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2848 && rand() % 100 < 10 ) | |
2849 v4 *= 3; | |
2850 goto LABEL_61; | |
2851 } | |
2852 v27 = MONSTER_SUPERTYPE_TITAN; | |
2853 } | |
2854 } | |
2855 } | |
2856 v20 = v27; | |
2857 } | |
2858 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2859 v4 *= 2; | |
2860 goto LABEL_57; | |
2861 } | |
2862 } | |
2863 } | |
2864 LABEL_62: | |
2865 v21 = v32 + v34; | |
2866 if ( !a2 ) | |
2867 { | |
2868 v22 = GetActualMight(); | |
1036 | 2869 v23 = GetParameterBonus(v22); |
0 | 2870 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; |
2871 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2872 } | |
2873 result = 1; | |
2874 if ( v21 >= 1 ) | |
2875 result = v21; | |
2876 return result; | |
2877 } | |
2878 | |
2879 //----- (0048D0B9) -------------------------------------------------------- | |
2880 int Player::GetRangedAttack() | |
2881 { | |
2882 Player *v1; // esi@1 | |
2883 int v2; // eax@1 | |
2884 int v3; // edi@3 | |
2885 int v4; // eax@4 | |
2886 int v5; // edi@4 | |
2887 int v6; // edi@4 | |
2888 int v7; // edi@4 | |
2889 | |
2890 v1 = this; | |
232 | 2891 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2892 if ( v2 < 64 || v2 > 65 ) |
2893 { | |
2894 v4 = GetActualAccuracy(); | |
1036 | 2895 v5 = GetParameterBonus(v4); |
0 | 2896 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
2897 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2898 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2899 } | |
2900 else | |
2901 { | |
2902 v3 = GetActualAttack(1); | |
2903 } | |
2904 return v3; | |
2905 } | |
2906 | |
2907 //----- (0048D124) -------------------------------------------------------- | |
2908 int Player::GetRangedDamageMin() | |
2909 { | |
2910 Player *v1; // esi@1 | |
2911 int v2; // edi@1 | |
2912 int v3; // edi@1 | |
2913 int v4; // edi@1 | |
2914 unsigned __int16 v5; // ax@1 | |
2915 int result; // eax@6 | |
2916 | |
2917 v1 = this; | |
1040 | 2918 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
2919 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2920 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2921 v5 = v1->pActiveSkills[5]; |
2922 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2923 v4 += v1->pActiveSkills[5] & 0x3F; | |
2924 if ( v4 >= 1 ) | |
2925 result = v4; | |
2926 else | |
2927 result = 0; | |
2928 return result; | |
2929 } | |
2930 | |
2931 //----- (0048D191) -------------------------------------------------------- | |
2932 int Player::GetRangedDamageMax() | |
2933 { | |
2934 Player *v1; // esi@1 | |
2935 int v2; // edi@1 | |
2936 int v3; // edi@1 | |
2937 int v4; // edi@1 | |
2938 unsigned __int16 v5; // ax@1 | |
2939 int result; // eax@6 | |
2940 | |
2941 v1 = this; | |
1040 | 2942 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
2943 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2944 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2945 v5 = v1->pActiveSkills[5]; |
2946 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2947 v4 += v1->pActiveSkills[5] & 0x3F; | |
2948 if ( v4 >= 1 ) | |
2949 result = v4; | |
2950 else | |
2951 result = 0; | |
2952 return result; | |
2953 } | |
2954 | |
2955 //----- (0048D1FE) -------------------------------------------------------- | |
2956 bool Player::CalculateRangedDamageTo(int a2) | |
2957 { | |
2958 Player *v2; // ebx@1 | |
2959 bool result; // eax@1 | |
2960 ItemGen *v4; // ebx@2 | |
2961 unsigned int v5; // edi@2 | |
2962 unsigned int v6; // esi@2 | |
2963 int v7; // edx@4 | |
2964 char v8; // zf@4 | |
2965 int v9; // esi@5 | |
2966 int v10; // ebx@6 | |
2967 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2968 unsigned __int16 v12; // ax@19 | |
2969 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2970 Player *v14; // [sp+4h] [bp-10h]@1 | |
2971 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2972 int v16; // [sp+Ch] [bp-8h]@3 | |
2973 int v17; // [sp+10h] [bp-4h]@1 | |
2974 | |
2975 v17 = 0; | |
2976 v2 = this; | |
2977 v14 = this; | |
2978 result = HasItemEquipped(EQUIP_BOW); | |
2979 if ( !result ) | |
2980 return result; | |
232 | 2981 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2982 v5 = v4->uItemID; |
2983 v6 = v4->uItemID; | |
2984 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2985 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2986 { | |
2987 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2988 do | |
2989 { | |
2990 v7 = rand() % v15; | |
2991 v8 = v16-- == 1; | |
2992 v17 += v7 + 1; | |
2993 } | |
2994 while ( !v8 ); | |
2995 } | |
2996 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2997 if ( a2 ) | |
2998 { | |
377 | 2999 v10 = v4->uSpecEnchantmentType; |
0 | 3000 if ( v10 == 64 ) |
3001 { | |
3002 v11 = (MONSTER_SUPERTYPE)1; | |
3003 goto LABEL_17; | |
3004 } | |
3005 if ( v10 == 39 || v5 == 508 ) | |
3006 { | |
3007 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
3008 goto LABEL_16; | |
3009 } | |
3010 if ( v10 == 40 ) | |
3011 { | |
3012 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3013 goto LABEL_16; | |
3014 } | |
3015 if ( v10 == 63 || v5 == 517 ) | |
3016 { | |
3017 v13 = MONSTER_SUPERTYPE_ELF; | |
3018 LABEL_16: | |
3019 v11 = v13; | |
3020 LABEL_17: | |
3021 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3022 v9 *= 2; | |
3023 goto LABEL_19; | |
3024 } | |
3025 } | |
3026 LABEL_19: | |
3027 v12 = v14->pActiveSkills[5]; | |
3028 if ( v12 ) | |
3029 { | |
3030 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3031 v9 += v14->pActiveSkills[5] & 0x3F; | |
3032 } | |
3033 return v9; | |
3034 } | |
3035 | |
3036 //----- (0048D2EA) -------------------------------------------------------- | |
3037 char *Player::GetMeleeDamageString() | |
3038 { | |
1036 | 3039 signed int itemid; // eax@1 |
3040 int min_damage; // edi@3 | |
3041 int max_damage; // eax@3 | |
0 | 3042 |
3043 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3044 | |
1036 | 3045 if ( pEquipment.uMainHand) |
3046 { | |
3047 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3048 if ( itemid < 64 || itemid > 65 ) //blasters | |
3049 { | |
3050 min_damage = GetMeleeDamageMinimal(); | |
3051 max_damage = GetMeleeDamageMaximal(); | |
3052 } | |
3053 else | |
3054 { //for blasters | |
3055 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3056 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3057 } | |
3058 if ( max_damage ) | |
3059 { | |
3060 if ( min_damage == max_damage ) | |
3061 { | |
3062 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
3063 } | |
3064 else | |
3065 { | |
3066 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3067 } | |
3068 } | |
3069 else | |
3070 { | |
3071 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
3072 } | |
3073 | |
3074 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3075 { | |
3076 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3077 } | |
3078 } | |
0 | 3079 else |
1036 | 3080 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
3081 return player__getmeleedamagestring_static_buff; | |
0 | 3082 } |
3083 | |
3084 //----- (0048D396) -------------------------------------------------------- | |
3085 char *Player::GetRangedDamageString() | |
1036 | 3086 { |
3087 signed int itemid; // eax@1 | |
3088 int min_damage; // edi@3 | |
3089 int max_damage; // eax@3 | |
3090 | |
3091 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3092 if ( pEquipment.uMainHand) | |
3093 { | |
3094 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3095 if ( itemid < 64 || itemid > 65 ) //blasters | |
3096 { | |
3097 min_damage = GetRangedDamageMin(); | |
3098 max_damage = GetRangedDamageMax(); | |
3099 } | |
3100 else | |
3101 { //for blasters | |
3102 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3103 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3104 } | |
3105 if ( max_damage ) | |
3106 { | |
3107 if ( min_damage == max_damage ) | |
3108 { | |
3109 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); | |
3110 } | |
3111 else | |
3112 { | |
3113 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3114 } | |
3115 } | |
3116 else | |
3117 { | |
3118 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3119 } | |
3120 | |
3121 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3122 { | |
3123 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3124 } | |
3125 } | |
0 | 3126 else |
1036 | 3127 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
3128 return player__getrangeddamagestring_static_buff; | |
3129 } | |
0 | 3130 |
3131 //----- (0048D45A) -------------------------------------------------------- | |
3132 bool Player::CanTrainToNextLevel() | |
3133 { | |
3134 int v1; // edx@1 | |
3135 int v2; // eax@1 | |
3136 int i; // esi@1 | |
3137 | |
3138 v1 = this->uLevel; | |
3139 v2 = 0; | |
3140 for ( i = 0; i < v1; ++i ) | |
3141 v2 += i + 1; | |
3142 return (signed __int64)this->uExperience >= 1000 * v2; | |
3143 } | |
3144 | |
3145 //----- (0048D498) -------------------------------------------------------- | |
3146 unsigned int Player::GetExperienceDisplayColor() | |
3147 { | |
3148 unsigned int result; // eax@2 | |
3149 | |
3150 if ( CanTrainToNextLevel() ) | |
995 | 3151 result = ui_character_bonus_text_color; |
0 | 3152 else |
995 | 3153 result = ui_character_default_text_color; |
0 | 3154 return result; |
3155 } | |
3156 | |
3157 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 3158 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
3159 { | |
3160 | |
3161 int resist_value; // edi@8 | |
3162 int player_luck; // eax@21 | |
3163 signed int res_rand_divider; // ebx@2 | |
3164 int armor_skill; // eax@29 | |
3165 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
3166 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
3167 | |
3168 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
3169 switch(dmg_type) | |
3170 { | |
3171 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
3172 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
3173 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
3174 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
3175 | |
3176 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
3177 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
3178 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
3179 } | |
3180 if (player_resist) | |
3181 resist_value = GetActualResistance(player_resist); | |
3182 else | |
3183 resist_value = 0; | |
3184 | |
3185 result_amount_dmg = amount; | |
3186 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 3187 return 0; |
1036 | 3188 player_luck = GetActualLuck(); |
3189 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
3190 | |
3191 if ( resist_value ) | |
3192 { | |
3193 if ( rand() % res_rand_divider >= 30 ) | |
3194 { | |
3195 result_amount_dmg = amount >> 1; | |
3196 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3197 { |
1036 | 3198 result_amount_dmg = amount >> 2; |
3199 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3200 { |
1036 | 3201 result_amount_dmg = amount >> 3; |
3202 if ( rand() % res_rand_divider >= 30 ) | |
3203 result_amount_dmg = amount >> 4; | |
0 | 3204 } |
3205 } | |
3206 } | |
3207 } | |
1036 | 3208 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
3209 { | |
3210 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 3211 { |
1036 | 3212 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
3213 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 3214 { |
1036 | 3215 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
3216 return (int)(double)result_amount_dmg * 0.5; | |
0 | 3217 } |
1036 | 3218 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 3219 { |
1036 | 3220 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
3221 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 3222 } |
3223 } | |
1036 | 3224 } |
3225 return result_amount_dmg; | |
0 | 3226 } |
3227 | |
3228 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3229 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3230 { | |
3231 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3232 } |
3233 | |
3234 //----- (0048D651) -------------------------------------------------------- | |
816 | 3235 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3236 { | |
3237 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3238 } |
3239 | |
3240 //----- (0048D676) -------------------------------------------------------- | |
3241 bool Player::IsUnarmed() | |
3242 { | |
1091 | 3243 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
3244 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3245 } |
3246 | |
3247 //----- (0048D6AA) -------------------------------------------------------- | |
3248 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3249 { | |
3250 auto i = pEquipment.pIndices[uEquipIndex]; | |
3251 if (i) | |
1080 | 3252 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 3253 else |
3254 return false; | |
0 | 3255 } |
3256 | |
3257 //----- (0048D6D0) -------------------------------------------------------- | |
3258 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3259 { | |
3260 for (uint i = 0; i < 16; ++i) | |
3261 { | |
3262 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 3263 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 3264 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3265 return true; | |
3266 } | |
3267 return false; | |
3268 } | |
3269 | |
3270 //----- (0048D709) -------------------------------------------------------- | |
1080 | 3271 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
3272 { | |
1010 | 3273 |
0 | 3274 int v6; // esi@5 |
3275 | |
1080 | 3276 if ( equip_type >= 16 ) |
0 | 3277 { |
3278 v6 = 0; | |
3279 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1091 | 3280 || pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 3281 { |
3282 ++v6; | |
3283 if ( (signed int)v6 >= 16 ) | |
3284 return 0; | |
3285 } | |
3286 return 1; | |
3287 } | |
1080 | 3288 if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 3289 return 1; |
3290 return 0; | |
3291 } | |
3292 | |
3293 //----- (0048D76C) -------------------------------------------------------- | |
3294 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3295 { | |
3296 unsigned __int16 v6; // cx@8 | |
3297 int v7; // edi@8 | |
3298 unsigned int v8; // ebx@8 | |
3299 unsigned int v9; // esi@8 | |
3300 int v10; // eax@8 | |
3301 int v11; // edi@12 | |
3302 bool result; // eax@13 | |
3303 | |
3304 if ( !a2 | |
3305 || this->pConditions[16] | |
3306 || this->pConditions[14] | |
3307 || this->pConditions[15] | |
3308 || this->pConditions[4] | |
3309 || this->pConditions[13] | |
3310 || this->pConditions[2] ) | |
3311 { | |
3312 result = 0; | |
3313 } | |
3314 else | |
3315 { | |
3316 v6 = this->pActiveSkills[34]; | |
3317 v7 = v6 & 0x3F; | |
3318 v8 = SkillToMastery(v6); | |
3319 v9 = a2->GetValue(); | |
3320 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3321 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3322 v9 *= 3; | |
3323 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3324 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3325 if ( rand() % 100 >= 5 ) | |
3326 { | |
3327 if ( *a6 > v11 ) | |
3328 result = *a6 - v11 < 500; | |
3329 else | |
3330 result = 2; | |
3331 } | |
3332 else | |
3333 { | |
3334 result = 0; | |
3335 } | |
3336 } | |
3337 return result; | |
3338 } | |
3339 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3340 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3341 | |
3342 //----- (0048D88B) -------------------------------------------------------- | |
3343 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3344 { | |
3345 Player *v4; // esi@1 | |
3346 Actor *v5; // edi@1 | |
3347 unsigned __int16 v6; // cx@10 | |
3348 int v7; // ebx@10 | |
3349 unsigned int v8; // esi@10 | |
3350 int v9; // eax@10 | |
3351 int v10; // esi@10 | |
3352 int v11; // eax@13 | |
3353 signed int v12; // ebx@15 | |
3354 signed int v13; // edx@15 | |
3355 int v14; // ecx@15 | |
3356 unsigned __int16 v15; // si@21 | |
3357 unsigned int v16; // ebx@24 | |
3358 int v17; // esi@24 | |
3359 const void *v18; // eax@29 | |
3360 unsigned int v19; // esi@31 | |
3361 int v20; // eax@34 | |
3362 char v21; // zf@36 | |
3363 unsigned int v22; // ST0C_4@39 | |
3364 char *v23; // esi@39 | |
3365 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3366 int v26; // [sp-8h] [bp-44h]@40 | |
3367 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3368 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3369 int v29; // [sp+30h] [bp-Ch]@10 | |
3370 int v30; // [sp+34h] [bp-8h]@10 | |
3371 Player *v31; // [sp+38h] [bp-4h]@1 | |
3372 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3373 | |
3374 v4 = this; | |
3375 v5 = &pActors[uActorID]; | |
3376 v31 = this; | |
3377 if ( &pActors[uActorID] | |
3378 && !this->pConditions[16] | |
3379 && !this->pConditions[14] | |
3380 && !this->pConditions[15] | |
3381 && !this->pConditions[4] | |
3382 && !this->pConditions[13] | |
3383 && !this->pConditions[2] ) | |
3384 { | |
3385 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3386 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3387 v6 = v4->pActiveSkills[34]; | |
3388 v7 = v6 & 0x3F; | |
3389 v8 = SkillToMastery(v6); | |
3390 v9 = rand(); | |
3391 v28 = 4 * v8; | |
3392 v30 = dword_4EDEA0[v8]; | |
3393 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3394 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3395 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3396 { | |
322 | 3397 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3398 _steal_perma = 0; |
3399 v26 = (int)v31->pName; | |
3400 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3401 } | |
3402 else | |
3403 { | |
3404 v11 = rand(); | |
3405 if ( v11 % 100 >= 40 ) | |
3406 { | |
3407 if ( v11 % 100 >= 70 ) | |
3408 { | |
3409 v19 = 0; | |
3410 if ( v7 > 0 ) | |
3411 { | |
3412 do | |
3413 { | |
3414 --v7; | |
3415 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3416 } | |
3417 while ( v7 ); | |
3418 } | |
3419 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3420 return _steal_perma; | |
377 | 3421 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3422 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3423 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3424 v21 = *(int *)v20 == v19; |
3425 *(int *)v20 -= v19; | |
3426 if ( v21 ) | |
3427 v5->array_000234[3].uItemID = 0; | |
3428 if ( v19 ) | |
3429 { | |
3430 party_finds_gold(v19, 2); | |
3431 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3432 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3433 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 3434 LABEL_43: |
3435 ShowStatusBarString(v23, 2u); | |
3436 return _steal_perma; | |
3437 } | |
3438 } | |
3439 else | |
3440 { | |
3441 v27.Reset(); | |
3442 v12 = 0; | |
3443 v13 = 0; | |
3444 v14 = (int)v5->array_000234; | |
3445 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3446 { | |
3447 ++v13; | |
3448 v14 += 36; | |
3449 if ( v13 >= 4 ) | |
3450 goto LABEL_21; | |
3451 } | |
3452 v12 = 1; | |
3453 LABEL_21: | |
3454 v15 = v5->uCarriedItemID; | |
3455 if ( v15 || v12 ) | |
3456 { | |
3457 v27.Reset(); | |
3458 if ( v15 ) | |
3459 { | |
3460 v16 = (signed __int16)v15; | |
3461 v5->uCarriedItemID = 0; | |
3462 v27.uItemID = (signed __int16)v15; | |
3463 v17 = (signed __int16)v15; | |
3464 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3465 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3466 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3467 { | |
3468 if ( v16 != 220 ) | |
570 | 3469 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3470 } |
3471 } | |
3472 else | |
3473 { | |
3474 v18 = &v5->array_000234[rand() % 4]; | |
3475 memcpy(&v27, v18, sizeof(v27)); | |
3476 ((ItemGen *)v18)->Reset(); | |
3477 v16 = v27.uItemID; | |
3478 } | |
3479 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3480 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3481 pTmpBuf2.data(), |
0 | 3482 pGlobalTXT_LocalizationStrings[304], |
3483 v31->pName, | |
3484 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3485 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 3486 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
3487 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3488 pMouse->SetCursorBitmapFromItemID(v16); | |
3489 return _steal_perma; | |
3490 } | |
3491 } | |
3492 } | |
3493 v26 = (int)v31->pName; | |
3494 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3495 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3496 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3497 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 3498 goto LABEL_43; |
3499 } | |
3500 return 0; | |
3501 } | |
3502 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3503 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3504 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3505 | |
3506 //----- (0048DBB9) -------------------------------------------------------- | |
3507 void Player::Heal(int amount) | |
3508 { | |
1010 | 3509 signed int max_health; // eax@3 |
3510 | |
3511 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3512 { | |
3513 max_health = GetMaxHealth(); | |
3514 if ( pConditions[Condition_Zombie] ) | |
3515 max_health /= 2; | |
3516 sHealth += amount; | |
3517 if ( sHealth > max_health ) | |
3518 sHealth = max_health; | |
3519 if ( pConditions[Condition_Unconcious] ) | |
3520 { | |
3521 if ( sHealth > 0 ) | |
3522 { | |
3523 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3524 } |
3525 } | |
3526 } | |
3527 } | |
3528 | |
3529 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 3530 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
3531 { | |
3532 signed int recieved_dmg; // eax@1 | |
3533 unsigned int armor_indx; // eax@8 | |
3534 bool broke_armor; | |
3535 | |
3536 pConditions[Condition_Sleep] = 0i64; | |
3537 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
3538 sHealth -= recieved_dmg; | |
3539 broke_armor = sHealth <= -10; | |
3540 if ( sHealth < 1 ) // | |
3541 { | |
3542 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
3543 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 3544 { |
1019 | 3545 SetCondition(Condition_Unconcious, 0); |
0 | 3546 } |
3547 else | |
3548 { | |
1019 | 3549 SetCondition(Condition_Dead, 0); |
1036 | 3550 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
3551 if ( sHealth > 0 ) | |
3552 sHealth = 0; | |
3553 } | |
3554 if (broke_armor ) | |
3555 { | |
3556 armor_indx = pEquipment.uArmor; | |
3557 if ( armor_indx ) | |
0 | 3558 { |
1036 | 3559 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 3560 { |
1036 | 3561 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 3562 } |
3563 } | |
3564 } | |
3565 } | |
1036 | 3566 if ( recieved_dmg && CanAct() ) |
187 | 3567 PlaySound(SPEECH_24, 0); |
1036 | 3568 return recieved_dmg; |
0 | 3569 } |
3570 | |
3571 //----- (0048DCF6) -------------------------------------------------------- | |
3572 int Player::_48DCF6(int a2, Actor *pActor) | |
3573 { | |
3574 signed int v3; // edi@1 | |
3575 signed int v4; // ebx@1 | |
3576 Player *v5; // esi@1 | |
3577 int v6; // eax@2 | |
3578 int v7; // eax@5 | |
3579 int v8; // eax@8 | |
3580 int v9; // ebx@8 | |
3581 int v10; // eax@8 | |
3582 int v11; // ebx@8 | |
3583 signed int v12; // edx@9 | |
3584 ItemGen *v13; // eax@9 | |
3585 int v14; // edx@16 | |
3586 unsigned int v15; // edx@17 | |
3587 int v16; // edx@26 | |
3588 unsigned int v17; // edx@27 | |
3589 signed int v19; // edx@38 | |
3590 int *v20; // ecx@38 | |
3591 signed int v21; // eax@40 | |
3592 int v22; // eax@49 | |
3593 signed int v23; // ebx@49 | |
3594 unsigned int v24; // eax@60 | |
3595 int v25; // ecx@61 | |
3596 int v26; // ebx@74 | |
3597 void *v27; // ecx@76 | |
3598 unsigned int v28; // ebx@78 | |
3599 signed int result; // eax@86 | |
3600 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3601 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3602 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3603 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3604 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3605 int v35; // [sp-Ch] [bp-ACh]@56 | |
3606 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3607 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3608 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3609 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3610 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3611 int v41; // [sp-4h] [bp-A4h]@51 | |
3612 int v42; // [sp-4h] [bp-A4h]@56 | |
3613 int v43; // [sp-4h] [bp-A4h]@57 | |
3614 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3615 int v45; // [sp-4h] [bp-A4h]@68 | |
3616 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3617 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3618 int v48; // [sp+9Ch] [bp-4h]@1 | |
3619 | |
3620 v3 = 0; | |
3621 v4 = 0; | |
3622 v5 = this; | |
3623 v47 = 0; | |
3624 v48 = 0; | |
3625 switch ( a2 ) | |
3626 { | |
3627 case 1: | |
3628 v6 = GetActualWillpower(); | |
3629 goto LABEL_46; | |
3630 case 2: | |
3631 case 3: | |
3632 case 4: | |
3633 case 9: | |
3634 case 10: | |
3635 case 11: | |
3636 case 13: | |
3637 case 21: | |
3638 v6 = GetActualEndurance(); | |
3639 goto LABEL_46; | |
3640 case 5: | |
3641 case 12: | |
3642 case 23: | |
3643 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3644 goto LABEL_5; | |
3645 case 15: | |
3646 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3647 goto LABEL_5; | |
3648 case 6: | |
3649 case 7: | |
3650 case 8: | |
3651 case 14: | |
3652 case 16: | |
3653 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3654 LABEL_5: | |
3655 v7 = GetActualResistance(v40); | |
3656 goto LABEL_47; | |
3657 case 22: | |
3658 v8 = GetActualWillpower(); | |
1036 | 3659 v9 = GetParameterBonus(v8); |
0 | 3660 v10 = GetActualIntelligence(); |
1036 | 3661 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 3662 break; |
3663 case 17: | |
3664 v12 = 0; | |
3665 v13 = this->pInventoryItems; | |
3666 do | |
3667 { | |
315 | 3668 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3669 v46[v4++] = v12; |
3670 ++v12; | |
3671 ++v13; | |
3672 } | |
3673 while ( v12 < 138 ); | |
3674 goto LABEL_36; | |
3675 case 18: | |
3676 v14 = 0; | |
3677 do | |
3678 { | |
3679 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3680 { | |
816 | 3681 if ( v15 == EQUIP_ARMOUR ) |
898 | 3682 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3683 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3684 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3685 } |
3686 v14 = v15 + 1; | |
3687 } | |
3688 while ( v14 < 16 ); | |
3689 goto LABEL_36; | |
3690 case 19: | |
3691 v16 = 0; | |
3692 do | |
3693 { | |
3694 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3695 { | |
3696 if ( v17 == 2 ) | |
3697 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3698 if ( (!v17 || v17 == 1) | |
816 | 3699 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3700 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3701 } |
3702 v16 = v17 + 1; | |
3703 } | |
3704 while ( v16 < 16 ); | |
3705 LABEL_36: | |
3706 if ( !v4 ) | |
3707 goto LABEL_87; | |
3708 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3709 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3710 break; | |
3711 case 20: | |
3712 v19 = 0; | |
3713 v20 = this->pInventoryIndices; | |
3714 do | |
3715 { | |
3716 if ( *v20 > 0 ) | |
3717 { | |
232 | 3718 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3719 if ( v21 > 0 ) |
3720 { | |
3721 if ( v21 <= 134 ) | |
3722 v46[v4++] = v19; | |
3723 } | |
3724 } | |
3725 ++v19; | |
3726 ++v20; | |
3727 } | |
3728 while ( v19 < 126 ); | |
3729 if ( !v4 ) | |
3730 goto LABEL_87; | |
3731 v47 = (unsigned __int8)v46[rand() % v4]; | |
3732 v6 = GetActualAccuracy(); | |
3733 LABEL_46: | |
1036 | 3734 v7 = GetParameterBonus(v6); |
0 | 3735 LABEL_47: |
3736 v11 = v7; | |
3737 break; | |
3738 default: | |
3739 v11 = 0; | |
3740 break; | |
3741 } | |
3742 v22 = GetActualLuck(); | |
1036 | 3743 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 3744 if ( rand() % v23 >= 30 ) |
3745 { | |
3746 LABEL_87: | |
3747 result = 0; | |
3748 } | |
3749 else | |
3750 { | |
3751 switch ( a2 ) | |
3752 { | |
3753 case 1: | |
3754 v41 = 1; | |
3755 v36 = 0; | |
3756 goto LABEL_56; | |
3757 case 2: | |
3758 v41 = 1; | |
3759 v36 = 1; | |
3760 goto LABEL_56; | |
3761 case 3: | |
3762 v41 = 1; | |
3763 v36 = 2; | |
3764 goto LABEL_56; | |
3765 case 23: | |
3766 v41 = 1; | |
3767 v36 = 3; | |
3768 goto LABEL_56; | |
3769 case 4: | |
3770 v41 = 1; | |
3771 v36 = 4; | |
3772 LABEL_56: | |
3773 SetCondition(v36, v41); | |
3774 v42 = 0; | |
3775 v37 = 0; | |
3776 v35 = 0; | |
3777 v34 = 0; | |
3778 v33 = -1; | |
3779 v32 = 0; | |
3780 v31 = 0; | |
3781 v30 = (SoundID)221; | |
3782 goto LABEL_83; | |
3783 case 5: | |
3784 v43 = 1; | |
3785 v38 = 5; | |
3786 goto LABEL_70; | |
3787 case 6: | |
3788 case 7: | |
3789 case 8: | |
3790 if ( a2 == 6 ) | |
3791 { | |
3792 v44 = 6; | |
3793 goto LABEL_60; | |
3794 } | |
3795 v25 = 2 * (a2 != 8) + 8; | |
3796 goto LABEL_65; | |
3797 case 9: | |
3798 if ( a2 == 6 ) | |
3799 { | |
3800 v44 = 7; | |
3801 LABEL_60: | |
3802 v24 = v44; | |
3803 } | |
3804 else | |
3805 { | |
3806 v25 = 2 * (a2 != 8) + 9; | |
3807 LABEL_65: | |
3808 v24 = v25; | |
3809 } | |
3810 SetCondition(v24, 1); | |
3811 v42 = 0; | |
3812 v37 = 0; | |
3813 v35 = 0; | |
3814 v34 = 0; | |
3815 v33 = -1; | |
3816 v32 = 0; | |
3817 v31 = 0; | |
3818 v30 = (SoundID)222; | |
3819 LABEL_83: | |
3820 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3821 do | |
3822 { | |
3823 LABEL_84: | |
3824 if ( v5 == pPlayers[v3 + 1] ) | |
3825 break; | |
3826 ++v3; | |
3827 } | |
3828 while ( v3 < 4 ); | |
3829 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3830 result = 1; | |
3831 break; | |
3832 case 12: | |
3833 v43 = 1; | |
3834 v38 = 12; | |
3835 goto LABEL_70; | |
3836 case 15: | |
3837 v45 = 1; | |
3838 v39 = 15; | |
3839 goto LABEL_73; | |
3840 case 13: | |
3841 v43 = 1; | |
3842 v38 = 13; | |
3843 LABEL_70: | |
3844 SetCondition(v38, v43); | |
3845 v42 = 0; | |
3846 v37 = 0; | |
3847 v35 = 0; | |
3848 v34 = 0; | |
3849 v33 = -1; | |
3850 v32 = 0; | |
3851 v31 = 0; | |
3852 v30 = (SoundID)224; | |
3853 goto LABEL_83; | |
3854 case 14: | |
3855 v45 = 1; | |
3856 v39 = 14; | |
3857 goto LABEL_73; | |
3858 case 16: | |
3859 v45 = 1; | |
3860 v39 = 16; | |
3861 LABEL_73: | |
3862 SetCondition(v39, v45); | |
3863 v42 = 0; | |
3864 v37 = 0; | |
3865 v35 = 0; | |
3866 v34 = 0; | |
3867 v33 = -1; | |
3868 v32 = 0; | |
3869 v31 = 0; | |
3870 v30 = (SoundID)225; | |
3871 goto LABEL_83; | |
3872 case 17: | |
3873 case 18: | |
3874 case 19: | |
3875 v26 = v48; | |
3876 if ( *(char *)(v48 + 21) & 2 ) | |
3877 goto LABEL_84; | |
187 | 3878 PlaySound(SPEECH_40, 0); |
0 | 3879 *(int *)(v26 + 20) |= 2u; |
3880 goto LABEL_79; | |
3881 case 20: | |
187 | 3882 PlaySound(SPEECH_40, 0); |
0 | 3883 v27 = pActor->array_000234; |
3884 if ( pActor->array_000234[0].uItemID ) | |
3885 { | |
3886 v27 = &pActor->array_000234[1]; | |
3887 if ( pActor->array_000234[1].uItemID ) | |
3888 goto LABEL_84; | |
3889 } | |
3890 v28 = v47; | |
654 | 3891 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3892 RemoveItemAtInventoryIndex(v28); |
3893 LABEL_79: | |
3894 v42 = 0; | |
3895 v37 = 0; | |
3896 v35 = 0; | |
3897 v34 = 0; | |
3898 v33 = -1; | |
3899 v32 = 0; | |
3900 v31 = 0; | |
3901 v30 = (SoundID)47; | |
3902 goto LABEL_83; | |
3903 case 21: | |
187 | 3904 PlaySound(SPEECH_42, 0); |
0 | 3905 ++v5->sAgeModifier; |
3906 goto LABEL_82; | |
3907 case 22: | |
187 | 3908 PlaySound(SPEECH_41, 0); |
0 | 3909 v5->sMana = 0; |
3910 LABEL_82: | |
3911 v42 = 0; | |
3912 v37 = 0; | |
3913 v35 = 0; | |
3914 v34 = 0; | |
3915 v33 = -1; | |
3916 v32 = 0; | |
3917 v31 = 0; | |
3918 v30 = (SoundID)226; | |
3919 goto LABEL_83; | |
3920 default: | |
3921 goto LABEL_87; | |
3922 } | |
3923 } | |
3924 return result; | |
3925 } | |
324 | 3926 |
0 | 3927 // 48DCF6: using guessed type char var_94[140]; |
3928 | |
3929 //----- (0048E1A3) -------------------------------------------------------- | |
3930 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3931 { | |
1091 | 3932 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 3933 } |
3934 | |
3935 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 3936 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
3937 { | |
3938 ItemGen *weapon = nullptr; | |
3939 ItemDesc *weapon_desc = nullptr; | |
3940 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
3941 if (bRangedAttack) | |
0 | 3942 { |
3943 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3944 goto LABEL_17; | |
816 | 3945 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
3946 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3947 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
3948 goto LABEL_17; | |
3949 } | |
3950 else if ( IsUnarmed() == 1 ) | |
3951 { | |
3952 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
3953 { | |
3954 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 3955 goto LABEL_17; |
3956 } | |
3957 } | |
816 | 3958 |
3959 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
3960 { | |
3961 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
3962 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3963 if (weapon_desc->uEquipType == EQUIP_WAND) | |
3964 { | |
3965 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
3966 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
3967 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
3968 } | |
0 | 3969 else |
816 | 3970 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
3971 } | |
1010 | 3972 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
3973 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 3974 { |
898 | 3975 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3976 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
3977 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
3978 { | |
898 | 3979 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3980 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3981 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
3982 } | |
3983 } | |
3984 | |
0 | 3985 LABEL_17: |
816 | 3986 uint armour_recovery = 0; |
0 | 3987 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
3988 { | |
898 | 3989 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 3990 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
3991 | |
3992 float armour_recovery_multipliers[4]; | |
3993 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
3994 { | |
3995 armour_recovery_multipliers[0] = 1.0f; | |
3996 armour_recovery_multipliers[1] = 0; | |
3997 armour_recovery_multipliers[2] = 0; | |
3998 armour_recovery_multipliers[3] = 0; | |
3999 } | |
4000 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
4001 { | |
4002 armour_recovery_multipliers[0] = 1.0f; | |
4003 armour_recovery_multipliers[1] = 0.5f; | |
4004 armour_recovery_multipliers[2] = 0; | |
4005 armour_recovery_multipliers[3] = 0; | |
4006 } | |
4007 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
4008 { | |
4009 armour_recovery_multipliers[0] = 1.0f; | |
4010 armour_recovery_multipliers[1] = 0.5f; | |
4011 armour_recovery_multipliers[2] = 0.5f; | |
4012 armour_recovery_multipliers[3] = 0; | |
0 | 4013 } |
4014 else | |
4015 { | |
816 | 4016 assert(false && "Unknown armour type"); // what kind of armour is that? |
4017 armour_recovery_multipliers[0] = 1.0f; | |
4018 armour_recovery_multipliers[1] = 1.0f; | |
4019 armour_recovery_multipliers[2] = 1.0f; | |
4020 armour_recovery_multipliers[3] = 1.0f; | |
4021 } | |
4022 | |
4023 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4024 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4025 } | |
4026 | |
4027 uint shield_recovery = 0; | |
4028 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4029 { | |
4030 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4031 | |
898 | 4032 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4033 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4034 | |
4035 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4036 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4037 } | |
4038 | |
1036 | 4039 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 4040 sword_axe_bow_recovery_reduction = 0; |
4041 bool shooting_laser = false; | |
4042 if (weapon_desc) | |
4043 { | |
4044 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4045 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4046 { | |
4047 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4048 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4049 } | |
4050 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4051 shooting_laser = true; | |
4052 } | |
4053 | |
4054 uint armsmaster_recovery_reduction = 0; | |
4055 if (!bRangedAttack && !shooting_laser) | |
4056 { | |
4057 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4058 { | |
4059 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4060 if (SkillToMastery(armsmaster_level) >= 4) | |
4061 armsmaster_recovery_reduction *= 2; | |
4062 } | |
4063 } | |
4064 | |
4065 uint v41 = 0; | |
4066 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4067 v41 = 25; |
816 | 4068 |
4069 uint weapon_enchantment_recovery_reduction = 0; | |
4070 if ( weapon ) | |
4071 { | |
4072 if (weapon->uSpecEnchantmentType == 59 || | |
4073 weapon->uSpecEnchantmentType == 41 || | |
4074 weapon->uSpecEnchantmentType == 500) | |
4075 weapon_enchantment_recovery_reduction = 20; | |
4076 } | |
4077 | |
4078 | |
4079 int recovery = weapon_recovery + | |
4080 armour_recovery + | |
4081 shield_recovery | |
4082 - armsmaster_recovery_reduction | |
4083 - weapon_enchantment_recovery_reduction | |
4084 - v41 | |
4085 - sword_axe_bow_recovery_reduction | |
4086 - player_speed_recovery_reduction; | |
4087 | |
4088 if (recovery < 0) | |
4089 recovery = 0; | |
4090 return recovery; | |
0 | 4091 } |
4092 | |
4093 //----- (0048E4F8) -------------------------------------------------------- | |
4094 int Player::GetMaxHealth() | |
4095 { | |
4096 int v3; // esi@1 | |
4097 int v4; // esi@1 | |
4098 int v6; // esi@1 | |
4099 | |
1036 | 4100 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 4101 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4102 v6 = uFullHealthBonus |
135 | 4103 + pBaseHealthByClass[classType / 4] |
0 | 4104 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4105 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4106 if (v6 <= 0) | |
4107 return 1; | |
4108 return v6; | |
4109 } | |
4110 | |
4111 //----- (0048E565) -------------------------------------------------------- | |
4112 int Player::GetMaxMana() | |
4113 { | |
4114 int v2; // eax@2 | |
4115 int v3; // esi@4 | |
4116 int v4; // eax@5 | |
4117 int v5; // esi@5 | |
4118 int v6; // eax@5 | |
4119 int v7; // esi@6 | |
4120 int v8; // esi@6 | |
4121 int v9; // esi@6 | |
4122 int result; // eax@7 | |
1116 | 4123 |
135 | 4124 switch (classType) |
0 | 4125 { |
1116 | 4126 case PLAYER_CLASS_ROGUE: |
4127 case PLAYER_CLASS_SPY: | |
4128 case PLAYER_CLASS_ASSASSIN: | |
4129 case PLAYER_CLASS_ARCHER: | |
4130 case PLAYER_CLASS_WARRIOR_MAGE: | |
4131 case PLAYER_CLASS_MASTER_ARCHER: | |
4132 case PLAYER_CLASS_SNIPER: | |
4133 case PLAYER_CLASS_SORCERER: | |
4134 case PLAYER_CLASS_WIZARD: | |
4135 case PLAYER_CLASS_ARCHMAGE: | |
4136 case PLAYER_CLASS_LICH: | |
0 | 4137 v2 = GetActualIntelligence(); |
1036 | 4138 v3 = GetParameterBonus(v2); |
1116 | 4139 break; |
4140 case PLAYER_CLASS_INITIATE: | |
4141 case PLAYER_CLASS_MASTER: | |
4142 case PLAYER_CLASS_NINJA: | |
4143 case PLAYER_CLASS_PALADIN: | |
4144 case PLAYER_CLASS_CRUSADER: | |
4145 case PLAYER_CLASS_HERO: | |
4146 case PLAYER_CLASS_VILLIAN: | |
4147 case PLAYER_CLASS_CLERIC: | |
4148 case PLAYER_CLASS_PRIEST: | |
4149 case PLAYER_CLASS_PRIEST_OF_SUN: | |
4150 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 4151 v2 = GetActualWillpower(); |
1036 | 4152 v3 = GetParameterBonus(v2); |
1116 | 4153 break; |
4154 case PLAYER_CLASS_HUNTER: | |
4155 case PLAYER_CLASS_RANGER_LORD: | |
4156 case PLAYER_CLASS_BOUNTY_HUNTER: | |
4157 case PLAYER_CLASS_DRUID: | |
4158 case PLAYER_CLASS_GREAT_DRUID: | |
4159 case PLAYER_CLASS_ARCH_DRUID: | |
4160 case PLAYER_CLASS_WARLOCK: | |
0 | 4161 v4 = GetActualWillpower(); |
1036 | 4162 v5 = GetParameterBonus(v4); |
0 | 4163 v6 = GetActualIntelligence(); |
1036 | 4164 v3 = GetParameterBonus(v6) + v5; |
0 | 4165 break; |
4166 default: | |
1116 | 4167 return 0; |
0 | 4168 break; |
4169 } | |
1116 | 4170 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
4171 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
4172 v9 = uFullManaBonus | |
4173 + pBaseManaByClass[classType / 4] | |
4174 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
4175 + v8; | |
4176 return max(0,v9); | |
0 | 4177 } |
4178 | |
4179 //----- (0048E656) -------------------------------------------------------- | |
4180 int Player::GetBaseAC() | |
4181 { | |
4182 Player *v1; // edi@1 | |
4183 int v2; // eax@1 | |
4184 int v3; // esi@1 | |
4185 int v4; // esi@1 | |
4186 int v5; // esi@1 | |
4187 int result; // eax@2 | |
4188 | |
4189 v1 = this; | |
4190 v2 = GetActualSpeed(); | |
1036 | 4191 v3 = GetParameterBonus(v2); |
0 | 4192 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4193 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4194 if ( v5 >= 1 ) | |
4195 result = v5; | |
4196 else | |
4197 result = 0; | |
4198 return result; | |
4199 } | |
4200 | |
4201 //----- (0048E68F) -------------------------------------------------------- | |
4202 int Player::GetActualAC() | |
4203 { | |
4204 Player *v1; // edi@1 | |
4205 int v2; // eax@1 | |
4206 int v3; // esi@1 | |
4207 int v4; // esi@1 | |
4208 int v5; // esi@1 | |
4209 int v6; // esi@1 | |
4210 int result; // eax@2 | |
4211 | |
4212 v1 = this; | |
4213 v2 = GetActualSpeed(); | |
1036 | 4214 v3 = GetParameterBonus(v2); |
0 | 4215 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4216 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4217 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4218 if ( v6 >= 1 ) | |
4219 result = v6; | |
4220 else | |
4221 result = 0; | |
4222 return result; | |
4223 } | |
4224 | |
4225 //----- (0048E6DC) -------------------------------------------------------- | |
4226 unsigned int Player::GetBaseAge() | |
4227 { | |
352 | 4228 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4229 } |
4230 | |
4231 //----- (0048E72C) -------------------------------------------------------- | |
4232 unsigned int Player::GetActualAge() | |
4233 { | |
4234 return this->sAgeModifier + GetBaseAge(); | |
4235 } | |
4236 | |
4237 //----- (0048E73F) -------------------------------------------------------- | |
4238 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4239 { | |
4240 Player *v2; // ebx@1 | |
4241 signed int v3; // esi@1 | |
4242 enum CHARACTER_RACE v4; // eax@1 | |
4243 signed int v5; // edi@8 | |
4244 char v6; // zf@9 | |
4245 int v7; // esi@20 | |
4246 int result; // eax@21 | |
4247 signed int v9; // [sp-4h] [bp-10h]@11 | |
4248 | |
4249 v2 = this; | |
4250 v3 = 0; | |
4251 v4 = GetRace(); | |
4252 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4253 { | |
4254 v5 = 0; | |
4255 goto LABEL_16; | |
4256 } | |
4257 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4258 { | |
4259 v5 = 1; | |
4260 LABEL_16: | |
4261 v6 = v4 == 2; | |
4262 goto LABEL_17; | |
4263 } | |
4264 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4265 { | |
4266 v6 = v4 == 3; | |
4267 v5 = 2; | |
4268 goto LABEL_17; | |
4269 } | |
4270 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4271 { | |
4272 v5 = 3; | |
4273 v6 = v4 == 3; | |
4274 goto LABEL_17; | |
4275 } | |
4276 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4277 { | |
4278 v5 = 7; | |
4279 if ( v4 != 1 ) | |
4280 goto LABEL_20; | |
4281 v9 = 10; | |
4282 LABEL_19: | |
4283 v3 = v9; | |
4284 goto LABEL_20; | |
4285 } | |
4286 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4287 { | |
4288 v5 = 8; | |
4289 v6 = v4 == 0; | |
4290 LABEL_17: | |
4291 if ( !v6 ) | |
4292 goto LABEL_20; | |
4293 v9 = 5; | |
4294 goto LABEL_19; | |
4295 } | |
4296 v5 = 0; | |
4297 LABEL_20: | |
4298 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4299 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4300 result = v7 + *(&v2->sResFireBase + v5); |
4301 return result; | |
4302 } | |
4303 | |
4304 //----- (0048E7D0) -------------------------------------------------------- | |
4305 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4306 { | |
4307 signed int v2; // edi@1 | |
4308 Player *v3; // esi@1 | |
4309 enum CHARACTER_RACE v4; // ebx@1 | |
4310 char v6; // zf@18 | |
4311 int v7; // ebx@28 | |
4312 int result; // eax@28 | |
4313 signed int v9; // [sp+10h] [bp-8h]@1 | |
4314 signed int v10; // [sp+14h] [bp-4h]@1 | |
4315 | |
4316 v2 = 0; | |
4317 v3 = this; | |
4318 v10 = 0; | |
4319 v9 = 0; | |
4320 v4 = GetRace(); | |
652 | 4321 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4322 v10 = 20; |
4323 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4324 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4325 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4326 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4327 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4328 && HasItemEquipped(EQUIP_ARMOUR) | |
4329 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4330 v10 += v3->pActiveSkills[9] & 0x3F; | |
4331 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4332 goto LABEL_25; | |
4333 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4334 { | |
4335 v2 = 1; | |
4336 LABEL_25: | |
4337 v6 = v4 == 2; | |
4338 LABEL_26: | |
4339 if ( v6 ) | |
4340 v9 = 5; | |
4341 goto LABEL_28; | |
4342 } | |
4343 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4344 { | |
4345 v6 = v4 == 3; | |
4346 v2 = 2; | |
4347 goto LABEL_26; | |
4348 } | |
4349 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4350 { | |
4351 v2 = 3; | |
4352 if ( v4 == 3 ) | |
4353 v10 += 5; | |
4354 } | |
4355 else | |
4356 { | |
4357 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4358 { | |
4359 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4360 goto LABEL_28; | |
4361 v2 = 8; | |
4362 v6 = v4 == 0; | |
4363 goto LABEL_26; | |
4364 } | |
4365 v2 = 7; | |
4366 if ( v4 == 1 ) | |
4367 v9 = 10; | |
4368 } | |
4369 LABEL_28: | |
4370 v7 = GetItemsBonus(a2, 0); | |
4371 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4372 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4373 { |
4374 if ( result > 200 ) | |
4375 result = 200; | |
4376 } | |
4377 return result; | |
4378 } | |
4379 | |
4380 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4381 bool Player::Recover(int dt) |
4382 { | |
4383 //Player *v2; // esi@1 | |
0 | 4384 signed __int64 v3; // qax@1 |
816 | 4385 //bool result; // eax@4 |
4386 | |
4387 //v2 = this; | |
4388 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4389 | |
4390 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4391 | |
4392 if (uTimeToRecovery > v3) | |
4393 { | |
4394 uTimeToRecovery -= v3; | |
4395 return true; | |
0 | 4396 } |
4397 else | |
4398 { | |
816 | 4399 uTimeToRecovery = 0; |
4400 viewparams->bRedrawGameUI = true; | |
4401 if (!uActiveCharacter) | |
0 | 4402 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4403 return false; |
4404 } | |
0 | 4405 } |
4406 | |
4407 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4408 void Player::SetRecoveryTime(signed int rec) |
4409 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4410 assert(rec >= 0); |
816 | 4411 |
4412 if (rec > uTimeToRecovery) | |
4413 uTimeToRecovery = rec; | |
4414 | |
4415 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4416 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4417 |
4418 viewparams->bRedrawGameUI = true; | |
0 | 4419 } |
4420 // 50C0C4: using guessed type int some_active_character; | |
4421 | |
4422 //----- (0048E9B7) -------------------------------------------------------- | |
4423 void Player::RandomizeName() | |
4424 { | |
4425 if (!uExpressionTimePassed) | |
4426 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4427 } | |
4428 | |
4429 //----- (0048E9F4) -------------------------------------------------------- | |
4430 unsigned int Player::GetMajorConditionIdx() | |
4431 { | |
4432 for (uint i = 0; i < 18; ++i) | |
4433 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4434 return pConditionImportancyTable[i]; | |
4435 | |
4436 return 18; | |
4437 } | |
4438 | |
4439 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 4440 int Player::GetParameterBonus( int player_parameter ) |
4441 { | |
4442 int i; // eax@1 | |
4443 i = 0; | |
4444 while (param_to_bonus_table[i]) | |
4445 { | |
4446 if (player_parameter >= param_to_bonus_table[i]) | |
4447 break; | |
4448 ++i; | |
4449 } | |
4450 return parameter_to_bonus_value[i]; | |
0 | 4451 } |
4452 | |
4453 //----- (0048EA46) -------------------------------------------------------- | |
4454 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4455 { | |
1032 | 4456 int inv_indx; // eax@3 |
4457 | |
4458 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
4459 { | |
4460 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4461 continue; | |
4462 inv_indx = pEquipment.pIndices[i] - 1; | |
4463 if (a2==17) | |
4464 { | |
1097 | 4465 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 4466 return 50; |
4467 } | |
4468 if (a2==24) | |
4469 { | |
4470 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. | |
4471 return 5; | |
4472 } | |
4473 } | |
4474 return 0; | |
0 | 4475 } |
4476 | |
4477 //----- (0048EAAE) -------------------------------------------------------- | |
4478 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4479 { | |
4480 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 4481 // signed int v4; // eax@1 |
0 | 4482 int v5; // edi@1 |
4483 Player *v6; // ebx@1 | |
4484 Player *v8; // ecx@48 | |
4485 int v9; // eax@49 | |
4486 int v10; // edx@49 | |
4487 Player *v11; // ecx@55 | |
4488 int v12; // eax@56 | |
4489 int v13; // edx@56 | |
4490 int v14; // ecx@58 | |
4491 int v15; // eax@58 | |
4492 Player *v16; // ecx@61 | |
4493 int v17; // eax@62 | |
4494 Player *v18; // ecx@66 | |
4495 int v19; // eax@67 | |
4496 int v20; // eax@69 | |
4497 Player *v21; // ecx@75 | |
4498 int v22; // eax@76 | |
4499 int v23; // edx@76 | |
4500 int v24; // eax@79 | |
4501 int v25; // ecx@80 | |
4502 int v26; // edi@80 | |
4503 Player *v27; // ecx@84 | |
4504 int v28; // eax@85 | |
4505 int v29; // edx@85 | |
4506 Player *v30; // ecx@96 | |
4507 int v31; // ebp@97 | |
4508 int v32; // eax@98 | |
4509 unsigned int v33; // eax@100 | |
4510 int v34; // eax@103 | |
4511 char v35; // zf@104 | |
4512 char v36; // zf@107 | |
4513 unsigned __int8 v37; // zf@119 | |
4514 char v38; // sf@119 | |
4515 unsigned __int8 v39; // of@119 | |
4516 char v40; // zf@122 | |
4517 char v41; // zf@145 | |
4518 char v42; // zf@164 | |
4519 char v43; // zf@173 | |
4520 char v44; // zf@189 | |
4521 char v45; // zf@198 | |
4522 char v46; // zf@239 | |
4523 int v47; // eax@268 | |
4524 int v48; // eax@269 | |
4525 int v49; // eax@291 | |
4526 char v50; // zf@295 | |
4527 int v51; // eax@306 | |
4528 int v52; // eax@307 | |
4529 char v53; // zf@312 | |
4530 char v54; // zf@336 | |
4531 char v55; // zf@348 | |
4532 int v56; // eax@365 | |
4533 int v57; // ebx@368 | |
4534 signed int v58; // [sp-4h] [bp-20h]@10 | |
4535 signed int v59; // [sp-4h] [bp-20h]@71 | |
4536 signed int v60; // [sp-4h] [bp-20h]@347 | |
4537 int v61; // [sp+10h] [bp-Ch]@1 | |
4538 int v62; // [sp+14h] [bp-8h]@1 | |
4539 int v63; // [sp+18h] [bp-4h]@101 | |
4540 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4541 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 4542 bool no_skills; |
0 | 4543 |
4544 v3 = attr; | |
4545 v5 = 0; | |
4546 v6 = this; | |
4547 v62 = 0; | |
4548 v61 = 0; | |
4549 | |
1040 | 4550 |
4551 no_skills=false; | |
0 | 4552 switch (attr) |
4553 { | |
1040 | 4554 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
4555 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
4556 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
4557 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
4558 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
4559 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
4560 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
4561 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
4562 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
4563 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
4564 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
4565 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
4566 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
4567 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
4568 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
4569 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
4570 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
4571 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
4572 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
4573 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
4574 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
4575 default: | |
4576 no_skills=true; | |
0 | 4577 } |
1040 | 4578 if (!no_skills) |
0 | 4579 { |
1040 | 4580 if ( !this->pActiveSkills[v58] ) |
4581 return 0; | |
0 | 4582 } |
1040 | 4583 |
0 | 4584 if ( (signed int)attr > 28 ) |
4585 { | |
4586 if ( (signed int)attr < 29 ) | |
4587 return v5 + v62 + v61; | |
1040 | 4588 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 4589 { |
4590 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 4591 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 4592 return v5 + v62 + v61; |
4593 } | |
1040 | 4594 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 4595 { |
4596 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4597 return v5 + v62 + v61; | |
1040 | 4598 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4599 v5 = pItemsTable->pItems[v57].uDamageMod; |
4600 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 4601 v5 += v56; |
4602 return v5 + v62 + v61; | |
4603 } | |
4604 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 4605 { |
4606 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4607 return v5 + v62 + v61; | |
1040 | 4608 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4609 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4610 LABEL_365: | |
4611 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4612 LABEL_366: | |
4613 v5 += v56; | |
4614 return v5 + v62 + v61; | |
4615 } | |
4616 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4617 return v5 + v62 + v61; | |
4618 LABEL_95: | |
4619 v65 = 0; | |
4620 while ( 1 ) | |
4621 { | |
4622 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4623 goto LABEL_361; | |
898 | 4624 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4625 if ( v3 == 9 ) |
4626 { | |
816 | 4627 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4628 if ( v32 >= 3 ) |
4629 { | |
4630 if ( v32 <= 11 ) | |
4631 { | |
4632 v33 = v6->pInventoryItems[v31].uItemID; | |
4633 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4634 } | |
4635 } | |
4636 } | |
4637 v63 = (int)((char *)v6 + 36 * v31); | |
4638 attra = (ItemGen *)(v63 + 532); | |
377 | 4639 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4640 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4641 { |
4642 v34 = attra->uItemID; | |
4643 switch ( attra->uItemID ) | |
4644 { | |
4645 case 0x1F4u: | |
4646 v35 = v3 == 5; | |
4647 goto LABEL_105; | |
4648 case 0x1F5u: | |
4649 v36 = v3 == 0; | |
4650 goto LABEL_108; | |
4651 case 0x1F6u: | |
4652 if ( v3 == 21 ) | |
4653 v61 += 10; | |
4654 v36 = v3 == 2; | |
4655 goto LABEL_108; | |
4656 case 0x1F7u: | |
4657 if ( v3 == 17 ) | |
4658 v61 += 5; | |
4659 if ( v3 == 18 ) | |
4660 v61 += 5; | |
4661 v36 = v3 == 6; | |
4662 goto LABEL_108; | |
4663 case 0x1F8u: | |
4664 goto LABEL_118; | |
4665 case 0x1F9u: | |
4666 v40 = v3 == 3; | |
4667 goto LABEL_123; | |
4668 case 0x1FAu: | |
4669 v35 = v3 == 10; | |
4670 goto LABEL_105; | |
4671 case 0x1FEu: | |
4672 v35 = v3 == 4; | |
4673 goto LABEL_105; | |
4674 case 0x1FFu: | |
4675 if ( v3 == 23 ) | |
4676 v61 += 10; | |
4677 if ( v3 == 22 ) | |
4678 v61 += 10; | |
4679 goto LABEL_361; | |
4680 case 0x200u: | |
4681 if ( v3 == 36 ) | |
4682 { | |
4683 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4684 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4685 } | |
4686 v36 = v3 == 5; | |
4687 LABEL_108: | |
4688 if ( v36 ) | |
4689 v5 += 40; | |
4690 goto LABEL_361; | |
4691 case 0x201u: | |
4692 if ( v3 == 39 ) | |
4693 { | |
4694 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4695 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4696 v62 = v34; | |
4697 } | |
4698 goto LABEL_136; | |
4699 case 0x202u: | |
4700 if ( !v3 ) | |
4701 v5 += 150; | |
4702 if ( v3 == 1 ) | |
4703 v5 -= 40; | |
4704 if ( v3 == 2 ) | |
4705 v5 -= 40; | |
4706 goto LABEL_145; | |
4707 case 0x203u: | |
4708 if ( v3 == 42 ) | |
4709 { | |
4710 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4711 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4712 } | |
4713 if ( v3 == 43 ) | |
4714 v61 += 15; | |
4715 goto LABEL_361; | |
4716 case 0x204u: | |
4717 if ( v3 == 17 ) | |
4718 v61 += 5; | |
4719 if ( v3 == 18 ) | |
4720 v61 += 5; | |
4721 if ( v3 == 6 ) | |
4722 v5 += 50; | |
4723 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4724 goto LABEL_166; | |
4725 v42 = v3 == 15; | |
4726 goto LABEL_165; | |
4727 case 0x205u: | |
4728 if ( v3 == 18 ) | |
4729 v61 += 5; | |
4730 goto LABEL_361; | |
4731 case 0x206u: | |
4732 if ( !v3 ) | |
4733 v5 += 100; | |
4734 if ( v3 == 3 ) | |
4735 v5 += 100; | |
4736 v43 = v3 == 9; | |
4737 goto LABEL_174; | |
4738 case 0x207u: | |
4739 if ( v3 == 45 ) | |
4740 v61 += 5; | |
4741 if ( v3 == 15 ) | |
4742 v5 -= 10; | |
4743 v42 = v3 == 14; | |
4744 LABEL_165: | |
4745 if ( v42 ) | |
4746 LABEL_166: | |
4747 v5 -= 10; | |
4748 goto LABEL_361; | |
4749 case 0x208u: | |
4750 v35 = v3 == 3; | |
4751 goto LABEL_105; | |
4752 case 0x209u: | |
4753 if ( v3 == 2 ) | |
4754 v5 += 15; | |
4755 if ( !v3 ) | |
4756 v5 += 15; | |
4757 v41 = v3 == 6; | |
4758 goto LABEL_146; | |
4759 case 0x20Au: | |
4760 if ( v3 == 46 ) | |
4761 v61 += 15; | |
4762 v44 = v3 == 3; | |
4763 goto LABEL_190; | |
4764 case 0x20Bu: | |
4765 if ( v3 == 34 ) | |
4766 { | |
4767 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4768 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4769 } | |
4770 if ( v3 == 12 ) | |
4771 v5 += 50; | |
4772 if ( v3 == 2 ) | |
4773 v5 += 30; | |
4774 v45 = v3 == 9; | |
4775 goto LABEL_199; | |
4776 case 0x20Cu: | |
4777 if ( !v3 ) | |
4778 v5 += 75; | |
4779 goto LABEL_145; | |
4780 case 0x20Du: | |
4781 if ( v3 == 5 ) | |
4782 v5 += 50; | |
4783 if ( v3 == 6 ) | |
4784 v5 += 50; | |
4785 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4786 goto LABEL_374; | |
4787 v43 = v3 == 15; | |
4788 LABEL_174: | |
4789 if ( v43 ) | |
4790 LABEL_374: | |
4791 v5 -= 15; | |
4792 goto LABEL_361; | |
4793 case 0x20Eu: | |
4794 if ( v3 == 4 ) | |
4795 v5 += 150; | |
4796 if ( v3 == 44 ) | |
4797 v61 += 5; | |
4798 if ( v3 == 9 ) | |
4799 v5 -= 25; | |
4800 goto LABEL_361; | |
4801 case 0x20Fu: | |
4802 if ( v3 == 39 ) | |
4803 { | |
4804 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4805 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4806 v62 = v34; | |
4807 } | |
4808 if ( v3 == 40 ) | |
4809 { | |
4810 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4811 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4812 } | |
4813 LABEL_145: | |
4814 v41 = v3 == 5; | |
4815 LABEL_146: | |
4816 if ( v41 ) | |
4817 v5 -= 40; | |
4818 goto LABEL_361; | |
4819 case 0x210u: | |
4820 if ( v3 == 38 ) | |
4821 { | |
4822 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4823 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4824 } | |
4825 if ( !v3 ) | |
4826 v5 += 75; | |
4827 v44 = v3 == 11; | |
4828 LABEL_190: | |
4829 if ( v44 ) | |
4830 v5 -= 50; | |
4831 goto LABEL_361; | |
4832 case 0x211u: | |
4833 if ( v3 == 5 ) | |
4834 v5 += 100; | |
4835 if ( v3 == 4 ) | |
4836 v5 += 50; | |
4837 v35 = v3 == 11; | |
4838 LABEL_105: | |
4839 if ( v35 ) | |
4840 v5 += 50; | |
4841 goto LABEL_361; | |
4842 case 0x212u: | |
4843 if ( v3 == 1 ) | |
4844 v5 -= 20; | |
4845 v45 = v3 == 2; | |
4846 LABEL_199: | |
4847 if ( v45 ) | |
4848 v5 -= 20; | |
4849 goto LABEL_361; | |
4850 case 0x214u: | |
4851 if ( v3 == 1 ) | |
4852 v5 += 15; | |
4853 v46 = v3 == 2; | |
4854 goto LABEL_240; | |
4855 case 0x215u: | |
4856 if ( v3 == 5 ) | |
4857 v5 += 15; | |
4858 v46 = v3 == 4; | |
4859 goto LABEL_240; | |
4860 case 0x216u: | |
4861 if ( v3 == 10 ) | |
4862 v5 += 30; | |
4863 if ( !v3 ) | |
4864 v5 += 15; | |
4865 goto LABEL_315; | |
4866 case 0x217u: | |
4867 if ( v3 == 21 ) | |
4868 v61 += 5; | |
4869 if ( !v3 ) | |
4870 v5 += 15; | |
4871 goto LABEL_253; | |
4872 case 0x218u: | |
4873 goto LABEL_253; | |
4874 default: | |
4875 goto LABEL_361; | |
4876 } | |
4877 goto LABEL_361; | |
4878 } | |
4879 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
4880 { | |
4881 if ( (signed int)v3 >= 0 ) | |
4882 { | |
4883 if ( (signed int)v3 <= 15 ) | |
4884 { | |
4885 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
4886 } | |
4887 else | |
4888 { | |
4889 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
4890 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
4891 } | |
4892 } | |
4893 goto LABEL_361; | |
4894 } | |
4895 v34 = *(int *)(v63 + 544); | |
4896 if ( v34 > 48 ) | |
4897 { | |
4898 switch ( v34 ) | |
4899 { | |
4900 case 54: | |
4901 goto LABEL_315; | |
4902 case 49: | |
4903 if ( v3 == 6 ) | |
4904 goto LABEL_121; | |
4905 v50 = v3 == 1; | |
4906 goto LABEL_296; | |
4907 case 51: | |
4908 if ( v3 != 5 && v3 != 1 ) | |
4909 goto LABEL_309; | |
4910 goto LABEL_121; | |
4911 case 52: | |
4912 if ( v3 == 3 ) | |
4913 goto LABEL_121; | |
4914 v50 = v3 == 4; | |
4915 goto LABEL_296; | |
4916 case 53: | |
4917 if ( !v3 ) | |
4918 goto LABEL_121; | |
4919 v50 = v3 == 2; | |
4920 goto LABEL_296; | |
4921 case 55: | |
4922 v46 = v3 == 6; | |
4923 goto LABEL_240; | |
4924 case 56: | |
4925 if ( !v3 ) | |
4926 goto LABEL_351; | |
4927 v53 = v3 == 3; | |
4928 goto LABEL_350; | |
4929 case 57: | |
4930 if ( v3 == 1 ) | |
4931 goto LABEL_351; | |
4932 v53 = v3 == 2; | |
4933 goto LABEL_350; | |
4934 case 50: | |
4935 if ( v3 == 10 ) | |
4936 v5 += 30; | |
4937 goto LABEL_361; | |
4938 case 60: | |
4939 if ( v3 != 23 ) | |
4940 goto LABEL_336; | |
4941 if ( v5 >= 3 ) | |
4942 goto LABEL_361; | |
4943 v5 = 3; | |
4944 LABEL_336: | |
4945 v54 = v3 == 22; | |
4946 goto LABEL_345; | |
4947 case 61: | |
4948 if ( v3 != 17 ) | |
4949 goto LABEL_340; | |
4950 if ( v5 >= 3 ) | |
4951 goto LABEL_361; | |
4952 v5 = 3; | |
4953 LABEL_340: | |
4954 v54 = v3 == 18; | |
4955 goto LABEL_345; | |
4956 case 62: | |
4957 if ( v3 != 19 ) | |
4958 goto LABEL_344; | |
4959 if ( v5 >= 3 ) | |
4960 goto LABEL_361; | |
4961 v5 = 3; | |
4962 LABEL_344: | |
4963 v54 = v3 == 20; | |
4964 LABEL_345: | |
4965 if ( !v54 ) | |
4966 goto LABEL_361; | |
4967 if ( v5 >= 3 ) | |
4968 goto LABEL_361; | |
4969 v60 = 3; | |
4970 goto LABEL_360; | |
4971 case 67: | |
4972 v55 = v3 == 18; | |
4973 goto LABEL_357; | |
4974 case 68: | |
4975 v53 = v3 == 9; | |
4976 goto LABEL_350; | |
4977 case 69: | |
4978 if ( v3 == 11 ) | |
4979 v5 += 20; | |
4980 break; | |
4981 case 70: | |
4982 if ( v3 == 12 ) | |
4983 v5 += 10; | |
4984 v55 = v3 == 16; | |
4985 LABEL_357: | |
4986 if ( v55 && v5 < 2 ) | |
4987 { | |
4988 v60 = 2; | |
4989 LABEL_360: | |
4990 v5 = v60; | |
4991 } | |
4992 break; | |
4993 default: | |
4994 goto LABEL_361; | |
4995 } | |
4996 goto LABEL_361; | |
4997 } | |
4998 if ( v34 == 48 ) | |
4999 { | |
5000 if ( v3 == 9 ) | |
5001 v5 += 5; | |
5002 LABEL_315: | |
5003 v46 = v3 == 3; | |
5004 LABEL_240: | |
5005 if ( v46 ) | |
5006 v5 += 15; | |
5007 goto LABEL_361; | |
5008 } | |
5009 if ( v34 > 32 ) | |
5010 { | |
5011 if ( v34 > 44 ) | |
5012 { | |
5013 v51 = v34 - 45; | |
5014 if ( !v51 ) | |
5015 { | |
5016 if ( v3 == 5 ) | |
5017 goto LABEL_351; | |
5018 v53 = v3 == 4; | |
5019 LABEL_350: | |
5020 if ( v53 ) | |
5021 LABEL_351: | |
5022 v5 += 5; | |
5023 goto LABEL_361; | |
5024 } | |
5025 v52 = v51 - 1; | |
5026 if ( !v52 ) | |
5027 { | |
5028 v40 = v3 == 0; | |
5029 LABEL_123: | |
5030 if ( v40 ) | |
5031 v5 += 25; | |
5032 goto LABEL_361; | |
5033 } | |
5034 if ( v52 == 1 ) | |
5035 { | |
5036 LABEL_309: | |
5037 v50 = v3 == 8; | |
5038 goto LABEL_296; | |
5039 } | |
5040 } | |
5041 else | |
5042 { | |
5043 if ( v34 == 44 ) | |
5044 { | |
5045 v50 = v3 == 7; | |
5046 goto LABEL_296; | |
5047 } | |
5048 v34 -= 33; | |
5049 if ( !v34 ) | |
5050 { | |
5051 if ( v3 != 38 ) | |
5052 goto LABEL_361; | |
5053 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5054 goto LABEL_138; | |
5055 } | |
5056 --v34; | |
5057 if ( !v34 ) | |
5058 { | |
5059 if ( v3 != 36 ) | |
5060 goto LABEL_361; | |
5061 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5062 goto LABEL_138; | |
5063 } | |
5064 v49 = v34 - 8; | |
5065 if ( !v49 ) | |
5066 { | |
5067 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5068 ++v5; | |
5069 goto LABEL_361; | |
5070 } | |
5071 if ( v49 == 1 ) | |
5072 { | |
5073 if ( v3 != 3 && v3 != 7 ) | |
5074 { | |
5075 v50 = v3 == 9; | |
5076 LABEL_296: | |
5077 if ( !v50 ) | |
5078 goto LABEL_361; | |
5079 } | |
5080 LABEL_121: | |
5081 v5 += 10; | |
5082 goto LABEL_361; | |
5083 } | |
5084 } | |
5085 } | |
5086 else | |
5087 { | |
5088 if ( v34 == 32 ) | |
5089 { | |
5090 if ( v3 != 39 ) | |
5091 goto LABEL_361; | |
5092 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5093 goto LABEL_138; | |
5094 } | |
5095 if ( v34 > 28 ) | |
5096 { | |
5097 v34 -= 29; | |
5098 if ( v34 ) | |
5099 { | |
5100 --v34; | |
5101 if ( v34 ) | |
5102 { | |
5103 --v34; | |
5104 if ( v34 || v3 != 41 ) | |
5105 goto LABEL_361; | |
5106 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5107 } | |
5108 else | |
5109 { | |
5110 if ( v3 != 34 ) | |
5111 goto LABEL_361; | |
5112 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5113 } | |
5114 } | |
5115 else | |
5116 { | |
5117 if ( v3 != 37 ) | |
5118 goto LABEL_361; | |
5119 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5120 } | |
5121 goto LABEL_138; | |
5122 } | |
5123 if ( v34 == 28 ) | |
5124 { | |
5125 LABEL_136: | |
5126 if ( v3 == 42 ) | |
5127 { | |
5128 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5129 LABEL_138: | |
5130 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5131 goto LABEL_361; | |
5132 } | |
5133 } | |
5134 else | |
5135 { | |
5136 v47 = v34 - 1; | |
5137 if ( v47 ) | |
5138 { | |
5139 v48 = v47 - 1; | |
5140 if ( v48 ) | |
5141 { | |
5142 v34 = v48 - 24; | |
5143 if ( v34 ) | |
5144 { | |
5145 --v34; | |
5146 if ( v34 || v3 != 40 ) | |
5147 goto LABEL_361; | |
5148 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5149 } | |
5150 else | |
5151 { | |
5152 if ( v3 != 35 ) | |
5153 goto LABEL_361; | |
5154 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5155 } | |
5156 goto LABEL_138; | |
5157 } | |
5158 LABEL_118: | |
5159 if ( (signed int)v3 < 0 ) | |
5160 goto LABEL_361; | |
5161 v39 = __OFSUB__((int)v3, 6); | |
5162 v37 = v3 == 6; | |
5163 v38 = v3 - 6 < 0; | |
5164 } | |
5165 else | |
5166 { | |
5167 LABEL_253: | |
5168 if ( (signed int)v3 < 10 ) | |
5169 goto LABEL_361; | |
5170 v39 = __OFSUB__((int)v3, 15); | |
5171 v37 = v3 == 15; | |
5172 v38 = v3 - 15 < 0; | |
5173 } | |
5174 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5175 goto LABEL_121; | |
5176 } | |
5177 } | |
5178 LABEL_361: | |
5179 ++v65; | |
5180 if ( (signed int)v65 >= 16 ) | |
5181 return v5 + v62 + v61; | |
5182 } | |
5183 } | |
1040 | 5184 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 5185 { |
5186 if ( IsUnarmed() != 1 ) | |
5187 { | |
816 | 5188 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5189 { | |
5190 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5191 if ( v22 >= 0 ) |
5192 { | |
5193 if ( v22 <= 2 ) | |
5194 { | |
1040 | 5195 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 5196 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5197 { |
5198 v24 = v23; | |
5199 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5200 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5201 } | |
5202 else | |
5203 { | |
5204 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5205 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5206 } | |
5207 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5208 } | |
5209 } | |
5210 } | |
1040 | 5211 |
5212 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
5213 { | |
5214 | |
5215 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5216 if ((v28 < 0) || v28 > 2 ) | |
5217 return v5 + v62 + v61; | |
5218 } | |
1062 | 5219 v15 = pItemsTable->pItems[v23].uDamageMod; |
5220 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 5221 v5 += v15 + v14; |
1049 | 5222 return v5 + v62 + v61; |
0 | 5223 } |
5224 v59 = 3; | |
5225 LABEL_74: | |
5226 v5 = v59; | |
5227 return v5 + v62 + v61; | |
5228 } | |
5229 if ( (signed int)attr < 0 ) | |
5230 return v5 + v62 + v61; | |
1040 | 5231 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 5232 goto LABEL_95; |
1040 | 5233 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
5234 { | |
5235 if ( !Player::HasEnchantedItemEquipped(25) ) | |
5236 return v5 + v62 + v61; | |
5237 v5 = 5; | |
5238 return v5 + v62 + v61; | |
5239 } | |
5240 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 5241 return v5 + v62 + v61; |
1040 | 5242 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 5243 { |
5244 if ( IsUnarmed() == 1 ) | |
5245 { | |
5246 v5 = 0; | |
5247 return v5 + v62 + v61; | |
5248 } | |
816 | 5249 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5250 { | |
5251 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5252 if ( v17 >= 0 ) |
5253 { | |
5254 if ( v17 <= 2 ) | |
1040 | 5255 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 5256 } |
5257 } | |
865 | 5258 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5259 return v5 + v62 + v61; |
1040 | 5260 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
5261 v56 = pItemsTable->pItems[v20].uDamageMod; | |
5262 v5 += v56; | |
5263 return v5 + v62 + v61; | |
5264 } | |
5265 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 5266 { |
5267 if ( IsUnarmed() == 1 ) | |
5268 { | |
5269 v5 = 1; | |
5270 return v5 + v62 + v61; | |
5271 } | |
816 | 5272 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5273 { | |
5274 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5275 if ( v9 >= 0 ) |
5276 { | |
5277 if ( v9 <= 2 ) | |
5278 { | |
1040 | 5279 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5280 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5281 if ( !v6->pEquipment.uShield ) |
0 | 5282 { |
1040 | 5283 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5284 ++v5; |
5285 } | |
5286 } | |
5287 } | |
5288 } | |
1040 | 5289 |
5290 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
5291 { | |
5292 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5293 if ((v12 < 0) || v12 > 2 ) | |
5294 return v5 + v62 + v61; | |
5295 } | |
5296 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
5297 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5298 LABEL_88: |
5299 v5 += v15 + v14; | |
5300 } | |
5301 return v5 + v62 + v61; | |
5302 } | |
5303 | |
5304 //----- (0048F73C) -------------------------------------------------------- | |
5305 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5306 { | |
5307 int result; // eax@1 | |
5308 int v3; // eax@4 | |
5309 int v4; // ecx@5 | |
5310 | |
5311 switch (a2) | |
5312 { | |
5313 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5314 } | |
5315 | |
5316 result = 0; | |
5317 if ( (signed int)a2 > 10 ) | |
5318 { | |
5319 if ( (signed int)a2 <= 15 ) | |
5320 { | |
5321 switch ( a2 ) | |
5322 { | |
5323 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5324 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 5325 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 5326 break; |
5327 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5328 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 5329 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 5330 break; |
5331 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5332 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 5333 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 5334 break; |
5335 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5336 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 5337 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 5338 break; |
5339 default: | |
5340 if ( a2 != 14 ) | |
5341 return result; | |
5342 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 5343 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 5344 break; |
5345 } | |
5346 return v4 + v3; | |
5347 } | |
5348 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5349 { | |
5350 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5351 { | |
5352 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 5353 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 5354 return v4 + v3; |
5355 } | |
5356 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5357 return result; | |
5358 } | |
5359 return this->pPlayerBuffs[1].uPower; | |
5360 } | |
5361 if ( a2 == 10 ) | |
5362 { | |
5363 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 5364 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 5365 return v4 + v3; |
5366 } | |
5367 switch ( a2 ) | |
5368 { | |
5369 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5370 v3 = pPlayerBuffs[19].uPower; | |
5371 goto LABEL_5; | |
5372 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5373 v3 = pPlayerBuffs[17].uPower; | |
5374 goto LABEL_5; | |
5375 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5376 v3 = pPlayerBuffs[20].uPower; | |
5377 goto LABEL_5; | |
5378 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5379 v3 = pPlayerBuffs[16].uPower; | |
5380 goto LABEL_5; | |
5381 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5382 v3 = pPlayerBuffs[15].uPower; | |
5383 goto LABEL_5; | |
5384 case CHARACTER_ATTRIBUTE_SPEED: | |
5385 v3 = pPlayerBuffs[21].uPower; | |
5386 goto LABEL_5; | |
5387 case CHARACTER_ATTRIBUTE_LUCK: | |
5388 v3 = pPlayerBuffs[18].uPower; | |
5389 LABEL_5: | |
1167 | 5390 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 5391 return v4 + v3; |
5392 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5393 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 5394 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 5395 return v4 + v3; |
5396 default: | |
5397 return result; | |
5398 } | |
5399 return result; | |
5400 } | |
5401 | |
5402 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5403 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5404 { | |
1064 | 5405 signed int bonus_value; // esi@1 |
5406 unsigned __int16 skill_value; // ax@126 | |
5407 int result; // al@127 | |
353 | 5408 |
1064 | 5409 bonus_value = 0; |
353 | 5410 switch (uSkillType) |
5411 { | |
5412 case PLAYER_SKILL_MONSTER_ID: | |
5413 { | |
652 | 5414 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 5415 bonus_value = 6; |
652 | 5416 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 5417 bonus_value += 6; |
5418 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 5419 } |
5420 break; | |
5421 | |
5422 case PLAYER_SKILL_ARMSMASTER: | |
5423 { | |
652 | 5424 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 5425 bonus_value = 2; |
652 | 5426 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 5427 bonus_value += 3; |
5428 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 5429 } |
5430 break; | |
5431 | |
5432 case PLAYER_SKILL_STEALING: | |
5433 { | |
652 | 5434 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 5435 bonus_value = 8; |
5436 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 5437 } |
5438 break; | |
5439 | |
5440 | |
5441 case PLAYER_SKILL_ALCHEMY: | |
5442 { | |
652 | 5443 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 5444 bonus_value = 4; |
652 | 5445 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 5446 bonus_value += 8; |
5447 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 5448 } |
5449 break; | |
5450 | |
5451 case PLAYER_SKILL_LEARNING: | |
5452 { | |
652 | 5453 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 5454 bonus_value = 10; |
652 | 5455 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 5456 bonus_value += 15; |
652 | 5457 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 5458 bonus_value += 5; |
5459 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 5460 } |
5461 break; | |
5462 | |
5463 case PLAYER_SKILL_UNARMED: | |
5464 { | |
652 | 5465 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 5466 bonus_value = 2; |
5467 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 5468 } |
5469 break; | |
5470 | |
5471 case PLAYER_SKILL_DODGE: | |
5472 { | |
652 | 5473 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 5474 bonus_value = 2; |
5475 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 5476 } |
5477 break; | |
5478 | |
5479 case PLAYER_SKILL_BOW: | |
1064 | 5480 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 5481 break; |
5482 case PLAYER_SKILL_SHIELD: | |
1064 | 5483 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 5484 break; |
5485 | |
5486 case PLAYER_SKILL_EARTH: | |
652 | 5487 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5488 bonus_value = 2; |
652 | 5489 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5490 bonus_value += 3; |
652 | 5491 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5492 bonus_value += 4; |
353 | 5493 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5494 bonus_value += 3; |
5495 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 5496 break; |
5497 case PLAYER_SKILL_FIRE: | |
652 | 5498 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5499 bonus_value = 2; |
652 | 5500 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5501 bonus_value += 3; |
652 | 5502 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5503 bonus_value += 4; |
353 | 5504 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5505 bonus_value += 3; |
5506 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 5507 break; |
5508 case PLAYER_SKILL_AIR: | |
652 | 5509 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5510 bonus_value = 2; |
652 | 5511 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5512 bonus_value += 3; |
652 | 5513 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5514 bonus_value += 4; |
353 | 5515 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5516 bonus_value += 3; |
5517 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 5518 break; |
5519 case PLAYER_SKILL_WATER: | |
652 | 5520 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5521 bonus_value = 2; |
652 | 5522 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5523 bonus_value += 3; |
652 | 5524 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5525 bonus_value += 4; |
353 | 5526 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5527 bonus_value += 3; |
5528 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 5529 break; |
5530 case PLAYER_SKILL_SPIRIT: | |
652 | 5531 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5532 bonus_value = 2; |
652 | 5533 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5534 bonus_value += 3; |
652 | 5535 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5536 bonus_value += 4; |
5537 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 5538 break; |
5539 case PLAYER_SKILL_MIND: | |
652 | 5540 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5541 bonus_value = 2; |
652 | 5542 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5543 bonus_value += 3; |
652 | 5544 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5545 bonus_value += 4; |
5546 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 5547 break; |
5548 case PLAYER_SKILL_BODY: | |
652 | 5549 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5550 bonus_value = 2; |
652 | 5551 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5552 bonus_value += 3; |
652 | 5553 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5554 bonus_value += 4; |
5555 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 5556 break; |
5557 case PLAYER_SKILL_LIGHT: | |
1064 | 5558 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 5559 break; |
5560 case PLAYER_SKILL_DARK: | |
5561 { | |
1064 | 5562 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 5563 } |
5564 break; | |
5565 | |
5566 case PLAYER_SKILL_MERCHANT: | |
5567 { | |
652 | 5568 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 5569 bonus_value = 4; |
652 | 5570 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 5571 bonus_value += 6; |
652 | 5572 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 5573 bonus_value += 3; |
652 | 5574 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 5575 bonus_value += 8; |
353 | 5576 } |
5577 break; | |
5578 | |
5579 case PLAYER_SKILL_PERCEPTION: | |
5580 { | |
652 | 5581 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 5582 bonus_value = 6; |
652 | 5583 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 5584 bonus_value += 5; |
353 | 5585 } |
5586 break; | |
5587 | |
0 | 5588 case PLAYER_SKILL_ITEM_ID: |
1064 | 5589 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 5590 break; |
5591 case PLAYER_SKILL_MEDITATION: | |
1064 | 5592 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 5593 break; |
0 | 5594 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5595 { |
652 | 5596 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 5597 bonus_value = 4; |
652 | 5598 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 5599 bonus_value += 6; |
652 | 5600 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 5601 bonus_value += 8; |
5602 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 5603 } |
5604 break; | |
5605 } | |
5606 | |
1064 | 5607 skill_value = pActiveSkills[uSkillType]; |
5608 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
5609 result = bonus_value + skill_value; | |
0 | 5610 else |
1064 | 5611 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 5612 return result; |
5613 } | |
5614 | |
5615 //----- (0048FC00) -------------------------------------------------------- | |
5616 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5617 { | |
1064 | 5618 |
5619 | |
5620 | |
0 | 5621 Player *v2; // esi@1 |
1064 | 5622 int armmaster_skill; // eax@1 |
0 | 5623 char v4; // di@1 |
5624 signed int v5; // ebx@1 | |
1064 | 5625 unsigned int armaster_mastery; // eax@2 |
0 | 5626 unsigned __int8 v7; // sf@5 |
5627 unsigned __int8 v8; // of@5 | |
5628 PlayerEquipment *v9; // ebx@19 | |
5629 Player *v10; // ecx@20 | |
821 | 5630 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5631 int v12; // eax@21 |
5632 int v13; // edi@21 | |
5633 char v14; // di@25 | |
5634 signed int v15; // esi@25 | |
5635 char v16; // al@32 | |
5636 int v18; // eax@36 | |
5637 unsigned int v19; // eax@37 | |
5638 ITEM_EQUIP_TYPE v20; // edi@40 | |
5639 int v21; // edx@41 | |
5640 int v22; // eax@42 | |
821 | 5641 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5642 unsigned __int16 v24; // ax@45 |
5643 unsigned __int16 v25; // bx@45 | |
5644 unsigned int v26; // eax@45 | |
5645 unsigned __int8 v27; // sf@50 | |
5646 unsigned __int8 v28; // of@50 | |
5647 unsigned int v29; // eax@52 | |
5648 int v30; // eax@55 | |
5649 int v31; // eax@58 | |
5650 unsigned int v32; // eax@59 | |
5651 int v33; // eax@65 | |
5652 char v34; // si@65 | |
5653 ITEM_EQUIP_TYPE v35; // edi@69 | |
5654 int v36; // edx@70 | |
5655 int v37; // eax@71 | |
821 | 5656 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5657 int v39; // eax@74 |
5658 int v40; // eax@89 | |
5659 char v41; // si@89 | |
5660 int v42; // eax@96 | |
821 | 5661 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5662 int v44; // eax@97 |
5663 int v45; // eax@98 | |
5664 int v46; // eax@99 | |
5665 int v47; // eax@100 | |
5666 int v48; // eax@101 | |
5667 int v49; // eax@102 | |
5668 unsigned __int16 v50; // ax@113 | |
5669 char v51; // di@113 | |
5670 unsigned int v52; // eax@113 | |
5671 int v53; // edi@113 | |
5672 signed int i; // ecx@113 | |
5673 unsigned __int16 v55; // ax@118 | |
5674 char v56; // si@118 | |
5675 unsigned int v57; // eax@118 | |
5676 int v58; // esi@121 | |
5677 signed int j; // ecx@121 | |
1064 | 5678 int base_value; // edi@126 |
5679 int attrib_modif; // eax@126 | |
0 | 5680 signed int v62; // [sp-4h] [bp-30h]@26 |
5681 signed int v63; // [sp-4h] [bp-30h]@80 | |
5682 int v64; // [sp+Ch] [bp-20h]@104 | |
5683 int v65; // [sp+10h] [bp-1Ch]@104 | |
5684 int v66; // [sp+14h] [bp-18h]@104 | |
5685 int v67; // [sp+18h] [bp-14h]@104 | |
5686 int v68; // [sp+1Ch] [bp-10h]@69 | |
5687 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
1080 | 5688 int skill_bonus; // [sp+24h] [bp-8h]@1 |
0 | 5689 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 |
5690 int a1; // [sp+34h] [bp+8h]@21 | |
5691 int a1a; // [sp+34h] [bp+8h]@74 | |
5692 signed int a1b; // [sp+34h] [bp+8h]@94 | |
1064 | 5693 int multiplier; |
5694 int arm_bonus; | |
5695 int lvl_avl[4]; | |
0 | 5696 |
5697 v2 = this; | |
1080 | 5698 skill_bonus = 0; |
0 | 5699 v69 = 0; |
1064 | 5700 multiplier =0; |
5701 arm_bonus =0; | |
0 | 5702 v71 = (ITEM_EQUIP_TYPE)0; |
1064 | 5703 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
5704 v4 = armmaster_skill; | |
0 | 5705 v5 = 1; |
1064 | 5706 if ( armmaster_skill ) |
5707 { | |
5708 armaster_mastery = SkillToMastery(armmaster_skill); | |
0 | 5709 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
5710 { | |
1064 | 5711 if ( armaster_mastery == 4 ) |
5712 multiplier =2; | |
5713 else if ( armaster_mastery == 3 ) | |
5714 multiplier =1; | |
5715 } | |
5716 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) | |
5717 { | |
5718 if ( armaster_mastery == 4 ) | |
5719 multiplier =2; | |
5720 else if ( armaster_mastery >= 2 ) | |
5721 multiplier =1; | |
5722 } | |
5723 arm_bonus=(armmaster_skill&0x3F)*multiplier; | |
5724 } | |
5725 | |
5726 | |
0 | 5727 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) |
5728 { | |
1064 | 5729 base_value = pBaseHealthPerLevelByClass[classType]; |
5730 attrib_modif = GetBodybuilding(); | |
5731 return base_value * attrib_modif; | |
0 | 5732 } |
5733 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5734 { | |
1064 | 5735 base_value = pBaseManaPerLevelByClass[classType]; |
5736 attrib_modif = GetMeditation(); | |
5737 return base_value * attrib_modif; | |
5738 } | |
5739 if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS ) | |
5740 { | |
5741 a1b = 0; | |
5742 v71 = (ITEM_EQUIP_TYPE)0; | |
5743 | |
5744 for (j=0; j<16; ++j) | |
5745 { | |
5746 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) | |
5747 { | |
5748 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; | |
5749 v44=pItemsTable->pItems[curr_item].uSkillType; | |
5750 switch (v44) | |
5751 { | |
5752 | |
5753 case PLAYER_SKILL_STAFF: | |
5754 | |
5755 lvl_avl[0]=0; | |
5756 lvl_avl[1]=1; | |
5757 lvl_avl[2]=0; | |
5758 lvl_avl[3]=0; | |
5759 break; | |
5760 case PLAYER_SKILL_SWORD: | |
5761 case PLAYER_SKILL_SPEAR: | |
5762 lvl_avl[0]=0; | |
5763 lvl_avl[1]=0; | |
5764 lvl_avl[2]=0; | |
5765 lvl_avl[3]=1; | |
5766 break; | |
5767 case PLAYER_SKILL_SHIELD: | |
5768 a1b = 1; | |
5769 lvl_avl[0]=1; | |
5770 lvl_avl[1]=0; | |
5771 lvl_avl[2]=1; | |
5772 lvl_avl[3]=0; | |
5773 break; | |
5774 case PLAYER_SKILL_LEATHER: | |
5775 v71 = (ITEM_EQUIP_TYPE)1; | |
5776 lvl_avl[0]=1; | |
5777 lvl_avl[1]=0; | |
5778 lvl_avl[2]=1; | |
5779 lvl_avl[3]=0; | |
5780 | |
5781 break; | |
5782 case PLAYER_SKILL_CHAIN: | |
5783 a1b = 1; | |
5784 lvl_avl[0]=1; | |
5785 lvl_avl[1]=0; | |
5786 lvl_avl[2]=0; | |
5787 lvl_avl[3]=0; | |
5788 break; | |
5789 case PLAYER_SKILL_PLATE: | |
5790 a1b = 1; | |
5791 lvl_avl[0]=1; | |
5792 lvl_avl[1]=0; | |
5793 lvl_avl[2]=0; | |
5794 lvl_avl[3]=0; | |
5795 break; | |
5796 default: | |
5797 continue; | |
5798 } | |
5799 | |
5800 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); | |
5801 v51 = v50; | |
5802 v52 = SkillToMastery(v50); | |
5803 v53 = v51 & 0x3F; | |
5804 for ( i = 0; i < (signed int)v52; ++i ) | |
5805 { | |
5806 if ( lvl_avl[i] ) | |
1080 | 5807 skill_bonus += v53; |
1064 | 5808 } |
5809 | |
5810 } | |
5811 } | |
5812 | |
5813 lvl_avl[0]=1; | |
5814 lvl_avl[1]=1; | |
5815 lvl_avl[2]=1; | |
5816 lvl_avl[3]=0; | |
5817 | |
5818 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
5819 v56 = v55; | |
5820 v57 = SkillToMastery(v55); | |
5821 if ( !a1b && (!v71 || v57 == 4) ) | |
5822 { | |
5823 v58 = v56 & 0x3F; | |
5824 for ( j = 0; j < (signed int)v57; ++j ) | |
5825 { | |
1069 | 5826 if ( lvl_avl[j] ) |
1080 | 5827 skill_bonus += v58; |
1064 | 5828 } |
5829 } | |
1080 | 5830 return skill_bonus; |
1064 | 5831 |
5832 | |
5833 } | |
5834 | |
1080 | 5835 if (a2 == CHARACTER_ATTRIBUTE_ATTACK) |
5836 { | |
5837 | |
5838 if ( v2->IsUnarmed() == 1 ) | |
5839 { | |
5840 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5841 v34 = v33; | |
5842 if ( !v33 ) | |
5843 return skill_bonus; | |
5844 if ( SkillToMastery(v33) >= 3 ) | |
5845 multiplier = 2; | |
5846 else | |
5847 multiplier=1; | |
5848 v30 = multiplier * (v34 & 0x3F); | |
5849 return arm_bonus + v30; | |
5850 } | |
5851 v35 = (ITEM_EQUIP_TYPE)0; | |
5852 v68 = 0; | |
5853 for (i=0; i<16 ; ++i) | |
5854 { | |
5855 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5856 { | |
5857 v37 = v2->pEquipment.pIndices[i]-1; | |
5858 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) | |
5859 break; | |
5860 } | |
5861 } | |
5862 if ( i >= 16 ) | |
5863 return skill_bonus; | |
5864 | |
5865 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5866 a1a = v2->GetActualSkillLevel(v38); | |
5867 v39= SkillToMastery(a1a); | |
5868 v71 = (ITEM_EQUIP_TYPE)0; | |
5869 switch (v38) | |
5870 { | |
5871 case PLAYER_SKILL_STAFF: | |
5872 v71 = (ITEM_EQUIP_TYPE)1; | |
5873 if ( v39 == 4 ) | |
5874 { | |
5875 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5876 v41 = v40; | |
5877 | |
5878 if ( v40 ) | |
5879 { | |
5880 if ( SkillToMastery(v40) >= 3 ) | |
5881 multiplier = 2; | |
5882 else | |
5883 multiplier=1; | |
5884 v68 = multiplier * (v41 & 0x3F); | |
5885 } | |
5886 } | |
5887 break; | |
5888 case PLAYER_SKILL_SWORD: | |
5889 case PLAYER_SKILL_DAGGER: | |
5890 case PLAYER_SKILL_AXE: | |
5891 case PLAYER_SKILL_SPEAR: | |
5892 case PLAYER_SKILL_MACE: | |
5893 v71 = (ITEM_EQUIP_TYPE)1; | |
5894 break; | |
5895 case PLAYER_SKILL_BLASTER: | |
5896 | |
5897 switch (v39) | |
5898 { | |
5899 case 0: multiplier=1; break; | |
5900 case 1: multiplier=3; break; | |
5901 case 3: multiplier=3; break; | |
5902 case 4: multiplier=5; break; | |
5903 } | |
5904 v5 = multiplier; | |
5905 return v5 * (a1a & 0x3F); | |
5906 break; | |
5907 } | |
5908 | |
5909 | |
5910 | |
5911 v30 = v68 + v71 * (a1a & 0x3F); | |
5912 return (int)((char *)v69 + v30); | |
5913 | |
5914 } | |
5915 | |
5916 | |
0 | 5917 if ( a2 != 9 ) |
5918 { | |
1080 | 5919 |
0 | 5920 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) |
1080 | 5921 return skill_bonus; |
0 | 5922 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
5923 { | |
5924 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
1080 | 5925 return skill_bonus; |
0 | 5926 v71 = (ITEM_EQUIP_TYPE)0; |
5927 v9 = &v2->pEquipment; | |
5928 while ( 1 ) | |
5929 { | |
5930 if ( v2->HasItemEquipped(v71) ) | |
5931 { | |
118 | 5932 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5933 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5934 a1 = v12; |
5935 SkillToMastery(v12); | |
5936 v13 = v11 - 5; | |
5937 if ( !v13 ) | |
5938 return a1 & 0x3F; | |
5939 if ( v13 == 2 ) | |
5940 break; | |
5941 } | |
5942 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5943 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5944 if ( (signed int)v71 >= 16 ) | |
1080 | 5945 return skill_bonus; |
0 | 5946 } |
5947 v14 = a1; | |
5948 v15 = 1; | |
5949 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5950 { | |
5951 v62 = 5; | |
5952 goto LABEL_31; | |
5953 } | |
5954 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5955 { | |
5956 v62 = 3; | |
5957 goto LABEL_31; | |
5958 } | |
5959 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5960 goto LABEL_32; | |
5961 goto LABEL_30; | |
5962 } | |
5963 if ( v2->IsUnarmed() ) | |
5964 { | |
5965 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5966 v14 = v18; | |
5967 if ( !v18 ) | |
1080 | 5968 return skill_bonus; |
0 | 5969 v15 = 0; |
5970 v19 = SkillToMastery(v18); | |
5971 if ( (signed int)v19 < 3 ) | |
5972 { | |
5973 if ( (signed int)v19 >= 2 ) | |
5974 v15 = 1; | |
5975 LABEL_32: | |
5976 v16 = v14; | |
5977 return v15 * (v16 & 0x3F); | |
5978 } | |
5979 LABEL_30: | |
5980 v62 = 2; | |
5981 LABEL_31: | |
5982 v15 = v62; | |
5983 goto LABEL_32; | |
5984 } | |
5985 v20 = (ITEM_EQUIP_TYPE)0; | |
5986 while ( 1 ) | |
5987 { | |
5988 if ( v2->HasItemEquipped(v20) ) | |
5989 { | |
118 | 5990 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5991 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5992 break; | |
5993 } | |
5994 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5995 if ( (signed int)v20 >= 16 ) | |
1080 | 5996 return skill_bonus; |
0 | 5997 } |
5998 v71 = (ITEM_EQUIP_TYPE)0; | |
5999 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
6000 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
6001 v25 = v24; | |
6002 v26 = SkillToMastery(v24); | |
6003 if ( !v23 ) | |
6004 { | |
6005 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
6006 { | |
6007 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
6008 LOBYTE(v25) = v31; | |
6009 if ( v31 ) | |
6010 { | |
6011 v15 = 0; | |
6012 v32 = SkillToMastery(v31); | |
6013 if ( (signed int)v32 < 3 ) | |
6014 { | |
6015 if ( (signed int)v32 >= 2 ) | |
6016 v15 = 1; | |
6017 } | |
6018 else | |
6019 { | |
6020 v15 = 2; | |
6021 } | |
6022 v16 = v25; | |
6023 return v15 * (v16 & 0x3F); | |
6024 } | |
6025 } | |
6026 goto LABEL_55; | |
6027 } | |
6028 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6029 { | |
6030 v29 = SkillToMastery(v25); | |
6031 v28 = __OFSUB__(v29, 4); | |
6032 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6033 } | |
6034 else | |
6035 { | |
6036 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6037 goto LABEL_55; | |
6038 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6039 { | |
6040 if ( v23 == PLAYER_SKILL_MACE ) | |
6041 { | |
6042 v28 = __OFSUB__(v26, 2); | |
118 | 6043 v27 = v26 - 2 < 0; |
0 | 6044 goto LABEL_53; |
6045 } | |
6046 LABEL_55: | |
6047 v30 = v71 * (v25 & 0x3F); | |
6048 return (int)((char *)v69 + v30); | |
6049 } | |
6050 v28 = __OFSUB__(v26, 3); | |
118 | 6051 v27 = v26 - 3 < 0; |
0 | 6052 } |
6053 LABEL_53: | |
6054 if ( !(v27 ^ v28) ) | |
6055 v71 = (ITEM_EQUIP_TYPE)1; | |
6056 goto LABEL_55; | |
6057 } | |
1080 | 6058 |
6059 | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
6060 assert(false && "Unknown attribute!"); |
0 | 6061 } |
6062 | |
6063 //----- (00490109) -------------------------------------------------------- | |
6064 // faces are: 0 1 2 3 human males | |
6065 // 4 5 6 7 human females | |
6066 // 8 9 elf males | |
6067 // 10 11 elf females | |
6068 // 12 13 dwarf males | |
6069 // 14 15 dwarf females | |
6070 // 16 17 goblin males | |
6071 // 18 19 goblin females | |
6072 // 20 lich male | |
6073 // 21 lich female | |
6074 // 22 underwater suits (unused) | |
6075 // 23 zombie male | |
6076 // 24 zombie female | |
6077 enum CHARACTER_RACE Player::GetRace() | |
6078 { | |
1014 | 6079 if ( uCurrentFace > 15 ) |
6080 { | |
6081 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6082 return CHARACTER_RACE_GOBLIN; |
6083 } | |
6084 else | |
6085 { | |
1014 | 6086 if ( uCurrentFace >= 12 ) |
0 | 6087 { |
6088 return CHARACTER_RACE_DWARF; | |
6089 } | |
6090 else | |
6091 { | |
1014 | 6092 |
6093 if ( uCurrentFace <= 7 ) | |
0 | 6094 { |
6095 return CHARACTER_RACE_HUMAN; | |
6096 } | |
6097 else | |
6098 { | |
1014 | 6099 if ( uCurrentFace <= 11 ) |
0 | 6100 return CHARACTER_RACE_ELF; |
6101 } | |
6102 } | |
6103 } | |
6104 return CHARACTER_RACE_HUMAN; | |
6105 } | |
6106 | |
6107 //----- (00490141) -------------------------------------------------------- | |
187 | 6108 PLAYER_SEX Player::GetSexByVoice() |
0 | 6109 { |
6110 signed int result; // eax@1 | |
6111 | |
6112 result = 0; | |
6113 switch ( this->uVoiceID ) | |
6114 { | |
6115 case 0u: | |
6116 case 1u: | |
6117 case 2u: | |
6118 case 3u: | |
6119 case 8u: | |
6120 case 9u: | |
6121 case 0xCu: | |
6122 case 0xDu: | |
6123 case 0x10u: | |
6124 case 0x11u: | |
6125 case 0x14u: | |
6126 case 0x17u: | |
187 | 6127 return SEX_MALE; |
6128 | |
0 | 6129 case 4u: |
6130 case 5u: | |
6131 case 6u: | |
6132 case 7u: | |
6133 case 0xAu: | |
6134 case 0xBu: | |
6135 case 0xEu: | |
6136 case 0xFu: | |
6137 case 0x12u: | |
6138 case 0x13u: | |
6139 case 0x15u: | |
6140 case 0x18u: | |
187 | 6141 return SEX_FEMALE; |
6142 | |
0 | 6143 default: |
187 | 6144 assert(false); |
6145 } | |
0 | 6146 } |
6147 | |
6148 //----- (00490188) -------------------------------------------------------- | |
6149 void Player::SetInitialStats() | |
6150 { | |
6151 auto v1 = GetRace(); | |
290 | 6152 uMight = StatTable[v1][0].uBaseValue; |
6153 uIntelligence = StatTable[v1][1].uBaseValue; | |
6154 uWillpower = StatTable[v1][2].uBaseValue; | |
6155 uEndurance = StatTable[v1][3].uBaseValue; | |
6156 uAccuracy = StatTable[v1][4].uBaseValue; | |
6157 uSpeed = StatTable[v1][5].uBaseValue; | |
6158 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6159 } |
6160 | |
6161 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6162 void Player::SetSexByVoice() |
6163 { | |
6164 switch ( this->uVoiceID) | |
0 | 6165 { |
6166 case 0: | |
6167 case 1: | |
6168 case 2: | |
6169 case 3: | |
6170 case 8: | |
6171 case 9: | |
6172 case 0xC: | |
6173 case 0xD: | |
6174 case 0x10: | |
6175 case 0x11: | |
6176 case 0x14: | |
6177 case 0x17: | |
1021 | 6178 this->uSex = SEX_MALE; |
0 | 6179 break; |
6180 case 4: | |
6181 case 5: | |
6182 case 6: | |
6183 case 7: | |
6184 case 0xA: | |
6185 case 0xB: | |
6186 case 0xE: | |
6187 case 0xF: | |
6188 case 0x12: | |
6189 case 0x13: | |
6190 case 0x15: | |
6191 case 0x18: | |
1021 | 6192 this->uSex = SEX_FEMALE; |
0 | 6193 break; |
6194 default: | |
6195 break; | |
6196 } | |
1021 | 6197 |
0 | 6198 } |
6199 | |
6200 //----- (0049024A) -------------------------------------------------------- | |
135 | 6201 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6202 { |
6203 sLevelModifier = 0; | |
6204 sAgeModifier = 0; | |
6205 | |
135 | 6206 classType = cls; |
0 | 6207 uLuckBonus = 0; |
6208 uSpeedBonus = 0; | |
6209 uAccuracyBonus = 0; | |
6210 uEnduranceBonus = 0; | |
6211 uWillpowerBonus = 0; | |
6212 uIntelligenceBonus = 0; | |
6213 uMightBonus = 0; | |
6214 uLevel = 1; | |
6215 uExperience = 251 + rand() % 100; | |
6216 uBirthYear = 1147 - rand() % 6; | |
6217 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6218 memset(_guilds_member_bits, 0, 64); |
0 | 6219 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6220 | |
6221 for (uint i = 0; i < 37; ++i) | |
6222 { | |
135 | 6223 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6224 continue; |
6225 | |
6226 pActiveSkills[i] = 1; | |
6227 | |
6228 switch (i) | |
6229 { | |
886 | 6230 case PLAYER_SKILL_FIRE: |
6231 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6232 |
6233 extern bool all_magic; | |
6234 if ( all_magic == true ) | |
6235 { | |
6236 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6237 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6238 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6239 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6240 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6241 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6242 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6243 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6244 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6245 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6246 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6247 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6248 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6249 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6250 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6251 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6252 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6253 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6254 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6255 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6256 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6257 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6258 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6259 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6260 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6261 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6262 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6263 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6264 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6265 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6266 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6267 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6268 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6269 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6270 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6271 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6272 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6273 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6274 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6275 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6276 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6277 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6278 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6279 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6280 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6281 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6282 } | |
486 | 6283 break; |
886 | 6284 case PLAYER_SKILL_AIR: |
6285 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6286 break; | |
6287 case PLAYER_SKILL_WATER: | |
6288 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6289 break; | |
6290 case PLAYER_SKILL_EARTH: | |
6291 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6292 break; | |
6293 case PLAYER_SKILL_SPIRIT: | |
6294 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6295 break; | |
6296 case PLAYER_SKILL_MIND: | |
6297 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6298 break; | |
6299 case PLAYER_SKILL_BODY: | |
6300 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6301 |
6302 if ( all_magic == true ) | |
6303 { | |
6304 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6305 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6306 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6307 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6308 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6309 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6310 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6311 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6312 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6313 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6314 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6315 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6316 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6317 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6318 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6319 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6320 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6321 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6322 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6323 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6324 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6325 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6326 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6327 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6328 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6329 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6330 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6331 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6332 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6333 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6334 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6335 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6336 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6337 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6338 } | |
569 | 6339 break; |
886 | 6340 case PLAYER_SKILL_LIGHT: |
6341 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6342 break; | |
6343 case PLAYER_SKILL_DARK: | |
6344 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6345 break; | |
0 | 6346 } |
6347 } | |
6348 | |
6349 sHealth = GetMaxHealth(); | |
6350 sMana = GetMaxMana(); | |
6351 } | |
6352 | |
6353 //----- (004903C9) -------------------------------------------------------- | |
821 | 6354 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6355 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6356 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6357 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6358 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6359 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6360 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6361 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6362 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6363 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6364 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6365 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6366 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6367 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6368 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6369 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6370 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6371 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6372 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6373 else if ( order <= 12 ) |
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 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6376 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6377 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6378 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6379 else |
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 return (PLAYER_SKILL_TYPE)37; |
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 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6384 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6385 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6386 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6387 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6388 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6389 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6390 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6391 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6392 } |
0 | 6393 } |
6394 | |
6395 | |
6396 | |
6397 //----- (0049048D) -------------------------------------------------------- | |
6398 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6399 void Player::DecreaseAttribute(int eAttribute) | |
6400 { | |
6401 int v2; // eax@1 | |
6402 int pBaseValue; // ecx@1 | |
6403 int pDroppedStep; // ebx@1 | |
6404 int pStep; // esi@1 | |
6405 unsigned __int16 result; // ax@7 | |
6406 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6407 | |
6408 v2 = eAttribute + 7 * GetRace(); | |
290 | 6409 pBaseValue = StatTable[0][v2].uBaseValue; |
6410 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6411 uMinValue = pBaseValue - 2; |
290 | 6412 pStep = StatTable[0][v2].uBaseStep; |
1272 | 6413 unsigned short* AttrToChange = nullptr; |
6414 switch ( eAttribute ) | |
6415 { | |
6416 case CHARACTER_ATTRIBUTE_STRENGTH: | |
6417 AttrToChange = &this->uMight; | |
6418 break; | |
6419 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
6420 AttrToChange = &this->uIntelligence; | |
6421 break; | |
6422 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
6423 AttrToChange = &this->uWillpower; | |
6424 break; | |
6425 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
6426 AttrToChange = &this->uEndurance; | |
6427 break; | |
6428 case CHARACTER_ATTRIBUTE_ACCURACY: | |
6429 AttrToChange = &this->uAccuracy; | |
6430 break; | |
6431 case CHARACTER_ATTRIBUTE_SPEED: | |
6432 AttrToChange = &this->uSpeed; | |
6433 break; | |
6434 case CHARACTER_ATTRIBUTE_LUCK: | |
6435 AttrToChange = &this->uLuck; | |
6436 break; | |
6437 } | |
6438 if ( *AttrToChange <= pBaseValue ) | |
6439 pStep = pDroppedStep; | |
6440 if ( *AttrToChange - pStep >= uMinValue ) | |
6441 *AttrToChange -= pStep; | |
0 | 6442 } |
6443 | |
6444 //----- (004905F5) -------------------------------------------------------- | |
6445 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
1273 | 6446 void Player::IncreaseAttribute( int eAttribute ) |
6447 { | |
6448 int raceId; // eax@1 | |
6449 int maxValue; // ebx@1 | |
6450 signed int baseStep; // edi@1 | |
6451 signed int tmp; // eax@17 | |
0 | 6452 signed int result; // eax@18 |
1273 | 6453 int baseValue; // [sp+Ch] [bp-8h]@1 |
6454 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
6455 unsigned short* statToChange; | |
6456 | |
6457 raceId = GetRace(); | |
6458 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
6459 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
6460 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
6461 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
6462 PlayerCreation_GetUnspentAttributePointCount(); | |
6463 switch ( eAttribute ) | |
6464 { | |
6465 case 0: | |
6466 statToChange = &this->uMight; | |
6467 break; | |
6468 case 1: | |
6469 statToChange = &this->uIntelligence; | |
6470 break; | |
6471 case 2: | |
6472 statToChange = &this->uWillpower; | |
6473 break; | |
6474 case 3: | |
6475 statToChange = &this->uEndurance; | |
6476 break; | |
6477 case 4: | |
6478 statToChange = &this->uAccuracy; | |
6479 break; | |
6480 case 5: | |
6481 statToChange = &this->uSpeed; | |
6482 break; | |
6483 case 6: | |
6484 statToChange = &this->uLuck; | |
6485 default: | |
6486 assert(false); | |
6487 return; | |
6488 break; | |
6489 } | |
6490 if ( *statToChange < baseValue ) | |
6491 { | |
6492 tmp = baseStep; | |
6493 baseStep = droppedStep; | |
6494 droppedStep = tmp; | |
6495 } | |
6496 result = PlayerCreation_GetUnspentAttributePointCount(); | |
6497 if ( result >= droppedStep ) | |
6498 { | |
6499 if ( baseStep + *statToChange <= maxValue ) | |
6500 *statToChange += baseStep; | |
6501 } | |
0 | 6502 } |
6503 | |
6504 //----- (0049070F) -------------------------------------------------------- | |
6505 void Player::Zero() | |
6506 { | |
6507 Player *v1; // esi@1 | |
6508 | |
6509 v1 = this; | |
6510 this->sLevelModifier = 0; | |
6511 this->sACModifier = 0; | |
6512 this->uLuckBonus = 0; | |
6513 this->uAccuracyBonus = 0; | |
6514 this->uSpeedBonus = 0; | |
6515 this->uEnduranceBonus = 0; | |
6516 this->uWillpowerBonus = 0; | |
6517 this->uIntelligenceBonus = 0; | |
6518 this->uMightBonus = 0; | |
6519 this->field_100 = 0; | |
6520 this->field_FC = 0; | |
6521 this->field_F8 = 0; | |
6522 this->field_F4 = 0; | |
6523 this->field_F0 = 0; | |
6524 this->field_EC = 0; | |
6525 this->field_E8 = 0; | |
6526 this->field_E4 = 0; | |
6527 this->field_E0 = 0; | |
766 | 6528 memset(&this->sResFireBonus, 0, 0x16u); |
0 | 6529 v1->field_1A97 = 0; |
6530 v1->_ranged_dmg_bonus = 0; | |
6531 v1->field_1A95 = 0; | |
6532 v1->_ranged_atk_bonus = 0; | |
6533 v1->field_1A93 = 0; | |
6534 v1->_melee_dmg_bonus = 0; | |
6535 v1->field_1A91 = 0; | |
6536 v1->_some_attack_bonus = 0; | |
6537 v1->_mana_related = 0; | |
6538 v1->uFullManaBonus = 0; | |
6539 v1->_health_related = 0; | |
6540 v1->uFullHealthBonus = 0; | |
6541 } | |
6542 | |
6543 //----- (004907E7) -------------------------------------------------------- | |
299 | 6544 unsigned int Player::GetStatColor(int uStat) |
0 | 6545 { |
6546 __int16 uWhite; // si@1 | |
290 | 6547 int attribute_value; // edx@1 |
299 | 6548 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6549 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6550 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6551 | |
1014 | 6552 uRed = TargetColor(255, 35, 0); |
6553 uGreen = TargetColor(0, 255, 0); | |
6554 uWhite = TargetColor(255, 255, 255); | |
299 | 6555 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6556 |
0 | 6557 switch (uStat) |
6558 { | |
6559 case 0: attribute_value = uMight; break; | |
6560 case 1: attribute_value = uIntelligence; break; | |
6561 case 2: attribute_value = uWillpower; break; | |
6562 case 3: attribute_value = uEndurance; break; | |
290 | 6563 case 4: attribute_value = uAccuracy; break; |
6564 case 5: attribute_value = uSpeed; break; | |
0 | 6565 case 6: attribute_value = uLuck; break; |
6566 }; | |
6567 | |
299 | 6568 if ( attribute_value == pBaseAttrValue ) |
290 | 6569 return uWhite; |
299 | 6570 else if ( attribute_value > pBaseAttrValue ) |
290 | 6571 return uGreen; |
0 | 6572 else |
290 | 6573 return uRed; |
0 | 6574 } |
6575 | |
6576 //----- (004908A8) -------------------------------------------------------- | |
6577 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6578 { | |
1014 | 6579 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6580 { | |
6581 pConditions[uCondition]=0i64; | |
6582 return true; | |
0 | 6583 } |
6584 else | |
1014 | 6585 return false; |
0 | 6586 } |
6587 | |
6588 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6589 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6590 { |
6591 Player *v3; // esi@1 | |
6592 signed int v5; // eax@17 | |
6593 int v8; // edx@39 | |
6594 char *v13; // eax@45 | |
6595 signed int v15; // edi@68 | |
6596 int v16; // edx@73 | |
6597 unsigned __int16 v17; // edi@73 | |
6598 unsigned int v18; // eax@73 | |
6599 const char *v22; // eax@84 | |
6600 int scroll_id; // esi@96 | |
6601 int v25; // eax@109 | |
6602 int v26; // eax@113 | |
6603 int new_mana_val; // edi@114 | |
6604 signed __int64 v28; // qax@120 | |
6605 __int64 v30; // edi@137 | |
6606 __int64 v32; // ST3C_4@137 | |
6607 __int64 v34; // ST34_4@137 | |
6608 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6609 const char *v66; // [sp-4h] [bp-30h]@69 | |
6610 signed int v67; // [sp-4h] [bp-30h]@77 | |
6611 const char *v68; // [sp-4h] [bp-30h]@89 | |
6612 char v72; // [sp+20h] [bp-Ch]@68 | |
6613 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6614 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6615 Player *thisb; // [sp+28h] [bp-4h]@1 |
6616 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6617 | |
6618 thisb = this; | |
6619 v3 = &pParty->pPlayers[player_num-1]; | |
6620 v73 = 1; | |
6621 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6622 return; | |
6623 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6624 { |
1021 | 6625 if ( pParty->pPickedItem.uItemID == 160 ) |
6626 { | |
6627 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6628 } | |
6629 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6630 { |
1021 | 6631 new_mana_val = v3->sMana; |
6632 new_mana_val += 2; | |
6633 if ( new_mana_val > v3->GetMaxMana() ) | |
6634 new_mana_val = v3->GetMaxMana(); | |
6635 v3->PlaySound(SPEECH_36, 0); | |
6636 } | |
6637 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6638 { | |
6639 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6640 v3->PlaySound(SPEECH_36, 0); |
1021 | 6641 |
6642 } | |
6643 else | |
6644 { | |
6645 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6646 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
|
6647 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 6648 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6649 return; | |
1019 | 6650 } |
1032 | 6651 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6652 | |
6653 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6654 { | |
6655 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6656 } | |
6657 if ( v73 ) | |
6658 { | |
6659 if ( pParty->bTurnBasedModeOn ) | |
6660 { | |
6661 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6662 thisb->SetRecoveryTime(100); | |
6663 pTurnEngine->_40471C(); | |
6664 } | |
6665 else | |
6666 { | |
6667 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6668 } | |
6669 } | |
6670 pMouse->RemoveHoldingItem(); | |
6671 return; | |
6672 | |
1021 | 6673 |
6674 } | |
6675 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6676 { |
1021 | 6677 switch ( pParty->pPickedItem.uItemID ) |
6678 { | |
6679 case 221: //Catalyst | |
6680 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6681 break; | |
6682 case 222: //Cure Wounds | |
6683 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6684 pParty->pPlayers[player_num-1].Heal(v25); | |
6685 v3->PlaySound(SPEECH_36, 0); | |
6686 break; | |
6687 case 223: //Magic Potion | |
6688 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6689 new_mana_val = v3->sMana; | |
6690 new_mana_val += v26; | |
6691 if ( new_mana_val > v3->GetMaxMana() ) | |
6692 new_mana_val = v3->GetMaxMana(); | |
6693 v3->PlaySound(SPEECH_36, 0); | |
6694 break; | |
6695 case 224: //Cure Weakness | |
6696 v3->pConditions[Condition_Weak] = 0i64; | |
6697 v3->PlaySound(SPEECH_36, 0); | |
6698 break; | |
6699 case 225: //Cure Disease | |
6700 v3->pConditions[Condition_Disease3] = 0i64; | |
6701 v3->pConditions[Condition_Disease2] = 0i64; | |
6702 v3->pConditions[Condition_Disease1] = 0i64; | |
6703 v3->PlaySound(SPEECH_36, 0); | |
6704 break; | |
6705 case 226: //Cure Poison | |
6706 v3->pConditions[Condition_Poison3] = 0i64; | |
6707 v3->pConditions[Condition_Poison2] = 0i64; | |
6708 v3->pConditions[Condition_Poison1] = 0i64; | |
6709 v3->PlaySound(SPEECH_36, 0); | |
6710 break; | |
6711 case 227: //Awaken | |
6712 v3->pConditions[Condition_Sleep] = 0i64; | |
6713 v3->PlaySound(SPEECH_36, 0); | |
6714 break; | |
6715 case 228: //Haste | |
6716 if ( !v3->pConditions[Condition_Weak] ) | |
6717 { | |
6718 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6719 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6720 v3->PlaySound(SPEECH_36, 0); | |
6721 } | |
6722 break; | |
6723 case 229: //Heroism | |
6724 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6725 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6726 v3->PlaySound(SPEECH_36, 0); | |
6727 break; | |
6728 case 230: //Bless | |
6729 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6730 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6731 v3->PlaySound(SPEECH_36, 0); | |
6732 break; | |
6733 case 231: //Preservation | |
1032 | 6734 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6735 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6736 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6737 v3->PlaySound(SPEECH_36, 0); | |
6738 break; | |
6739 case 232: //Shield | |
1032 | 6740 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6741 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6742 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6743 v3->PlaySound(SPEECH_36, 0); | |
6744 break; | |
6745 case 234: //Stoneskin | |
6746 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6747 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6748 v3->PlaySound(SPEECH_36, 0); | |
6749 break; | |
6750 case 235: //Water Breathing | |
6751 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6752 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6753 break; | |
6754 case 237: //Remove Fear | |
6755 v3->pConditions[Condition_Fear] = 0i64; | |
6756 v3->PlaySound(SPEECH_36, 0); | |
6757 break; | |
6758 case 238: //Remove Curse | |
6759 v3->pConditions[Condition_Cursed] = 0i64; | |
6760 v3->PlaySound(SPEECH_36, 0); | |
6761 break; | |
6762 case 239: //Cure Insanity | |
6763 v3->pConditions[Condition_Insane] = 0i64; | |
6764 v3->PlaySound(SPEECH_36, 0); | |
6765 break; | |
6766 case 240: //Might Boost | |
1032 | 6767 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6768 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6769 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6770 v3->PlaySound(SPEECH_36, 0); | |
6771 break; | |
6772 case 241: //Intellect Boost | |
1032 | 6773 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6774 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6775 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6776 v3->PlaySound(SPEECH_36, 0); | |
6777 break; | |
6778 case 242: //Personality Boost | |
1032 | 6779 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6780 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6781 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6782 v3->PlaySound(SPEECH_36, 0); | |
6783 break; | |
6784 case 243://Endurance Boost | |
1032 | 6785 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6786 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6787 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6788 v3->PlaySound(SPEECH_36, 0); | |
6789 break; | |
6790 case 244: //Speed Boost | |
1032 | 6791 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6792 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6793 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6794 v3->PlaySound(SPEECH_36, 0); | |
6795 break; | |
6796 case 245: //Accuracy Boost | |
1032 | 6797 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6798 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6799 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6800 v3->PlaySound(SPEECH_36, 0); | |
6801 break; | |
6802 case 251: //Cure Paralysis | |
6803 v3->pConditions[Condition_Paralyzed] = 0i64; | |
6804 v3->PlaySound(SPEECH_36, 0); | |
6805 break; | |
6806 case 252://Divine Restoration | |
6807 v30 = v3->pConditions[Condition_Dead]; | |
6808 v32 = v3->pConditions[Condition_Pertified]; | |
6809 v34 = v3->pConditions[Condition_Eradicated]; | |
6810 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
6811 v3->pConditions[Condition_Dead] = v30; | |
6812 v3->pConditions[Condition_Pertified] = v32; | |
6813 v3->pConditions[Condition_Eradicated] = v34; | |
6814 v3->PlaySound(SPEECH_36, 0); | |
6815 break; | |
6816 case 253: //Divine Cure | |
6817 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6818 pParty->pPlayers[player_num-1].Heal(v25); | |
6819 v3->PlaySound(SPEECH_36, 0); | |
6820 break; | |
6821 case 254: //Divine Power | |
6822 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6823 new_mana_val = v3->sMana; | |
6824 new_mana_val += v26; | |
6825 if ( new_mana_val > v3->GetMaxMana() ) | |
6826 new_mana_val = v3->GetMaxMana(); | |
6827 v3->PlaySound(SPEECH_36, 0); | |
6828 break; | |
6829 case 255: //Luck Boost | |
1032 | 6830 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6831 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6832 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6833 v3->PlaySound(SPEECH_36, 0); | |
6834 break; | |
6835 case 256: //Fire Resistance | |
1032 | 6836 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6837 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6838 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6839 v3->PlaySound(SPEECH_36, 0); | |
1032 | 6840 break; |
1021 | 6841 case 257: //Air Resistance |
1032 | 6842 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6843 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6844 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6845 v3->PlaySound(SPEECH_36, 0); | |
6846 break; | |
6847 case 258: //Water Resistance | |
1032 | 6848 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6849 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6850 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6851 v3->PlaySound(SPEECH_36, 0); | |
6852 break; | |
6853 case 259: //Earth Resistance | |
1032 | 6854 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6855 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6856 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6857 v3->PlaySound(SPEECH_36, 0); | |
6858 break; | |
6859 case 260: //Mind Resistance | |
1032 | 6860 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6861 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6862 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6863 v3->PlaySound(SPEECH_36, 0); | |
6864 break; | |
6865 case 261: //Body Resistance | |
1032 | 6866 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6867 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6868 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6869 v3->PlaySound(SPEECH_36, 0); | |
6870 break; | |
6871 case 262: //Stone to Flesh | |
6872 v3->pConditions[Condition_Pertified] = 0i64; | |
6873 v3->PlaySound(SPEECH_36, 0); | |
6874 break; | |
6875 case 264: //Pure Luck | |
6876 if ( !v3->pure_luck_used ) | |
6877 { | |
6878 v3->uLuck += 50; | |
6879 v3->pure_luck_used = 1; | |
6880 } | |
6881 v3->PlaySound(SPEECH_36, 0); | |
6882 break; | |
6883 case 265: //Pure Speed | |
6884 if ( !v3->pure_speed_used ) | |
6885 { | |
6886 v3->uSpeed += 50; | |
6887 v3->pure_speed_used = 1; | |
6888 } | |
6889 v3->PlaySound(SPEECH_36, 0); | |
6890 break; | |
6891 case 266: //Pure Intellect | |
6892 if ( !v3->pure_intellect_used ) | |
6893 { | |
6894 v3->uIntelligence += 50; | |
6895 v3->pure_intellect_used = 1; | |
6896 } | |
6897 v3->PlaySound(SPEECH_36, 0); | |
6898 break; | |
6899 case 267: //Pure Endurance | |
6900 if ( !v3->pure_endurance_used ) | |
6901 { | |
6902 v3->uEndurance += 50; | |
6903 v3->pure_endurance_used = 1; | |
6904 } | |
6905 v3->PlaySound(SPEECH_36, 0); | |
6906 break; | |
6907 case 268: //Pure Personality | |
6908 if ( !v3->pure_willpower_used ) | |
6909 { | |
6910 v3->uWillpower += 50; | |
6911 v3->pure_willpower_used = 1; | |
6912 } | |
6913 v3->PlaySound(SPEECH_36, 0); | |
6914 break; | |
6915 case 269: //Pure Accuracy | |
6916 if ( !v3->pure_accuracy_used ) | |
6917 { | |
6918 v3->uAccuracy += 50; | |
6919 v3->pure_accuracy_used = 1; | |
6920 } | |
6921 v3->PlaySound(SPEECH_36, 0); | |
6922 break; | |
6923 case 270: //Pure Might | |
6924 if ( !v3->pure_might_used ) | |
6925 { | |
6926 v3->uMight += 50; | |
6927 v3->pure_might_used = 1; | |
6928 } | |
6929 v3->PlaySound(SPEECH_36, 0); | |
6930 break; | |
6931 case 271: //Rejuvenation | |
6932 v3->sAgeModifier = 0; | |
6933 v3->PlaySound(SPEECH_36, 0); | |
6934 break; | |
6935 | |
6936 default: | |
6937 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6938 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
|
6939 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 6940 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6941 return; | |
1032 | 6942 } |
6943 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
6944 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6945 { | |
6946 if ( !v73 ) | |
6947 { | |
6948 pMouse->RemoveHoldingItem(); | |
6949 return; | |
6950 } | |
6951 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 6952 } |
1032 | 6953 if ( v73 ) |
6954 { | |
6955 if ( pParty->bTurnBasedModeOn ) | |
6956 { | |
6957 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6958 thisb->SetRecoveryTime(100); | |
6959 pTurnEngine->_40471C(); | |
6960 } | |
6961 else | |
6962 { | |
6963 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6964 } | |
6965 } | |
6966 pMouse->RemoveHoldingItem(); | |
6967 return; | |
6968 | |
1021 | 6969 } |
6970 | |
6971 | |
6972 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
6973 { | |
6974 | |
6975 | |
6976 if ( pCurrentScreen == SCREEN_CASTING ) | |
6977 return; | |
6978 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
6979 { | |
6980 | |
6981 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6982 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6983 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6984 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6985 return; |
6986 } | |
6987 if ( bUnderwater == 1 ) | |
6988 { | |
1032 | 6989 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
6990 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 6991 return; |
6992 } | |
6993 dword_50C9AC = 1; | |
6994 scroll_id = pParty->pPickedItem.uItemID - 299; | |
6995 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
6996 { | |
6997 pMouse->RemoveHoldingItem(); | |
6998 pGUIWindow_CurrentMenu->Release(); | |
6999 pIcons_LOD->_4114F2(); | |
7000 pCurrentScreen = SCREEN_GAME; | |
7001 viewparams->bRedrawGameUI = 1; | |
7002 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
7003 } | |
7004 else | |
7005 { | |
7006 _720984_unused = pParty->pPickedItem.uItemID; | |
7007 pMouse->RemoveHoldingItem(); | |
7008 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
7009 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
7010 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
7011 { | |
7012 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7013 } | |
7014 } | |
7015 return; | |
7016 } | |
7017 | |
7018 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7019 | |
7020 { | |
7021 v15 = pParty->pPickedItem.uItemID - 400; | |
7022 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7023 if ( v72 ) | |
7024 { | |
7025 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7026 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
|
7027 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7028 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7029 return; |
7030 } | |
7031 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7032 { | |
7033 v66 = 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], v66);//"That player is %s" |
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 v16 = v15 % 11 + 1; | |
7040 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7041 v18 = SkillToMastery(v17) - 1; | |
1032 | 7042 switch (v18) |
7043 { | |
7044 case 0: v67 = 4; break; | |
7045 case 1: v67 = 7; break; | |
7046 case 2: v67 = 10; break; | |
7047 case 3: v67 = 11; break; | |
7048 default: | |
7049 v67 = player_num; | |
7050 } | |
7051 | |
7052 if ( v16 > v67 || !v17 ) | |
1021 | 7053 { |
1032 | 7054 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7055 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
|
7056 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7057 v3->PlaySound((PlayerSpeech)20, 0); |
7058 return; | |
7059 } | |
7060 // v72 = 1; | |
7061 v3->PlaySound(SPEECH_21, 0); | |
7062 v73 = 0; | |
7063 | |
7064 | |
7065 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7066 { | |
7067 if ( !v73 ) | |
1021 | 7068 { |
1032 | 7069 pMouse->RemoveHoldingItem(); |
7070 return; | |
7071 } | |
7072 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7073 } | |
7074 if ( v73 ) | |
7075 { | |
7076 if ( pParty->bTurnBasedModeOn ) | |
7077 { | |
7078 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7079 thisb->SetRecoveryTime(100); | |
7080 pTurnEngine->_40471C(); | |
1021 | 7081 } |
7082 else | |
7083 { | |
1032 | 7084 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7085 } |
7086 } | |
1032 | 7087 pMouse->RemoveHoldingItem(); |
7088 return; | |
7089 | |
1021 | 7090 } |
7091 | |
7092 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7093 | |
7094 { | |
7095 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7096 { | |
7097 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7098 v3->PlaySound(SPEECH_37, 0); |
1021 | 7099 return; |
7100 } | |
7101 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7102 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7103 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7104 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7105 return; |
7106 } | |
7107 else | |
7108 { | |
1019 | 7109 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7110 { |
7111 thisa = pParty->uCurrentMonthWeek + 1; | |
7112 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7113 v74 = NULL; |
1021 | 7114 else |
7115 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7116 switch ( pParty->uCurrentMonth ) | |
7117 { | |
1019 | 7118 case 0: |
1021 | 7119 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7120 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7121 break; |
1019 | 7122 case 1: |
1021 | 7123 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7124 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7125 break; |
1019 | 7126 case 2: |
1021 | 7127 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7128 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7129 break; |
1019 | 7130 case 3: |
1021 | 7131 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7132 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7133 break; |
1019 | 7134 case 4: |
1021 | 7135 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7136 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7137 break; |
1019 | 7138 case 5: |
1021 | 7139 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7140 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7141 break; |
1019 | 7142 case 6: |
1021 | 7143 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7144 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7145 break; |
1019 | 7146 case 7: |
1021 | 7147 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7148 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7149 break; |
1019 | 7150 case 8: |
1021 | 7151 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7152 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7153 break; |
0 | 7154 case 9u: |
1021 | 7155 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7156 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7157 break; |
1019 | 7158 case 10: |
1021 | 7159 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7160 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7161 break; |
1019 | 7162 case 11: |
1021 | 7163 v8 = rand() % 6; |
7164 switch (v8) | |
7165 { | |
7166 case 0: | |
7167 v3->sResFireBase += thisa; | |
7168 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7169 break; | |
7170 case 1: | |
7171 v3->sResAirBase += thisa; | |
7172 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7173 break; | |
7174 case 2: | |
7175 v3->sResWaterBase += thisa; | |
7176 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7177 break; | |
7178 case 3: | |
7179 v3->sResEarthBase += thisa; | |
7180 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7181 break; | |
7182 case 4: | |
7183 v3->sResMindBase += thisa; | |
7184 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7185 break; | |
7186 case 5: | |
7187 v3->sResBodyBase += thisa; | |
7188 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7189 break; |
1021 | 7190 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7191 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7192 break; |
7193 | |
7194 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7195 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 7196 pMouse->RemoveHoldingItem(); |
7197 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7198 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7199 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7200 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7201 { |
1021 | 7202 v3->SetCondition(Condition_Eradicated, 0); |
7203 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7204 } |
1021 | 7205 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7206 { | |
7207 v3->SetCondition(Condition_Dead, 0); | |
7208 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7209 } | |
7210 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7211 { | |
7212 v3->SetCondition(Condition_Pertified, 0); | |
7213 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7214 } | |
1019 | 7215 return; |
1021 | 7216 } |
7217 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7218 { | |
7219 Party::GiveFood(1u); | |
7220 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7221 | |
7222 } | |
7223 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7224 { | |
7225 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7226 return; | |
7227 } | |
7228 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7229 { | |
7230 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7231 return; | |
7232 } | |
7233 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7234 { | |
7235 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7236 return; | |
7237 } | |
1032 | 7238 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7239 { |
7240 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7241 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7242 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7243 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7244 } | |
7245 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7246 { | |
7247 sub_44C28F_open_nwc_dungeon(); | |
7248 return; | |
7249 } | |
0 | 7250 else |
1021 | 7251 { |
7252 | |
7253 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7254 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
|
7255 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7256 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7257 return; |
7258 } | |
1032 | 7259 |
0 | 7260 pMouse->RemoveHoldingItem(); |
7261 return; | |
7262 } | |
1021 | 7263 |
7264 } | |
0 | 7265 |
7266 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7267 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7268 { |
0 | 7269 Player *v3; // esi@1 |
7270 signed int v4; // edi@1 | |
7271 unsigned int v5; // eax@8 | |
7272 int v6; // eax@9 | |
7273 enum CHARACTER_RACE v7; // eax@11 | |
7274 signed int v8; // eax@17 | |
7275 unsigned __int8 v9; // sf@17 | |
7276 unsigned __int8 v10; // of@17 | |
7277 int v11; // eax@19 | |
7278 unsigned int v12; // eax@20 | |
484 | 7279 unsigned int test_bit_value; // eax@25 |
7280 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7281 signed int v15; // ecx@28 |
7282 ItemGen *v16; // eax@28 | |
7283 char v17; // zf@31 | |
7284 int v18; // edi@90 | |
7285 DDM_DLV_Header *v19; // eax@122 | |
7286 char v20; // cl@124 | |
7287 DDM_DLV_Header *v21; // eax@126 | |
7288 unsigned int v22; // edi@129 | |
100 | 7289 Player *v23; // esi@134 |
0 | 7290 ItemGen *v24; // ecx@135 |
7291 signed int v25; // edx@135 | |
7292 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7293 char *v27; // edi@155 | |
7294 int v28; // ebx@161 | |
7295 int v29; // eax@161 | |
7296 | |
469 | 7297 v6 = 0; |
0 | 7298 v3 = this; |
7299 v4 = -1; | |
469 | 7300 if ( VarNum > VAR_AutoNotes ) |
7301 { | |
7302 switch ( VarNum ) | |
0 | 7303 { |
7304 case VAR_Invisible: | |
1167 | 7305 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 7306 return true; |
484 | 7307 return false; |
0 | 7308 case VAR_NumDeaths: |
7309 v4 = pParty->uNumDeaths; | |
469 | 7310 return v4 >= pValue; |
0 | 7311 case VAR_NumBounties: |
7312 v4 = pParty->uNumBountiesCollected; | |
469 | 7313 return v4 >= pValue; |
0 | 7314 case VAR_PrisonTerms: |
7315 v4 = pParty->uNumPrisonTerms; | |
469 | 7316 return v4 >= pValue; |
0 | 7317 case VAR_ArenaWinsPage: |
7318 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7319 return v4 >= pValue; |
0 | 7320 case VAR_ArenaWinsSquire: |
7321 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7322 return v4 >= pValue; |
0 | 7323 case VAR_ArenaWinsKnight: |
7324 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7325 return v4 >= pValue; |
0 | 7326 case VAR_ArenaWinsLord: |
7327 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7328 return v4 >= pValue; |
0 | 7329 case VAR_ReputationInCurrentLocation: |
7330 v19 = &pOutdoor->ddm; | |
7331 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7332 v19 = &pIndoor->dlv; | |
469 | 7333 v6 = v19->uReputation >= pValue; |
7334 return v6; | |
0 | 7335 case VAR_History_28|VAR_Sex: |
7336 v21 = &pOutdoor->ddm; | |
7337 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7338 v21 = &pIndoor->dlv; | |
469 | 7339 v6 = v21->field_C_alert == pValue; |
0 | 7340 return v6; |
7341 case VAR_MonthEquals2|VAR_Sex: | |
7342 case VAR_MonthEquals2|VAR_Class: | |
7343 case VAR_Counter1: | |
7344 case VAR_Counter2: | |
7345 case VAR_Counter3: | |
7346 case VAR_Counter4: | |
7347 case VAR_Counter5: | |
7348 case VAR_Counter6: | |
7349 case VAR_Counter7: | |
7350 case VAR_Counter8: | |
469 | 7351 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7352 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7353 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7354 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7355 return true; | |
7356 return false; | |
0 | 7357 case VAR_NumSkillPoints: |
7358 v4 = this->uSkillPoints; | |
469 | 7359 return v4 >= pValue; |
0 | 7360 case VAR_CircusPrises: |
7361 v4 = 0; | |
100 | 7362 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7363 do |
7364 { | |
469 | 7365 v24 = v23->pInventoryItems; |
0 | 7366 v25 = 138; |
7367 do | |
7368 { | |
7369 switch ( v24->uItemID ) | |
7370 { | |
7371 case 0x1D6u: | |
7372 ++v4; | |
7373 break; | |
7374 case 0x1D7u: | |
7375 v4 += 3; | |
7376 break; | |
7377 case 0x1DDu: | |
7378 v4 += 5; | |
7379 break; | |
7380 } | |
7381 ++v24; | |
7382 --v25; | |
7383 } | |
7384 while ( v25 ); | |
100 | 7385 ++v23; |
0 | 7386 } |
100 | 7387 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7388 return v4 >= pValue; |
0 | 7389 case VAR_MonthEquals2: |
469 | 7390 v6 = pParty->uCurrentMonth == pValue; |
7391 return v6; | |
0 | 7392 case VAR_IsFlying: |
7393 if ( pParty->bFlying | |
1167 | 7394 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 7395 return true; |
7396 return false; | |
0 | 7397 case VAR_HiredNPCHasSpeciality: |
469 | 7398 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7399 return v6; |
7400 case VAR_NPCs2: | |
469 | 7401 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7402 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7403 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7404 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7405 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7406 return v4 >= pValue; |
7407 v4 = pValue; | |
7408 return v4 >= pValue; | |
0 | 7409 case VAR_ItemEquipped: |
7410 v26 = (ITEM_EQUIP_TYPE)0; | |
7411 v27 = (char *)&this->pEquipment; | |
7412 break; | |
7413 case VAR_GoldInBank: | |
7414 v4 = pParty->uNumGoldInBank; | |
469 | 7415 return v4 >= pValue; |
0 | 7416 case VAR_ThieverySkill|0x80: |
7417 v28 = GetActualMight(); | |
7418 v29 = v3->GetBaseStrength(); | |
7419 goto LABEL_168; | |
7420 case VAR_DisarmTrapSkill|0x80: | |
7421 v28 = GetActualIntelligence(); | |
7422 v29 = v3->GetBaseIntelligence(); | |
7423 goto LABEL_168; | |
7424 case VAR_MonthEquals: | |
7425 v28 = GetActualWillpower(); | |
7426 v29 = v3->GetBaseWillpower(); | |
7427 goto LABEL_168; | |
7428 case VAR_MonthEquals|VAR_Sex: | |
7429 v28 = GetActualEndurance(); | |
7430 v29 = v3->GetBaseEndurance(); | |
7431 goto LABEL_168; | |
7432 case VAR_IdentifyMonsterSkill|0x80: | |
7433 v28 = GetActualSpeed(); | |
7434 v29 = v3->GetBaseSpeed(); | |
7435 goto LABEL_168; | |
7436 case VAR_ArmsmasterSkill|0x80: | |
7437 v28 = GetActualAccuracy(); | |
7438 v29 = v3->GetBaseAccuracy(); | |
7439 goto LABEL_168; | |
7440 case VAR_MonthEquals|VAR_MaxHP: | |
7441 v28 = GetActualLuck(); | |
7442 v29 = v3->GetBaseLuck(); | |
7443 LABEL_168: | |
7444 v10 = __OFSUB__(v28, v29); | |
7445 v9 = v28 - v29 < 0; | |
7446 LABEL_169: | |
7447 if ( v9 ^ v10 ) | |
469 | 7448 return v4 >= pValue; |
7449 return true; | |
0 | 7450 default: |
469 | 7451 return v4 >= pValue; |
0 | 7452 } |
7453 while ( !v3->HasItemEquipped(v26) | |
654 | 7454 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7455 { |
7456 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7457 v27 += 4; | |
7458 if ( (signed int)v26 >= 16 ) | |
469 | 7459 return false; |
7460 } | |
7461 return true; | |
7462 } | |
7463 if ( VarNum == VAR_AutoNotes ) | |
0 | 7464 { |
1033 | 7465 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7466 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7467 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7468 return false; | |
7469 return true; | |
469 | 7470 } |
7471 if ( VarNum <= VAR_BaseLuck ) | |
7472 { | |
7473 if ( VarNum != VAR_BaseLuck ) | |
7474 { | |
7475 switch ( VarNum ) | |
0 | 7476 { |
7477 case VAR_Hour: | |
469 | 7478 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7479 return true; | |
7480 return false; | |
0 | 7481 case VAR_DayOfYear: |
469 | 7482 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7483 v6 = v5 == pValue; | |
7484 return v6; | |
0 | 7485 case VAR_DayOfWeek: |
469 | 7486 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7487 v6 = v5 == pValue; | |
0 | 7488 return v6; |
7489 case VAR_Sex: | |
469 | 7490 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7491 return true; | |
7492 return v4 >= pValue; | |
0 | 7493 case VAR_Class: |
135 | 7494 v7 = (CHARACTER_RACE)this->classType; |
469 | 7495 if ( pValue == v7 ) |
7496 return true; | |
7497 return v4 >= pValue; | |
0 | 7498 case VAR_Race: |
7499 v7 = GetRace(); | |
469 | 7500 if ( pValue == v7 ) |
7501 return true; | |
7502 return v4 >= pValue; | |
0 | 7503 case VAR_CurrentHP: |
7504 v4 = this->sHealth; | |
469 | 7505 return v4 >= pValue; |
0 | 7506 case VAR_MaxHP: |
7507 v8 = GetMaxHealth(); | |
7508 v10 = __OFSUB__(v3->sHealth, v8); | |
7509 v9 = v3->sHealth - v8 < 0; | |
7510 goto LABEL_169; | |
7511 case VAR_CurrentSP: | |
7512 v4 = this->sMana; | |
469 | 7513 return v4 >= pValue; |
0 | 7514 case VAR_MaxSP: |
7515 v11 = GetMaxMana(); | |
7516 v10 = __OFSUB__(v3->sMana, v11); | |
7517 v9 = v3->sMana - v11 < 0; | |
7518 goto LABEL_169; | |
7519 case VAR_ActualAC: | |
7520 v12 = GetActualAC(); | |
7521 goto _j_cmp_against_arg; | |
7522 case VAR_ACModifier: | |
7523 v4 = this->sACModifier; | |
469 | 7524 return v4 >= pValue; |
0 | 7525 case VAR_BaseLevel: |
7526 v4 = this->uLevel; | |
469 | 7527 return v4 >= pValue; |
0 | 7528 case VAR_LevelModifier: |
7529 v4 = this->sLevelModifier; | |
469 | 7530 return v4 >= pValue; |
0 | 7531 case VAR_Age: |
7532 v12 = GetActualAge(); | |
7533 goto _j_cmp_against_arg; | |
7534 case VAR_Award: | |
1033 | 7535 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7536 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7537 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7538 return true; | |
7539 return false; | |
0 | 7540 case VAR_Experience: |
7541 v4 = LODWORD(this->uExperience); | |
469 | 7542 return v4 >= pValue; |
0 | 7543 case VAR_QBits_QuestsDone: |
484 | 7544 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7545 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7546 if ( test_bit_value & our_bit_value ) | |
478 | 7547 return true; |
7548 return false; | |
0 | 7549 case VAR_PlayerItemInHands: |
7550 v15 = 0; | |
7551 v16 = v3->pInventoryItems; | |
7552 break; | |
7553 case VAR_FixedGold: | |
7554 v4 = pParty->uNumGold; | |
469 | 7555 return v4 >= pValue; |
0 | 7556 case VAR_MightBonus: |
7557 v4 = this->uMightBonus; | |
469 | 7558 return v4 >= pValue; |
0 | 7559 case VAR_IntellectBonus: |
7560 v4 = this->uIntelligenceBonus; | |
469 | 7561 return v4 >= pValue; |
0 | 7562 case VAR_PersonalityBonus: |
7563 v4 = this->uWillpowerBonus; | |
469 | 7564 return v4 >= pValue; |
0 | 7565 case VAR_EnduranceBonus: |
7566 v4 = this->uEnduranceBonus; | |
469 | 7567 return v4 >= pValue; |
0 | 7568 case VAR_SpeedBonus: |
7569 v4 = this->uSpeedBonus; | |
469 | 7570 return v4 >= pValue; |
0 | 7571 case VAR_AccuracyBonus: |
7572 v4 = this->uAccuracyBonus; | |
469 | 7573 return v4 >= pValue; |
0 | 7574 case VAR_LuckBonus: |
7575 v4 = this->uLuckBonus; | |
469 | 7576 return v4 >= pValue; |
0 | 7577 case VAR_BaseMight: |
7578 v4 = this->uMight; | |
469 | 7579 return v4 >= pValue; |
0 | 7580 case VAR_BaseIntellect: |
7581 v4 = this->uIntelligence; | |
469 | 7582 return v4 >= pValue; |
0 | 7583 case VAR_BasePersonality: |
7584 v4 = this->uWillpower; | |
469 | 7585 return v4 >= pValue; |
0 | 7586 case VAR_BaseEndurance: |
7587 v4 = this->uEndurance; | |
469 | 7588 return v4 >= pValue; |
0 | 7589 case VAR_BaseSpeed: |
7590 v4 = this->uSpeed; | |
469 | 7591 return v4 >= pValue; |
0 | 7592 case VAR_BaseAccuracy: |
7593 v4 = this->uAccuracy; | |
469 | 7594 return v4 >= pValue; |
0 | 7595 case VAR_FixedFood: |
7596 v4 = pParty->uNumFoodRations; | |
469 | 7597 return v4 >= pValue; |
0 | 7598 default: |
469 | 7599 return v4 >= pValue; |
7600 } | |
7601 while ( v16->uItemID != pValue ) | |
0 | 7602 { |
7603 ++v15; | |
7604 ++v16; | |
7605 if ( v15 >= 138 ) | |
7606 { | |
469 | 7607 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7608 return v6; |
7609 } | |
7610 } | |
469 | 7611 return true; |
0 | 7612 } |
7613 v4 = this->uLuck; | |
469 | 7614 return v4 >= pValue; |
7615 } | |
7616 if ( VarNum <= VAR_MagicResistance ) | |
7617 { | |
7618 if ( VarNum == VAR_MagicResistance ) | |
0 | 7619 { |
7620 v4 = this->sResMagicBase; | |
7621 } | |
7622 else | |
7623 { | |
469 | 7624 switch ( VarNum ) |
0 | 7625 { |
7626 case VAR_FireResistance: | |
7627 v4 = this->sResFireBase; | |
469 | 7628 return v4 >= pValue; |
0 | 7629 case VAR_AirResistance: |
7630 v4 = this->sResAirBase; | |
469 | 7631 return v4 >= pValue; |
0 | 7632 case VAR_WaterResistance: |
7633 v4 = this->sResWaterBase; | |
469 | 7634 return v4 >= pValue; |
0 | 7635 case VAR_EarthResistance: |
7636 v4 = this->sResEarthBase; | |
469 | 7637 return v4 >= pValue; |
0 | 7638 case VAR_SpiritResistance: |
7639 v4 = this->sResSpiritBase; | |
469 | 7640 return v4 >= pValue; |
0 | 7641 case VAR_MindResistance: |
7642 v4 = this->sResMindBase; | |
469 | 7643 return v4 >= pValue; |
0 | 7644 case VAR_BodyResistance: |
7645 v4 = this->sResBodyBase; | |
469 | 7646 return v4 >= pValue; |
0 | 7647 case VAR_LightResistance: |
7648 v4 = this->sResLightBase; | |
469 | 7649 return v4 >= pValue; |
0 | 7650 case VAR_DarkResistance: |
7651 v4 = this->sResDarkBase; | |
469 | 7652 return v4 >= pValue; |
0 | 7653 case VAR_ActualMight: |
7654 v12 = GetActualMight(); | |
7655 goto _j_cmp_against_arg; | |
7656 case VAR_ActualIntellect: | |
7657 v12 = GetActualIntelligence(); | |
7658 goto _j_cmp_against_arg; | |
7659 case VAR_ActualPersonality: | |
7660 v12 = GetActualWillpower(); | |
7661 goto _j_cmp_against_arg; | |
7662 case VAR_ActualEndurance: | |
7663 v12 = GetActualEndurance(); | |
7664 goto _j_cmp_against_arg; | |
7665 case VAR_ActualSpeed: | |
7666 v12 = GetActualSpeed(); | |
7667 goto _j_cmp_against_arg; | |
7668 case VAR_ActualAccuracy: | |
7669 v12 = GetActualAccuracy(); | |
7670 goto _j_cmp_against_arg; | |
7671 case VAR_ActualLuck: | |
7672 v12 = GetActualLuck(); | |
7673 _j_cmp_against_arg: | |
7674 v4 = v12; | |
7675 break; | |
7676 default: | |
469 | 7677 return v4 >= pValue; |
7678 } | |
7679 } | |
7680 return v4 >= pValue; | |
7681 } | |
7682 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7683 { | |
7684 if ( VarNum != VAR_DisarmTrapSkill ) | |
7685 { | |
7686 if ( VarNum <= VAR_MindResistanceBonus ) | |
7687 { | |
7688 switch ( VarNum ) | |
0 | 7689 { |
7690 case VAR_MindResistanceBonus: | |
7691 v4 = this->sResMindBonus; | |
7692 break; | |
7693 case VAR_FireResistanceBonus: | |
7694 v4 = this->sResFireBonus; | |
7695 break; | |
7696 case VAR_AirResistanceBonus: | |
7697 v4 = this->sResAirBonus; | |
7698 break; | |
7699 case VAR_WaterResistanceBonus: | |
7700 v4 = this->sResWaterBonus; | |
7701 break; | |
7702 case VAR_EarthResistanceBonus: | |
7703 v4 = this->sResEarthBonus; | |
7704 break; | |
7705 case VAR_SpiritResistanceBonus: | |
7706 v4 = this->sResSpiritBonus; | |
7707 break; | |
7708 } | |
469 | 7709 return v4 >= pValue; |
7710 } | |
7711 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7712 { |
7713 v4 = this->sResBodyBonus; | |
469 | 7714 return v4 >= pValue; |
7715 } | |
7716 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7717 { |
7718 v4 = this->sResLightBonus; | |
469 | 7719 return v4 >= pValue; |
7720 } | |
7721 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7722 { |
7723 v4 = this->sResDarkBonus; | |
469 | 7724 return v4 >= pValue; |
7725 } | |
7726 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7727 { |
7728 v4 = this->sResMagicBonus; | |
469 | 7729 return v4 >= pValue; |
7730 } | |
7731 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7732 return v4 >= pValue; | |
0 | 7733 } |
7734 LABEL_90: | |
469 | 7735 v18 = *((short *)&this->pConditions[16] + VarNum); |
7736 if ( pValue <= 63 ) | |
0 | 7737 v4 = v18 & 0x3F; |
7738 else | |
469 | 7739 v4 = pValue & v18; |
7740 return v4 >= pValue; | |
7741 } | |
7742 if ( VarNum == 104 ) | |
0 | 7743 goto LABEL_90; |
469 | 7744 if ( (signed int)VarNum <= 104 ) |
7745 return v4 >= pValue; | |
7746 if ( (signed int)VarNum > 0x79 ) | |
7747 { | |
7748 if ( VarNum != 122 ) | |
7749 { | |
7750 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7751 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7752 return v4 >= pValue; | |
0 | 7753 } |
7754 v4 = GetMajorConditionIdx(); | |
7755 if ( v4 != 18 ) | |
7756 { | |
469 | 7757 return v4 >= pValue; |
7758 } | |
7759 v4 = pValue; | |
7760 return v4 >= pValue; | |
7761 } | |
1072 | 7762 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 7763 } |
7764 | |
7765 | |
7766 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 7767 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7768 { | |
7769 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
|
7770 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
|
7771 unsigned int v5_unused; // edi@1 |
0 | 7772 unsigned int v6; // esi@13 |
7773 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
|
7774 signed int v8_unused; // eax@17 |
0 | 7775 ItemGen *v9; // ecx@17 |
7776 int v10; // eax@21 | |
7777 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
|
7778 Player *unused12; // ecx@44 |
0 | 7779 char *v13; // ecx@45 |
7780 Player *v14; // ecx@49 | |
7781 int v15; // ecx@86 | |
7782 int v16; // esi@106 | |
7783 char v17; // al@106 | |
7784 int v18; // eax@107 | |
7785 Player *v19; // ecx@112 | |
7786 Player *v20; // ecx@127 | |
7787 int v21; // eax@127 | |
7788 int v22; // eax@145 | |
7789 char v23; // zf@146 | |
7790 DDM_DLV_Header *v24; // ecx@148 | |
7791 signed int v25; // eax@172 | |
7792 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
|
7793 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
|
7794 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 7795 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
|
7796 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
|
7797 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
|
7798 |
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
|
7799 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
|
7800 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
|
7801 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7802 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
|
7803 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7804 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
|
7805 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
|
7806 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7807 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7808 assert(currPlayerId != -1); |
492 | 7809 if ( var_type > VAR_AutoNotes ) |
7810 { | |
7811 if ( var_type <= VAR_GoldInBank ) | |
7812 { | |
7813 if ( var_type == VAR_GoldInBank ) | |
7814 { | |
7815 pParty->uNumGoldInBank = var_value; | |
0 | 7816 return; |
7817 } | |
492 | 7818 if ( var_type <= VAR_Counter8 ) |
7819 { | |
7820 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7821 { |
492 | 7822 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7823 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7824 } |
7825 else | |
7826 { | |
492 | 7827 switch ( var_type ) |
0 | 7828 { |
7829 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 7830 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 7831 break; |
7832 case VAR_NPCs2: | |
7833 pParty->field_709 = 0; | |
492 | 7834 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 7835 pParty->CountHirelings(); |
7836 viewparams->bRedrawGameUI = true; | |
0 | 7837 break; |
7838 case VAR_NumSkillPoints: | |
492 | 7839 this->uSkillPoints = var_value; |
0 | 7840 break; |
7841 } | |
7842 } | |
7843 return; | |
7844 } | |
492 | 7845 if ( var_type < VAR_Counter9 ) |
0 | 7846 return; |
492 | 7847 if ( (signed int)var_type <= 0x112 ) |
7848 { | |
7849 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7850 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7851 } |
7852 else | |
7853 { | |
492 | 7854 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 7855 { |
7856 v24 = &pOutdoor->ddm; | |
7857 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7858 v24 = &pIndoor->dlv; | |
492 | 7859 v24->uReputation = var_value; |
7860 if ( var_value > 10000 ) | |
0 | 7861 v24->uReputation = 10000; |
7862 return; | |
7863 } | |
492 | 7864 if ( var_type <= VAR_ReputationInCurrentLocation |
7865 || var_type > VAR_History_28 | |
7866 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
7867 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7868 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 7869 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7870 v23) ) |
7871 return; | |
7872 bFlashHistoryBook = 1; | |
7873 } | |
492 | 7874 v25 = 8 * currPlayerId + 400; |
862 | 7875 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
|
7876 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 7877 return; |
7878 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7879 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7880 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7881 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7882 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
|
7883 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7884 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7885 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7886 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7887 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7888 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7889 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7890 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7891 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7892 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7893 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7894 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7895 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7896 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7897 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7898 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7899 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7900 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7901 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7902 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7903 return; |
0 | 7904 } |
492 | 7905 if ( var_type == VAR_AutoNotes ) |
7906 { | |
7907 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
|
7908 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 7909 && pAutonoteTxt[var_value-1].pText ) |
7910 { | |
7911 v20 = pPlayers[currPlayerId + 1]; | |
187 | 7912 v20->PlaySound(SPEECH_96, 0); |
492 | 7913 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 7914 bFlashAutonotesBook = 1; |
981 | 7915 _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
|
7916 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 7917 } |
492 | 7918 _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
|
7919 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7920 return; |
0 | 7921 } |
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
|
7922 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
|
7923 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7924 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
|
7925 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7926 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
|
7927 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
|
7928 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
|
7929 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
|
7930 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
|
7931 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
|
7932 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7933 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7934 for (int i = 0; i < 138; i++) |
0 | 7935 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7936 v9 = &this->pInventoryItems[i]; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7937 if (v9->uItemID == 615) |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7938 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
|
7939 } |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7940 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
|
7941 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7942 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
|
7943 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7944 *(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
|
7945 } |
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
|
7946 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
|
7947 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
|
7948 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
|
7949 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
|
7950 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
|
7951 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
|
7952 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
|
7953 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
|
7954 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
|
7955 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
|
7956 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
|
7957 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
|
7958 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
|
7959 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
|
7960 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7961 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
|
7962 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
|
7963 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7964 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
|
7965 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7966 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
|
7967 this->uVoiceID = 20; |
0 | 7968 } |
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
|
7969 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
|
7970 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7971 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
|
7972 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
|
7973 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
|
7974 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
|
7975 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
|
7976 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
|
7977 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
|
7978 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
|
7979 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
|
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_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
|
7982 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
|
7983 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
|
7984 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
|
7985 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
|
7986 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
|
7987 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
|
7988 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
|
7989 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
|
7990 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
|
7991 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
|
7992 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
|
7993 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
|
7994 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
|
7995 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
|
7996 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
|
7997 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
|
7998 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
|
7999 //&& 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
|
8000 && 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
|
8001 { |
7ef8ae7ce42a
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 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
|
8003 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8004 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
|
8005 } |
7ef8ae7ce42a
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 _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
|
8007 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
|
8008 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
|
8009 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
|
8010 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
|
8011 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
|
8012 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
|
8013 // && (&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
|
8014 && pQuestTable[var_value-1] ) |
0 | 8015 { |
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
|
8016 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
|
8017 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
|
8018 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
|
8019 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8020 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
|
8021 } |
7ef8ae7ce42a
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 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
|
8023 _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
|
8024 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
|
8025 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
|
8026 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
|
8027 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
|
8028 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
|
8029 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
|
8030 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
|
8031 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
|
8032 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
|
8033 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
|
8034 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
|
8035 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
|
8036 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
|
8037 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
|
8038 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
|
8039 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
|
8040 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
|
8041 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
|
8042 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
|
8043 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
|
8044 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
|
8045 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
|
8046 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
|
8047 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
|
8048 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
|
8049 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
|
8050 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
|
8051 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
|
8052 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
|
8053 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
|
8054 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
|
8055 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
|
8056 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
|
8057 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
|
8058 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
|
8059 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
|
8060 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
|
8061 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
|
8062 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
|
8063 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
|
8064 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
|
8065 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
|
8066 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
|
8067 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
|
8068 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
|
8069 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
|
8070 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8071 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
|
8072 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
|
8073 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
|
8074 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8075 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
|
8076 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
|
8077 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
|
8078 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8079 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
|
8080 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
|
8081 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
|
8082 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8083 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
|
8084 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
|
8085 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
|
8086 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8087 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
|
8088 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
|
8089 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
|
8090 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8091 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
|
8092 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
|
8093 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
|
8094 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8095 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
|
8096 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
|
8097 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
|
8098 } |
0 | 8099 LABEL_111: |
187 | 8100 v26 = SPEECH_91; |
0 | 8101 LABEL_112: |
492 | 8102 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8103 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
|
8104 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8105 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8106 return; |
0 | 8107 } |
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
|
8108 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
|
8109 { |
492 | 8110 switch ( var_type ) |
0 | 8111 { |
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
|
8112 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
|
8113 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
|
8114 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
|
8115 goto LABEL_111; |
0 | 8116 case VAR_ActualIntellect: |
8117 LABEL_68: | |
492 | 8118 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8119 goto LABEL_111; |
8120 case VAR_ActualPersonality: | |
8121 LABEL_69: | |
492 | 8122 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8123 goto LABEL_111; |
8124 case VAR_ActualEndurance: | |
8125 LABEL_70: | |
492 | 8126 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8127 goto LABEL_111; |
8128 case VAR_ActualSpeed: | |
8129 LABEL_71: | |
492 | 8130 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8131 goto LABEL_111; |
8132 case VAR_ActualAccuracy: | |
8133 LABEL_72: | |
492 | 8134 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8135 goto LABEL_111; |
8136 case VAR_ActualLuck: | |
8137 LABEL_73: | |
492 | 8138 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8139 goto LABEL_111; |
8140 case VAR_FireResistance: | |
492 | 8141 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
|
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; |
0 | 8144 case VAR_AirResistance: |
492 | 8145 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
|
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; |
0 | 8148 case VAR_WaterResistance: |
492 | 8149 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
|
8150 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8151 goto LABEL_112; |
0 | 8152 case VAR_EarthResistance: |
492 | 8153 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
|
8154 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8155 goto LABEL_112; |
0 | 8156 case VAR_SpiritResistance: |
492 | 8157 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
|
8158 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8159 goto LABEL_112; |
0 | 8160 case VAR_MindResistance: |
492 | 8161 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
|
8162 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8163 goto LABEL_112; |
0 | 8164 case VAR_BodyResistance: |
492 | 8165 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
|
8166 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8167 goto LABEL_112; |
0 | 8168 case VAR_LightResistance: |
492 | 8169 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
|
8170 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8171 goto LABEL_112; |
0 | 8172 case VAR_DarkResistance: |
492 | 8173 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
|
8174 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8175 goto LABEL_112; |
0 | 8176 case VAR_MagicResistance: |
492 | 8177 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8178 v26 = 92; |
8179 goto LABEL_112; | |
8180 default: | |
8181 return; | |
8182 } | |
8183 return; | |
8184 } | |
8185 HIWORD(v15) = 0; | |
492 | 8186 if ( var_type > VAR_DisarmTrapSkill ) |
8187 { | |
8188 if ( var_type != VAR_LearningSkill ) | |
8189 { | |
8190 if ( var_type <= VAR_LearningSkill ) | |
0 | 8191 return; |
492 | 8192 if ( var_type <= VAR_Eradicated ) |
8193 { | |
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
|
8194 this->SetCondition(var_type - 105, 1); |
0 | 8195 } |
8196 else | |
8197 { | |
492 | 8198 if ( var_type != VAR_MajorCondition ) |
0 | 8199 { |
492 | 8200 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8201 byte_5E4C15[var_type] = var_value; | |
0 | 8202 return; |
8203 } | |
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
|
8204 memset(this, 0, 0xA0u); |
0 | 8205 } |
8206 } | |
8207 else | |
8208 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8209 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
|
8210 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8211 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8212 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8213 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8214 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8215 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8216 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8217 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8218 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
|
8219 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8220 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8221 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8222 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8223 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8224 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8225 return; |
0 | 8226 } |
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
|
8227 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 8228 { |
8229 switch ( var_type ) | |
0 | 8230 { |
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
|
8231 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
|
8232 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 8233 break; |
8234 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
|
8235 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 8236 break; |
8237 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
|
8238 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8239 break; |
8240 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
|
8241 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8242 break; |
8243 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
|
8244 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
|
8245 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
|
8246 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
|
8247 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
|
8248 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
|
8249 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
|
8250 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
|
8251 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
|
8252 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
|
8253 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
|
8254 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
|
8255 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
|
8256 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
|
8257 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
|
8258 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
|
8259 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
|
8260 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
|
8261 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
|
8262 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
|
8263 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 8264 break; |
8265 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
|
8266 assert("Unexpected var_type" && false); |
0 | 8267 return; |
8268 break; | |
8269 } | |
8270 goto LABEL_111; | |
8271 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8272 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
|
8273 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8274 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8275 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8276 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8277 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8278 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8279 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8280 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
|
8281 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8282 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
|
8283 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
|
8284 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
|
8285 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8286 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8287 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8288 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
|
8289 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8290 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
|
8291 } |
0 | 8292 |
8293 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8294 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8295 { |
8296 char v3; // bl@1 | |
8297 Player *v4; // esi@1 | |
8298 signed int uPlayerIdx; // edi@1 | |
8299 int v6; // eax@15 | |
8300 unsigned int v7; // esi@18 | |
8301 int *v8; // ebx@21 | |
8302 int v9; // eax@22 | |
8303 signed int v10; // eax@24 | |
8304 int v11; // eax@27 | |
8305 __int16 *v12; // esi@28 | |
8306 Player *v13; // ecx@34 | |
8307 Player *v14; // ecx@36 | |
8308 char *v15; // ecx@37 | |
8309 unsigned __int8 v16; // cf@38 | |
8310 Player *v17; // ecx@42 | |
8311 __int16 *v18; // esi@53 | |
8312 __int16 *v19; // esi@62 | |
8313 char *v20; // esi@107 | |
8314 __int16 v21; // dx@107 | |
8315 int v22; // ecx@107 | |
8316 Player *v23; // ecx@132 | |
8317 int v24; // eax@132 | |
8318 int v25; // eax@150 | |
8319 char v26; // zf@151 | |
8320 DDM_DLV_Header *v27; // eax@153 | |
8321 signed int v28; // eax@176 | |
8322 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8323 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8324 int v31; // [sp-4h] [bp-3Ch]@84 |
8325 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8326 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8327 char v34; // [sp+37h] [bp-1h]@1 | |
8328 | |
8329 auto Dst = this; | |
8330 v3 = 0; | |
8331 v34 = 0; | |
8332 v4 = Dst; | |
8333 uPlayerIdx = 0; | |
8334 if ( Dst == pPlayers[2] ) | |
8335 uPlayerIdx = 1; | |
310 | 8336 else if ( Dst == pPlayers[3] ) |
8337 uPlayerIdx = 2; | |
8338 else if ( Dst == pPlayers[4] ) | |
8339 uPlayerIdx = 3; | |
8340 | |
8341 if ( var_type <= VAR_AutoNotes ) | |
8342 { | |
8343 if ( var_type != VAR_AutoNotes ) | |
8344 { | |
8345 if ( var_type <= VAR_ActualMight ) | |
8346 { | |
8347 if ( var_type != VAR_ActualMight ) | |
0 | 8348 { |
310 | 8349 switch ( var_type ) |
0 | 8350 { |
8351 case VAR_RandomGold: | |
8352 if ( !val ) | |
8353 val = 1; | |
8354 v6 = rand(); | |
8355 party_finds_gold(v6 % val + 1, 1); | |
8356 GameUI_DrawFoodAndGold(); | |
8357 return; | |
8358 case VAR_RandomFood: | |
8359 if ( !val ) | |
8360 val = 1; | |
8361 v7 = rand() % val + 1; | |
8362 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8363 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
|
8364 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8365 GameUI_DrawFoodAndGold(); |
8366 goto _play_sound; | |
8367 case VAR_Sex: | |
8368 Dst->uSex = (PLAYER_SEX)val; | |
8369 goto _play_anim_and_exit; | |
8370 case VAR_Class: | |
135 | 8371 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8372 goto _play_anim_and_exit; |
8373 case VAR_CurrentHP: | |
8374 v8 = &Dst->sHealth; | |
8375 *v8 += val; | |
8376 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8377 goto _play_anim_and_exit; | |
8378 v9 = v4->GetMaxHealth(); | |
8379 goto LABEL_23; | |
8380 case VAR_MaxHP: | |
8381 v10 = Dst->GetMaxHealth(); | |
8382 v4->_health_related = 0; | |
8383 v4->uFullHealthBonus = 0; | |
8384 v4->sHealth = v10; | |
8385 return; | |
8386 case VAR_CurrentSP: | |
8387 v8 = &Dst->sMana; | |
8388 *v8 += val; | |
8389 if ( Dst->sMana > GetMaxMana() ) | |
8390 { | |
8391 v9 = v4->GetMaxMana(); | |
8392 LABEL_23: | |
8393 *v8 = v9; | |
8394 } | |
8395 goto _play_anim_and_exit; | |
8396 case VAR_MaxSP: | |
8397 v11 = GetMaxMana(); | |
8398 v4->_mana_related = 0; | |
8399 v4->uFullManaBonus = 0; | |
8400 v4->sMana = v11; | |
8401 return; | |
8402 case VAR_ACModifier: | |
8403 v12 = &Dst->sACModifier; | |
8404 goto LABEL_29; | |
8405 case VAR_BaseLevel: | |
8406 v12 = (__int16 *)&Dst->uLevel; | |
8407 goto LABEL_29; | |
8408 case VAR_LevelModifier: | |
8409 v12 = &Dst->sLevelModifier; | |
8410 LABEL_29: | |
8411 *v12 += val; | |
8412 if ( *v12 > 255 ) | |
8413 *v12 = 255; | |
8414 goto _play_anim_and_exit; | |
8415 case VAR_Age: | |
8416 Dst->sAgeModifier += val; | |
8417 return; | |
8418 case VAR_Award: | |
8419 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8420 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8421 | |
492 | 8422 && pAwards[val].pText ) |
0 | 8423 { |
8424 v14 = pPlayers[uPlayerIdx + 1]; | |
8425 v34 = 1; | |
8426 v3 = 1; | |
187 | 8427 v14->PlaySound(SPEECH_96, 0); |
0 | 8428 } |
735 | 8429 v15 = (char *)v4->_guilds_member_bits; |
0 | 8430 goto LABEL_44; |
8431 case VAR_Experience: | |
8432 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8433 LODWORD(Dst->uExperience) += val; | |
8434 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8435 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8436 Dst->uExperience = 4000000000i64; | |
8437 goto _play_anim_and_exit; | |
8438 case VAR_QBits_QuestsDone: | |
484 | 8439 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
|
8440 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8441 && pQuestTable[val-1] ) |
0 | 8442 { |
501 | 8443 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8444 bFlashQuestBook = 1; |
8445 v34 = 1; | |
8446 v3 = 1; | |
501 | 8447 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8448 } |
484 | 8449 v15 = (char *)pParty->_quest_bits; |
0 | 8450 LABEL_44: |
8451 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8452 goto LABEL_173; | |
8453 case VAR_PlayerItemInHands: | |
8454 item.Reset(); | |
8455 item.Reset(); | |
8456 item.uAttributes = 1; | |
8457 item.uItemID = val; | |
8458 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8459 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8460 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8461 { | |
8462 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8463 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8464 } | |
8465 pParty->SetHoldingItem(&item); | |
8466 return; | |
8467 case VAR_FixedGold: | |
8468 party_finds_gold(val, 1); | |
8469 return; | |
8470 case VAR_BaseMight: | |
8471 v18 = (__int16 *)&Dst->uMight; | |
8472 goto LABEL_82; | |
8473 case VAR_BaseIntellect: | |
8474 v18 = (__int16 *)&Dst->uIntelligence; | |
8475 goto LABEL_82; | |
8476 case VAR_BasePersonality: | |
8477 v18 = (__int16 *)&Dst->uWillpower; | |
8478 goto LABEL_82; | |
8479 case VAR_BaseEndurance: | |
8480 v18 = (__int16 *)&Dst->uEndurance; | |
8481 goto LABEL_82; | |
8482 case VAR_BaseSpeed: | |
8483 v18 = (__int16 *)&Dst->uSpeed; | |
8484 goto LABEL_82; | |
8485 case VAR_BaseAccuracy: | |
8486 v18 = (__int16 *)&Dst->uAccuracy; | |
8487 goto LABEL_82; | |
8488 case VAR_BaseLuck: | |
8489 v18 = (__int16 *)&Dst->uLuck; | |
8490 goto LABEL_82; | |
8491 case VAR_FixedFood: | |
8492 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8493 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8494 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8495 if ( pParty->uNumFoodRations > 0xFFFF ) |
8496 Party::SetFood(0xFFFFu); | |
8497 goto _play_sound; | |
8498 case VAR_MightBonus: | |
8499 goto LABEL_62; | |
8500 case VAR_IntellectBonus: | |
8501 goto LABEL_66; | |
8502 case VAR_PersonalityBonus: | |
8503 goto LABEL_67; | |
8504 case VAR_EnduranceBonus: | |
8505 goto LABEL_68; | |
8506 case VAR_SpeedBonus: | |
8507 goto LABEL_69; | |
8508 case VAR_AccuracyBonus: | |
8509 goto LABEL_70; | |
8510 case VAR_LuckBonus: | |
8511 goto LABEL_71; | |
8512 default: | |
8513 return; | |
8514 } | |
8515 return; | |
8516 } | |
8517 LABEL_62: | |
8518 v19 = (__int16 *)&Dst->uMightBonus; | |
8519 goto LABEL_113; | |
8520 } | |
310 | 8521 if ( var_type <= VAR_FireResistanceBonus ) |
8522 { | |
8523 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8524 { |
310 | 8525 switch ( var_type ) |
0 | 8526 { |
8527 case VAR_ActualIntellect: | |
8528 LABEL_66: | |
8529 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8530 goto LABEL_113; | |
8531 case VAR_ActualPersonality: | |
8532 LABEL_67: | |
8533 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8534 goto LABEL_113; | |
8535 case VAR_ActualEndurance: | |
8536 LABEL_68: | |
8537 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8538 goto LABEL_113; | |
8539 case VAR_ActualSpeed: | |
8540 LABEL_69: | |
8541 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8542 goto LABEL_113; | |
8543 case VAR_ActualAccuracy: | |
8544 LABEL_70: | |
8545 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8546 goto LABEL_113; | |
8547 case VAR_ActualLuck: | |
8548 LABEL_71: | |
8549 v19 = (__int16 *)&Dst->uLuckBonus; | |
8550 goto LABEL_113; | |
8551 case VAR_FireResistance: | |
8552 v18 = &Dst->sResFireBase; | |
8553 goto LABEL_82; | |
8554 case VAR_AirResistance: | |
8555 v18 = &Dst->sResAirBase; | |
8556 goto LABEL_82; | |
8557 case VAR_WaterResistance: | |
8558 v18 = &Dst->sResWaterBase; | |
8559 goto LABEL_82; | |
8560 case VAR_EarthResistance: | |
8561 v18 = &Dst->sResEarthBase; | |
8562 goto LABEL_82; | |
8563 case VAR_SpiritResistance: | |
8564 v18 = &Dst->sResSpiritBase; | |
8565 goto LABEL_82; | |
8566 case VAR_MindResistance: | |
8567 v18 = &Dst->sResMindBase; | |
8568 goto LABEL_82; | |
8569 case VAR_BodyResistance: | |
8570 v18 = &Dst->sResBodyBase; | |
8571 goto LABEL_82; | |
8572 case VAR_LightResistance: | |
8573 v18 = &Dst->sResLightBase; | |
8574 goto LABEL_82; | |
8575 case VAR_DarkResistance: | |
8576 v18 = &Dst->sResDarkBase; | |
8577 goto LABEL_82; | |
8578 case VAR_MagicResistance: | |
8579 v18 = &Dst->sResMagicBase; | |
8580 LABEL_82: | |
8581 *v18 += val; | |
8582 if ( *v18 > 255 ) | |
8583 *v18 = 255; | |
8584 v31 = 0; | |
8585 v29 = 92; | |
8586 goto LABEL_116; | |
8587 default: | |
8588 return; | |
8589 } | |
8590 return; | |
8591 } | |
8592 v19 = &Dst->sResFireBonus; | |
8593 LABEL_113: | |
8594 *v19 += val; | |
8595 if ( *v19 > 255 ) | |
8596 *v19 = 255; | |
8597 v31 = 0; | |
187 | 8598 v29 = SPEECH_91; |
0 | 8599 LABEL_116: |
8600 v3 = 1; | |
187 | 8601 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8602 goto _play_anim_and_maybe_sound; |
8603 } | |
310 | 8604 if ( var_type <= VAR_DisarmTrapSkill ) |
8605 { | |
8606 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8607 { |
310 | 8608 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8609 { |
310 | 8610 switch ( var_type ) |
0 | 8611 { |
8612 case VAR_BodyResistanceBonus: | |
8613 v19 = &Dst->sResBodyBonus; | |
8614 break; | |
8615 case VAR_AirResistanceBonus: | |
8616 v19 = &Dst->sResAirBonus; | |
8617 break; | |
8618 case VAR_WaterResistanceBonus: | |
8619 v19 = &Dst->sResWaterBonus; | |
8620 break; | |
8621 case VAR_EarthResistanceBonus: | |
8622 v19 = &Dst->sResEarthBonus; | |
8623 break; | |
8624 case VAR_SpiritResistanceBonus: | |
8625 v19 = &Dst->sResSpiritBonus; | |
8626 break; | |
8627 default: | |
310 | 8628 if ( var_type != 62 ) |
0 | 8629 return; |
8630 v19 = &Dst->sResMindBonus; | |
8631 break; | |
8632 } | |
8633 goto LABEL_113; | |
8634 } | |
310 | 8635 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8636 { |
8637 v19 = &Dst->sResLightBonus; | |
8638 goto LABEL_113; | |
8639 } | |
310 | 8640 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8641 { |
8642 v19 = &Dst->sResDarkBonus; | |
8643 goto LABEL_113; | |
8644 } | |
310 | 8645 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8646 { |
8647 v19 = &Dst->sResMagicBonus; | |
8648 goto LABEL_113; | |
8649 } | |
310 | 8650 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8651 return; |
8652 } | |
8653 goto LABEL_106; | |
8654 } | |
310 | 8655 if ( var_type == VAR_LearningSkill ) |
0 | 8656 { |
8657 LABEL_106: | |
8658 if ( val <= VAR_BodyResistanceBonus ) | |
8659 { | |
310 | 8660 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8661 } |
8662 else | |
8663 { | |
310 | 8664 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8665 v21 = *(short *)v20; |
8666 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8667 if ( v22 > 60 ) | |
8668 LOWORD(v22) = 60; | |
8669 LOBYTE(v21) = v21 & 0xC0; | |
8670 *(short *)v20 = v22 | v21; | |
8671 } | |
8672 goto _play_anim_and_exit; | |
8673 } | |
310 | 8674 if ( var_type <= VAR_LearningSkill ) |
0 | 8675 return; |
310 | 8676 if ( var_type <= VAR_Eradicated ) |
8677 { | |
8678 Dst->SetCondition(var_type - 105, 0); | |
0 | 8679 } |
8680 else | |
8681 { | |
310 | 8682 if ( var_type != VAR_MajorCondition ) |
0 | 8683 { |
310 | 8684 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8685 { |
310 | 8686 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8687 byte_5E4C15[var_type] += val; | |
0 | 8688 else |
310 | 8689 byte_5E4C15[var_type] = -1; |
0 | 8690 } |
8691 return; | |
8692 } | |
8693 memset(Dst, 0, 0xA0u); | |
8694 } | |
8695 _play_anim_and_exit: | |
8696 v3 = 1; | |
8697 _play_anim_and_maybe_sound: | |
8698 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8699 _maybe_play_sound: | |
8700 if ( v3 != 1 ) | |
8701 return; | |
8702 goto _play_sound; | |
8703 } | |
8704 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
|
8705 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8706 && pAutonoteTxt[val-1].pText ) |
0 | 8707 { |
8708 v23 = pPlayers[uPlayerIdx + 1]; | |
8709 v34 = 1; | |
187 | 8710 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8711 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8712 bFlashAutonotesBook = 1; |
981 | 8713 _506568_autonote_type = v24; |
0 | 8714 } |
8715 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8716 v3 = 1; | |
8717 LABEL_173: | |
8718 if ( v34 != 1 ) | |
8719 goto _maybe_play_sound; | |
8720 goto _play_anim_and_maybe_sound; | |
8721 } | |
310 | 8722 if ( var_type > VAR_GoldInBank ) |
8723 { | |
8724 if ( var_type == 307 ) | |
0 | 8725 { |
8726 pParty->uNumDeaths += val; | |
8727 goto LABEL_173; | |
8728 } | |
310 | 8729 switch ( var_type ) |
0 | 8730 { |
8731 case 308: | |
8732 pParty->uNumBountiesCollected += val; | |
8733 break; | |
8734 case 309: | |
8735 pParty->uNumPrisonTerms += val; | |
8736 break; | |
8737 case 310: | |
8738 pParty->uNumArenaPageWins += val; | |
8739 break; | |
8740 case 311: | |
8741 pParty->uNumArenaSquireWins += val; | |
8742 break; | |
8743 case 312: | |
8744 pParty->uNumArenaKnightWins += val; | |
8745 break; | |
8746 case 313: | |
8747 pParty->uNumArenaLordWins += val; | |
8748 break; | |
8749 } | |
8750 } | |
8751 else | |
8752 { | |
310 | 8753 if ( var_type == VAR_GoldInBank ) |
0 | 8754 { |
8755 pParty->uNumGoldInBank += val; | |
8756 return; | |
8757 } | |
310 | 8758 if ( var_type <= VAR_Counter8 ) |
8759 { | |
8760 if ( (signed int)var_type >= 245 ) | |
8761 { | |
8762 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
8763 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8764 } |
8765 else | |
8766 { | |
310 | 8767 switch ( var_type ) |
0 | 8768 { |
8769 case VAR_MonthEquals|VAR_CurrentSP: | |
8770 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
8771 break; | |
8772 case VAR_NPCs2: | |
8773 pParty->field_709 = 0; | |
8774 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 8775 pParty->CountHirelings(); |
8776 viewparams->bRedrawGameUI = true; | |
0 | 8777 break; |
8778 case VAR_NumSkillPoints: | |
8779 Dst->uSkillPoints += val; | |
8780 break; | |
8781 } | |
8782 } | |
8783 return; | |
8784 } | |
310 | 8785 if ( var_type < VAR_Counter9 ) |
0 | 8786 return; |
310 | 8787 if ( (signed int)var_type <= 274 ) |
8788 { | |
8789 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8790 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8791 goto _play_sound; |
8792 } | |
310 | 8793 if ( var_type != VAR_ReputationInCurrentLocation ) |
8794 { | |
8795 if ( var_type <= VAR_ReputationInCurrentLocation | |
8796 || var_type > VAR_History_28 | |
8797 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
8798 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8799 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 8800 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8801 v26) ) |
8802 return; | |
8803 bFlashHistoryBook = 1; | |
8804 _play_sound: | |
8805 v28 = 8 * uPlayerIdx + 400; | |
862 | 8806 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 8807 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
8808 return; | |
8809 } | |
8810 v27 = &pOutdoor->ddm; | |
8811 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8812 v27 = &pIndoor->dlv; | |
8813 v27->uReputation += val; | |
8814 if ( v27->uReputation > 10000 ) | |
8815 v27->uReputation = 10000; | |
8816 } | |
8817 } | |
8818 // 506568: using guessed type int dword_506568; | |
8819 // 507948: using guessed type char bFlashHistoryBook; | |
8820 // 507949: using guessed type char bFlashAutonotesBook; | |
8821 // 50794A: using guessed type char bFlashQuestBook; | |
8822 // 72371C: using guessed type int dword_72371C[]; | |
8823 // 723E80: using guessed type int dword_723E80_award_related[]; | |
8824 | |
8825 | |
8826 | |
8827 | |
8828 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 8829 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 8830 { |
8831 unsigned int v3; // ebx@1 | |
8832 signed int v4; // esi@1 | |
501 | 8833 bool result; // eax@8 |
0 | 8834 int v6; // esi@11 |
8835 int v7; // edi@14 | |
8836 signed int v8; // eax@17 | |
8837 char *v9; // eax@20 | |
8838 char v10; // sf@20 | |
8839 char *v11; // ecx@26 | |
8840 char *v12; // ecx@27 | |
8841 __int64 v13; // qax@27 | |
8842 unsigned __int8 v14; // cf@27 | |
501 | 8843 int *v15; // edx@29 |
0 | 8844 char *v16; // eax@90 |
8845 char *v17; // ecx@94 | |
501 | 8846 int v18; // esi@97 |
0 | 8847 signed int v19; // edx@97 |
8848 char *v20; // ecx@98 | |
8849 int v21; // eax@100 | |
8850 __int16 v22; // dx@112 | |
8851 int v23; // [sp-8h] [bp-14h]@45 | |
8852 signed int v24; // [sp-4h] [bp-10h]@4 | |
8853 int v25; // [sp-4h] [bp-10h]@45 | |
8854 | |
8855 v3 = 0; | |
605 | 8856 v4 = uActiveCharacter - 1; |
501 | 8857 result = false; |
8858 if ( (signed int)VarNum > 222 ) | |
8859 { | |
8860 if ( (signed int)VarNum <= 307 ) | |
8861 { | |
8862 if ( VarNum == 307 ) | |
8863 { | |
8864 pParty->uNumDeaths -= (unsigned int)pValue; | |
8865 return pValue; | |
8866 } | |
8867 if ( VarNum == 223 ) | |
0 | 8868 { |
8869 v11 = (char *)pParty->_autonote_bits; | |
501 | 8870 v22 = (short)pValue - 1; |
0 | 8871 } |
8872 else | |
8873 { | |
501 | 8874 if ( VarNum != 231 ) |
0 | 8875 { |
501 | 8876 switch ( VarNum ) |
0 | 8877 { |
8878 case 232: | |
501 | 8879 VarNum = (VariableType)0; |
1094 | 8880 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 8881 result = (bool) pValue; |
8882 dword_5B65CC = 0; | |
8883 if ( (int)VarNum == pValue ) | |
0 | 8884 { |
501 | 8885 dword_5B65CC = (int)pValue; |
0 | 8886 } |
8887 else | |
8888 { | |
8889 pParty->field_709 = 0; | |
501 | 8890 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 8891 pParty->CountHirelings(); |
8892 viewparams->bRedrawGameUI = true; | |
0 | 8893 } |
8894 break; | |
8895 case 241: | |
8896 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8897 { | |
8898 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 8899 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 8900 { |
605 | 8901 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 8902 { |
8903 v21 = *(int *)v20; | |
8904 if ( (char)*(int *)v20 < 0 ) | |
8905 { | |
8906 LOBYTE(v21) = v21 & 0x7F; | |
8907 *(int *)v20 = v21; | |
8908 } | |
8909 } | |
8910 v20 += 76; | |
8911 } | |
8912 } | |
605 | 8913 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 8914 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 8915 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 8916 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
8917 pParty->field_709 = 0; | |
1035 | 8918 pParty->CountHirelings(); |
0 | 8919 break; |
8920 case 243: | |
8921 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8922 result = *v17 != NULL; |
501 | 8923 if ( (unsigned int)pValue <= *(int *)v17 ) |
8924 { | |
8925 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8926 result = (v17 != NULL); |
501 | 8927 } |
0 | 8928 else |
8929 *(int *)v17 = 0; | |
8930 break; | |
8931 case 275: | |
8932 v16 = (char *)&pOutdoor->ddm; | |
8933 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8934 v16 = (char *)&pIndoor->dlv; | |
501 | 8935 *((int *)v16 + 2) -= (int)pValue; |
0 | 8936 if ( *((int *)v16 + 2) < -10000 ) |
8937 *((int *)v16 + 2) = -10000; | |
8938 break; | |
8939 case 306: | |
501 | 8940 result = VarNum - 306; |
8941 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
8942 { | |
8943 result = (bool)pValue; | |
8944 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 8945 } |
0 | 8946 else |
8947 LABEL_88: | |
8948 dword_5B65C4 = 1; | |
8949 break; | |
8950 } | |
501 | 8951 return result; |
0 | 8952 } |
8953 v11 = this->field_1A50; | |
501 | 8954 v22 = (signed __int16)pValue; |
0 | 8955 } |
8956 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 8957 return result; |
8958 } | |
8959 switch ( VarNum ) | |
0 | 8960 { |
8961 case 308: | |
501 | 8962 result = (bool)pValue; |
8963 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 8964 break; |
8965 case 309: | |
501 | 8966 result = (bool)pValue; |
8967 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 8968 break; |
8969 case 310: | |
501 | 8970 result = (bool)pValue; |
8971 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 8972 break; |
8973 case 311: | |
501 | 8974 result = (bool)pValue; |
8975 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 8976 break; |
8977 case 312: | |
501 | 8978 result = (bool)pValue; |
8979 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 8980 break; |
8981 case 313: | |
501 | 8982 result = (bool)pValue; |
8983 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 8984 break; |
8985 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8986 assert(false && "Function not returning any value!"); |
0 | 8987 } |
8988 else | |
8989 { | |
501 | 8990 if ( (signed int)VarNum >= 123 ) |
8991 { | |
8992 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 8993 } |
8994 else | |
8995 { | |
501 | 8996 switch ( VarNum ) |
0 | 8997 { |
8998 case VAR_RandomGold: | |
501 | 8999 v6 = rand() % (signed int)pValue + 1; |
0 | 9000 if ( v6 > pParty->uNumGold ) |
9001 v6 = pParty->uNumGold; | |
9002 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9003 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9004 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 9005 GameUI_DrawFoodAndGold(); |
501 | 9006 return result; |
0 | 9007 case VAR_RandomFood: |
501 | 9008 v7 = rand() % (signed int)pValue + 1; |
0 | 9009 if ( v7 > pParty->uNumFoodRations ) |
9010 v7 = pParty->uNumFoodRations; | |
9011 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9012 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
9013 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 9014 GameUI_DrawFoodAndGold(); |
605 | 9015 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9016 v8 = 8 * v4 + 400; | |
862 | 9017 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9018 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9019 return result; |
0 | 9020 case VAR_CurrentHP: |
1036 | 9021 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 9022 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9023 v8 = 8 * v4 + 400; | |
862 | 9024 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9025 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9026 return result; | |
0 | 9027 case VAR_CurrentSP: |
9028 v9 = (char *)&this->sMana; | |
501 | 9029 v10 = this->sMana - (signed int)pValue < 0; |
9030 *(int *)v9 -= (int)pValue; | |
0 | 9031 if ( v10 ) |
9032 *(int *)v9 = 0; | |
605 | 9033 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9034 v8 = 8 * v4 + 400; | |
862 | 9035 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9036 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9037 return result; | |
0 | 9038 case VAR_ACModifier: |
501 | 9039 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9040 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9041 v8 = 8 * v4 + 400; | |
862 | 9042 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9043 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9044 return result; | |
0 | 9045 case VAR_BaseLevel: |
501 | 9046 this->uLevel -= (unsigned __int8)pValue; |
605 | 9047 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9048 v8 = 8 * v4 + 400; | |
862 | 9049 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9050 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9051 return result; | |
0 | 9052 case VAR_LevelModifier: |
501 | 9053 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 9054 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9055 v8 = 8 * v4 + 400; | |
862 | 9056 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9057 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9058 return result; | |
0 | 9059 case VAR_Age: |
501 | 9060 this->sAgeModifier -= (signed __int16)pValue; |
9061 return result; | |
0 | 9062 case VAR_Award: |
605 | 9063 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9064 return result; | |
0 | 9065 case VAR_Experience: |
9066 v12 = (char *)&this->uExperience; | |
501 | 9067 v13 = (signed int)pValue; |
9068 v14 = *(int *)v12 < (unsigned int)pValue; | |
9069 *(int *)v12 -= (int)pValue; | |
0 | 9070 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9071 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9072 v8 = 8 * v4 + 400; | |
862 | 9073 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9074 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9075 return result; | |
0 | 9076 case VAR_QBits_QuestsDone: |
501 | 9077 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9078 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9079 return true; |
0 | 9080 case VAR_PlayerItemInHands: |
501 | 9081 v15 = this->pInventoryIndices; |
0 | 9082 break; |
9083 case VAR_FixedGold: | |
501 | 9084 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9085 goto LABEL_88; |
501 | 9086 Party::TakeGold((unsigned int)pValue); |
9087 return result; | |
0 | 9088 case VAR_MightBonus: |
9089 case VAR_ActualMight: | |
501 | 9090 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9091 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
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_IntellectBonus: |
9098 case VAR_ActualIntellect: | |
501 | 9099 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9100 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9101 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9102 v8 = 8 * v4 + 400; | |
862 | 9103 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9104 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9105 return result; | |
0 | 9106 case VAR_PersonalityBonus: |
9107 case VAR_ActualPersonality: | |
501 | 9108 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9109 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9110 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9111 v8 = 8 * v4 + 400; | |
862 | 9112 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9113 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9114 return result; | |
0 | 9115 case VAR_EnduranceBonus: |
9116 case VAR_ActualEndurance: | |
501 | 9117 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9118 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9119 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9120 v8 = 8 * v4 + 400; | |
862 | 9121 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9122 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9123 return result; | |
0 | 9124 case VAR_SpeedBonus: |
9125 case VAR_ActualSpeed: | |
501 | 9126 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9127 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9128 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9129 v8 = 8 * v4 + 400; | |
862 | 9130 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9131 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9132 return result; | |
0 | 9133 case VAR_AccuracyBonus: |
9134 case VAR_ActualAccuracy: | |
501 | 9135 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9136 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9137 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9138 v8 = 8 * v4 + 400; | |
862 | 9139 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9140 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9141 return result; | |
0 | 9142 case VAR_LuckBonus: |
9143 case VAR_ActualLuck: | |
501 | 9144 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9145 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9146 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9147 v8 = 8 * v4 + 400; | |
862 | 9148 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9149 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9150 return result; | |
0 | 9151 case VAR_BaseMight: |
501 | 9152 this->uMight -= (unsigned __int16)pValue; |
605 | 9153 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9154 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9155 v8 = 8 * v4 + 400; | |
862 | 9156 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9157 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9158 return result; | |
0 | 9159 case VAR_BaseIntellect: |
501 | 9160 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9161 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_BasePersonality: |
501 | 9168 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9169 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9170 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9171 v8 = 8 * v4 + 400; | |
862 | 9172 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9173 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9174 return result; | |
0 | 9175 case VAR_BaseEndurance: |
501 | 9176 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9177 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9178 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9179 v8 = 8 * v4 + 400; | |
862 | 9180 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9181 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9182 return result; | |
0 | 9183 case VAR_BaseSpeed: |
501 | 9184 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9185 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9186 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9187 v8 = 8 * v4 + 400; | |
862 | 9188 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9189 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9190 return result; | |
0 | 9191 case VAR_BaseAccuracy: |
501 | 9192 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9193 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9194 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9195 v8 = 8 * v4 + 400; | |
862 | 9196 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9197 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9198 return result; | |
0 | 9199 case VAR_BaseLuck: |
501 | 9200 this->uLuck -= (unsigned __int16)pValue; |
605 | 9201 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9202 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9203 v8 = 8 * v4 + 400; | |
862 | 9204 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9205 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9206 return result; | |
0 | 9207 case VAR_FireResistance: |
501 | 9208 this->sResFireBase -= (signed __int16)pValue; |
605 | 9209 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9210 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9211 v8 = 8 * v4 + 400; | |
862 | 9212 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9213 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9214 return result; | |
0 | 9215 case VAR_AirResistance: |
501 | 9216 this->sResAirBase -= (signed __int16)pValue; |
605 | 9217 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9218 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9219 v8 = 8 * v4 + 400; | |
862 | 9220 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9221 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9222 return result; | |
0 | 9223 case VAR_WaterResistance: |
501 | 9224 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9225 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9226 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9227 v8 = 8 * v4 + 400; | |
862 | 9228 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9229 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9230 return result; | |
0 | 9231 case VAR_EarthResistance: |
501 | 9232 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9233 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9234 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9235 v8 = 8 * v4 + 400; | |
862 | 9236 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9237 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9238 return result; | |
0 | 9239 case VAR_SpiritResistance: |
501 | 9240 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9241 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9242 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9243 v8 = 8 * v4 + 400; | |
862 | 9244 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9245 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9246 return result; | |
0 | 9247 case VAR_MindResistance: |
501 | 9248 this->sResMindBase -= (signed __int16)pValue; |
605 | 9249 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9250 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9251 v8 = 8 * v4 + 400; | |
862 | 9252 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9253 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9254 return result; | |
0 | 9255 case VAR_BodyResistance: |
501 | 9256 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9257 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9258 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9259 v8 = 8 * v4 + 400; | |
862 | 9260 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9261 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9262 return result; | |
0 | 9263 case VAR_LightResistance: |
501 | 9264 this->sResLightBase -= (signed __int16)pValue; |
605 | 9265 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9266 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9267 v8 = 8 * v4 + 400; | |
862 | 9268 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9269 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9270 return result; | |
0 | 9271 case VAR_DarkResistance: |
501 | 9272 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9273 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9274 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9275 v8 = 8 * v4 + 400; | |
862 | 9276 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9277 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9278 return result; | |
0 | 9279 case VAR_MagicResistance: |
501 | 9280 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9281 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9282 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9283 v8 = 8 * v4 + 400; | |
862 | 9284 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9285 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9286 return result; | |
0 | 9287 case VAR_FireResistanceBonus: |
501 | 9288 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9289 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9290 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9291 v8 = 8 * v4 + 400; | |
862 | 9292 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9293 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9294 return result; | |
0 | 9295 case VAR_AirResistanceBonus: |
501 | 9296 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9297 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9298 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9299 v8 = 8 * v4 + 400; | |
862 | 9300 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9301 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9302 return result; | |
0 | 9303 case VAR_WaterResistanceBonus: |
501 | 9304 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9305 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9306 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9307 v8 = 8 * v4 + 400; | |
862 | 9308 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9309 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9310 return result; | |
0 | 9311 case VAR_EarthResistanceBonus: |
501 | 9312 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9313 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9314 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9315 v8 = 8 * v4 + 400; | |
862 | 9316 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9317 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9318 return result; | |
0 | 9319 case VAR_SpiritResistanceBonus: |
501 | 9320 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9321 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9322 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9323 v8 = 8 * v4 + 400; | |
862 | 9324 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9325 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9326 return result; | |
0 | 9327 case VAR_MindResistanceBonus: |
501 | 9328 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9329 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9330 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9331 v8 = 8 * v4 + 400; | |
862 | 9332 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9333 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9334 return result; | |
0 | 9335 case VAR_BodyResistanceBonus: |
501 | 9336 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9337 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9338 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9339 v8 = 8 * v4 + 400; | |
862 | 9340 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9341 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9342 return result; | |
0 | 9343 case VAR_LightResistanceBonus: |
501 | 9344 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9345 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9346 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9347 v8 = 8 * v4 + 400; | |
862 | 9348 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9349 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9350 return result; | |
0 | 9351 case VAR_DarkResistanceBonus: |
501 | 9352 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9353 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9354 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9355 v8 = 8 * v4 + 400; | |
862 | 9356 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9357 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9358 return result; | |
0 | 9359 case VAR_MagicResistanceBonus: |
501 | 9360 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9361 v25 = 0; |
187 | 9362 v23 = SPEECH_91; |
9363 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9364 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9365 v8 = 8 * v4 + 400; | |
862 | 9366 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9367 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9368 return result; | |
0 | 9369 case VAR_FixedFood: |
501 | 9370 Party::TakeFood((unsigned int)pValue); |
605 | 9371 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9372 v8 = 8 * v4 + 400; | |
862 | 9373 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9374 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9375 return result; | |
0 | 9376 case VAR_StaffSkill: |
9377 case VAR_SwordSkill: | |
9378 case VAR_DaggerSkill: | |
9379 case VAR_AxeSkill: | |
9380 case VAR_SpearSkill: | |
9381 case VAR_BowSkill: | |
9382 case VAR_MaceSkill: | |
9383 case VAR_BlasterSkill: | |
9384 case VAR_ShieldSkill: | |
9385 case VAR_LeatherSkill: | |
9386 case VAR_SkillChain: | |
9387 case VAR_PlateSkill: | |
9388 case VAR_FireSkill: | |
9389 case VAR_AirSkill: | |
9390 case VAR_WaterSkill: | |
9391 case VAR_EarthSkill: | |
9392 case VAR_SpiritSkill: | |
9393 case VAR_MindSkill: | |
9394 case VAR_BodySkill: | |
9395 case VAR_LightSkill: | |
9396 case VAR_DarkSkill: | |
9397 case VAR_IdentifyItemSkill: | |
9398 case VAR_MerchantSkill: | |
9399 case VAR_RepairSkill: | |
9400 case VAR_BodybuildingSkill: | |
9401 case VAR_MeditationSkill: | |
9402 case VAR_PerceptionSkill: | |
9403 case VAR_DiplomacySkill: | |
9404 case VAR_DisarmTrapSkill: | |
9405 case VAR_LearningSkill: | |
501 | 9406 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9407 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9408 v8 = 8 * v4 + 400; | |
862 | 9409 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9410 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9411 return result; | |
0 | 9412 case VAR_Cursed: |
9413 case VAR_Weak: | |
9414 case VAR_Asleep: | |
9415 case VAR_Afraid: | |
9416 case VAR_Drunk: | |
9417 case VAR_Insane: | |
9418 case VAR_PoisonedGreen: | |
9419 case VAR_DiseasedGreen: | |
9420 case VAR_PoisonedYellow: | |
9421 case VAR_DiseasedYellow: | |
9422 case VAR_PoisonedRed: | |
9423 case VAR_DiseasedRed: | |
9424 case VAR_Paralyzed: | |
9425 case VAR_Unconsious: | |
9426 case VAR_Dead: | |
9427 case VAR_Stoned: | |
9428 case VAR_Eradicated: | |
1071 | 9429 //*((int *)this + 2 * VarNum - 210) = 0; |
9430 //*((int *)this + 2 * result - 209) = 0; | |
9431 this->pConditions[VarNum] = 0; | |
0 | 9432 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9433 v8 = 8 * v4 + 400; | |
862 | 9434 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9435 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9436 return result; |
605 | 9437 default: |
9438 return result; | |
9439 } | |
9440 for (v3 = 1; v3 < 126; v3++) | |
9441 { | |
9442 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9443 { |
605 | 9444 RemoveItemAtInventoryIndex(v3); |
501 | 9445 return true; |
0 | 9446 } |
605 | 9447 } |
501 | 9448 if ( pParty->pPickedItem.uItemID == pValue ) |
9449 { | |
605 | 9450 pMouse->RemoveHoldingItem(); |
9451 return true; | |
9452 } | |
9453 return false; | |
0 | 9454 } |
9455 } | |
9456 } | |
9457 // 5B65C4: using guessed type int dword_5B65C4; | |
9458 // 5B65CC: using guessed type int dword_5B65CC; |