Mercurial > mm7
annotate Player.cpp @ 1278:ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
author | Grumpy7 |
---|---|
date | Sat, 15 Jun 2013 07:52:05 +0200 |
parents | f11651288371 |
children | 86a83e12d795 |
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 { | |
1275 | 203 if (sMana >= (signed int)uRequiredMana) |
204 { | |
205 sMana -= (signed int)uRequiredMana; | |
488 | 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) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
262 int Player::GetTempleHealCostModifier(float a2) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
263 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
264 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
265 int conditionTimeMultiplier; // esi@1 |
0 | 266 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
267 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
268 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 269 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
270 conditionIdx = GetMajorConditionIdx(); |
1275 | 271 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
272 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
273 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
274 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
275 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
276 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
277 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
278 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
279 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
280 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
281 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
282 } |
1275 | 283 else if (conditionIdx < 14) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
284 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
285 baseConditionMultiplier = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 conditionTimeMultiplier = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
287 for (int i = 0; i <= 13; i++) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 v6 = GetConditionDayOfWeek(i); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
290 if ( v6 > conditionTimeMultiplier ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 conditionTimeMultiplier = v6; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
292 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
293 if ( !conditionTimeMultiplier ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 conditionTimeMultiplier = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
295 } |
1275 | 296 else{ |
297 conditionTimeMultiplier = 1; | |
298 baseConditionMultiplier = 1; | |
299 } | |
300 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 return result; |
0 | 304 } |
305 | |
306 //----- (004B8102) -------------------------------------------------------- | |
917 | 307 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 308 { |
309 signed int v3; // esi@1 | |
310 signed int result; // eax@3 | |
311 | |
1275 | 312 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 313 if ( v3 > uRealValue ) |
314 v3 = uRealValue; | |
0 | 315 result = 1; |
316 if ( v3 >= 1 ) | |
317 result = v3; | |
318 return result; | |
319 } | |
320 | |
321 //----- (004B8142) -------------------------------------------------------- | |
749 | 322 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
323 { | |
1275 | 324 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 325 assert (price > 0); |
326 | |
327 if (price < uRealValue) | |
328 price = uRealValue; | |
329 return price; | |
0 | 330 } |
331 | |
332 //----- (004B8179) -------------------------------------------------------- | |
916 | 333 int Player::GetPriceIdentification(float a2) |
0 | 334 { |
335 signed int v2; // esi@1 | |
336 int v3; // ecx@1 | |
337 signed int result; // eax@3 | |
338 | |
1275 | 339 v2 = (signed int)(a2 * 50.0); |
0 | 340 v3 = v2 * (100 - GetMerchant()) / 100; |
341 if ( v3 < v2 / 3 ) | |
342 v3 = v2 / 3; | |
343 result = 1; | |
344 if ( v3 >= 1 ) | |
345 result = v3; | |
346 return result; | |
347 } | |
348 | |
349 //----- (004B81C3) -------------------------------------------------------- | |
916 | 350 int Player::GetPriceRepair(int a2, float a3) |
0 | 351 { |
352 signed int v3; // esi@1 | |
353 int v4; // ecx@1 | |
354 signed int result; // eax@3 | |
355 | |
1275 | 356 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 357 v4 = v3 * (100 - GetMerchant()) / 100; |
358 if ( v4 < v3 / 3 ) | |
359 v4 = v3 / 3; | |
360 result = 1; | |
361 if ( v4 >= 1 ) | |
362 result = v4; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B8213) -------------------------------------------------------- | |
1275 | 367 int Player::GetBaseSellingPrice(int a2, float a3) |
368 { | |
369 signed int v3; // qax@1 | |
370 | |
371 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
372 if ( v3 < 1 ) | |
373 v3 = 1; | |
0 | 374 return v3; |
375 } | |
376 | |
377 //----- (004B8233) -------------------------------------------------------- | |
1275 | 378 int Player::GetBaseBuyingPrice(int a2, float a3) |
379 { | |
380 signed int v3; // qax@1 | |
381 | |
382 v3 = (signed int)((double)a2 * a3); | |
383 if ( v3 < 1 ) | |
384 v3 = 1; | |
0 | 385 return v3; |
386 } | |
387 | |
388 //----- (004B824B) -------------------------------------------------------- | |
1275 | 389 int Player::GetBaseIdentifyPrice(float a2) |
390 { | |
391 signed int v2; // qax@1 | |
392 | |
393 v2 = (signed int)(a2 * 50.0); | |
394 if ( v2 < 1 ) | |
395 v2 = 1; | |
0 | 396 return v2; |
397 } | |
398 | |
399 //----- (004B8265) -------------------------------------------------------- | |
1275 | 400 int Player::GetBaseRepairPrice(int a2, float a3) |
401 { | |
402 signed int v3; // qax@1 | |
403 | |
404 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
405 if ( v3 < 1 ) | |
406 v3 = 1; | |
0 | 407 return v3; |
408 } | |
409 | |
410 | |
411 | |
412 | |
413 | |
414 //----- (004B6FF9) -------------------------------------------------------- | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
415 int Player::IsPlayerHealableByTemple() |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
416 { |
0 | 417 signed int v2; // eax@1 |
336 | 418 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
419 |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
420 if ( this->sHealth < GetMaxHealth() || this->sMana < GetMaxMana() ) |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
421 { |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
422 return 1; |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
423 } |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
424 else if (GetMajorConditionIdx() == 18) |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
425 { |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
426 return 0; |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
427 } |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
428 else if (GetMajorConditionIdx() == 17 && (v2 == 78 || v2 > 80) && v2 <= 82) |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
429 { |
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
430 return 0; |
0 | 431 } |
432 else | |
433 { | |
434 return 1; | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
435 } |
0 | 436 } |
437 | |
438 | |
439 | |
440 //----- (00421E75) -------------------------------------------------------- | |
1012 | 441 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
442 { | |
443 int item_idx; // eax@1 | |
444 int inv_index; // eax@3 | |
445 | |
446 item_idx = *pitem_index; | |
447 if ( item_idx >125 || item_idx < 0 ) | |
448 { | |
449 return 0; | |
450 } | |
451 | |
452 inv_index = this->pInventoryIndices[item_idx]; | |
453 if ( inv_index < 0 ) | |
454 { | |
455 *pitem_index = -1 - inv_index; | |
456 inv_index = this->pInventoryIndices[-1 - inv_index]; | |
457 } | |
458 | |
459 return inv_index; | |
0 | 460 } |
461 | |
462 | |
463 | |
464 //----- (004160CA) -------------------------------------------------------- | |
1012 | 465 void Player::ItemsEnchant( int enchant_count ) |
466 { | |
467 int avalible_items; // ebx@1 | |
468 int i; // edx@8 | |
469 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
470 | |
471 avalible_items = 0; | |
472 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
473 | |
474 for (i=0; i<138; ++i) | |
475 { | |
476 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134)) | |
477 item_index_tabl[avalible_items++] = i; | |
478 } | |
479 | |
480 if ( avalible_items ) | |
481 { | |
482 if ( enchant_count ) | |
483 { | |
484 for ( i = 0; i < enchant_count; ++i ) | |
0 | 485 { |
1012 | 486 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
487 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED; | |
0 | 488 } |
1012 | 489 |
0 | 490 } |
491 else | |
492 { | |
1012 | 493 for ( i = 0; i < avalible_items; ++i ) |
494 { | |
495 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) | |
496 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED; | |
497 } | |
498 } | |
499 } | |
500 ; | |
0 | 501 } |
502 | |
503 //----- (004948B1) -------------------------------------------------------- | |
187 | 504 void Player::PlaySound(PlayerSpeech speech, int a3) |
505 { | |
506 //Player *pPlayer; // edi@1 | |
507 //int v4; // eax@4 | |
0 | 508 signed int v5; // esi@4 |
203 | 509 unsigned char *v6; // ebx@4 |
0 | 510 signed int v7; // ecx@5 |
511 unsigned __int8 v8; // al@6 | |
512 int v9; // eax@10 | |
187 | 513 //unsigned int pVoiceID; // ecx@10 |
0 | 514 int v11; // esi@10 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
515 //signed int v12; // eax@11 |
0 | 516 signed int v13; // esi@12 |
517 int v14; // eax@12 | |
187 | 518 //int v15; // eax@17 |
248 | 519 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
0 | 520 signed int v17; // ecx@19 |
521 char *pSoundID; // edi@20 | |
522 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | |
187 | 523 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
0 | 524 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
525 int pSoundId; // [sp+30h] [bp+8h]@4 | |
526 | |
187 | 527 //pPlayer = this; |
528 //pPlayer2 = this; | |
529 | |
0 | 530 pPlayerNum = 1; |
187 | 531 for (int i = 0; i < 4; ++i) |
532 if (&pParty->pPlayers[i] == this) | |
533 { | |
534 pPlayerNum = i + 1; | |
0 | 535 break; |
187 | 536 } |
537 | |
538 //v4 = a2;//102 | |
0 | 539 v5 = 0; |
540 pSoundId = 0; | |
1213 | 541 v6 = SoundSetAction[speech].data();//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
203 | 542 if (uVoicesVolumeMultiplier) |
0 | 543 { |
544 v7 = 0; | |
545 do | |
546 { | |
547 v8 = v6[v7]; | |
548 if ( v8 ) | |
549 v20[v5++] = v8; | |
550 ++v7; | |
551 } | |
552 while ( v7 < 2 ); | |
553 if ( v5 ) | |
554 { | |
555 v9 = rand(); | |
187 | 556 //pVoiceID = uVoiceID; |
0 | 557 v11 = v20[v9 % v5]; |
203 | 558 |
559 if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID]) | |
560 { | |
561 pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
562 pAudioPlayer->PlaySound((SoundID)pSoundId, PID(OBJECT_Player, pPlayerNum + 39), 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
0 | 563 } |
564 } | |
565 } | |
203 | 566 |
0 | 567 v13 = 0; |
568 v14 = (int)(v6 + 3); | |
569 do | |
570 { | |
571 if ( *(char *)v14 ) | |
572 v20[v13++] = *(char *)v14; | |
573 ++v14; | |
574 } | |
575 while ( -3 - (signed int)v6 + v14 < 5 ); | |
576 if ( v13 ) | |
577 { | |
578 pPlayerNum = 0; | |
248 | 579 expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; |
580 if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) | |
0 | 581 { |
582 v17 = 0; | |
764 | 583 if ( (signed int)pSoundList->sNumSounds <= 0 ) |
0 | 584 { |
585 LABEL_23: | |
586 v17 = 0; | |
587 } | |
588 else | |
589 { | |
590 pSoundID = (char *)&pSoundList->pSounds->uSoundID; | |
591 while ( *(int *)pSoundID != pSoundId ) | |
592 { | |
593 ++v17; | |
594 pSoundID += 120; | |
764 | 595 if ( v17 >= (signed int)pSoundList->sNumSounds ) |
0 | 596 goto LABEL_23; |
597 } | |
598 } | |
599 if ( pSoundList->pSounds[v17].pSoundData[0] ) | |
600 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | |
601 } | |
248 | 602 /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); |
187 | 603 } |
604 //return v14; | |
0 | 605 } |
606 // 4948B1: using guessed type int var_1C[5]; | |
607 | |
608 //----- (00494A25) -------------------------------------------------------- | |
187 | 609 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
610 { | |
611 //signed int v3; // eax@1 | |
612 //CHARACTER_EXPRESSION_ID v4; // dx@1 | |
0 | 613 signed int v5; // edi@15 |
614 PlayerFrame *v6; // esi@17 | |
615 signed int v7; // eax@20 | |
616 | |
187 | 617 //LOWORD(v3) = this->expression; |
618 //v4 = expr; | |
619 if (expression != CHARACTER_EXPRESSION_SLEEP && | |
620 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) | |
621 { | |
622 int v3 = (unsigned)expression; | |
0 | 623 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
624 { | |
625 if ( v3 <= 7 ) | |
626 goto LABEL_12; | |
627 if ( v3 > 8 ) | |
628 { | |
629 if ( v3 > 11 ) | |
630 { | |
1014 | 631 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) ) |
187 | 632 return; |
0 | 633 goto LABEL_15; |
634 } | |
635 LABEL_12: | |
187 | 636 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
637 return; | |
0 | 638 goto LABEL_15; |
639 } | |
640 } | |
641 } | |
642 LABEL_15: | |
187 | 643 //LOWORD(v3) = a3; |
0 | 644 v5 = 0; |
645 this->uExpressionTimeLength = a3; | |
646 this->uExpressionTimePassed = 0; | |
647 if ( !a3 ) | |
648 { | |
649 if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) | |
650 { | |
651 LABEL_20: | |
652 v7 = 0; | |
653 } | |
654 else | |
655 { | |
656 v6 = pPlayerFrameTable->pFrames; | |
187 | 657 while ( v6->expression != new_expression ) |
0 | 658 { |
659 ++v5; | |
660 ++v6; | |
661 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | |
662 goto LABEL_20; | |
663 } | |
664 v7 = v5; | |
665 } | |
187 | 666 //v4 = expr; |
667 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; | |
668 } | |
669 expression = new_expression; | |
0 | 670 viewparams->bRedrawGameUI = 1; |
671 } | |
672 | |
673 //----- (0049327B) -------------------------------------------------------- | |
674 int Player::_49327B(unsigned int uClass, int a3) | |
675 { | |
676 Player *v3; // esi@1 | |
677 char v4; // zf@4 | |
678 __int16 v5; // dx@9 | |
679 signed int result; // eax@84 | |
680 unsigned int v7; // [sp-8h] [bp-10h]@3 | |
681 int v8; // [sp-4h] [bp-Ch]@3 | |
682 | |
683 v3 = this; | |
135 | 684 if ( this->classType == uClass ) |
0 | 685 { |
686 LABEL_84: | |
687 result = 1; | |
688 } | |
689 else | |
690 { | |
691 switch ( uClass ) | |
692 { | |
693 case 0u: | |
694 v8 = a3; | |
695 v7 = 1; | |
696 goto LABEL_4; | |
697 case 1u: | |
484 | 698 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 17) |
0 | 699 || _49327B(2u, a3) ) |
700 goto LABEL_84; | |
701 v8 = a3; | |
702 v7 = 3; | |
703 goto LABEL_4; | |
704 case 2u: | |
705 v5 = 19; | |
706 goto LABEL_82; | |
707 case 3u: | |
708 v5 = 21; | |
709 goto LABEL_82; | |
710 case 4u: | |
711 v8 = a3; | |
712 v7 = 5; | |
713 goto LABEL_4; | |
714 case 5u: | |
484 | 715 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 11) |
0 | 716 || _49327B(6u, a3) ) |
717 goto LABEL_84; | |
718 v8 = a3; | |
719 v7 = 7; | |
720 goto LABEL_4; | |
721 case 6u: | |
722 if ( !a3 ) | |
723 break; | |
724 v5 = 13; | |
725 goto LABEL_82; | |
726 case 7u: | |
727 if ( !a3 ) | |
728 break; | |
729 v5 = 15; | |
730 goto LABEL_82; | |
731 case 8u: | |
732 v8 = a3; | |
733 v7 = 9; | |
734 goto LABEL_4; | |
735 case 9u: | |
484 | 736 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 23) |
0 | 737 || _49327B(0xAu, a3) ) |
738 goto LABEL_84; | |
739 v8 = a3; | |
740 v7 = 11; | |
741 goto LABEL_4; | |
742 case 0xAu: | |
743 if ( !a3 ) | |
744 break; | |
745 v5 = 25; | |
746 goto LABEL_82; | |
747 case 0xBu: | |
748 if ( !a3 ) | |
749 break; | |
750 v5 = 27; | |
751 goto LABEL_82; | |
752 case 0xCu: | |
753 v8 = a3; | |
754 v7 = 13; | |
755 goto LABEL_4; | |
756 case 0xDu: | |
484 | 757 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 41) |
0 | 758 || _49327B(0xEu, a3) ) |
759 goto LABEL_84; | |
760 v8 = a3; | |
761 v7 = 15; | |
762 goto LABEL_4; | |
763 case 0xEu: | |
764 if ( !a3 ) | |
765 break; | |
766 v5 = 43; | |
767 goto LABEL_82; | |
768 case 0xFu: | |
769 if ( !a3 ) | |
770 break; | |
771 v5 = 45; | |
772 goto LABEL_82; | |
773 case 0x10u: | |
774 v8 = a3; | |
775 v7 = 17; | |
776 goto LABEL_4; | |
777 case 0x11u: | |
484 | 778 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 35) |
0 | 779 || _49327B(0x12u, a3) ) |
780 goto LABEL_84; | |
781 v8 = a3; | |
782 v7 = 19; | |
783 goto LABEL_4; | |
784 case 0x12u: | |
785 if ( !a3 ) | |
786 break; | |
787 v5 = 37; | |
788 goto LABEL_82; | |
789 case 0x13u: | |
790 v5 = 39; | |
791 goto LABEL_82; | |
792 case 0x14u: | |
793 v8 = a3; | |
794 v7 = 21; | |
795 goto LABEL_4; | |
796 case 0x15u: | |
484 | 797 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 29) |
0 | 798 || _49327B(0x16u, a3) ) |
799 goto LABEL_84; | |
800 v8 = a3; | |
801 v7 = 23; | |
802 goto LABEL_4; | |
803 case 0x16u: | |
804 if ( !a3 ) | |
805 break; | |
806 v5 = 31; | |
807 goto LABEL_82; | |
808 case 0x17u: | |
809 if ( !a3 ) | |
810 break; | |
811 v5 = 33; | |
812 goto LABEL_82; | |
813 case 0x18u: | |
814 if ( !_49327B(0x19u, a3) ) | |
815 goto LABEL_56; | |
816 break; | |
817 case 0x19u: | |
818 LABEL_56: | |
484 | 819 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v3->_guilds_member_bits, 63) |
0 | 820 || _49327B(0x1Au, a3) ) |
821 goto LABEL_84; | |
822 v8 = a3; | |
823 v7 = 27; | |
824 goto LABEL_4; | |
825 case 0x1Au: | |
826 if ( !a3 ) | |
827 break; | |
828 v5 = 65; | |
829 goto LABEL_82; | |
830 case 0x1Bu: | |
831 if ( !a3 ) | |
832 break; | |
833 v5 = 67; | |
834 goto LABEL_82; | |
835 case 0x1Cu: | |
836 v8 = a3; | |
837 v7 = 29; | |
838 goto LABEL_4; | |
839 case 0x1Du: | |
484 | 840 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 69) |
0 | 841 || _49327B(0x1Eu, a3) ) |
842 goto LABEL_84; | |
843 v8 = a3; | |
844 v7 = 31; | |
845 goto LABEL_4; | |
846 case 0x1Eu: | |
847 if ( !a3 ) | |
848 break; | |
849 v5 = 71; | |
850 goto LABEL_82; | |
851 case 0x1Fu: | |
852 if ( !a3 ) | |
853 break; | |
854 v5 = 73; | |
855 goto LABEL_82; | |
856 case 0x20u: | |
857 v8 = a3; | |
858 v7 = 33; | |
859 goto LABEL_4; | |
860 case 0x21u: | |
484 | 861 if ( a3 && (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 73) |
0 | 862 || _49327B(0x22u, a3) ) |
863 goto LABEL_84; | |
864 v8 = a3; | |
865 v7 = 35; | |
866 LABEL_4: | |
867 v4 = _49327B(v7, v8) == 0; | |
868 goto LABEL_83; | |
869 case 0x22u: | |
870 if ( !a3 ) | |
871 break; | |
872 v5 = 77; | |
873 goto LABEL_82; | |
874 case 0x23u: | |
875 if ( a3 ) | |
876 { | |
877 v5 = 79; | |
878 LABEL_82: | |
484 | 879 v4 = (unsigned __int16)_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, v5) == 0; |
0 | 880 LABEL_83: |
881 if ( !v4 ) | |
882 goto LABEL_84; | |
883 } | |
884 break; | |
885 default: | |
886 break; | |
887 } | |
888 result = 0; | |
889 } | |
890 return result; | |
891 } | |
892 | |
893 | |
894 //----- (00492C0B) -------------------------------------------------------- | |
895 bool Player::CanAct() | |
896 { | |
897 bool result; // eax@2 | |
898 | |
899 if ( this->pConditions[2] | this->pConditions[12] | this->pConditions[13] | this->pConditions[14] | this->pConditions[15] | this->pConditions[16] ) | |
900 result = 0; | |
901 else | |
902 result = 1; | |
903 return result; | |
904 } | |
905 | |
906 //----- (00492C40) -------------------------------------------------------- | |
907 bool Player::CanSteal() | |
908 { | |
909 int v1; // eax@1 | |
910 | |
911 LOBYTE(v1) = GetActualSkillLevel(PLAYER_SKILL_STEALING); | |
912 return v1 != 0; | |
913 } | |
914 | |
915 //----- (00492C4E) -------------------------------------------------------- | |
916 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
917 { | |
918 char v2; // zf@9 | |
919 __int16 v4; // dx@13 | |
920 char v5; // zf@15 | |
921 | |
922 if ( (signed int)uItemID > 532 ) // if (uItemID == 514 || // item233 ®á®å âਪ àâ¥ä ªâ, §«® | |
923 // uItemID == 516 || // item221 ‘â àë© ¨ª àâ¥ä ªâ, §«® | |
924 // uItemID == 524) // item325 ‘ã¬à ª ५¨ª¢¨ï, §«® | |
925 { | |
926 if ( uItemID == 533 ) | |
927 { | |
928 v2 = GetRace() == 1; | |
929 } | |
930 else | |
931 { | |
932 if ( uItemID != 534 ) | |
933 { | |
934 if ( uItemID == 535 ) // | |
935 // if (uItemID == 530) // item093 ƒ¨¡¥«ì «ìä àâ¥ä ªâ, £®¡«¨ | |
936 { | |
937 switch ( this->uVoiceID ) | |
938 { | |
939 default: | |
940 return 1; | |
941 case 4u: | |
942 case 5u: | |
943 case 6u: | |
944 case 7u: | |
945 case 0xAu: | |
946 case 0xBu: | |
947 case 0xEu: // | |
948 // if (uItemID == 535) // item129 ᪮àâ ‹¥¤¨ àâ¥ä ªâ, ¦¥é¨ | |
949 case 0xFu: | |
950 case 0x12u: | |
951 case 0x13u: | |
952 case 0x15u: | |
953 case 0x18u: | |
954 return 0; | |
955 } | |
956 return 0; | |
957 } | |
958 if ( uItemID == 536 ) // | |
959 // if (uItemID == 531) // item093 Žª® Œë᫨ àâ¥ä ªâ, 祫®¢¥ª | |
960 { | |
961 switch ( this->uVoiceID ) | |
962 { | |
963 case 4u: | |
964 case 5u: | |
965 case 6u: | |
966 case 7u: | |
967 case 0xAu: | |
968 case 0xBu: | |
969 case 0xEu: | |
970 case 0xFu: | |
971 case 0x12u: | |
972 case 0x13u: | |
973 case 0x15u: | |
974 case 0x18u: | |
975 return 1; | |
976 default: | |
977 return 0; | |
978 } | |
979 return 0; | |
980 } | |
981 if ( uItemID != 604 ) // | |
982 // if (uItemID == 532) // item073 «ìä¨©áª ï Š®«ìç㣠àâ¥ä ªâ, í«ìä | |
983 return 1; | |
984 v5 = _43EEF3() == 0; | |
985 goto LABEL_23; | |
986 } | |
987 v2 = GetRace() == 3; // | |
988 // if (uItemID == 533) // item113 Š®¢ ë¥ ‹ âë¥ ãª ¢¨æë àâ¥ä ªâ, £®¬ | |
989 } | |
990 } | |
991 else | |
992 { | |
993 if ( uItemID != 532 ) | |
994 { | |
995 if ( uItemID != 515 && uItemID != 517 ) // | |
996 // if (uItemID == 534) // item104 ®ïá ƒ¥à®ï àâ¥ä ªâ, ¬ã¦ç¨ | |
997 { | |
998 if ( uItemID == 521 ) // if (uItemID == 521 || // item239 ˜«¥¬ ’ «¥¤® àâ¥ä ªâ, ¤®¡à® | |
999 // uItemID == 526) // item230 ‘¯à ¢¥¤«¨¢®áâì ५¨ª¢¨ï, ¤®¡à® | |
1000 { | |
1001 LABEL_13: | |
1002 v4 = 99; | |
1003 LABEL_15: | |
484 | 1004 v5 = (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v4) == 0; |
0 | 1005 LABEL_23: |
1006 if ( !v5 ) | |
1007 return 1; | |
1008 return 0; | |
1009 } | |
1010 if ( uItemID != 525 ) | |
1011 { | |
1012 if ( uItemID != 527 ) | |
1013 { | |
1014 if ( uItemID != 531 ) | |
1015 return 1; | |
1016 v2 = GetRace() == 2; | |
1017 goto LABEL_10; | |
1018 } | |
1019 goto LABEL_13; | |
1020 } | |
1021 } | |
1022 v4 = 100; | |
1023 goto LABEL_15; | |
1024 } | |
1025 v2 = GetRace() == 0; | |
1026 } | |
1027 LABEL_10: | |
1028 if ( v2 ) | |
1029 return 1; | |
1030 return 0; | |
1031 } | |
1032 | |
1033 //----- (00492D65) -------------------------------------------------------- | |
1034 int Player::SetCondition(unsigned int uConditionIdx, int a3) | |
1014 | 1035 { |
1036 | |
1037 signed int player_sex; // ecx@77 | |
1038 char zombi_face; // al@80 | |
1039 signed int remainig_player; // ebx@82 | |
1040 int players_before; // [sp+10h] [bp-4h]@2 | |
1041 int players_after; // [sp+20h] [bp+Ch]@82 | |
1042 | |
1043 if ( pConditions[uConditionIdx] ) | |
1044 return 0; | |
1045 players_before = 0; | |
1046 for (int i=1;i<5;++i) | |
1047 if ( pPlayers[i]->CanAct() ) | |
1048 ++players_before; | |
1049 | |
0 | 1050 switch ( uConditionIdx ) |
1014 | 1051 { |
1052 case Condition_Cursed: | |
1053 PlaySound((PlayerSpeech)30, 0); | |
1054 break; | |
1055 case Condition_Weak: | |
1167 | 1056 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 ) |
1057 {--pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; | |
1058 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1059 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1060 return 0; |
1061 } | |
1062 | |
1063 PlaySound((PlayerSpeech)25, 0); | |
1064 break; | |
1065 case Condition_Sleep: | |
1080 | 1066 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)|| |
1067 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR))) | |
1014 | 1068 return 0; |
1069 break; | |
1070 | |
1071 case Condition_Fear: | |
1072 PlaySound((PlayerSpeech)26, 0); | |
1073 break; | |
1074 case Condition_Drunk: | |
1075 PlaySound((PlayerSpeech)31, 0); | |
1076 break; | |
1077 | |
1078 case Condition_Insane: | |
0 | 1079 if ( a3 == 1 |
1080 | 1080 && (HasEnchantedItemEquipped(19) || |
1081 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1082 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1083 return 0; |
1084 | |
1085 PlaySound((PlayerSpeech)29, 0); | |
1086 break; | |
1087 case Condition_Poison1: | |
1088 case Condition_Poison2: | |
1089 case Condition_Poison3: | |
1090 if ( a3 == 1 ) | |
1091 { | |
1167 | 1092 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1093 { |
1167 | 1094 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1095 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1096 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1097 } |
1098 if ( HasEnchantedItemEquipped(21) | |
1080 | 1099 || WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) |
1082 | 1100 || WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1101 //goto LABEL_76; |
1102 return 0; | |
1103 } | |
1104 | |
1105 //v23 = 27; | |
1106 PlaySound((PlayerSpeech)27, 0); | |
1107 break; | |
1108 | |
1109 case Condition_Disease1: | |
1110 case Condition_Disease2: | |
1111 case Condition_Disease3: | |
0 | 1112 if ( a3 == 1 ) |
1014 | 1113 { |
1167 | 1114 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1115 { |
1167 | 1116 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1117 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1118 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1119 return 0; |
1120 } | |
1121 | |
1080 | 1122 if ( HasEnchantedItemEquipped(18) || |
1123 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1124 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK) ) |
1014 | 1125 return 0; |
1126 } | |
1127 PlaySound((PlayerSpeech)28, 0); | |
1128 break; | |
1129 case Condition_Paralyzed: | |
1130 if ( a3 == 1 ) | |
1131 { | |
1167 | 1132 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 ) |
1014 | 1133 { |
1167 | 1134 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1135 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1136 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1137 return 0; |
1138 } | |
1139 | |
1080 | 1140 if ( HasEnchantedItemEquipped(20)|| |
1141 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR)|| | |
1142 WearsItem(ITEM_ARTIFACT_GHOULSBANE, EQIUP_ANY)|| | |
1082 | 1143 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) |
1014 | 1144 return 0; |
1145 } | |
1146 break; | |
1147 case Condition_Unconcious: | |
1148 PlaySound(SPEECH_32, 0); | |
1149 if ( sHealth > 0 ) | |
1150 sHealth = 0; | |
1151 break; | |
1152 case Condition_Dead: | |
1167 | 1153 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64 && pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u ) |
1014 | 1154 { |
1167 | 1155 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1156 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1157 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1158 } |
1159 | |
1160 PlaySound((PlayerSpeech)33, 0); | |
1161 if ( sHealth > 0 ) | |
1162 sHealth = 0; | |
1163 if ( sMana > 0 ) | |
1164 sMana = 0; | |
1165 break; | |
1166 case Condition_Pertified: | |
0 | 1167 if ( a3 == 1 |
1167 | 1168 &&((pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0i64) |
1080 | 1169 || HasEnchantedItemEquipped(23)|| |
1170 WearsItem(ITEM_RELIC_KELEBRIM, EQIUP_ANY) || | |
1171 WearsItem(ITEM_ARTIFACT_YORUBA, EQUIP_ARMOUR) || | |
1082 | 1172 WearsItem(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, EQUIP_CLOAK)) ) |
1014 | 1173 |
1174 return 0; | |
1175 PlaySound((PlayerSpeech)34, 0); | |
1176 break; | |
1177 case Condition_Eradicated: | |
1167 | 1178 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uExpireTime > 0 )&&( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uSkill >= 4u )) |
1014 | 1179 { |
1167 | 1180 --pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower; |
1181 if ( pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].uPower < 1u ) | |
1182 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Reset(); | |
1014 | 1183 return 0; |
1184 } | |
1185 PlaySound(SPEECH_35, 0); | |
1186 if (sHealth > 0 ) | |
1187 sHealth = 0; | |
1188 if ( sMana > 0 ) | |
1189 sMana = 0; | |
1190 break; | |
1191 case Condition_Zombie: | |
1192 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead()) | |
1193 return 0; | |
1194 memset(&pConditions[0], 0, sizeof(pConditions)); | |
1195 sHealth = GetMaxHealth(); | |
1196 sMana = 0; | |
1197 player_sex = 0; | |
1198 uPrevFace = uCurrentFace; | |
1199 uPrevVoiceID = uVoiceID; | |
1200 switch ( uVoiceID ) | |
1201 { | |
1202 case 0: | |
1203 case 1: | |
1204 case 2: | |
1205 case 3: | |
1206 case 8: | |
1207 case 9: | |
1208 case 12: | |
1209 case 13: | |
1210 case 16: | |
1211 case 17: | |
1212 case 20: | |
1213 case 23: | |
1214 player_sex = 0; | |
1215 break; | |
1216 case 4: | |
1217 case 5: | |
1218 case 6: | |
1219 case 7: | |
1220 case 10: | |
1221 case 11: | |
1222 case 14: | |
1223 case 15: | |
1224 case 18: | |
1225 case 19: | |
1226 case 21: | |
1227 case 24: | |
1228 player_sex = 1; | |
1229 break; | |
1230 default: | |
1231 break; | |
1232 } | |
1233 | |
1234 zombi_face = (player_sex != 0) + 23; | |
1235 uCurrentFace = zombi_face; | |
1236 uVoiceID = zombi_face; | |
1237 PlaySound((PlayerSpeech)SPEECH_99, 0); | |
1238 break; | |
0 | 1239 } |
1014 | 1240 |
1241 remainig_player = 0; | |
1242 pConditions[uConditionIdx] = pParty->uTimePlayed; | |
1243 players_after = 0; | |
1244 for (int i=1;i<5;++i) | |
0 | 1245 { |
1014 | 1246 |
1247 | |
1248 if ( pPlayers[i]->CanAct() ) | |
1249 { | |
1250 remainig_player=i; | |
1251 ++players_after; | |
1252 } | |
0 | 1253 } |
1014 | 1254 if (( players_before == 2 )&&( players_after == 1 )) |
1255 { | |
1256 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); | |
1257 } | |
1258 return 1; | |
1259 } | |
0 | 1260 |
1261 //----- (00492528) -------------------------------------------------------- | |
1262 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
1263 { | |
973 | 1264 //unsigned int v3; // eax@1 |
0 | 1265 Texture *v4; // esi@1 |
1266 unsigned int v5; // ebx@1 | |
1267 signed int v6; // edi@5 | |
1268 int *v7; // ecx@6 | |
1269 signed int v8; // edx@7 | |
1270 int *v9; // eax@8 | |
973 | 1271 //Player *v11; // [sp+Ch] [bp-4h]@1 |
0 | 1272 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 |
1273 | |
973 | 1274 v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1275 v5 = GetSizeInInventorySlots(v4->uTextureWidth); | |
0 | 1276 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); |
1277 if ( !areWeLoadingTexture ) | |
1278 { | |
1279 v4->Release(); | |
1006 | 1280 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1281 } |
1282 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) | |
1283 { | |
1284 v6 = 0; | |
1285 if ( (signed int)uItemIDa <= 0 ) | |
1286 return 1; | |
973 | 1287 v7 = &pInventoryIndices[uSlot]; |
0 | 1288 while ( 1 ) |
1289 { | |
1290 v8 = 0; | |
1291 if ( (signed int)v5 > 0 ) | |
1292 break; | |
1293 LABEL_11: | |
1294 ++v6; | |
1295 v7 += 14; | |
1296 if ( v6 >= (signed int)uItemIDa ) | |
1297 return 1; | |
1298 } | |
1299 v9 = v7; | |
1300 while ( !*v9 ) | |
1301 { | |
1302 ++v8; | |
1303 ++v9; | |
1304 if ( v8 >= (signed int)v5 ) | |
1305 goto LABEL_11; | |
1306 } | |
1307 } | |
1308 return 0; | |
1309 } | |
1310 // 506128: using guessed type int areWeLoadingTexture; | |
1311 | |
1312 //----- (004925E6) -------------------------------------------------------- | |
1313 unsigned int Player::FindFreeInventorySlot() | |
1314 { | |
1315 unsigned int result; // eax@1 | |
1316 ItemGen *v2; // ecx@1 | |
1317 | |
1318 result = 0; | |
1319 v2 = this->pInventoryItems; | |
1320 while ( v2->uItemID ) | |
1321 { | |
1322 ++result; | |
1323 ++v2; | |
1324 if ( (signed int)result >= 126 ) | |
1325 return -1; | |
1326 } | |
1327 return result; | |
1328 } | |
1329 | |
1330 //----- (00492600) -------------------------------------------------------- | |
1331 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
1332 { | |
1333 signed int v3; // edx@1 | |
1334 ItemGen *v4; // eax@1 | |
1335 int result; // eax@8 | |
1336 unsigned int v6; // ebx@10 | |
973 | 1337 //unsigned int v7; // eax@10 |
0 | 1338 Texture *v8; // esi@10 |
1339 void *v9; // esi@13 | |
1340 unsigned int v10; // [sp+0h] [bp-Ch]@10 | |
1341 Player *v11; // [sp+4h] [bp-8h]@1 | |
1342 signed int v12; // [sp+8h] [bp-4h]@4 | |
1343 unsigned int uItemIDa; // [sp+18h] [bp+Ch]@10 | |
1344 | |
1345 v11 = this; | |
1346 v3 = 0; | |
1347 v4 = this->pInventoryItems; | |
1348 while ( v4->uItemID ) | |
1349 { | |
1350 ++v3; | |
1351 ++v4; | |
1352 if ( v3 >= 126 ) | |
1353 { | |
1354 v12 = -1; | |
1355 goto LABEL_5; | |
1356 } | |
1357 } | |
1358 v12 = v3; | |
1359 LABEL_5: | |
1360 if ( v12 == -1 ) | |
1361 { | |
1362 if ( uActiveCharacter ) | |
201 | 1363 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
0 | 1364 result = 0; |
1365 } | |
1366 else | |
1367 { | |
1368 v6 = uItemID; | |
973 | 1369 v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1370 v10 = GetSizeInInventorySlots(v8->uTextureWidth); | |
0 | 1371 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); |
1372 if ( !areWeLoadingTexture ) | |
1373 { | |
1374 v8->Release(); | |
1006 | 1375 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1376 } |
1377 if ( (signed int)uItemIDa > 0 ) | |
1378 { | |
1379 v9 = &v11->pInventoryIndices[uSlot]; | |
1380 do | |
1381 { | |
1382 if ( (signed int)v10 > 0 ) | |
1383 memset32(v9, -1 - uSlot, v10); | |
1384 v9 = (char *)v9 + 56; | |
1385 --uItemIDa; | |
1386 } | |
1387 while ( uItemIDa ); | |
1388 } | |
1389 result = v12 + 1; | |
1390 v11->pInventoryIndices[uSlot] = v12 + 1; | |
1391 v11->pInventoryItems[v12].uItemID = v6; | |
1392 } | |
1393 return result; | |
1394 } | |
1395 // 506128: using guessed type int areWeLoadingTexture; | |
1396 | |
1397 //----- (00492700) -------------------------------------------------------- | |
1398 int Player::HasSkill(unsigned int uSkillType) | |
1399 { | |
1400 signed int result; // eax@3 | |
1401 | |
1402 if ( (signed int)uSkillType >= 37 || this->pActiveSkills[uSkillType] ) | |
1403 { | |
1404 result = 1; | |
1405 } | |
1406 else | |
1407 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1408 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
1409 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 1410 result = 0; |
1411 } | |
1412 return result; | |
1413 } | |
1414 | |
1415 //----- (00492745) -------------------------------------------------------- | |
1416 int Player::WearItem(unsigned int uItemID) | |
1417 { | |
1010 | 1418 int item_body_anch; // edi@6 |
1419 int item_indx; | |
1420 //find empty slot | |
1421 for(item_indx=0;item_indx<126;++item_indx) | |
1422 if (pInventoryItems[item_indx].uItemID==0) | |
1423 break; | |
1424 if (item_indx==126) //not found | |
1425 item_indx=-1; | |
1426 | |
1427 if ( item_indx != -1 ) | |
1428 { | |
1429 | |
1430 pInventoryItems[item_indx].uItemID=uItemID; | |
1431 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; | |
1432 pEquipment.pIndices[item_body_anch]=item_indx+1; | |
1433 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1; | |
1434 | |
0 | 1435 } |
1436 return 0; | |
1437 } | |
1438 | |
1439 //----- (004927A8) -------------------------------------------------------- | |
1014 | 1440 int Player::AddItem(int uSlot, unsigned int uItemID) |
0 | 1441 { |
1442 signed int v3; // ebx@2 | |
1443 signed int v4; // edi@3 | |
1444 unsigned int v5; // esi@3 | |
1445 unsigned int v7; // [sp-8h] [bp-18h]@8 | |
1446 unsigned int v8; // [sp-4h] [bp-14h]@8 | |
1447 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1448 | |
1449 thisa = this; | |
1450 if ( uSlot == -1 ) | |
1451 { | |
1452 v3 = 0; | |
1014 | 1453 while ( true ) |
0 | 1454 { |
1455 v4 = 0; | |
1456 v5 = v3; | |
1457 do | |
1458 { | |
1459 if ( CanFitItem(v5, uItemID) ) | |
1460 { | |
1461 v8 = uItemID; | |
1462 v7 = v5; | |
1463 return CreateItemInInventory(v7, v8); | |
1464 } | |
1465 ++v4; | |
1466 v5 += 14; | |
1467 } | |
1468 while ( v4 < 9 ); | |
1469 ++v3; | |
1470 if ( v3 < 14 ) | |
1471 continue; | |
1472 break; | |
1473 } | |
1474 return 0; | |
1475 } | |
1476 if ( !CanFitItem(uSlot, uItemID) ) | |
1477 { | |
1478 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
1479 return 0; | |
1480 } | |
1481 v8 = uItemID; | |
1482 v7 = uSlot; | |
1483 return CreateItemInInventory(v7, v8); | |
1484 } | |
1485 | |
1486 //----- (00492826) -------------------------------------------------------- | |
1014 | 1487 int Player::AddItem2(int uSlot, ItemGen *Src) |
0 | 1488 { |
1489 unsigned int v3; // ebx@1 | |
1490 unsigned int v4; // esi@3 | |
1491 signed int v5; // edi@3 | |
1492 unsigned int v7; // [sp-8h] [bp-18h]@9 | |
1493 ItemGen *v8; // [sp-4h] [bp-14h]@9 | |
1494 Player *thisa; // [sp+Ch] [bp-4h]@1 | |
1495 signed int uSlota; // [sp+18h] [bp+8h]@2 | |
1496 | |
1497 thisa = this; | |
1498 v3 = Src->uItemID; | |
1499 pItemsTable->SetSpecialBonus(Src); | |
1500 if ( uSlot == -1 ) | |
1501 { | |
1502 uSlota = 0; | |
1014 | 1503 while ( true ) |
0 | 1504 { |
1505 v4 = uSlota; | |
1506 v5 = 0; | |
1507 do | |
1508 { | |
1509 if ( CanFitItem(v4, v3) ) | |
1510 { | |
1511 v8 = Src; | |
1512 v7 = v4; | |
1513 return CreateItemInInventory2(v7, v8); | |
1514 } | |
1515 ++v5; | |
1516 v4 += 14; | |
1517 } | |
1518 while ( v5 < 14 ); | |
1519 ++uSlota; | |
1520 if ( uSlota < 9 ) | |
1521 continue; | |
1522 break; | |
1523 } | |
1524 return 0; | |
1525 } | |
1526 if ( !CanFitItem(uSlot, v3) ) | |
1527 return 0; | |
1528 v8 = Src; | |
1529 v7 = uSlot; | |
1530 return CreateItemInInventory2(v7, v8); | |
1531 } | |
1532 | |
1533 //----- (0049289C) -------------------------------------------------------- | |
1534 int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) | |
1535 { | |
1536 signed int v3; // ebx@1 | |
1537 ItemGen *v4; // eax@1 | |
1538 int result; // eax@6 | |
973 | 1539 //unsigned int v6; // eax@7 |
1014 | 1540 Texture *item_texture; // esi@7 |
0 | 1541 unsigned int v8; // edx@9 |
1014 | 1542 int *pInvPos; // esi@10 |
1543 unsigned int slot_width; // [sp+4h] [bp-Ch]@7 | |
1544 unsigned int slot_height; // [sp+8h] [bp-8h]@7 | |
0 | 1545 Player *v12; // [sp+Ch] [bp-4h]@1 |
1014 | 1546 |
0 | 1547 |
1548 v12 = this; | |
1549 v3 = 0; | |
1550 v4 = this->pInventoryItems; | |
1551 while ( v4->uItemID ) | |
1552 { | |
1553 ++v3; | |
1554 ++v4; | |
1555 if ( v3 >= 126 ) | |
1556 { | |
1557 v3 = -1; | |
1558 break; | |
1559 } | |
1560 } | |
1561 if ( v3 == -1 ) | |
1562 { | |
1563 result = 0; | |
1564 } | |
1565 else | |
1566 { | |
1014 | 1567 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1568 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1569 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1570 if ( !areWeLoadingTexture ) |
1571 { | |
1014 | 1572 item_texture->Release(); |
1006 | 1573 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1574 } |
1014 | 1575 if ( slot_height > 0 ) |
1576 { | |
1577 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1578 do |
1579 { | |
1014 | 1580 if ( slot_width > 0 ) |
1581 memset32(pInvPos, -1 - uSlot, slot_width); | |
1582 pInvPos +=14; | |
1583 --slot_height; | |
1584 } | |
1585 while ( slot_height ); | |
1586 } | |
1587 pInventoryIndices[uSlot] = v3 + 1; | |
1588 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); | |
0 | 1589 result = v3 + 1; |
1590 } | |
1591 return result; | |
1592 } | |
1593 // 506128: using guessed type int areWeLoadingTexture; | |
1594 | |
1595 //----- (0049298B) -------------------------------------------------------- | |
1014 | 1596 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) |
1597 { | |
973 | 1598 //Player *v4; // ebx@1 |
1599 //unsigned int v5; // eax@1 | |
1014 | 1600 Texture *item_texture; // esi@1 |
1601 int *pInvPos; // esi@4 | |
1602 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
1603 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
1604 | |
1605 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1606 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1607 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1608 if ( !areWeLoadingTexture ) |
1609 { | |
1014 | 1610 item_texture->Release(); |
1006 | 1611 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1612 } |
1014 | 1613 if ( (signed int)slot_height > 0 ) |
1614 { | |
1615 pInvPos = &pInventoryIndices[uSlot]; //14x9 | |
0 | 1616 do |
1617 { | |
1014 | 1618 if ( (signed int)slot_width > 0 ) |
1619 memset32(pInvPos, -1 - uSlot, slot_width); | |
1620 pInvPos +=14; | |
1621 --slot_height; | |
1622 } | |
1623 while ( slot_height ); | |
1624 } | |
1625 pInventoryIndices[uSlot] = item_id + 1; | |
0 | 1626 return 1; |
1627 } | |
278 | 1628 |
0 | 1629 // 506128: using guessed type int areWeLoadingTexture; |
1630 | |
1631 //----- (00492A36) -------------------------------------------------------- | |
1006 | 1632 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) |
1633 { | |
1014 | 1634 |
1635 ItemGen *item_in_slot; // ecx@1 | |
1636 Texture *item_texture; // esi@1 | |
1637 unsigned int slot_height; // ebp@1 | |
1638 int *pInvPos; // edx@4 | |
1639 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1640 | |
1641 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; | |
1642 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
1643 item_in_slot->Reset(); | |
1644 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1645 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1646 if ( !areWeLoadingTexture ) |
1647 { | |
1014 | 1648 item_texture->Release(); |
1006 | 1649 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1650 } |
1014 | 1651 if ( slot_height > 0 ) |
1652 { | |
1653 pInvPos = &pInventoryIndices[uSlot]; | |
0 | 1654 do |
1655 { | |
1014 | 1656 if (slot_width > 0 ) |
1657 memset32(pInvPos, 0, slot_width); | |
1658 pInvPos += 14; | |
1659 --slot_height; | |
1660 } | |
1661 while ( slot_height ); | |
0 | 1662 } |
1006 | 1663 |
0 | 1664 } |
1665 // 506128: using guessed type int areWeLoadingTexture; | |
1666 | |
436 | 1667 //identf |
0 | 1668 //----- (00490EEE) -------------------------------------------------------- |
917 | 1669 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) |
1670 { | |
1671 int pSkillLevel; // eax@1 | |
1672 int NotBuy; // eax@1 | |
1673 int result; | |
1674 signed int pEquipType; // esi@1 | |
1675 float *pPriceMultiplier; // esi@26 | |
1676 int pPriceItemService; // edi@26 | |
1677 | |
1678 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1679 NotBuy = 4; | |
1680 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | |
1681 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | |
1682 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | |
0 | 1683 return 5; |
917 | 1684 if ( building_type == BildingType_WeaponShop ) |
1685 { | |
1686 if ( pEquipType > EQUIP_BOW ) | |
1687 return NotBuy; | |
1688 if (pItem->Stolen()) | |
1689 return 6; | |
1690 } | |
1691 if ( building_type == BildingType_ArmorShop ) | |
1692 { | |
1693 if ( pEquipType < 3 && pEquipType > 9 ) | |
1694 return NotBuy; | |
1695 if (pItem->Stolen()) | |
1696 return 6; | |
1697 } | |
1698 if ( building_type == BildingType_MagicShop ) | |
1699 { | |
1700 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | |
1701 { | |
1702 if (pItem->Stolen()) | |
1703 return 6; | |
1704 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1705 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1706 if ( ShopMenuType == 3 )//Sell | |
1707 { | |
1708 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1709 if (!pItem->Broken()) | |
1710 { | |
1711 if ( pSkillLevel ) | |
1712 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1713 else | |
1714 result = 1; | |
1715 return result; | |
1716 } | |
1717 pPriceItemService = 1; | |
1718 if ( pSkillLevel ) | |
1719 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1720 else | |
1721 result = 1; | |
1722 return result; | |
1723 } | |
1724 if ( ShopMenuType == 4 )//Identify | |
1725 { | |
1726 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1727 if ( pSkillLevel ) | |
1728 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1729 else | |
1730 result = 1; | |
1731 return result; | |
1732 } | |
1733 if ( ShopMenuType == 5 )//Repair | |
1734 { | |
1735 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1736 if ( pSkillLevel ) | |
1737 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1738 else | |
1739 result = 1; | |
1740 return result; | |
1741 } | |
1742 if ( ShopMenuType != 6 )//Buy and ??? | |
1743 { | |
1744 if ( pSkillLevel ) | |
1745 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1746 else | |
1747 result = 1; | |
1748 return result; | |
1749 } | |
1750 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1751 if (pItem->Broken()) | |
1752 pPriceItemService = 1; | |
1753 if ( pPriceItemService >= 1 ) | |
1754 { | |
1755 if ( pSkillLevel ) | |
1756 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1757 else | |
1758 result = 1; | |
1759 return result; | |
1760 } | |
1761 pPriceItemService = 1; | |
1762 if ( pSkillLevel ) | |
1763 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1764 else | |
1765 result = 1; | |
0 | 1766 return result; |
917 | 1767 } |
1768 if ( pEquipType != EQUIP_BOOK ) | |
1769 return NotBuy; | |
1770 } | |
1771 if ( building_type == BildingType_AlchemistShop ) | |
1772 { | |
1773 if ( pEquipType < EQUIP_REAGENT ) | |
1774 return NotBuy; | |
1775 if ( pEquipType > EQUIP_POTION ) | |
1776 { | |
1777 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | |
1778 return NotBuy; | |
1779 } | |
1780 if (pItem->Stolen()) | |
1781 return 6; | |
1782 } | |
1783 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1784 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1785 if ( ShopMenuType == 3 )//Sell | |
1786 { | |
1787 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1788 if (!pItem->Broken()) | |
1789 { | |
1790 if ( pSkillLevel ) | |
1791 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1792 else | |
1793 result = 1; | |
0 | 1794 return result; |
917 | 1795 } |
1796 pPriceItemService = 1; | |
1797 if ( pSkillLevel ) | |
1798 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1799 else | |
1800 result = 1; | |
1801 return result; | |
1802 } | |
1803 if ( ShopMenuType == 4 )//Identify | |
1804 { | |
1805 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1806 if ( pSkillLevel ) | |
1807 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1808 else | |
1809 result = 1; | |
1810 return result; | |
1811 } | |
1812 if ( ShopMenuType == 5 )//Repair | |
1813 { | |
1814 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1815 if ( pSkillLevel ) | |
1816 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1817 else | |
1818 result = 1; | |
1819 return result; | |
1820 } | |
1821 if ( ShopMenuType != 6 )//Buy and ??? | |
1822 { | |
1823 if ( pSkillLevel ) | |
1824 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1825 else | |
1826 result = 1; | |
1827 return result; | |
1828 } | |
1829 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
315 | 1830 if (pItem->Broken()) |
917 | 1831 pPriceItemService = 1; |
1832 if ( pPriceItemService >= 1 ) | |
1833 { | |
1834 if ( pSkillLevel ) | |
1835 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1836 else | |
1837 result = 1; | |
1838 return result; | |
1839 } | |
1840 pPriceItemService = 1; | |
1841 if ( pSkillLevel ) | |
1842 result = (pPriceItemService == pItem->GetValue()) + 2; | |
0 | 1843 else |
1844 result = 1; | |
1845 return result; | |
1846 } | |
1847 | |
1848 //----- (0049107D) -------------------------------------------------------- | |
1849 int Player::GetBodybuilding() | |
1850 { | |
1010 | 1851 int v1; // al@1 |
0 | 1852 int v2; // ecx@1 |
1853 int v4; // eax@3 | |
1854 signed int v6; // [sp-4h] [bp-4h]@2 | |
1855 | |
1856 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1857 v2 = v1 & 0x3F; | |
1858 if ( v1 & 0x100 ) | |
1859 { | |
1860 v6 = 5; | |
1861 } | |
1862 else | |
1863 { | |
1008 | 1864 if ( (v1&0xFF) >= 0 ) |
0 | 1865 { |
1866 v4 = ((v1 & 0x40) != 0) + 1; | |
1867 return v2 * v4; | |
1868 } | |
1869 v6 = 3; | |
1870 } | |
1871 v4 = v6; | |
1872 return v2 * v4; | |
1873 } | |
1874 | |
1875 //----- (004910A8) -------------------------------------------------------- | |
607 | 1876 int Player::GetMeditation() |
0 | 1877 { |
1010 | 1878 int v1; // al@1 |
1008 | 1879 int base_level; // ecx@1 |
0 | 1880 int v4; // eax@3 |
1881 signed int v6; // [sp-4h] [bp-4h]@2 | |
1882 | |
1883 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1884 base_level = v1 & 0x3F; |
0 | 1885 if ( v1 & 0x100 ) |
1886 { | |
1887 v6 = 5; | |
1888 } | |
1889 else | |
1890 { | |
1008 | 1891 if ( (v1&0xFF) >= 0 ) |
0 | 1892 { |
1893 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1894 return base_level * v4; |
0 | 1895 } |
1896 v6 = 3; | |
1897 } | |
1898 v4 = v6; | |
1008 | 1899 return base_level * v4; |
0 | 1900 } |
1901 | |
1902 //----- (004910D3) -------------------------------------------------------- | |
1903 int Player::CanIdentify(ItemGen *pItem) | |
1904 { | |
1905 unsigned __int16 v2; // ax@1 | |
1906 unsigned __int16 v3; // bx@1 | |
1907 int uSkillMult; // eax@3 | |
1908 int v5; // edi@7 | |
1909 signed int v6; // ebp@7 | |
1910 char *v7; // esi@7 | |
1911 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
652 | 1912 |
1913 if (CheckHiredNPCSpeciality(Scholar)) | |
1914 return true; | |
0 | 1915 |
179 | 1916 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1917 v3 = v2; |
179 | 1918 if ( v2 & 1 ) |
0 | 1919 { |
1920 uSkillMultiplier = 5; | |
1921 } | |
1922 else | |
1923 { | |
1924 if ( (v2 & 0x80u) == 0 ) | |
1925 { | |
1926 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1927 v5 = uSkillMult * (v3 & 0x3F); |
1928 v6 = 0; | |
1929 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1930 |
179 | 1931 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1932 v6 = 1; | |
1933 if ( v5 >= (unsigned __int8)v7[46] ) | |
1934 v6 = 1; | |
1935 return v6; | |
0 | 1936 } |
1937 uSkillMultiplier = 3; | |
1938 } | |
1939 uSkillMult = uSkillMultiplier; | |
1940 v5 = uSkillMult * (v3 & 0x3F); | |
1941 v6 = 0; | |
1942 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1943 |
0 | 1944 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1945 v6 = 1; | |
1946 if ( v5 >= (unsigned __int8)v7[46] ) | |
1947 v6 = 1; | |
1948 return v6; | |
1949 } | |
1950 | |
1951 //----- (00491151) -------------------------------------------------------- | |
1952 int Player::CanRepair(ItemGen *a2) | |
1953 { | |
1954 unsigned __int16 v2; // ax@1 | |
1955 unsigned __int16 v3; // bx@1 | |
1956 int v4; // eax@3 | |
1957 int v5; // edi@7 | |
1958 signed int v6; // ebp@7 | |
1959 signed int v10; // [sp-4h] [bp-14h]@2 | |
1960 | |
652 | 1961 |
1962 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1963 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1964 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1965 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1966 return true; | |
1967 | |
1010 | 1968 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1969 v3 = v2; |
1010 | 1970 if (v2 & 0x100 ) |
0 | 1971 { |
1972 v10 = 5; | |
1973 } | |
1974 else | |
1975 { | |
1976 if ( (v2 & 0x80u) == 0 ) | |
1977 { | |
1978 v4 = ((v2 & 0x40) != 0) + 1; | |
1979 goto LABEL_7; | |
1980 } | |
1981 v10 = 3; | |
1982 } | |
1983 v4 = v10; | |
1984 LABEL_7: | |
1985 v5 = v4 * (v3 & 0x3F); | |
1986 v6 = 0; | |
1987 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1988 return true; | |
1989 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
1990 { | |
1991 __debugbreak(); // really odd | |
1992 return true; | |
1993 } | |
1994 return false; | |
1995 } | |
1996 | |
1997 //----- (004911F3) -------------------------------------------------------- | |
1998 int Player::GetMerchant() | |
1999 { | |
2000 Player *v1; // edi@1 | |
2001 unsigned __int16 v2; // ax@1 | |
2002 unsigned __int16 v3; // bx@1 | |
2003 int v4; // esi@1 | |
2004 int v5; // edi@1 | |
2005 int v7; // eax@3 | |
2006 int v8; // ecx@7 | |
2007 signed int v9; // [sp-4h] [bp-10h]@6 | |
2008 | |
2009 v1 = this; | |
607 | 2010 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 2011 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 2012 v4 = v2 & 0x003F; |
1010 | 2013 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 2014 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2015 return 10000; | |
2016 v7 = GetPartyReputation(); | |
2017 if ( !v4 ) | |
2018 return -v7; | |
1010 | 2019 if ( v3 & 0x100 ) |
0 | 2020 { |
2021 v9 = 5; | |
2022 } | |
2023 else | |
2024 { | |
2025 if ( (v3 & 0x80u) == 0 ) | |
2026 { | |
2027 v8 = ((v3 & 0x40) != 0) + 1; | |
2028 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2029 } | |
2030 v9 = 3; | |
2031 } | |
2032 v8 = v9; | |
2033 return v5 * (v8 - 1) - v7 + v4 + 7; | |
2034 } | |
2035 | |
2036 //----- (0049125A) -------------------------------------------------------- | |
2037 int Player::GetPerception() | |
2038 { | |
2039 Player *v1; // edi@1 | |
2040 unsigned __int16 v2; // ax@1 | |
2041 unsigned __int16 v3; // bx@1 | |
2042 int v4; // esi@1 | |
2043 int v5; // edi@1 | |
2044 int v7; // eax@5 | |
2045 signed int v8; // [sp-4h] [bp-10h]@4 | |
2046 | |
2047 v1 = this; | |
1010 | 2048 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
2049 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 2050 v4 = v2 & 0x3F; |
1010 | 2051 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 2052 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2053 return 10000; | |
1010 | 2054 if ( v3 & 0x100 ) |
0 | 2055 { |
2056 v8 = 5; | |
2057 } | |
2058 else | |
2059 { | |
2060 if ( (v3 & 0x80u) == 0 ) | |
2061 { | |
2062 v7 = ((v3 & 0x40) != 0) + 1; | |
2063 return v4 + v5 * (v7 - 1); | |
2064 } | |
2065 v8 = 3; | |
2066 } | |
2067 v7 = v8; | |
2068 return v4 + v5 * (v7 - 1); | |
2069 } | |
2070 | |
2071 //----- (004912B0) -------------------------------------------------------- | |
2072 int Player::GetDisarmTrap() | |
2073 { | |
2074 Player *v1; // ebp@1 | |
2075 unsigned __int16 v2; // ax@1 | |
2076 unsigned __int16 v3; // bx@1 | |
2077 int v4; // esi@1 | |
2078 int v5; // edi@1 | |
2079 int v7; // eax@7 | |
2080 signed int v8; // [sp-4h] [bp-14h]@6 | |
2081 | |
2082 v1 = this; | |
1010 | 2083 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 2084 v3 = v1->pActiveSkills[29]; |
2085 v4 = v2 & 0x3F; | |
2086 v5 = v1->pActiveSkills[29] & 0x3F; | |
2087 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
2088 return 10000; | |
2089 if ( HasEnchantedItemEquipped(35) ) | |
2090 v4 *= 2; | |
1010 | 2091 if ( v3 & 0x100 ) |
0 | 2092 { |
2093 v8 = 5; | |
2094 } | |
2095 else | |
2096 { | |
2097 if ( (v3 & 0x80u) == 0 ) | |
2098 { | |
2099 v7 = ((v3 & 0x40) != 0) + 1; | |
2100 return v4 + v5 * (v7 - 1); | |
2101 } | |
2102 v8 = 3; | |
2103 } | |
2104 v7 = v8; | |
2105 return v4 + v5 * (v7 - 1); | |
2106 } | |
2107 | |
2108 //----- (00491317) -------------------------------------------------------- | |
2109 char Player::GetLearningPercent() | |
2110 { | |
2111 Player *v1; // esi@1 | |
2112 int v2; // eax@1 | |
2113 unsigned __int16 v3; // bx@1 | |
2114 int v4; // ecx@1 | |
2115 int v5; // eax@4 | |
2116 signed int v7; // [sp-4h] [bp-Ch]@3 | |
2117 | |
2118 v1 = this; | |
1010 | 2119 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 2120 v3 = v1->pActiveSkills[36]; |
2121 v4 = v2 & 0x3F; | |
2122 if ( v2 ) | |
2123 { | |
1010 | 2124 if (v3 & 0x100 ) |
0 | 2125 { |
2126 v7 = 5; | |
2127 } | |
2128 else | |
2129 { | |
2130 if ( (v3 & 0x80u) == 0 ) | |
2131 { | |
2132 v5 = ((v3 & 0x40) != 0) + 1; | |
2133 goto LABEL_8; | |
2134 } | |
2135 v7 = 3; | |
2136 } | |
2137 v5 = v7; | |
2138 LABEL_8: | |
2139 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
2140 } | |
2141 return v2; | |
2142 } | |
2143 | |
2144 //----- (0048C6AF) -------------------------------------------------------- | |
2145 Player::Player() | |
2146 { | |
2147 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
2148 memset(pInventoryIndices, 0, 126 * sizeof(int)); | |
2149 for (uint i = 0; i < 126; ++i) | |
2150 pInventoryItems[i].Reset(); | |
2151 for (uint i = 0; i < 12; ++i) | |
2152 pEquippedItems[i].Reset(); | |
2153 | |
2154 | |
2155 for (uint i = 0; i < 24; ++i) | |
2156 { | |
2157 pPlayerBuffs[i].uSkill = 0; | |
2158 pPlayerBuffs[i].uSkill = 0; | |
2159 pPlayerBuffs[i].uPower = 0; | |
2160 pPlayerBuffs[i].uExpireTime = 0; | |
2161 pPlayerBuffs[i].uCaster = 0; | |
2162 pPlayerBuffs[i].uFlags = 0; | |
2163 } | |
2164 | |
2165 pName[0] = 0; | |
1014 | 2166 uCurrentFace = 0; |
0 | 2167 uVoiceID = 0; |
2168 memset(pConditions, 0, 20 * sizeof(__int64)); | |
2169 | |
2170 field_BB = 0; | |
2171 | |
2172 uMight = uMightBonus = 0; | |
2173 uIntelligence = uIntelligenceBonus = 0; | |
2174 uWillpower = uWillpowerBonus = 0; | |
2175 uEndurance = uEnduranceBonus = 0; | |
2176 uSpeed = uSpeedBonus = 0; | |
2177 uAccuracy = uAccuracyBonus = 0; | |
2178 uLuck = uLuckBonus = 0; | |
2179 uLevel = sLevelModifier = 0; | |
2180 sAgeModifier = 0; | |
2181 | |
1019 | 2182 // memset(field_1F5, 0, 30); |
2183 pure_luck_used=0; | |
2184 pure_speed_used=0; | |
2185 pure_intellect_used=0; | |
2186 pure_endurance_used=0; | |
2187 pure_willpower_used=0; | |
2188 pure_accuracy_used=0; | |
2189 pure_might_used=0; | |
0 | 2190 |
2191 sResFireBase = sResFireBonus = 0; | |
2192 sResAirBase = sResAirBonus = 0; | |
2193 sResWaterBase = sResWaterBonus = 0; | |
2194 sResEarthBase = sResEarthBonus = 0; | |
2195 sResMagicBase = sResMagicBonus = 0; | |
2196 sResSpiritBase = sResSpiritBonus = 0; | |
2197 sResMindBase = sResMindBonus = 0; | |
2198 sResBodyBase = sResBodyBonus = 0; | |
2199 sResLightBase = sResLightBonus = 0; | |
2200 sResDarkBase = sResDarkBonus = 0; | |
2201 | |
2202 uTimeToRecovery = 0; | |
2203 | |
2204 uSkillPoints = 0; | |
2205 | |
2206 sHealth = 0; | |
2207 uFullHealthBonus = 0; | |
2208 _health_related = 0; | |
2209 | |
2210 sMana = 0; | |
2211 uFullManaBonus = 0; | |
2212 _mana_related = 0; | |
2213 | |
2214 uQuickSpell = 0; | |
2215 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
2216 | |
2217 _some_attack_bonus = 0; | |
2218 field_1A91 = 0; | |
2219 _melee_dmg_bonus = 0; | |
2220 field_1A93 = 0; | |
2221 _ranged_atk_bonus = 0; | |
2222 field_1A95 = 0; | |
2223 _ranged_dmg_bonus = 0; | |
2224 field_1A97 = 0; | |
2225 | |
130 | 2226 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 2227 uExpressionTimePassed = 0; |
2228 uExpressionTimeLength = 0; | |
2229 | |
2230 uNumDivineInterventionCastsThisDay = 0; | |
2231 uNumArmageddonCasts = 0; | |
2232 uNumFireSpikeCasts = 0; | |
2233 | |
2234 memset(field_1988, 0, 49 * sizeof(int)); | |
2235 memset(field_1A50, 0, 64 * sizeof(char)); | |
2236 | |
2237 field_E0 = 0; | |
2238 field_E4 = 0; | |
2239 field_E8 = 0; | |
2240 field_EC = 0; | |
2241 field_F0 = 0; | |
2242 field_F4 = 0; | |
2243 field_F8 = 0; | |
2244 field_FC = 0; | |
2245 field_100 = 0; | |
2246 field_104 = 0; | |
198 | 2247 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2248 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2249 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
2250 |
198 | 2251 lastOpenedSpellbookPage = 0; |
0 | 2252 } |
2253 | |
2254 //----- (0048C6F6) -------------------------------------------------------- | |
2255 bool Party::AddItem(ItemGen *pItem) | |
2256 { | |
2257 unsigned int v2; // eax@1 | |
2258 unsigned int v3; // ecx@4 | |
2259 signed int v4; // edx@4 | |
2260 char *v5; // eax@8 | |
973 | 2261 //unsigned int v6; // eax@10 |
0 | 2262 Texture *v7; // ebx@10 |
2263 signed int v8; // esi@10 | |
2264 Player *v9; // edi@11 | |
2265 int v10; // eax@11 | |
2266 bool result; // eax@15 | |
2267 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 2268 |
2269 | |
188 | 2270 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
2271 //int v16; // [sp+10h] [bp-18h]@3 | |
2272 //int v17; // [sp+14h] [bp-14h]@3 | |
2273 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 2274 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
2275 Party *v20; // [sp+20h] [bp-8h]@1 | |
2276 int v21; // [sp+24h] [bp-4h]@10 | |
2277 | |
2278 auto thos = this; | |
2279 | |
2280 v20 = thos; | |
2281 v2 = pItem->uItemID; | |
222 | 2282 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 2283 pItem->SetIdentified(); |
188 | 2284 ///v15 = 0; |
2285 //v16 = 1; | |
2286 //v18 = 3; | |
2287 //v17 = 2; | |
0 | 2288 if ( uActiveCharacter ) |
2289 { | |
2290 v3 = uActiveCharacter - 1; | |
2291 v4 = 0; | |
2292 do | |
2293 { | |
188 | 2294 v15[v4++] = v3++; |
0 | 2295 if ( (signed int)v3 >= 4 ) |
2296 v3 = 0; | |
2297 } | |
2298 while ( v4 < 4 ); | |
2299 } | |
2300 v5 = pItemsTable->pItems[v2].pIconName; | |
2301 if ( v5 ) | |
2302 { | |
973 | 2303 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 2304 v21 = areWeLoadingTexture; |
2305 v8 = 0; | |
2306 while ( 1 ) | |
2307 { | |
188 | 2308 v9 = &v20->pPlayers[v15[v8]]; |
2309 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 2310 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 2311 if ( v10 ) |
2312 break; | |
2313 ++v8; | |
2314 if ( v8 >= 4 ) | |
2315 { | |
2316 if ( !v21 ) | |
2317 { | |
2318 v7->Release(); | |
1006 | 2319 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2320 } |
2321 goto LABEL_15; | |
2322 } | |
2323 } | |
232 | 2324 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); |
0 | 2325 pItem->Reset(); |
2326 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 2327 v19->PlaySound(SPEECH_60, 0); |
0 | 2328 if ( !v21 ) |
2329 { | |
2330 v7->Release(); | |
1006 | 2331 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 2332 } |
2333 result = 1; | |
2334 } | |
2335 else | |
2336 { | |
2337 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
2338 LABEL_15: | |
2339 result = 0; | |
2340 } | |
2341 return result; | |
2342 } | |
2343 // 506128: using guessed type int areWeLoadingTexture; | |
2344 | |
2345 //----- (0048C855) -------------------------------------------------------- | |
2346 int Player::GetBaseStrength() | |
2347 { | |
2348 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2349 } | |
2350 | |
2351 //----- (0048C86C) -------------------------------------------------------- | |
2352 int Player::GetBaseIntelligence() | |
2353 { | |
2354 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2355 } | |
2356 | |
2357 //----- (0048C883) -------------------------------------------------------- | |
2358 int Player::GetBaseWillpower() | |
2359 { | |
2360 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
2361 } | |
2362 | |
2363 //----- (0048C89A) -------------------------------------------------------- | |
2364 int Player::GetBaseEndurance() | |
2365 { | |
2366 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2367 } | |
2368 | |
2369 //----- (0048C8B1) -------------------------------------------------------- | |
2370 int Player::GetBaseAccuracy() | |
2371 { | |
2372 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2373 } | |
2374 | |
2375 //----- (0048C8C8) -------------------------------------------------------- | |
2376 int Player::GetBaseSpeed() | |
2377 { | |
2378 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2379 } | |
2380 | |
2381 //----- (0048C8DF) -------------------------------------------------------- | |
2382 int Player::GetBaseLuck() | |
2383 { | |
2384 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2385 } | |
2386 | |
2387 //----- (0048C8F6) -------------------------------------------------------- | |
2388 int Player::GetBaseLevel() | |
2389 { | |
2390 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2391 } | |
2392 | |
2393 //----- (0048C90D) -------------------------------------------------------- | |
2394 int Player::GetActualLevel() | |
2395 { | |
2396 return uLevel + sLevelModifier + | |
2397 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
2398 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
2399 } | |
2400 | |
2401 //----- (0048C93C) -------------------------------------------------------- | |
2402 int Player::GetActualMight() | |
2403 { | |
2404 Player *v1; // esi@1 | |
2405 unsigned int v2; // eax@1 | |
2406 signed int v3; // ecx@1 | |
2407 signed int v4; // ebx@4 | |
2408 int v5; // edi@5 | |
2409 int v6; // ST14_4@5 | |
2410 | |
2411 v1 = this; | |
2412 v2 = this->sAgeModifier + GetBaseAge(); | |
2413 v3 = 0; | |
2414 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2415 { | |
2416 ++v3; | |
2417 if ( v3 >= 4 ) | |
2418 { | |
2419 v4 = 100; | |
2420 goto LABEL_5; | |
2421 } | |
2422 } | |
2423 v4 = pAgeingStrengthMultiplier[v3]; | |
2424 LABEL_5: | |
2425 v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; | |
2426 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
2427 return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; | |
2428 } | |
2429 | |
2430 //----- (0048C9C2) -------------------------------------------------------- | |
2431 int Player::GetActualIntelligence() | |
2432 { | |
2433 Player *v1; // esi@1 | |
2434 unsigned int sAge; // eax@1 | |
2435 signed int uAgeLevel; // ecx@1 | |
2436 signed int v4; // ebx@4 | |
2437 int v5; // edi@5 | |
2438 int v6; // ebp@5 | |
2439 | |
2440 v1 = this; | |
2441 sAge = this->sAgeModifier + GetBaseAge(); | |
2442 uAgeLevel = 0; | |
2443 while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) | |
2444 { | |
2445 ++uAgeLevel; | |
2446 if ( uAgeLevel >= 4 ) | |
2447 { | |
2448 v4 = 100; | |
2449 goto LABEL_5; | |
2450 } | |
2451 } | |
2452 v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; | |
2453 LABEL_5: | |
2454 v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; | |
2455 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
2456 return v5 * v4 * v1->uIntelligence / 100 / 100 | |
2457 + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) | |
2458 + v6 | |
2459 + v1->uIntelligenceBonus; | |
2460 } | |
2461 | |
2462 //----- (0048CA3F) -------------------------------------------------------- | |
2463 int Player::GetActualWillpower() | |
2464 { | |
2465 int v5; // edi@5 | |
2466 | |
2467 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2468 uint uAgeingMultiplier = 100; | |
2469 for (uint i = 0; i < 4; ++i) | |
2470 if (uActualAge >= pAgeingTable[i]) | |
2471 uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; | |
2472 else break; | |
2473 | |
2474 v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; | |
2475 return v5 * uAgeingMultiplier * uWillpower / 100 / 100 | |
2476 + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) | |
2477 + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) | |
2478 + uWillpowerBonus; | |
2479 } | |
2480 | |
2481 //----- (0048CABC) -------------------------------------------------------- | |
2482 int Player::GetActualEndurance() | |
2483 { | |
2484 uint uActualAge = GetBaseAge() + sAgeModifier; | |
2485 uint uAgeingMultiplier = 100; | |
2486 for (uint i = 0; i < 4; ++i) | |
2487 if (uActualAge >= pAgeingTable[i]) | |
2488 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; | |
2489 else break; | |
2490 | |
2491 auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; | |
2492 auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
2493 return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 | |
2494 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) | |
2495 + uItemBonus | |
2496 + uEnduranceBonus; | |
2497 } | |
2498 | |
2499 //----- (0048CB39) -------------------------------------------------------- | |
2500 int Player::GetActualAccuracy() | |
2501 { | |
2502 Player *v1; // esi@1 | |
2503 unsigned int v2; // eax@1 | |
2504 signed int v3; // ecx@1 | |
2505 signed int v4; // ebx@4 | |
2506 int v5; // edi@5 | |
2507 int v6; // ebp@5 | |
2508 | |
2509 v1 = this; | |
2510 v2 = this->sAgeModifier + GetBaseAge(); | |
2511 v3 = 0; | |
2512 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2513 { | |
2514 ++v3; | |
2515 if ( v3 >= 4 ) | |
2516 { | |
2517 v4 = 100; | |
2518 goto LABEL_5; | |
2519 } | |
2520 } | |
2521 v4 = pAgeingAccuracyMultiplier[v3]; | |
2522 LABEL_5: | |
2523 v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; | |
2524 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
2525 return v5 * v4 * v1->uAccuracy / 100 / 100 | |
2526 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) | |
2527 + v6 | |
2528 + v1->uAccuracyBonus; | |
2529 } | |
2530 | |
2531 //----- (0048CBB6) -------------------------------------------------------- | |
2532 int Player::GetActualSpeed() | |
2533 { | |
2534 Player *v1; // esi@1 | |
2535 unsigned int v2; // eax@1 | |
2536 signed int v3; // ecx@1 | |
2537 signed int v4; // ebx@4 | |
2538 int v5; // edi@5 | |
2539 int v6; // ebp@5 | |
2540 | |
2541 v1 = this; | |
2542 v2 = this->sAgeModifier + GetBaseAge(); | |
2543 v3 = 0; | |
2544 while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) | |
2545 { | |
2546 ++v3; | |
2547 if ( v3 >= 4 ) | |
2548 { | |
2549 v4 = 100; | |
2550 goto LABEL_5; | |
2551 } | |
2552 } | |
2553 v4 = pAgeingSpeedMultiplier[v3]; | |
2554 LABEL_5: | |
2555 v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; | |
2556 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
2557 return v5 * v4 * v1->uSpeed / 100 / 100 | |
2558 + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) | |
2559 + v6 | |
2560 + v1->uSpeedBonus; | |
2561 } | |
2562 | |
2563 //----- (0048CC33) -------------------------------------------------------- | |
2564 int Player::GetActualLuck() | |
2565 { | |
1036 | 2566 signed int curr_age; // eax@7 |
2567 signed int i; // ecx@7 | |
2568 signed int age_luck_pc; // ebx@10 | |
2569 int condition_luck_pc; // edi@11 | |
2570 int items_luck_bonus; // ebp@11 | |
2571 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2572 signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 | |
2573 int full_luck; | |
2574 | |
2575 npc_luck_bonus = 0; | |
652 | 2576 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 2577 npc_luck_bonus = 5; |
652 | 2578 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 2579 npc_luck_bonus += 20; |
652 | 2580 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 2581 npc_luck_bonus += 10; |
2582 curr_age = sAgeModifier + GetBaseAge(); | |
2583 i = 0; | |
2584 while ( curr_age >= pAgeingTable[i] ) | |
2585 { | |
2586 ++i; | |
2587 if ( i >= 4 ) | |
2588 break; | |
2589 } | |
2590 if (i < 4) | |
2591 age_luck_pc = pAgeingLuckMultiplier[i]; | |
2592 else | |
2593 age_luck_pc = 100; | |
2594 | |
2595 condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; | |
2596 items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
2597 magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); | |
2598 full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus | |
2599 + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; | |
2600 return full_luck; | |
0 | 2601 } |
2602 | |
2603 //----- (0048CCF5) -------------------------------------------------------- | |
2604 int Player::GetActualAttack(int a2) | |
2605 { | |
2606 Player *v2; // esi@1 | |
2607 int v3; // eax@1 | |
2608 int v4; // edi@1 | |
2609 int v5; // ebx@1 | |
2610 int v6; // ebp@1 | |
2611 | |
2612 v2 = this; | |
2613 v3 = GetActualAccuracy(); | |
1036 | 2614 v4 = GetParameterBonus(v3); |
0 | 2615 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
2616 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
2617 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
2618 } | |
2619 | |
2620 //----- (0048CD45) -------------------------------------------------------- | |
2621 int Player::GetMeleeDamageMinimal() | |
2622 { | |
2623 Player *v1; // edi@1 | |
2624 int v2; // eax@1 | |
2625 int v3; // esi@1 | |
2626 int v4; // esi@1 | |
2627 int v5; // esi@1 | |
2628 int v6; // esi@1 | |
2629 signed int result; // eax@1 | |
2630 | |
1036 | 2631 |
0 | 2632 v2 = GetActualMight(); |
1036 | 2633 v3 = GetParameterBonus(v2); |
0 | 2634 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
2635 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 2636 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
2637 if ( result < 1 ) | |
2638 result = 1; | |
0 | 2639 return result; |
2640 } | |
2641 | |
2642 //----- (0048CD90) -------------------------------------------------------- | |
2643 int Player::GetMeleeDamageMaximal() | |
2644 { | |
2645 Player *v1; // edi@1 | |
2646 int v2; // eax@1 | |
2647 int v3; // esi@1 | |
2648 int v4; // esi@1 | |
2649 int v5; // esi@1 | |
2650 int v6; // esi@1 | |
2651 signed int result; // eax@1 | |
2652 | |
2653 v1 = this; | |
2654 v2 = GetActualMight(); | |
1036 | 2655 v3 = GetParameterBonus(v2); |
0 | 2656 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
2657 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
2658 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
2659 result = 1; | |
2660 if ( v6 >= 1 ) | |
2661 result = v6; | |
2662 return result; | |
2663 } | |
2664 | |
2665 //----- (0048CDDB) -------------------------------------------------------- | |
2666 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
2667 { | |
2668 int v4; // esi@1 | |
2669 Player *v5; // edi@1 | |
2670 ItemGen *v6; // ebx@4 | |
2671 unsigned int v7; // ebp@4 | |
2672 unsigned int v8; // esi@4 | |
2673 int v9; // eax@4 | |
2674 int v10; // eax@9 | |
2675 char v11; // zf@9 | |
2676 int v12; // esi@10 | |
2677 int v13; // eax@11 | |
2678 enum MONSTER_SUPERTYPE v14; // edx@24 | |
2679 ItemGen *v15; // ebx@35 | |
2680 unsigned int v16; // ebp@35 | |
2681 unsigned int v17; // esi@35 | |
2682 int v18; // edx@38 | |
2683 int v19; // eax@40 | |
2684 enum MONSTER_SUPERTYPE v20; // edx@53 | |
2685 int v21; // esi@62 | |
2686 int v22; // eax@63 | |
2687 int v23; // ebx@63 | |
2688 int v24; // ebx@63 | |
2689 signed int result; // eax@64 | |
2690 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
2691 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
2692 int v28; // [sp+10h] [bp-10h]@1 | |
2693 int v29; // [sp+10h] [bp-10h]@33 | |
2694 signed int v30; // [sp+14h] [bp-Ch]@7 | |
2695 signed int v31; // [sp+14h] [bp-Ch]@36 | |
2696 int v32; // [sp+18h] [bp-8h]@1 | |
2697 int v33; // [sp+18h] [bp-8h]@8 | |
2698 int v34; // [sp+1Ch] [bp-4h]@1 | |
2699 int v35; // [sp+28h] [bp+8h]@37 | |
2700 | |
2701 v4 = 0; | |
2702 v5 = this; | |
2703 v34 = 0; | |
2704 v32 = 0; | |
2705 v28 = 0; | |
2706 if ( IsUnarmed() == 1 ) | |
2707 { | |
2708 v32 = rand() % 3 + 1; | |
2709 LABEL_61: | |
2710 v34 = v4; | |
2711 goto LABEL_62; | |
2712 } | |
816 | 2713 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 2714 { |
232 | 2715 v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; |
0 | 2716 v7 = v6->uItemID; |
2717 v8 = v6->uItemID; | |
2718 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 2719 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 2720 ++v9; |
2721 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
2722 if ( v9 > 0 ) | |
2723 { | |
2724 v33 = v9; | |
2725 do | |
2726 { | |
2727 v10 = rand(); | |
2728 v11 = v33-- == 1; | |
2729 v28 += v10 % v30 + 1; | |
2730 } | |
2731 while ( !v11 ); | |
2732 } | |
2733 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
2734 if ( !uTargetActorID ) | |
2735 goto LABEL_28; | |
377 | 2736 v13 = v6->uSpecEnchantmentType; |
0 | 2737 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
2738 { | |
2739 v14 = (MONSTER_SUPERTYPE)1; | |
2740 } | |
2741 else | |
2742 { | |
2743 if ( v13 == 39 ) | |
2744 { | |
2745 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
2746 } | |
2747 else | |
2748 { | |
2749 if ( v13 == 40 ) | |
2750 { | |
2751 v26 = MONSTER_SUPERTYPE_DRAGON; | |
2752 } | |
2753 else | |
2754 { | |
2755 if ( v13 == 63 || v7 == 517 ) | |
2756 { | |
2757 v26 = MONSTER_SUPERTYPE_ELF; | |
2758 } | |
2759 else | |
2760 { | |
2761 if ( v13 != 65 ) | |
2762 { | |
2763 LABEL_28: | |
2764 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
2765 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
2766 && rand() % 100 < 10 ) | |
2767 v12 *= 3; | |
2768 v32 = v12; | |
2769 goto LABEL_33; | |
2770 } | |
2771 v26 = MONSTER_SUPERTYPE_TITAN; | |
2772 } | |
2773 } | |
2774 } | |
2775 v14 = v26; | |
2776 } | |
2777 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
2778 v12 *= 2; | |
2779 goto LABEL_28; | |
2780 } | |
2781 LABEL_33: | |
2782 v29 = 0; | |
2783 if ( !a3 ) | |
2784 { | |
2785 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
2786 { | |
898 | 2787 v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; |
0 | 2788 v16 = v15->uItemID; |
2789 v17 = v15->uItemID; | |
2790 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
2791 { | |
2792 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
2793 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
2794 { | |
2795 v35 = pItemsTable->pItems[v17].uDamageDice; | |
2796 do | |
2797 { | |
2798 v18 = rand() % v31; | |
2799 v11 = v35-- == 1; | |
2800 v29 += v18 + 1; | |
2801 } | |
2802 while ( !v11 ); | |
2803 } | |
2804 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2805 if ( !uTargetActorID ) | |
2806 goto LABEL_57; | |
377 | 2807 v19 = v15->uSpecEnchantmentType; |
0 | 2808 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2809 { | |
2810 v20 = (MONSTER_SUPERTYPE)1; | |
2811 } | |
2812 else | |
2813 { | |
2814 if ( v19 == 39 ) | |
2815 { | |
2816 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2817 } | |
2818 else | |
2819 { | |
2820 if ( v19 == 40 ) | |
2821 { | |
2822 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2823 } | |
2824 else | |
2825 { | |
2826 if ( v19 == 63 || v16 == 517 ) | |
2827 { | |
2828 v27 = MONSTER_SUPERTYPE_ELF; | |
2829 } | |
2830 else | |
2831 { | |
2832 if ( v19 != 65 ) | |
2833 { | |
2834 LABEL_57: | |
2835 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2836 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2837 && rand() % 100 < 10 ) | |
2838 v4 *= 3; | |
2839 goto LABEL_61; | |
2840 } | |
2841 v27 = MONSTER_SUPERTYPE_TITAN; | |
2842 } | |
2843 } | |
2844 } | |
2845 v20 = v27; | |
2846 } | |
2847 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2848 v4 *= 2; | |
2849 goto LABEL_57; | |
2850 } | |
2851 } | |
2852 } | |
2853 LABEL_62: | |
2854 v21 = v32 + v34; | |
2855 if ( !a2 ) | |
2856 { | |
2857 v22 = GetActualMight(); | |
1036 | 2858 v23 = GetParameterBonus(v22); |
0 | 2859 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; |
2860 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2861 } | |
2862 result = 1; | |
2863 if ( v21 >= 1 ) | |
2864 result = v21; | |
2865 return result; | |
2866 } | |
2867 | |
2868 //----- (0048D0B9) -------------------------------------------------------- | |
2869 int Player::GetRangedAttack() | |
2870 { | |
2871 Player *v1; // esi@1 | |
2872 int v2; // eax@1 | |
2873 int v3; // edi@3 | |
2874 int v4; // eax@4 | |
2875 int v5; // edi@4 | |
2876 int v6; // edi@4 | |
2877 int v7; // edi@4 | |
2878 | |
2879 v1 = this; | |
232 | 2880 v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; |
0 | 2881 if ( v2 < 64 || v2 > 65 ) |
2882 { | |
2883 v4 = GetActualAccuracy(); | |
1036 | 2884 v5 = GetParameterBonus(v4); |
0 | 2885 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
2886 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2887 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2888 } | |
2889 else | |
2890 { | |
2891 v3 = GetActualAttack(1); | |
2892 } | |
2893 return v3; | |
2894 } | |
2895 | |
2896 //----- (0048D124) -------------------------------------------------------- | |
2897 int Player::GetRangedDamageMin() | |
2898 { | |
2899 Player *v1; // esi@1 | |
2900 int v2; // edi@1 | |
2901 int v3; // edi@1 | |
2902 int v4; // edi@1 | |
2903 unsigned __int16 v5; // ax@1 | |
2904 int result; // eax@6 | |
2905 | |
2906 v1 = this; | |
1040 | 2907 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
2908 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2909 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2910 v5 = v1->pActiveSkills[5]; |
2911 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2912 v4 += v1->pActiveSkills[5] & 0x3F; | |
2913 if ( v4 >= 1 ) | |
2914 result = v4; | |
2915 else | |
2916 result = 0; | |
2917 return result; | |
2918 } | |
2919 | |
2920 //----- (0048D191) -------------------------------------------------------- | |
2921 int Player::GetRangedDamageMax() | |
2922 { | |
2923 Player *v1; // esi@1 | |
2924 int v2; // edi@1 | |
2925 int v3; // edi@1 | |
2926 int v4; // edi@1 | |
2927 unsigned __int16 v5; // ax@1 | |
2928 int result; // eax@6 | |
2929 | |
2930 v1 = this; | |
1040 | 2931 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
2932 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2933 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2934 v5 = v1->pActiveSkills[5]; |
2935 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2936 v4 += v1->pActiveSkills[5] & 0x3F; | |
2937 if ( v4 >= 1 ) | |
2938 result = v4; | |
2939 else | |
2940 result = 0; | |
2941 return result; | |
2942 } | |
2943 | |
2944 //----- (0048D1FE) -------------------------------------------------------- | |
2945 bool Player::CalculateRangedDamageTo(int a2) | |
2946 { | |
2947 Player *v2; // ebx@1 | |
2948 bool result; // eax@1 | |
2949 ItemGen *v4; // ebx@2 | |
2950 unsigned int v5; // edi@2 | |
2951 unsigned int v6; // esi@2 | |
2952 int v7; // edx@4 | |
2953 char v8; // zf@4 | |
2954 int v9; // esi@5 | |
2955 int v10; // ebx@6 | |
2956 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2957 unsigned __int16 v12; // ax@19 | |
2958 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2959 Player *v14; // [sp+4h] [bp-10h]@1 | |
2960 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2961 int v16; // [sp+Ch] [bp-8h]@3 | |
2962 int v17; // [sp+10h] [bp-4h]@1 | |
2963 | |
2964 v17 = 0; | |
2965 v2 = this; | |
2966 v14 = this; | |
2967 result = HasItemEquipped(EQUIP_BOW); | |
2968 if ( !result ) | |
2969 return result; | |
232 | 2970 v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; |
0 | 2971 v5 = v4->uItemID; |
2972 v6 = v4->uItemID; | |
2973 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2974 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2975 { | |
2976 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2977 do | |
2978 { | |
2979 v7 = rand() % v15; | |
2980 v8 = v16-- == 1; | |
2981 v17 += v7 + 1; | |
2982 } | |
2983 while ( !v8 ); | |
2984 } | |
2985 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2986 if ( a2 ) | |
2987 { | |
377 | 2988 v10 = v4->uSpecEnchantmentType; |
0 | 2989 if ( v10 == 64 ) |
2990 { | |
2991 v11 = (MONSTER_SUPERTYPE)1; | |
2992 goto LABEL_17; | |
2993 } | |
2994 if ( v10 == 39 || v5 == 508 ) | |
2995 { | |
2996 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
2997 goto LABEL_16; | |
2998 } | |
2999 if ( v10 == 40 ) | |
3000 { | |
3001 v13 = MONSTER_SUPERTYPE_DRAGON; | |
3002 goto LABEL_16; | |
3003 } | |
3004 if ( v10 == 63 || v5 == 517 ) | |
3005 { | |
3006 v13 = MONSTER_SUPERTYPE_ELF; | |
3007 LABEL_16: | |
3008 v11 = v13; | |
3009 LABEL_17: | |
3010 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
3011 v9 *= 2; | |
3012 goto LABEL_19; | |
3013 } | |
3014 } | |
3015 LABEL_19: | |
3016 v12 = v14->pActiveSkills[5]; | |
3017 if ( v12 ) | |
3018 { | |
3019 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
3020 v9 += v14->pActiveSkills[5] & 0x3F; | |
3021 } | |
3022 return v9; | |
3023 } | |
3024 | |
3025 //----- (0048D2EA) -------------------------------------------------------- | |
3026 char *Player::GetMeleeDamageString() | |
3027 { | |
1036 | 3028 signed int itemid; // eax@1 |
3029 int min_damage; // edi@3 | |
3030 int max_damage; // eax@3 | |
0 | 3031 |
3032 static char player__getmeleedamagestring_static_buff[40]; // idb | |
3033 | |
1036 | 3034 if ( pEquipment.uMainHand) |
3035 { | |
3036 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3037 if ( itemid < 64 || itemid > 65 ) //blasters | |
3038 { | |
3039 min_damage = GetMeleeDamageMinimal(); | |
3040 max_damage = GetMeleeDamageMaximal(); | |
3041 } | |
3042 else | |
3043 { //for blasters | |
3044 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
3045 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
3046 } | |
3047 if ( max_damage ) | |
3048 { | |
3049 if ( min_damage == max_damage ) | |
3050 { | |
3051 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
3052 } | |
3053 else | |
3054 { | |
3055 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3056 } | |
3057 } | |
3058 else | |
3059 { | |
3060 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
3061 } | |
3062 | |
3063 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3064 { | |
3065 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3066 } | |
3067 } | |
0 | 3068 else |
1036 | 3069 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
3070 return player__getmeleedamagestring_static_buff; | |
0 | 3071 } |
3072 | |
3073 //----- (0048D396) -------------------------------------------------------- | |
3074 char *Player::GetRangedDamageString() | |
1036 | 3075 { |
3076 signed int itemid; // eax@1 | |
3077 int min_damage; // edi@3 | |
3078 int max_damage; // eax@3 | |
3079 | |
3080 static char player__getrangeddamagestring_static_buff[40]; // idb | |
3081 if ( pEquipment.uMainHand) | |
3082 { | |
3083 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
3084 if ( itemid < 64 || itemid > 65 ) //blasters | |
3085 { | |
3086 min_damage = GetRangedDamageMin(); | |
3087 max_damage = GetRangedDamageMax(); | |
3088 } | |
3089 else | |
3090 { //for blasters | |
3091 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
3092 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
3093 } | |
3094 if ( max_damage ) | |
3095 { | |
3096 if ( min_damage == max_damage ) | |
3097 { | |
3098 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); | |
3099 } | |
3100 else | |
3101 { | |
3102 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
3103 } | |
3104 } | |
3105 else | |
3106 { | |
3107 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
3108 } | |
3109 | |
3110 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
3111 { | |
3112 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
3113 } | |
3114 } | |
0 | 3115 else |
1036 | 3116 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
3117 return player__getrangeddamagestring_static_buff; | |
3118 } | |
0 | 3119 |
3120 //----- (0048D45A) -------------------------------------------------------- | |
3121 bool Player::CanTrainToNextLevel() | |
3122 { | |
3123 int v1; // edx@1 | |
3124 int v2; // eax@1 | |
3125 int i; // esi@1 | |
3126 | |
3127 v1 = this->uLevel; | |
3128 v2 = 0; | |
3129 for ( i = 0; i < v1; ++i ) | |
3130 v2 += i + 1; | |
3131 return (signed __int64)this->uExperience >= 1000 * v2; | |
3132 } | |
3133 | |
3134 //----- (0048D498) -------------------------------------------------------- | |
3135 unsigned int Player::GetExperienceDisplayColor() | |
3136 { | |
3137 unsigned int result; // eax@2 | |
3138 | |
3139 if ( CanTrainToNextLevel() ) | |
995 | 3140 result = ui_character_bonus_text_color; |
0 | 3141 else |
995 | 3142 result = ui_character_default_text_color; |
0 | 3143 return result; |
3144 } | |
3145 | |
3146 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 3147 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
3148 { | |
3149 | |
3150 int resist_value; // edi@8 | |
3151 int player_luck; // eax@21 | |
3152 signed int res_rand_divider; // ebx@2 | |
3153 int armor_skill; // eax@29 | |
3154 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
3155 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
3156 | |
3157 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
3158 switch(dmg_type) | |
3159 { | |
3160 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
3161 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
3162 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
3163 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
3164 | |
3165 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
3166 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
3167 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
3168 } | |
3169 if (player_resist) | |
3170 resist_value = GetActualResistance(player_resist); | |
3171 else | |
3172 resist_value = 0; | |
3173 | |
3174 result_amount_dmg = amount; | |
3175 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 3176 return 0; |
1036 | 3177 player_luck = GetActualLuck(); |
3178 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
3179 | |
3180 if ( resist_value ) | |
3181 { | |
3182 if ( rand() % res_rand_divider >= 30 ) | |
3183 { | |
3184 result_amount_dmg = amount >> 1; | |
3185 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3186 { |
1036 | 3187 result_amount_dmg = amount >> 2; |
3188 if ( rand() % res_rand_divider >= 30 ) | |
0 | 3189 { |
1036 | 3190 result_amount_dmg = amount >> 3; |
3191 if ( rand() % res_rand_divider >= 30 ) | |
3192 result_amount_dmg = amount >> 4; | |
0 | 3193 } |
3194 } | |
3195 } | |
3196 } | |
1036 | 3197 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
3198 { | |
3199 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 3200 { |
1036 | 3201 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
3202 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 3203 { |
1036 | 3204 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
3205 return (int)(double)result_amount_dmg * 0.5; | |
0 | 3206 } |
1036 | 3207 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 3208 { |
1036 | 3209 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
3210 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 3211 } |
3212 } | |
1036 | 3213 } |
3214 return result_amount_dmg; | |
0 | 3215 } |
3216 | |
3217 //----- (0048D62C) -------------------------------------------------------- | |
816 | 3218 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
3219 { | |
3220 return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; | |
0 | 3221 } |
3222 | |
3223 //----- (0048D651) -------------------------------------------------------- | |
816 | 3224 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
3225 { | |
3226 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; | |
0 | 3227 } |
3228 | |
3229 //----- (0048D676) -------------------------------------------------------- | |
3230 bool Player::IsUnarmed() | |
3231 { | |
1091 | 3232 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
3233 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 3234 } |
3235 | |
3236 //----- (0048D6AA) -------------------------------------------------------- | |
3237 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
3238 { | |
3239 auto i = pEquipment.pIndices[uEquipIndex]; | |
3240 if (i) | |
1080 | 3241 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 3242 else |
3243 return false; | |
0 | 3244 } |
3245 | |
3246 //----- (0048D6D0) -------------------------------------------------------- | |
3247 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
3248 { | |
3249 for (uint i = 0; i < 16; ++i) | |
3250 { | |
3251 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 3252 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 3253 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
3254 return true; | |
3255 } | |
3256 return false; | |
3257 } | |
3258 | |
3259 //----- (0048D709) -------------------------------------------------------- | |
1080 | 3260 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
3261 { | |
1010 | 3262 |
0 | 3263 int v6; // esi@5 |
3264 | |
1080 | 3265 if ( equip_type >= 16 ) |
0 | 3266 { |
3267 v6 = 0; | |
3268 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1091 | 3269 || pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 3270 { |
3271 ++v6; | |
3272 if ( (signed int)v6 >= 16 ) | |
3273 return 0; | |
3274 } | |
3275 return 1; | |
3276 } | |
1080 | 3277 if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 3278 return 1; |
3279 return 0; | |
3280 } | |
3281 | |
3282 //----- (0048D76C) -------------------------------------------------------- | |
3283 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
3284 { | |
3285 unsigned __int16 v6; // cx@8 | |
3286 int v7; // edi@8 | |
3287 unsigned int v8; // ebx@8 | |
3288 unsigned int v9; // esi@8 | |
3289 int v10; // eax@8 | |
3290 int v11; // edi@12 | |
3291 bool result; // eax@13 | |
3292 | |
3293 if ( !a2 | |
3294 || this->pConditions[16] | |
3295 || this->pConditions[14] | |
3296 || this->pConditions[15] | |
3297 || this->pConditions[4] | |
3298 || this->pConditions[13] | |
3299 || this->pConditions[2] ) | |
3300 { | |
3301 result = 0; | |
3302 } | |
3303 else | |
3304 { | |
3305 v6 = this->pActiveSkills[34]; | |
3306 v7 = v6 & 0x3F; | |
3307 v8 = SkillToMastery(v6); | |
3308 v9 = a2->GetValue(); | |
3309 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
3310 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
3311 v9 *= 3; | |
3312 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
3313 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
3314 if ( rand() % 100 >= 5 ) | |
3315 { | |
3316 if ( *a6 > v11 ) | |
3317 result = *a6 - v11 < 500; | |
3318 else | |
3319 result = 2; | |
3320 } | |
3321 else | |
3322 { | |
3323 result = 0; | |
3324 } | |
3325 } | |
3326 return result; | |
3327 } | |
3328 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3329 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3330 | |
3331 //----- (0048D88B) -------------------------------------------------------- | |
3332 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
3333 { | |
3334 Player *v4; // esi@1 | |
3335 Actor *v5; // edi@1 | |
3336 unsigned __int16 v6; // cx@10 | |
3337 int v7; // ebx@10 | |
3338 unsigned int v8; // esi@10 | |
3339 int v9; // eax@10 | |
3340 int v10; // esi@10 | |
3341 int v11; // eax@13 | |
3342 signed int v12; // ebx@15 | |
3343 signed int v13; // edx@15 | |
3344 int v14; // ecx@15 | |
3345 unsigned __int16 v15; // si@21 | |
3346 unsigned int v16; // ebx@24 | |
3347 int v17; // esi@24 | |
3348 const void *v18; // eax@29 | |
3349 unsigned int v19; // esi@31 | |
3350 int v20; // eax@34 | |
3351 char v21; // zf@36 | |
3352 unsigned int v22; // ST0C_4@39 | |
3353 char *v23; // esi@39 | |
3354 const char *v25; // [sp-Ch] [bp-48h]@40 | |
3355 int v26; // [sp-8h] [bp-44h]@40 | |
3356 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
3357 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
3358 int v29; // [sp+30h] [bp-Ch]@10 | |
3359 int v30; // [sp+34h] [bp-8h]@10 | |
3360 Player *v31; // [sp+38h] [bp-4h]@1 | |
3361 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
3362 | |
3363 v4 = this; | |
3364 v5 = &pActors[uActorID]; | |
3365 v31 = this; | |
3366 if ( &pActors[uActorID] | |
3367 && !this->pConditions[16] | |
3368 && !this->pConditions[14] | |
3369 && !this->pConditions[15] | |
3370 && !this->pConditions[4] | |
3371 && !this->pConditions[13] | |
3372 && !this->pConditions[2] ) | |
3373 { | |
3374 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
3375 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
3376 v6 = v4->pActiveSkills[34]; | |
3377 v7 = v6 & 0x3F; | |
3378 v8 = SkillToMastery(v6); | |
3379 v9 = rand(); | |
3380 v28 = 4 * v8; | |
3381 v30 = dword_4EDEA0[v8]; | |
3382 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
3383 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
3384 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
3385 { | |
322 | 3386 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 3387 _steal_perma = 0; |
3388 v26 = (int)v31->pName; | |
3389 v25 = pGlobalTXT_LocalizationStrings[376]; | |
3390 } | |
3391 else | |
3392 { | |
3393 v11 = rand(); | |
3394 if ( v11 % 100 >= 40 ) | |
3395 { | |
3396 if ( v11 % 100 >= 70 ) | |
3397 { | |
3398 v19 = 0; | |
3399 if ( v7 > 0 ) | |
3400 { | |
3401 do | |
3402 { | |
3403 --v7; | |
3404 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
3405 } | |
3406 while ( v7 ); | |
3407 } | |
3408 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
3409 return _steal_perma; | |
377 | 3410 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
3411 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
3412 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 3413 v21 = *(int *)v20 == v19; |
3414 *(int *)v20 -= v19; | |
3415 if ( v21 ) | |
3416 v5->array_000234[3].uItemID = 0; | |
3417 if ( v19 ) | |
3418 { | |
3419 party_finds_gold(v19, 2); | |
3420 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3421 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3422 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 3423 LABEL_43: |
3424 ShowStatusBarString(v23, 2u); | |
3425 return _steal_perma; | |
3426 } | |
3427 } | |
3428 else | |
3429 { | |
3430 v27.Reset(); | |
3431 v12 = 0; | |
3432 v13 = 0; | |
3433 v14 = (int)v5->array_000234; | |
3434 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
3435 { | |
3436 ++v13; | |
3437 v14 += 36; | |
3438 if ( v13 >= 4 ) | |
3439 goto LABEL_21; | |
3440 } | |
3441 v12 = 1; | |
3442 LABEL_21: | |
3443 v15 = v5->uCarriedItemID; | |
3444 if ( v15 || v12 ) | |
3445 { | |
3446 v27.Reset(); | |
3447 if ( v15 ) | |
3448 { | |
3449 v16 = (signed __int16)v15; | |
3450 v5->uCarriedItemID = 0; | |
3451 v27.uItemID = (signed __int16)v15; | |
3452 v17 = (signed __int16)v15; | |
3453 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
3454 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
3455 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
3456 { | |
3457 if ( v16 != 220 ) | |
570 | 3458 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 3459 } |
3460 } | |
3461 else | |
3462 { | |
3463 v18 = &v5->array_000234[rand() % 4]; | |
3464 memcpy(&v27, v18, sizeof(v27)); | |
3465 ((ItemGen *)v18)->Reset(); | |
3466 v16 = v27.uItemID; | |
3467 } | |
3468 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
3469 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3470 pTmpBuf2.data(), |
0 | 3471 pGlobalTXT_LocalizationStrings[304], |
3472 v31->pName, | |
3473 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3474 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 3475 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
3476 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
3477 pMouse->SetCursorBitmapFromItemID(v16); | |
3478 return _steal_perma; | |
3479 } | |
3480 } | |
3481 } | |
3482 v26 = (int)v31->pName; | |
3483 v25 = pGlobalTXT_LocalizationStrings[377]; | |
3484 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3485 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
3486 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 3487 goto LABEL_43; |
3488 } | |
3489 return 0; | |
3490 } | |
3491 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
3492 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
3493 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
3494 | |
3495 //----- (0048DBB9) -------------------------------------------------------- | |
3496 void Player::Heal(int amount) | |
3497 { | |
1010 | 3498 signed int max_health; // eax@3 |
3499 | |
3500 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
3501 { | |
3502 max_health = GetMaxHealth(); | |
3503 if ( pConditions[Condition_Zombie] ) | |
3504 max_health /= 2; | |
3505 sHealth += amount; | |
3506 if ( sHealth > max_health ) | |
3507 sHealth = max_health; | |
3508 if ( pConditions[Condition_Unconcious] ) | |
3509 { | |
3510 if ( sHealth > 0 ) | |
3511 { | |
3512 pConditions[Condition_Unconcious] = 0i64; | |
0 | 3513 } |
3514 } | |
3515 } | |
3516 } | |
3517 | |
3518 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 3519 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
3520 { | |
3521 signed int recieved_dmg; // eax@1 | |
3522 unsigned int armor_indx; // eax@8 | |
3523 bool broke_armor; | |
3524 | |
3525 pConditions[Condition_Sleep] = 0i64; | |
3526 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
3527 sHealth -= recieved_dmg; | |
3528 broke_armor = sHealth <= -10; | |
3529 if ( sHealth < 1 ) // | |
3530 { | |
3531 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
3532 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 3533 { |
1019 | 3534 SetCondition(Condition_Unconcious, 0); |
0 | 3535 } |
3536 else | |
3537 { | |
1019 | 3538 SetCondition(Condition_Dead, 0); |
1036 | 3539 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
3540 if ( sHealth > 0 ) | |
3541 sHealth = 0; | |
3542 } | |
3543 if (broke_armor ) | |
3544 { | |
3545 armor_indx = pEquipment.uArmor; | |
3546 if ( armor_indx ) | |
0 | 3547 { |
1036 | 3548 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 3549 { |
1036 | 3550 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 3551 } |
3552 } | |
3553 } | |
3554 } | |
1036 | 3555 if ( recieved_dmg && CanAct() ) |
187 | 3556 PlaySound(SPEECH_24, 0); |
1036 | 3557 return recieved_dmg; |
0 | 3558 } |
3559 | |
3560 //----- (0048DCF6) -------------------------------------------------------- | |
3561 int Player::_48DCF6(int a2, Actor *pActor) | |
3562 { | |
3563 signed int v3; // edi@1 | |
3564 signed int v4; // ebx@1 | |
3565 Player *v5; // esi@1 | |
3566 int v6; // eax@2 | |
3567 int v7; // eax@5 | |
3568 int v8; // eax@8 | |
3569 int v9; // ebx@8 | |
3570 int v10; // eax@8 | |
3571 int v11; // ebx@8 | |
3572 signed int v12; // edx@9 | |
3573 ItemGen *v13; // eax@9 | |
3574 int v14; // edx@16 | |
3575 unsigned int v15; // edx@17 | |
3576 int v16; // edx@26 | |
3577 unsigned int v17; // edx@27 | |
3578 signed int v19; // edx@38 | |
3579 int *v20; // ecx@38 | |
3580 signed int v21; // eax@40 | |
3581 int v22; // eax@49 | |
3582 signed int v23; // ebx@49 | |
3583 unsigned int v24; // eax@60 | |
3584 int v25; // ecx@61 | |
3585 int v26; // ebx@74 | |
3586 void *v27; // ecx@76 | |
3587 unsigned int v28; // ebx@78 | |
3588 signed int result; // eax@86 | |
3589 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
3590 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
3591 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
3592 signed int v33; // [sp-14h] [bp-B4h]@56 | |
3593 signed int v34; // [sp-10h] [bp-B0h]@56 | |
3594 int v35; // [sp-Ch] [bp-ACh]@56 | |
3595 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
3596 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
3597 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
3598 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
3599 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
3600 int v41; // [sp-4h] [bp-A4h]@51 | |
3601 int v42; // [sp-4h] [bp-A4h]@56 | |
3602 int v43; // [sp-4h] [bp-A4h]@57 | |
3603 signed int v44; // [sp-4h] [bp-A4h]@59 | |
3604 int v45; // [sp-4h] [bp-A4h]@68 | |
3605 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
3606 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
3607 int v48; // [sp+9Ch] [bp-4h]@1 | |
3608 | |
3609 v3 = 0; | |
3610 v4 = 0; | |
3611 v5 = this; | |
3612 v47 = 0; | |
3613 v48 = 0; | |
3614 switch ( a2 ) | |
3615 { | |
3616 case 1: | |
3617 v6 = GetActualWillpower(); | |
3618 goto LABEL_46; | |
3619 case 2: | |
3620 case 3: | |
3621 case 4: | |
3622 case 9: | |
3623 case 10: | |
3624 case 11: | |
3625 case 13: | |
3626 case 21: | |
3627 v6 = GetActualEndurance(); | |
3628 goto LABEL_46; | |
3629 case 5: | |
3630 case 12: | |
3631 case 23: | |
3632 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
3633 goto LABEL_5; | |
3634 case 15: | |
3635 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
3636 goto LABEL_5; | |
3637 case 6: | |
3638 case 7: | |
3639 case 8: | |
3640 case 14: | |
3641 case 16: | |
3642 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
3643 LABEL_5: | |
3644 v7 = GetActualResistance(v40); | |
3645 goto LABEL_47; | |
3646 case 22: | |
3647 v8 = GetActualWillpower(); | |
1036 | 3648 v9 = GetParameterBonus(v8); |
0 | 3649 v10 = GetActualIntelligence(); |
1036 | 3650 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 3651 break; |
3652 case 17: | |
3653 v12 = 0; | |
3654 v13 = this->pInventoryItems; | |
3655 do | |
3656 { | |
315 | 3657 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 3658 v46[v4++] = v12; |
3659 ++v12; | |
3660 ++v13; | |
3661 } | |
3662 while ( v12 < 138 ); | |
3663 goto LABEL_36; | |
3664 case 18: | |
3665 v14 = 0; | |
3666 do | |
3667 { | |
3668 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
3669 { | |
816 | 3670 if ( v15 == EQUIP_ARMOUR ) |
898 | 3671 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 3672 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 3673 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 3674 } |
3675 v14 = v15 + 1; | |
3676 } | |
3677 while ( v14 < 16 ); | |
3678 goto LABEL_36; | |
3679 case 19: | |
3680 v16 = 0; | |
3681 do | |
3682 { | |
3683 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
3684 { | |
3685 if ( v17 == 2 ) | |
3686 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
3687 if ( (!v17 || v17 == 1) | |
816 | 3688 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 3689 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 3690 } |
3691 v16 = v17 + 1; | |
3692 } | |
3693 while ( v16 < 16 ); | |
3694 LABEL_36: | |
3695 if ( !v4 ) | |
3696 goto LABEL_87; | |
3697 v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; | |
3698 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); | |
3699 break; | |
3700 case 20: | |
3701 v19 = 0; | |
3702 v20 = this->pInventoryIndices; | |
3703 do | |
3704 { | |
3705 if ( *v20 > 0 ) | |
3706 { | |
232 | 3707 v21 = *(int *)&v5->pInventoryItems[*v20-1]; |
0 | 3708 if ( v21 > 0 ) |
3709 { | |
3710 if ( v21 <= 134 ) | |
3711 v46[v4++] = v19; | |
3712 } | |
3713 } | |
3714 ++v19; | |
3715 ++v20; | |
3716 } | |
3717 while ( v19 < 126 ); | |
3718 if ( !v4 ) | |
3719 goto LABEL_87; | |
3720 v47 = (unsigned __int8)v46[rand() % v4]; | |
3721 v6 = GetActualAccuracy(); | |
3722 LABEL_46: | |
1036 | 3723 v7 = GetParameterBonus(v6); |
0 | 3724 LABEL_47: |
3725 v11 = v7; | |
3726 break; | |
3727 default: | |
3728 v11 = 0; | |
3729 break; | |
3730 } | |
3731 v22 = GetActualLuck(); | |
1036 | 3732 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 3733 if ( rand() % v23 >= 30 ) |
3734 { | |
3735 LABEL_87: | |
3736 result = 0; | |
3737 } | |
3738 else | |
3739 { | |
3740 switch ( a2 ) | |
3741 { | |
3742 case 1: | |
3743 v41 = 1; | |
3744 v36 = 0; | |
3745 goto LABEL_56; | |
3746 case 2: | |
3747 v41 = 1; | |
3748 v36 = 1; | |
3749 goto LABEL_56; | |
3750 case 3: | |
3751 v41 = 1; | |
3752 v36 = 2; | |
3753 goto LABEL_56; | |
3754 case 23: | |
3755 v41 = 1; | |
3756 v36 = 3; | |
3757 goto LABEL_56; | |
3758 case 4: | |
3759 v41 = 1; | |
3760 v36 = 4; | |
3761 LABEL_56: | |
3762 SetCondition(v36, v41); | |
3763 v42 = 0; | |
3764 v37 = 0; | |
3765 v35 = 0; | |
3766 v34 = 0; | |
3767 v33 = -1; | |
3768 v32 = 0; | |
3769 v31 = 0; | |
3770 v30 = (SoundID)221; | |
3771 goto LABEL_83; | |
3772 case 5: | |
3773 v43 = 1; | |
3774 v38 = 5; | |
3775 goto LABEL_70; | |
3776 case 6: | |
3777 case 7: | |
3778 case 8: | |
3779 if ( a2 == 6 ) | |
3780 { | |
3781 v44 = 6; | |
3782 goto LABEL_60; | |
3783 } | |
3784 v25 = 2 * (a2 != 8) + 8; | |
3785 goto LABEL_65; | |
3786 case 9: | |
3787 if ( a2 == 6 ) | |
3788 { | |
3789 v44 = 7; | |
3790 LABEL_60: | |
3791 v24 = v44; | |
3792 } | |
3793 else | |
3794 { | |
3795 v25 = 2 * (a2 != 8) + 9; | |
3796 LABEL_65: | |
3797 v24 = v25; | |
3798 } | |
3799 SetCondition(v24, 1); | |
3800 v42 = 0; | |
3801 v37 = 0; | |
3802 v35 = 0; | |
3803 v34 = 0; | |
3804 v33 = -1; | |
3805 v32 = 0; | |
3806 v31 = 0; | |
3807 v30 = (SoundID)222; | |
3808 LABEL_83: | |
3809 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3810 do | |
3811 { | |
3812 LABEL_84: | |
3813 if ( v5 == pPlayers[v3 + 1] ) | |
3814 break; | |
3815 ++v3; | |
3816 } | |
3817 while ( v3 < 4 ); | |
3818 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3819 result = 1; | |
3820 break; | |
3821 case 12: | |
3822 v43 = 1; | |
3823 v38 = 12; | |
3824 goto LABEL_70; | |
3825 case 15: | |
3826 v45 = 1; | |
3827 v39 = 15; | |
3828 goto LABEL_73; | |
3829 case 13: | |
3830 v43 = 1; | |
3831 v38 = 13; | |
3832 LABEL_70: | |
3833 SetCondition(v38, v43); | |
3834 v42 = 0; | |
3835 v37 = 0; | |
3836 v35 = 0; | |
3837 v34 = 0; | |
3838 v33 = -1; | |
3839 v32 = 0; | |
3840 v31 = 0; | |
3841 v30 = (SoundID)224; | |
3842 goto LABEL_83; | |
3843 case 14: | |
3844 v45 = 1; | |
3845 v39 = 14; | |
3846 goto LABEL_73; | |
3847 case 16: | |
3848 v45 = 1; | |
3849 v39 = 16; | |
3850 LABEL_73: | |
3851 SetCondition(v39, v45); | |
3852 v42 = 0; | |
3853 v37 = 0; | |
3854 v35 = 0; | |
3855 v34 = 0; | |
3856 v33 = -1; | |
3857 v32 = 0; | |
3858 v31 = 0; | |
3859 v30 = (SoundID)225; | |
3860 goto LABEL_83; | |
3861 case 17: | |
3862 case 18: | |
3863 case 19: | |
3864 v26 = v48; | |
3865 if ( *(char *)(v48 + 21) & 2 ) | |
3866 goto LABEL_84; | |
187 | 3867 PlaySound(SPEECH_40, 0); |
0 | 3868 *(int *)(v26 + 20) |= 2u; |
3869 goto LABEL_79; | |
3870 case 20: | |
187 | 3871 PlaySound(SPEECH_40, 0); |
0 | 3872 v27 = pActor->array_000234; |
3873 if ( pActor->array_000234[0].uItemID ) | |
3874 { | |
3875 v27 = &pActor->array_000234[1]; | |
3876 if ( pActor->array_000234[1].uItemID ) | |
3877 goto LABEL_84; | |
3878 } | |
3879 v28 = v47; | |
654 | 3880 memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); |
0 | 3881 RemoveItemAtInventoryIndex(v28); |
3882 LABEL_79: | |
3883 v42 = 0; | |
3884 v37 = 0; | |
3885 v35 = 0; | |
3886 v34 = 0; | |
3887 v33 = -1; | |
3888 v32 = 0; | |
3889 v31 = 0; | |
3890 v30 = (SoundID)47; | |
3891 goto LABEL_83; | |
3892 case 21: | |
187 | 3893 PlaySound(SPEECH_42, 0); |
0 | 3894 ++v5->sAgeModifier; |
3895 goto LABEL_82; | |
3896 case 22: | |
187 | 3897 PlaySound(SPEECH_41, 0); |
0 | 3898 v5->sMana = 0; |
3899 LABEL_82: | |
3900 v42 = 0; | |
3901 v37 = 0; | |
3902 v35 = 0; | |
3903 v34 = 0; | |
3904 v33 = -1; | |
3905 v32 = 0; | |
3906 v31 = 0; | |
3907 v30 = (SoundID)226; | |
3908 goto LABEL_83; | |
3909 default: | |
3910 goto LABEL_87; | |
3911 } | |
3912 } | |
3913 return result; | |
3914 } | |
324 | 3915 |
0 | 3916 // 48DCF6: using guessed type char var_94[140]; |
3917 | |
3918 //----- (0048E1A3) -------------------------------------------------------- | |
3919 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3920 { | |
1091 | 3921 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 3922 } |
3923 | |
3924 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 3925 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
3926 { | |
3927 ItemGen *weapon = nullptr; | |
3928 ItemDesc *weapon_desc = nullptr; | |
3929 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
3930 if (bRangedAttack) | |
0 | 3931 { |
3932 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3933 goto LABEL_17; | |
816 | 3934 weapon = &pInventoryItems[pEquipment.uBow - 1]; |
3935 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3936 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
3937 goto LABEL_17; | |
3938 } | |
3939 else if ( IsUnarmed() == 1 ) | |
3940 { | |
3941 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
3942 { | |
3943 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 3944 goto LABEL_17; |
3945 } | |
3946 } | |
816 | 3947 |
3948 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
3949 { | |
3950 weapon = &pInventoryItems[pEquipment.uMainHand - 1]; | |
3951 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; | |
3952 if (weapon_desc->uEquipType == EQUIP_WAND) | |
3953 { | |
3954 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
3955 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
3956 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
3957 } | |
0 | 3958 else |
816 | 3959 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
3960 } | |
1010 | 3961 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
3962 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 3963 { |
898 | 3964 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3965 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
3966 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
3967 { | |
898 | 3968 weapon = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 3969 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3970 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
3971 } | |
3972 } | |
3973 | |
0 | 3974 LABEL_17: |
816 | 3975 uint armour_recovery = 0; |
0 | 3976 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
3977 { | |
898 | 3978 auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 3979 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
3980 | |
3981 float armour_recovery_multipliers[4]; | |
3982 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
3983 { | |
3984 armour_recovery_multipliers[0] = 1.0f; | |
3985 armour_recovery_multipliers[1] = 0; | |
3986 armour_recovery_multipliers[2] = 0; | |
3987 armour_recovery_multipliers[3] = 0; | |
3988 } | |
3989 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
3990 { | |
3991 armour_recovery_multipliers[0] = 1.0f; | |
3992 armour_recovery_multipliers[1] = 0.5f; | |
3993 armour_recovery_multipliers[2] = 0; | |
3994 armour_recovery_multipliers[3] = 0; | |
3995 } | |
3996 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
3997 { | |
3998 armour_recovery_multipliers[0] = 1.0f; | |
3999 armour_recovery_multipliers[1] = 0.5f; | |
4000 armour_recovery_multipliers[2] = 0.5f; | |
4001 armour_recovery_multipliers[3] = 0; | |
0 | 4002 } |
4003 else | |
4004 { | |
816 | 4005 assert(false && "Unknown armour type"); // what kind of armour is that? |
4006 armour_recovery_multipliers[0] = 1.0f; | |
4007 armour_recovery_multipliers[1] = 1.0f; | |
4008 armour_recovery_multipliers[2] = 1.0f; | |
4009 armour_recovery_multipliers[3] = 1.0f; | |
4010 } | |
4011 | |
4012 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
4013 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
4014 } | |
4015 | |
4016 uint shield_recovery = 0; | |
4017 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
4018 { | |
4019 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
4020 | |
898 | 4021 auto shield = &pInventoryItems[pEquipment.uShield - 1]; |
816 | 4022 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
4023 | |
4024 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
4025 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
4026 } | |
4027 | |
1036 | 4028 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 4029 sword_axe_bow_recovery_reduction = 0; |
4030 bool shooting_laser = false; | |
4031 if (weapon_desc) | |
4032 { | |
4033 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
4034 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
4035 { | |
4036 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
4037 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
4038 } | |
4039 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
4040 shooting_laser = true; | |
4041 } | |
4042 | |
4043 uint armsmaster_recovery_reduction = 0; | |
4044 if (!bRangedAttack && !shooting_laser) | |
4045 { | |
4046 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
4047 { | |
4048 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
4049 if (SkillToMastery(armsmaster_level) >= 4) | |
4050 armsmaster_recovery_reduction *= 2; | |
4051 } | |
4052 } | |
4053 | |
4054 uint v41 = 0; | |
4055 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 4056 v41 = 25; |
816 | 4057 |
4058 uint weapon_enchantment_recovery_reduction = 0; | |
4059 if ( weapon ) | |
4060 { | |
4061 if (weapon->uSpecEnchantmentType == 59 || | |
4062 weapon->uSpecEnchantmentType == 41 || | |
4063 weapon->uSpecEnchantmentType == 500) | |
4064 weapon_enchantment_recovery_reduction = 20; | |
4065 } | |
4066 | |
4067 | |
4068 int recovery = weapon_recovery + | |
4069 armour_recovery + | |
4070 shield_recovery | |
4071 - armsmaster_recovery_reduction | |
4072 - weapon_enchantment_recovery_reduction | |
4073 - v41 | |
4074 - sword_axe_bow_recovery_reduction | |
4075 - player_speed_recovery_reduction; | |
4076 | |
4077 if (recovery < 0) | |
4078 recovery = 0; | |
4079 return recovery; | |
0 | 4080 } |
4081 | |
4082 //----- (0048E4F8) -------------------------------------------------------- | |
4083 int Player::GetMaxHealth() | |
4084 { | |
4085 int v3; // esi@1 | |
4086 int v4; // esi@1 | |
4087 int v6; // esi@1 | |
4088 | |
1036 | 4089 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 4090 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 4091 v6 = uFullHealthBonus |
135 | 4092 + pBaseHealthByClass[classType / 4] |
0 | 4093 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
4094 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
4095 if (v6 <= 0) | |
4096 return 1; | |
4097 return v6; | |
4098 } | |
4099 | |
4100 //----- (0048E565) -------------------------------------------------------- | |
4101 int Player::GetMaxMana() | |
4102 { | |
4103 int v2; // eax@2 | |
4104 int v3; // esi@4 | |
4105 int v4; // eax@5 | |
4106 int v5; // esi@5 | |
4107 int v6; // eax@5 | |
4108 int v7; // esi@6 | |
4109 int v8; // esi@6 | |
4110 int v9; // esi@6 | |
4111 int result; // eax@7 | |
1116 | 4112 |
135 | 4113 switch (classType) |
0 | 4114 { |
1116 | 4115 case PLAYER_CLASS_ROGUE: |
4116 case PLAYER_CLASS_SPY: | |
4117 case PLAYER_CLASS_ASSASSIN: | |
4118 case PLAYER_CLASS_ARCHER: | |
4119 case PLAYER_CLASS_WARRIOR_MAGE: | |
4120 case PLAYER_CLASS_MASTER_ARCHER: | |
4121 case PLAYER_CLASS_SNIPER: | |
4122 case PLAYER_CLASS_SORCERER: | |
4123 case PLAYER_CLASS_WIZARD: | |
4124 case PLAYER_CLASS_ARCHMAGE: | |
4125 case PLAYER_CLASS_LICH: | |
0 | 4126 v2 = GetActualIntelligence(); |
1036 | 4127 v3 = GetParameterBonus(v2); |
1116 | 4128 break; |
4129 case PLAYER_CLASS_INITIATE: | |
4130 case PLAYER_CLASS_MASTER: | |
4131 case PLAYER_CLASS_NINJA: | |
4132 case PLAYER_CLASS_PALADIN: | |
4133 case PLAYER_CLASS_CRUSADER: | |
4134 case PLAYER_CLASS_HERO: | |
4135 case PLAYER_CLASS_VILLIAN: | |
4136 case PLAYER_CLASS_CLERIC: | |
4137 case PLAYER_CLASS_PRIEST: | |
4138 case PLAYER_CLASS_PRIEST_OF_SUN: | |
4139 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 4140 v2 = GetActualWillpower(); |
1036 | 4141 v3 = GetParameterBonus(v2); |
1116 | 4142 break; |
4143 case PLAYER_CLASS_HUNTER: | |
4144 case PLAYER_CLASS_RANGER_LORD: | |
4145 case PLAYER_CLASS_BOUNTY_HUNTER: | |
4146 case PLAYER_CLASS_DRUID: | |
4147 case PLAYER_CLASS_GREAT_DRUID: | |
4148 case PLAYER_CLASS_ARCH_DRUID: | |
4149 case PLAYER_CLASS_WARLOCK: | |
0 | 4150 v4 = GetActualWillpower(); |
1036 | 4151 v5 = GetParameterBonus(v4); |
0 | 4152 v6 = GetActualIntelligence(); |
1036 | 4153 v3 = GetParameterBonus(v6) + v5; |
0 | 4154 break; |
4155 default: | |
1116 | 4156 return 0; |
0 | 4157 break; |
4158 } | |
1116 | 4159 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
4160 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
4161 v9 = uFullManaBonus | |
4162 + pBaseManaByClass[classType / 4] | |
4163 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
4164 + v8; | |
4165 return max(0,v9); | |
0 | 4166 } |
4167 | |
4168 //----- (0048E656) -------------------------------------------------------- | |
4169 int Player::GetBaseAC() | |
4170 { | |
4171 Player *v1; // edi@1 | |
4172 int v2; // eax@1 | |
4173 int v3; // esi@1 | |
4174 int v4; // esi@1 | |
4175 int v5; // esi@1 | |
4176 int result; // eax@2 | |
4177 | |
4178 v1 = this; | |
4179 v2 = GetActualSpeed(); | |
1036 | 4180 v3 = GetParameterBonus(v2); |
0 | 4181 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4182 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4183 if ( v5 >= 1 ) | |
4184 result = v5; | |
4185 else | |
4186 result = 0; | |
4187 return result; | |
4188 } | |
4189 | |
4190 //----- (0048E68F) -------------------------------------------------------- | |
4191 int Player::GetActualAC() | |
4192 { | |
4193 Player *v1; // edi@1 | |
4194 int v2; // eax@1 | |
4195 int v3; // esi@1 | |
4196 int v4; // esi@1 | |
4197 int v5; // esi@1 | |
4198 int v6; // esi@1 | |
4199 int result; // eax@2 | |
4200 | |
4201 v1 = this; | |
4202 v2 = GetActualSpeed(); | |
1036 | 4203 v3 = GetParameterBonus(v2); |
0 | 4204 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
4205 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
4206 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
4207 if ( v6 >= 1 ) | |
4208 result = v6; | |
4209 else | |
4210 result = 0; | |
4211 return result; | |
4212 } | |
4213 | |
4214 //----- (0048E6DC) -------------------------------------------------------- | |
4215 unsigned int Player::GetBaseAge() | |
4216 { | |
352 | 4217 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 4218 } |
4219 | |
4220 //----- (0048E72C) -------------------------------------------------------- | |
4221 unsigned int Player::GetActualAge() | |
4222 { | |
4223 return this->sAgeModifier + GetBaseAge(); | |
4224 } | |
4225 | |
4226 //----- (0048E73F) -------------------------------------------------------- | |
4227 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4228 { | |
4229 Player *v2; // ebx@1 | |
4230 signed int v3; // esi@1 | |
4231 enum CHARACTER_RACE v4; // eax@1 | |
4232 signed int v5; // edi@8 | |
4233 char v6; // zf@9 | |
4234 int v7; // esi@20 | |
4235 int result; // eax@21 | |
4236 signed int v9; // [sp-4h] [bp-10h]@11 | |
4237 | |
4238 v2 = this; | |
4239 v3 = 0; | |
4240 v4 = GetRace(); | |
4241 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4242 { | |
4243 v5 = 0; | |
4244 goto LABEL_16; | |
4245 } | |
4246 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4247 { | |
4248 v5 = 1; | |
4249 LABEL_16: | |
4250 v6 = v4 == 2; | |
4251 goto LABEL_17; | |
4252 } | |
4253 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4254 { | |
4255 v6 = v4 == 3; | |
4256 v5 = 2; | |
4257 goto LABEL_17; | |
4258 } | |
4259 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4260 { | |
4261 v5 = 3; | |
4262 v6 = v4 == 3; | |
4263 goto LABEL_17; | |
4264 } | |
4265 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4266 { | |
4267 v5 = 7; | |
4268 if ( v4 != 1 ) | |
4269 goto LABEL_20; | |
4270 v9 = 10; | |
4271 LABEL_19: | |
4272 v3 = v9; | |
4273 goto LABEL_20; | |
4274 } | |
4275 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
4276 { | |
4277 v5 = 8; | |
4278 v6 = v4 == 0; | |
4279 LABEL_17: | |
4280 if ( !v6 ) | |
4281 goto LABEL_20; | |
4282 v9 = 5; | |
4283 goto LABEL_19; | |
4284 } | |
4285 v5 = 0; | |
4286 LABEL_20: | |
4287 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 4288 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 4289 result = v7 + *(&v2->sResFireBase + v5); |
4290 return result; | |
4291 } | |
4292 | |
4293 //----- (0048E7D0) -------------------------------------------------------- | |
4294 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4295 { | |
4296 signed int v2; // edi@1 | |
4297 Player *v3; // esi@1 | |
4298 enum CHARACTER_RACE v4; // ebx@1 | |
4299 char v6; // zf@18 | |
4300 int v7; // ebx@28 | |
4301 int result; // eax@28 | |
4302 signed int v9; // [sp+10h] [bp-8h]@1 | |
4303 signed int v10; // [sp+14h] [bp-4h]@1 | |
4304 | |
4305 v2 = 0; | |
4306 v3 = this; | |
4307 v10 = 0; | |
4308 v9 = 0; | |
4309 v4 = GetRace(); | |
652 | 4310 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 4311 v10 = 20; |
4312 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
4313 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
4314 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
4315 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
4316 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
4317 && HasItemEquipped(EQUIP_ARMOUR) | |
4318 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
4319 v10 += v3->pActiveSkills[9] & 0x3F; | |
4320 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
4321 goto LABEL_25; | |
4322 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
4323 { | |
4324 v2 = 1; | |
4325 LABEL_25: | |
4326 v6 = v4 == 2; | |
4327 LABEL_26: | |
4328 if ( v6 ) | |
4329 v9 = 5; | |
4330 goto LABEL_28; | |
4331 } | |
4332 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
4333 { | |
4334 v6 = v4 == 3; | |
4335 v2 = 2; | |
4336 goto LABEL_26; | |
4337 } | |
4338 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
4339 { | |
4340 v2 = 3; | |
4341 if ( v4 == 3 ) | |
4342 v10 += 5; | |
4343 } | |
4344 else | |
4345 { | |
4346 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
4347 { | |
4348 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
4349 goto LABEL_28; | |
4350 v2 = 8; | |
4351 v6 = v4 == 0; | |
4352 goto LABEL_26; | |
4353 } | |
4354 v2 = 7; | |
4355 if ( v4 == 1 ) | |
4356 v9 = 10; | |
4357 } | |
4358 LABEL_28: | |
4359 v7 = GetItemsBonus(a2, 0); | |
4360 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 4361 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 4362 { |
4363 if ( result > 200 ) | |
4364 result = 200; | |
4365 } | |
4366 return result; | |
4367 } | |
4368 | |
4369 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 4370 bool Player::Recover(int dt) |
4371 { | |
4372 //Player *v2; // esi@1 | |
0 | 4373 signed __int64 v3; // qax@1 |
816 | 4374 //bool result; // eax@4 |
4375 | |
4376 //v2 = this; | |
4377 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
4378 | |
4379 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
4380 | |
4381 if (uTimeToRecovery > v3) | |
4382 { | |
4383 uTimeToRecovery -= v3; | |
4384 return true; | |
0 | 4385 } |
4386 else | |
4387 { | |
816 | 4388 uTimeToRecovery = 0; |
4389 viewparams->bRedrawGameUI = true; | |
4390 if (!uActiveCharacter) | |
0 | 4391 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4392 return false; |
4393 } | |
0 | 4394 } |
4395 | |
4396 //----- (0048E96A) -------------------------------------------------------- | |
816 | 4397 void Player::SetRecoveryTime(signed int rec) |
4398 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
4399 assert(rec >= 0); |
816 | 4400 |
4401 if (rec > uTimeToRecovery) | |
4402 uTimeToRecovery = rec; | |
4403 | |
4404 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 4405 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 4406 |
4407 viewparams->bRedrawGameUI = true; | |
0 | 4408 } |
4409 // 50C0C4: using guessed type int some_active_character; | |
4410 | |
4411 //----- (0048E9B7) -------------------------------------------------------- | |
4412 void Player::RandomizeName() | |
4413 { | |
4414 if (!uExpressionTimePassed) | |
4415 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
4416 } | |
4417 | |
4418 //----- (0048E9F4) -------------------------------------------------------- | |
4419 unsigned int Player::GetMajorConditionIdx() | |
4420 { | |
4421 for (uint i = 0; i < 18; ++i) | |
4422 if (pConditions[pConditionImportancyTable[i]] != 0) | |
4423 return pConditionImportancyTable[i]; | |
4424 | |
4425 return 18; | |
4426 } | |
4427 | |
4428 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 4429 int Player::GetParameterBonus( int player_parameter ) |
4430 { | |
4431 int i; // eax@1 | |
4432 i = 0; | |
4433 while (param_to_bonus_table[i]) | |
4434 { | |
4435 if (player_parameter >= param_to_bonus_table[i]) | |
4436 break; | |
4437 ++i; | |
4438 } | |
4439 return parameter_to_bonus_value[i]; | |
0 | 4440 } |
4441 | |
4442 //----- (0048EA46) -------------------------------------------------------- | |
4443 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
4444 { | |
1032 | 4445 int inv_indx; // eax@3 |
4446 | |
4447 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
4448 { | |
4449 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4450 continue; | |
4451 inv_indx = pEquipment.pIndices[i] - 1; | |
4452 if (a2==17) | |
4453 { | |
1097 | 4454 if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 4455 return 50; |
4456 } | |
4457 if (a2==24) | |
4458 { | |
4459 if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. | |
4460 return 5; | |
4461 } | |
4462 } | |
4463 return 0; | |
0 | 4464 } |
4465 | |
4466 //----- (0048EAAE) -------------------------------------------------------- | |
4467 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
4468 { | |
4469 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 4470 // signed int v4; // eax@1 |
0 | 4471 int v5; // edi@1 |
4472 Player *v6; // ebx@1 | |
4473 Player *v8; // ecx@48 | |
4474 int v9; // eax@49 | |
4475 int v10; // edx@49 | |
4476 Player *v11; // ecx@55 | |
4477 int v12; // eax@56 | |
4478 int v13; // edx@56 | |
4479 int v14; // ecx@58 | |
4480 int v15; // eax@58 | |
4481 Player *v16; // ecx@61 | |
4482 int v17; // eax@62 | |
4483 Player *v18; // ecx@66 | |
4484 int v19; // eax@67 | |
4485 int v20; // eax@69 | |
4486 Player *v21; // ecx@75 | |
4487 int v22; // eax@76 | |
4488 int v23; // edx@76 | |
4489 int v24; // eax@79 | |
4490 int v25; // ecx@80 | |
4491 int v26; // edi@80 | |
4492 Player *v27; // ecx@84 | |
4493 int v28; // eax@85 | |
4494 int v29; // edx@85 | |
4495 Player *v30; // ecx@96 | |
4496 int v31; // ebp@97 | |
4497 int v32; // eax@98 | |
4498 unsigned int v33; // eax@100 | |
4499 int v34; // eax@103 | |
4500 char v35; // zf@104 | |
4501 char v36; // zf@107 | |
4502 unsigned __int8 v37; // zf@119 | |
4503 char v38; // sf@119 | |
4504 unsigned __int8 v39; // of@119 | |
4505 char v40; // zf@122 | |
4506 char v41; // zf@145 | |
4507 char v42; // zf@164 | |
4508 char v43; // zf@173 | |
4509 char v44; // zf@189 | |
4510 char v45; // zf@198 | |
4511 char v46; // zf@239 | |
4512 int v47; // eax@268 | |
4513 int v48; // eax@269 | |
4514 int v49; // eax@291 | |
4515 char v50; // zf@295 | |
4516 int v51; // eax@306 | |
4517 int v52; // eax@307 | |
4518 char v53; // zf@312 | |
4519 char v54; // zf@336 | |
4520 char v55; // zf@348 | |
4521 int v56; // eax@365 | |
4522 int v57; // ebx@368 | |
4523 signed int v58; // [sp-4h] [bp-20h]@10 | |
4524 signed int v59; // [sp-4h] [bp-20h]@71 | |
4525 signed int v60; // [sp-4h] [bp-20h]@347 | |
4526 int v61; // [sp+10h] [bp-Ch]@1 | |
4527 int v62; // [sp+14h] [bp-8h]@1 | |
4528 int v63; // [sp+18h] [bp-4h]@101 | |
4529 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
4530 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 4531 bool no_skills; |
0 | 4532 |
4533 v3 = attr; | |
4534 v5 = 0; | |
4535 v6 = this; | |
4536 v62 = 0; | |
4537 v61 = 0; | |
4538 | |
1040 | 4539 |
4540 no_skills=false; | |
0 | 4541 switch (attr) |
4542 { | |
1040 | 4543 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
4544 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
4545 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
4546 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
4547 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
4548 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
4549 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
4550 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
4551 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
4552 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
4553 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
4554 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
4555 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
4556 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
4557 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
4558 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
4559 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
4560 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
4561 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
4562 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
4563 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
4564 default: | |
4565 no_skills=true; | |
0 | 4566 } |
1040 | 4567 if (!no_skills) |
0 | 4568 { |
1040 | 4569 if ( !this->pActiveSkills[v58] ) |
4570 return 0; | |
0 | 4571 } |
1040 | 4572 |
0 | 4573 if ( (signed int)attr > 28 ) |
4574 { | |
4575 if ( (signed int)attr < 29 ) | |
4576 return v5 + v62 + v61; | |
1040 | 4577 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 4578 { |
4579 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 4580 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 4581 return v5 + v62 + v61; |
4582 } | |
1040 | 4583 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 4584 { |
4585 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4586 return v5 + v62 + v61; | |
1040 | 4587 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4588 v5 = pItemsTable->pItems[v57].uDamageMod; |
4589 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 4590 v5 += v56; |
4591 return v5 + v62 + v61; | |
4592 } | |
4593 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 4594 { |
4595 if ( !HasItemEquipped(EQUIP_BOW) ) | |
4596 return v5 + v62 + v61; | |
1040 | 4597 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 4598 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
4599 LABEL_365: | |
4600 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4601 LABEL_366: | |
4602 v5 += v56; | |
4603 return v5 + v62 + v61; | |
4604 } | |
4605 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
4606 return v5 + v62 + v61; | |
4607 LABEL_95: | |
4608 v65 = 0; | |
4609 while ( 1 ) | |
4610 { | |
4611 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
4612 goto LABEL_361; | |
898 | 4613 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 4614 if ( v3 == 9 ) |
4615 { | |
816 | 4616 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 4617 if ( v32 >= 3 ) |
4618 { | |
4619 if ( v32 <= 11 ) | |
4620 { | |
4621 v33 = v6->pInventoryItems[v31].uItemID; | |
4622 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; | |
4623 } | |
4624 } | |
4625 } | |
4626 v63 = (int)((char *)v6 + 36 * v31); | |
4627 attra = (ItemGen *)(v63 + 532); | |
377 | 4628 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
4629 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 4630 { |
4631 v34 = attra->uItemID; | |
4632 switch ( attra->uItemID ) | |
4633 { | |
4634 case 0x1F4u: | |
4635 v35 = v3 == 5; | |
4636 goto LABEL_105; | |
4637 case 0x1F5u: | |
4638 v36 = v3 == 0; | |
4639 goto LABEL_108; | |
4640 case 0x1F6u: | |
4641 if ( v3 == 21 ) | |
4642 v61 += 10; | |
4643 v36 = v3 == 2; | |
4644 goto LABEL_108; | |
4645 case 0x1F7u: | |
4646 if ( v3 == 17 ) | |
4647 v61 += 5; | |
4648 if ( v3 == 18 ) | |
4649 v61 += 5; | |
4650 v36 = v3 == 6; | |
4651 goto LABEL_108; | |
4652 case 0x1F8u: | |
4653 goto LABEL_118; | |
4654 case 0x1F9u: | |
4655 v40 = v3 == 3; | |
4656 goto LABEL_123; | |
4657 case 0x1FAu: | |
4658 v35 = v3 == 10; | |
4659 goto LABEL_105; | |
4660 case 0x1FEu: | |
4661 v35 = v3 == 4; | |
4662 goto LABEL_105; | |
4663 case 0x1FFu: | |
4664 if ( v3 == 23 ) | |
4665 v61 += 10; | |
4666 if ( v3 == 22 ) | |
4667 v61 += 10; | |
4668 goto LABEL_361; | |
4669 case 0x200u: | |
4670 if ( v3 == 36 ) | |
4671 { | |
4672 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4673 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4674 } | |
4675 v36 = v3 == 5; | |
4676 LABEL_108: | |
4677 if ( v36 ) | |
4678 v5 += 40; | |
4679 goto LABEL_361; | |
4680 case 0x201u: | |
4681 if ( v3 == 39 ) | |
4682 { | |
4683 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4684 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4685 v62 = v34; | |
4686 } | |
4687 goto LABEL_136; | |
4688 case 0x202u: | |
4689 if ( !v3 ) | |
4690 v5 += 150; | |
4691 if ( v3 == 1 ) | |
4692 v5 -= 40; | |
4693 if ( v3 == 2 ) | |
4694 v5 -= 40; | |
4695 goto LABEL_145; | |
4696 case 0x203u: | |
4697 if ( v3 == 42 ) | |
4698 { | |
4699 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4700 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4701 } | |
4702 if ( v3 == 43 ) | |
4703 v61 += 15; | |
4704 goto LABEL_361; | |
4705 case 0x204u: | |
4706 if ( v3 == 17 ) | |
4707 v61 += 5; | |
4708 if ( v3 == 18 ) | |
4709 v61 += 5; | |
4710 if ( v3 == 6 ) | |
4711 v5 += 50; | |
4712 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4713 goto LABEL_166; | |
4714 v42 = v3 == 15; | |
4715 goto LABEL_165; | |
4716 case 0x205u: | |
4717 if ( v3 == 18 ) | |
4718 v61 += 5; | |
4719 goto LABEL_361; | |
4720 case 0x206u: | |
4721 if ( !v3 ) | |
4722 v5 += 100; | |
4723 if ( v3 == 3 ) | |
4724 v5 += 100; | |
4725 v43 = v3 == 9; | |
4726 goto LABEL_174; | |
4727 case 0x207u: | |
4728 if ( v3 == 45 ) | |
4729 v61 += 5; | |
4730 if ( v3 == 15 ) | |
4731 v5 -= 10; | |
4732 v42 = v3 == 14; | |
4733 LABEL_165: | |
4734 if ( v42 ) | |
4735 LABEL_166: | |
4736 v5 -= 10; | |
4737 goto LABEL_361; | |
4738 case 0x208u: | |
4739 v35 = v3 == 3; | |
4740 goto LABEL_105; | |
4741 case 0x209u: | |
4742 if ( v3 == 2 ) | |
4743 v5 += 15; | |
4744 if ( !v3 ) | |
4745 v5 += 15; | |
4746 v41 = v3 == 6; | |
4747 goto LABEL_146; | |
4748 case 0x20Au: | |
4749 if ( v3 == 46 ) | |
4750 v61 += 15; | |
4751 v44 = v3 == 3; | |
4752 goto LABEL_190; | |
4753 case 0x20Bu: | |
4754 if ( v3 == 34 ) | |
4755 { | |
4756 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4757 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4758 } | |
4759 if ( v3 == 12 ) | |
4760 v5 += 50; | |
4761 if ( v3 == 2 ) | |
4762 v5 += 30; | |
4763 v45 = v3 == 9; | |
4764 goto LABEL_199; | |
4765 case 0x20Cu: | |
4766 if ( !v3 ) | |
4767 v5 += 75; | |
4768 goto LABEL_145; | |
4769 case 0x20Du: | |
4770 if ( v3 == 5 ) | |
4771 v5 += 50; | |
4772 if ( v3 == 6 ) | |
4773 v5 += 50; | |
4774 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
4775 goto LABEL_374; | |
4776 v43 = v3 == 15; | |
4777 LABEL_174: | |
4778 if ( v43 ) | |
4779 LABEL_374: | |
4780 v5 -= 15; | |
4781 goto LABEL_361; | |
4782 case 0x20Eu: | |
4783 if ( v3 == 4 ) | |
4784 v5 += 150; | |
4785 if ( v3 == 44 ) | |
4786 v61 += 5; | |
4787 if ( v3 == 9 ) | |
4788 v5 -= 25; | |
4789 goto LABEL_361; | |
4790 case 0x20Fu: | |
4791 if ( v3 == 39 ) | |
4792 { | |
4793 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4794 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
4795 v62 = v34; | |
4796 } | |
4797 if ( v3 == 40 ) | |
4798 { | |
4799 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4800 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4801 } | |
4802 LABEL_145: | |
4803 v41 = v3 == 5; | |
4804 LABEL_146: | |
4805 if ( v41 ) | |
4806 v5 -= 40; | |
4807 goto LABEL_361; | |
4808 case 0x210u: | |
4809 if ( v3 == 38 ) | |
4810 { | |
4811 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4812 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4813 } | |
4814 if ( !v3 ) | |
4815 v5 += 75; | |
4816 v44 = v3 == 11; | |
4817 LABEL_190: | |
4818 if ( v44 ) | |
4819 v5 -= 50; | |
4820 goto LABEL_361; | |
4821 case 0x211u: | |
4822 if ( v3 == 5 ) | |
4823 v5 += 100; | |
4824 if ( v3 == 4 ) | |
4825 v5 += 50; | |
4826 v35 = v3 == 11; | |
4827 LABEL_105: | |
4828 if ( v35 ) | |
4829 v5 += 50; | |
4830 goto LABEL_361; | |
4831 case 0x212u: | |
4832 if ( v3 == 1 ) | |
4833 v5 -= 20; | |
4834 v45 = v3 == 2; | |
4835 LABEL_199: | |
4836 if ( v45 ) | |
4837 v5 -= 20; | |
4838 goto LABEL_361; | |
4839 case 0x214u: | |
4840 if ( v3 == 1 ) | |
4841 v5 += 15; | |
4842 v46 = v3 == 2; | |
4843 goto LABEL_240; | |
4844 case 0x215u: | |
4845 if ( v3 == 5 ) | |
4846 v5 += 15; | |
4847 v46 = v3 == 4; | |
4848 goto LABEL_240; | |
4849 case 0x216u: | |
4850 if ( v3 == 10 ) | |
4851 v5 += 30; | |
4852 if ( !v3 ) | |
4853 v5 += 15; | |
4854 goto LABEL_315; | |
4855 case 0x217u: | |
4856 if ( v3 == 21 ) | |
4857 v61 += 5; | |
4858 if ( !v3 ) | |
4859 v5 += 15; | |
4860 goto LABEL_253; | |
4861 case 0x218u: | |
4862 goto LABEL_253; | |
4863 default: | |
4864 goto LABEL_361; | |
4865 } | |
4866 goto LABEL_361; | |
4867 } | |
4868 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
4869 { | |
4870 if ( (signed int)v3 >= 0 ) | |
4871 { | |
4872 if ( (signed int)v3 <= 15 ) | |
4873 { | |
4874 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
4875 } | |
4876 else | |
4877 { | |
4878 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
4879 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
4880 } | |
4881 } | |
4882 goto LABEL_361; | |
4883 } | |
4884 v34 = *(int *)(v63 + 544); | |
4885 if ( v34 > 48 ) | |
4886 { | |
4887 switch ( v34 ) | |
4888 { | |
4889 case 54: | |
4890 goto LABEL_315; | |
4891 case 49: | |
4892 if ( v3 == 6 ) | |
4893 goto LABEL_121; | |
4894 v50 = v3 == 1; | |
4895 goto LABEL_296; | |
4896 case 51: | |
4897 if ( v3 != 5 && v3 != 1 ) | |
4898 goto LABEL_309; | |
4899 goto LABEL_121; | |
4900 case 52: | |
4901 if ( v3 == 3 ) | |
4902 goto LABEL_121; | |
4903 v50 = v3 == 4; | |
4904 goto LABEL_296; | |
4905 case 53: | |
4906 if ( !v3 ) | |
4907 goto LABEL_121; | |
4908 v50 = v3 == 2; | |
4909 goto LABEL_296; | |
4910 case 55: | |
4911 v46 = v3 == 6; | |
4912 goto LABEL_240; | |
4913 case 56: | |
4914 if ( !v3 ) | |
4915 goto LABEL_351; | |
4916 v53 = v3 == 3; | |
4917 goto LABEL_350; | |
4918 case 57: | |
4919 if ( v3 == 1 ) | |
4920 goto LABEL_351; | |
4921 v53 = v3 == 2; | |
4922 goto LABEL_350; | |
4923 case 50: | |
4924 if ( v3 == 10 ) | |
4925 v5 += 30; | |
4926 goto LABEL_361; | |
4927 case 60: | |
4928 if ( v3 != 23 ) | |
4929 goto LABEL_336; | |
4930 if ( v5 >= 3 ) | |
4931 goto LABEL_361; | |
4932 v5 = 3; | |
4933 LABEL_336: | |
4934 v54 = v3 == 22; | |
4935 goto LABEL_345; | |
4936 case 61: | |
4937 if ( v3 != 17 ) | |
4938 goto LABEL_340; | |
4939 if ( v5 >= 3 ) | |
4940 goto LABEL_361; | |
4941 v5 = 3; | |
4942 LABEL_340: | |
4943 v54 = v3 == 18; | |
4944 goto LABEL_345; | |
4945 case 62: | |
4946 if ( v3 != 19 ) | |
4947 goto LABEL_344; | |
4948 if ( v5 >= 3 ) | |
4949 goto LABEL_361; | |
4950 v5 = 3; | |
4951 LABEL_344: | |
4952 v54 = v3 == 20; | |
4953 LABEL_345: | |
4954 if ( !v54 ) | |
4955 goto LABEL_361; | |
4956 if ( v5 >= 3 ) | |
4957 goto LABEL_361; | |
4958 v60 = 3; | |
4959 goto LABEL_360; | |
4960 case 67: | |
4961 v55 = v3 == 18; | |
4962 goto LABEL_357; | |
4963 case 68: | |
4964 v53 = v3 == 9; | |
4965 goto LABEL_350; | |
4966 case 69: | |
4967 if ( v3 == 11 ) | |
4968 v5 += 20; | |
4969 break; | |
4970 case 70: | |
4971 if ( v3 == 12 ) | |
4972 v5 += 10; | |
4973 v55 = v3 == 16; | |
4974 LABEL_357: | |
4975 if ( v55 && v5 < 2 ) | |
4976 { | |
4977 v60 = 2; | |
4978 LABEL_360: | |
4979 v5 = v60; | |
4980 } | |
4981 break; | |
4982 default: | |
4983 goto LABEL_361; | |
4984 } | |
4985 goto LABEL_361; | |
4986 } | |
4987 if ( v34 == 48 ) | |
4988 { | |
4989 if ( v3 == 9 ) | |
4990 v5 += 5; | |
4991 LABEL_315: | |
4992 v46 = v3 == 3; | |
4993 LABEL_240: | |
4994 if ( v46 ) | |
4995 v5 += 15; | |
4996 goto LABEL_361; | |
4997 } | |
4998 if ( v34 > 32 ) | |
4999 { | |
5000 if ( v34 > 44 ) | |
5001 { | |
5002 v51 = v34 - 45; | |
5003 if ( !v51 ) | |
5004 { | |
5005 if ( v3 == 5 ) | |
5006 goto LABEL_351; | |
5007 v53 = v3 == 4; | |
5008 LABEL_350: | |
5009 if ( v53 ) | |
5010 LABEL_351: | |
5011 v5 += 5; | |
5012 goto LABEL_361; | |
5013 } | |
5014 v52 = v51 - 1; | |
5015 if ( !v52 ) | |
5016 { | |
5017 v40 = v3 == 0; | |
5018 LABEL_123: | |
5019 if ( v40 ) | |
5020 v5 += 25; | |
5021 goto LABEL_361; | |
5022 } | |
5023 if ( v52 == 1 ) | |
5024 { | |
5025 LABEL_309: | |
5026 v50 = v3 == 8; | |
5027 goto LABEL_296; | |
5028 } | |
5029 } | |
5030 else | |
5031 { | |
5032 if ( v34 == 44 ) | |
5033 { | |
5034 v50 = v3 == 7; | |
5035 goto LABEL_296; | |
5036 } | |
5037 v34 -= 33; | |
5038 if ( !v34 ) | |
5039 { | |
5040 if ( v3 != 38 ) | |
5041 goto LABEL_361; | |
5042 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
5043 goto LABEL_138; | |
5044 } | |
5045 --v34; | |
5046 if ( !v34 ) | |
5047 { | |
5048 if ( v3 != 36 ) | |
5049 goto LABEL_361; | |
5050 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
5051 goto LABEL_138; | |
5052 } | |
5053 v49 = v34 - 8; | |
5054 if ( !v49 ) | |
5055 { | |
5056 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
5057 ++v5; | |
5058 goto LABEL_361; | |
5059 } | |
5060 if ( v49 == 1 ) | |
5061 { | |
5062 if ( v3 != 3 && v3 != 7 ) | |
5063 { | |
5064 v50 = v3 == 9; | |
5065 LABEL_296: | |
5066 if ( !v50 ) | |
5067 goto LABEL_361; | |
5068 } | |
5069 LABEL_121: | |
5070 v5 += 10; | |
5071 goto LABEL_361; | |
5072 } | |
5073 } | |
5074 } | |
5075 else | |
5076 { | |
5077 if ( v34 == 32 ) | |
5078 { | |
5079 if ( v3 != 39 ) | |
5080 goto LABEL_361; | |
5081 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
5082 goto LABEL_138; | |
5083 } | |
5084 if ( v34 > 28 ) | |
5085 { | |
5086 v34 -= 29; | |
5087 if ( v34 ) | |
5088 { | |
5089 --v34; | |
5090 if ( v34 ) | |
5091 { | |
5092 --v34; | |
5093 if ( v34 || v3 != 41 ) | |
5094 goto LABEL_361; | |
5095 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
5096 } | |
5097 else | |
5098 { | |
5099 if ( v3 != 34 ) | |
5100 goto LABEL_361; | |
5101 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
5102 } | |
5103 } | |
5104 else | |
5105 { | |
5106 if ( v3 != 37 ) | |
5107 goto LABEL_361; | |
5108 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
5109 } | |
5110 goto LABEL_138; | |
5111 } | |
5112 if ( v34 == 28 ) | |
5113 { | |
5114 LABEL_136: | |
5115 if ( v3 == 42 ) | |
5116 { | |
5117 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
5118 LABEL_138: | |
5119 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
5120 goto LABEL_361; | |
5121 } | |
5122 } | |
5123 else | |
5124 { | |
5125 v47 = v34 - 1; | |
5126 if ( v47 ) | |
5127 { | |
5128 v48 = v47 - 1; | |
5129 if ( v48 ) | |
5130 { | |
5131 v34 = v48 - 24; | |
5132 if ( v34 ) | |
5133 { | |
5134 --v34; | |
5135 if ( v34 || v3 != 40 ) | |
5136 goto LABEL_361; | |
5137 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
5138 } | |
5139 else | |
5140 { | |
5141 if ( v3 != 35 ) | |
5142 goto LABEL_361; | |
5143 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
5144 } | |
5145 goto LABEL_138; | |
5146 } | |
5147 LABEL_118: | |
5148 if ( (signed int)v3 < 0 ) | |
5149 goto LABEL_361; | |
5150 v39 = __OFSUB__((int)v3, 6); | |
5151 v37 = v3 == 6; | |
5152 v38 = v3 - 6 < 0; | |
5153 } | |
5154 else | |
5155 { | |
5156 LABEL_253: | |
5157 if ( (signed int)v3 < 10 ) | |
5158 goto LABEL_361; | |
5159 v39 = __OFSUB__((int)v3, 15); | |
5160 v37 = v3 == 15; | |
5161 v38 = v3 - 15 < 0; | |
5162 } | |
5163 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
5164 goto LABEL_121; | |
5165 } | |
5166 } | |
5167 LABEL_361: | |
5168 ++v65; | |
5169 if ( (signed int)v65 >= 16 ) | |
5170 return v5 + v62 + v61; | |
5171 } | |
5172 } | |
1040 | 5173 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 5174 { |
5175 if ( IsUnarmed() != 1 ) | |
5176 { | |
816 | 5177 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5178 { | |
5179 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5180 if ( v22 >= 0 ) |
5181 { | |
5182 if ( v22 <= 2 ) | |
5183 { | |
1040 | 5184 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 5185 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 5186 { |
5187 v24 = v23; | |
5188 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
5189 v25 = pItemsTable->pItems[v23].uDamageDice; | |
5190 } | |
5191 else | |
5192 { | |
5193 v25 = pItemsTable->pItems[v24].uDamageRoll; | |
5194 v26 = pItemsTable->pItems[v24].uDamageDice + 1; | |
5195 } | |
5196 v5 = pItemsTable->pItems[v24].uDamageMod + v25 * v26; | |
5197 } | |
5198 } | |
5199 } | |
1040 | 5200 |
5201 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
5202 { | |
5203 | |
5204 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5205 if ((v28 < 0) || v28 > 2 ) | |
5206 return v5 + v62 + v61; | |
5207 } | |
1062 | 5208 v15 = pItemsTable->pItems[v23].uDamageMod; |
5209 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 5210 v5 += v15 + v14; |
1049 | 5211 return v5 + v62 + v61; |
0 | 5212 } |
5213 v59 = 3; | |
5214 LABEL_74: | |
5215 v5 = v59; | |
5216 return v5 + v62 + v61; | |
5217 } | |
5218 if ( (signed int)attr < 0 ) | |
5219 return v5 + v62 + v61; | |
1040 | 5220 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 5221 goto LABEL_95; |
1040 | 5222 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
5223 { | |
5224 if ( !Player::HasEnchantedItemEquipped(25) ) | |
5225 return v5 + v62 + v61; | |
5226 v5 = 5; | |
5227 return v5 + v62 + v61; | |
5228 } | |
5229 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 5230 return v5 + v62 + v61; |
1040 | 5231 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 5232 { |
5233 if ( IsUnarmed() == 1 ) | |
5234 { | |
5235 v5 = 0; | |
5236 return v5 + v62 + v61; | |
5237 } | |
816 | 5238 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5239 { | |
5240 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5241 if ( v17 >= 0 ) |
5242 { | |
5243 if ( v17 <= 2 ) | |
1040 | 5244 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 5245 } |
5246 } | |
865 | 5247 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 5248 return v5 + v62 + v61; |
1040 | 5249 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
5250 v56 = pItemsTable->pItems[v20].uDamageMod; | |
5251 v5 += v56; | |
5252 return v5 + v62 + v61; | |
5253 } | |
5254 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 5255 { |
5256 if ( IsUnarmed() == 1 ) | |
5257 { | |
5258 v5 = 1; | |
5259 return v5 + v62 + v61; | |
5260 } | |
816 | 5261 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
5262 { | |
5263 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 5264 if ( v9 >= 0 ) |
5265 { | |
5266 if ( v9 <= 2 ) | |
5267 { | |
1040 | 5268 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
5269 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 5270 if ( !v6->pEquipment.uShield ) |
0 | 5271 { |
1040 | 5272 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 5273 ++v5; |
5274 } | |
5275 } | |
5276 } | |
5277 } | |
1040 | 5278 |
5279 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
5280 { | |
5281 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
5282 if ((v12 < 0) || v12 > 2 ) | |
5283 return v5 + v62 + v61; | |
5284 } | |
5285 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
5286 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 5287 LABEL_88: |
5288 v5 += v15 + v14; | |
5289 } | |
5290 return v5 + v62 + v61; | |
5291 } | |
5292 | |
5293 //----- (0048F73C) -------------------------------------------------------- | |
5294 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5295 { | |
5296 int result; // eax@1 | |
5297 int v3; // eax@4 | |
5298 int v4; // ecx@5 | |
5299 | |
5300 switch (a2) | |
5301 { | |
5302 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
5303 } | |
5304 | |
5305 result = 0; | |
5306 if ( (signed int)a2 > 10 ) | |
5307 { | |
5308 if ( (signed int)a2 <= 15 ) | |
5309 { | |
5310 switch ( a2 ) | |
5311 { | |
5312 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
5313 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 5314 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 5315 break; |
5316 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
5317 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 5318 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 5319 break; |
5320 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
5321 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 5322 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 5323 break; |
5324 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
5325 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 5326 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 5327 break; |
5328 default: | |
5329 if ( a2 != 14 ) | |
5330 return result; | |
5331 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 5332 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 5333 break; |
5334 } | |
5335 return v4 + v3; | |
5336 } | |
5337 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
5338 { | |
5339 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
5340 { | |
5341 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 5342 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 5343 return v4 + v3; |
5344 } | |
5345 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
5346 return result; | |
5347 } | |
5348 return this->pPlayerBuffs[1].uPower; | |
5349 } | |
5350 if ( a2 == 10 ) | |
5351 { | |
5352 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 5353 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 5354 return v4 + v3; |
5355 } | |
5356 switch ( a2 ) | |
5357 { | |
5358 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5359 v3 = pPlayerBuffs[19].uPower; | |
5360 goto LABEL_5; | |
5361 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5362 v3 = pPlayerBuffs[17].uPower; | |
5363 goto LABEL_5; | |
5364 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5365 v3 = pPlayerBuffs[20].uPower; | |
5366 goto LABEL_5; | |
5367 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5368 v3 = pPlayerBuffs[16].uPower; | |
5369 goto LABEL_5; | |
5370 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5371 v3 = pPlayerBuffs[15].uPower; | |
5372 goto LABEL_5; | |
5373 case CHARACTER_ATTRIBUTE_SPEED: | |
5374 v3 = pPlayerBuffs[21].uPower; | |
5375 goto LABEL_5; | |
5376 case CHARACTER_ATTRIBUTE_LUCK: | |
5377 v3 = pPlayerBuffs[18].uPower; | |
5378 LABEL_5: | |
1167 | 5379 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 5380 return v4 + v3; |
5381 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
5382 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 5383 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 5384 return v4 + v3; |
5385 default: | |
5386 return result; | |
5387 } | |
5388 return result; | |
5389 } | |
5390 | |
5391 //----- (0048F882) -------------------------------------------------------- | |
1008 | 5392 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
5393 { | |
1064 | 5394 signed int bonus_value; // esi@1 |
5395 unsigned __int16 skill_value; // ax@126 | |
5396 int result; // al@127 | |
353 | 5397 |
1064 | 5398 bonus_value = 0; |
353 | 5399 switch (uSkillType) |
5400 { | |
5401 case PLAYER_SKILL_MONSTER_ID: | |
5402 { | |
652 | 5403 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 5404 bonus_value = 6; |
652 | 5405 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 5406 bonus_value += 6; |
5407 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 5408 } |
5409 break; | |
5410 | |
5411 case PLAYER_SKILL_ARMSMASTER: | |
5412 { | |
652 | 5413 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 5414 bonus_value = 2; |
652 | 5415 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 5416 bonus_value += 3; |
5417 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 5418 } |
5419 break; | |
5420 | |
5421 case PLAYER_SKILL_STEALING: | |
5422 { | |
652 | 5423 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 5424 bonus_value = 8; |
5425 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 5426 } |
5427 break; | |
5428 | |
5429 | |
5430 case PLAYER_SKILL_ALCHEMY: | |
5431 { | |
652 | 5432 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 5433 bonus_value = 4; |
652 | 5434 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 5435 bonus_value += 8; |
5436 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 5437 } |
5438 break; | |
5439 | |
5440 case PLAYER_SKILL_LEARNING: | |
5441 { | |
652 | 5442 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 5443 bonus_value = 10; |
652 | 5444 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 5445 bonus_value += 15; |
652 | 5446 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 5447 bonus_value += 5; |
5448 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 5449 } |
5450 break; | |
5451 | |
5452 case PLAYER_SKILL_UNARMED: | |
5453 { | |
652 | 5454 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 5455 bonus_value = 2; |
5456 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 5457 } |
5458 break; | |
5459 | |
5460 case PLAYER_SKILL_DODGE: | |
5461 { | |
652 | 5462 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 5463 bonus_value = 2; |
5464 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 5465 } |
5466 break; | |
5467 | |
5468 case PLAYER_SKILL_BOW: | |
1064 | 5469 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 5470 break; |
5471 case PLAYER_SKILL_SHIELD: | |
1064 | 5472 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 5473 break; |
5474 | |
5475 case PLAYER_SKILL_EARTH: | |
652 | 5476 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 5477 bonus_value = 2; |
652 | 5478 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 5479 bonus_value += 3; |
652 | 5480 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 5481 bonus_value += 4; |
353 | 5482 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 5483 bonus_value += 3; |
5484 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 5485 break; |
5486 case PLAYER_SKILL_FIRE: | |
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_FIRE, 0); | |
353 | 5496 break; |
5497 case PLAYER_SKILL_AIR: | |
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_AIR, 0); | |
353 | 5507 break; |
5508 case PLAYER_SKILL_WATER: | |
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_WATER, 0); | |
353 | 5518 break; |
5519 case PLAYER_SKILL_SPIRIT: | |
652 | 5520 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5521 bonus_value = 2; |
652 | 5522 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5523 bonus_value += 3; |
652 | 5524 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5525 bonus_value += 4; |
5526 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 5527 break; |
5528 case PLAYER_SKILL_MIND: | |
652 | 5529 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5530 bonus_value = 2; |
652 | 5531 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5532 bonus_value += 3; |
652 | 5533 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5534 bonus_value += 4; |
5535 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 5536 break; |
5537 case PLAYER_SKILL_BODY: | |
652 | 5538 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 5539 bonus_value = 2; |
652 | 5540 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 5541 bonus_value += 3; |
652 | 5542 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 5543 bonus_value += 4; |
5544 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 5545 break; |
5546 case PLAYER_SKILL_LIGHT: | |
1064 | 5547 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 5548 break; |
5549 case PLAYER_SKILL_DARK: | |
5550 { | |
1064 | 5551 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 5552 } |
5553 break; | |
5554 | |
5555 case PLAYER_SKILL_MERCHANT: | |
5556 { | |
652 | 5557 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 5558 bonus_value = 4; |
652 | 5559 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 5560 bonus_value += 6; |
652 | 5561 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 5562 bonus_value += 3; |
652 | 5563 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 5564 bonus_value += 8; |
353 | 5565 } |
5566 break; | |
5567 | |
5568 case PLAYER_SKILL_PERCEPTION: | |
5569 { | |
652 | 5570 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 5571 bonus_value = 6; |
652 | 5572 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 5573 bonus_value += 5; |
353 | 5574 } |
5575 break; | |
5576 | |
0 | 5577 case PLAYER_SKILL_ITEM_ID: |
1064 | 5578 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 5579 break; |
5580 case PLAYER_SKILL_MEDITATION: | |
1064 | 5581 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 5582 break; |
0 | 5583 case PLAYER_SKILL_TRAP_DISARM: |
353 | 5584 { |
652 | 5585 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 5586 bonus_value = 4; |
652 | 5587 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 5588 bonus_value += 6; |
652 | 5589 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 5590 bonus_value += 8; |
5591 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 5592 } |
5593 break; | |
5594 } | |
5595 | |
1064 | 5596 skill_value = pActiveSkills[uSkillType]; |
5597 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
5598 result = bonus_value + skill_value; | |
0 | 5599 else |
1064 | 5600 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 5601 return result; |
5602 } | |
5603 | |
5604 //----- (0048FC00) -------------------------------------------------------- | |
5605 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
5606 { | |
1064 | 5607 |
5608 | |
5609 | |
0 | 5610 Player *v2; // esi@1 |
1064 | 5611 int armmaster_skill; // eax@1 |
0 | 5612 char v4; // di@1 |
5613 signed int v5; // ebx@1 | |
1064 | 5614 unsigned int armaster_mastery; // eax@2 |
0 | 5615 unsigned __int8 v7; // sf@5 |
5616 unsigned __int8 v8; // of@5 | |
5617 PlayerEquipment *v9; // ebx@19 | |
5618 Player *v10; // ecx@20 | |
821 | 5619 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 5620 int v12; // eax@21 |
5621 int v13; // edi@21 | |
5622 char v14; // di@25 | |
5623 signed int v15; // esi@25 | |
5624 char v16; // al@32 | |
5625 int v18; // eax@36 | |
5626 unsigned int v19; // eax@37 | |
5627 ITEM_EQUIP_TYPE v20; // edi@40 | |
5628 int v21; // edx@41 | |
5629 int v22; // eax@42 | |
821 | 5630 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 5631 unsigned __int16 v24; // ax@45 |
5632 unsigned __int16 v25; // bx@45 | |
5633 unsigned int v26; // eax@45 | |
5634 unsigned __int8 v27; // sf@50 | |
5635 unsigned __int8 v28; // of@50 | |
5636 unsigned int v29; // eax@52 | |
5637 int v30; // eax@55 | |
5638 int v31; // eax@58 | |
5639 unsigned int v32; // eax@59 | |
5640 int v33; // eax@65 | |
5641 char v34; // si@65 | |
5642 ITEM_EQUIP_TYPE v35; // edi@69 | |
5643 int v36; // edx@70 | |
5644 int v37; // eax@71 | |
821 | 5645 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 5646 int v39; // eax@74 |
5647 int v40; // eax@89 | |
5648 char v41; // si@89 | |
5649 int v42; // eax@96 | |
821 | 5650 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 5651 int v44; // eax@97 |
5652 int v45; // eax@98 | |
5653 int v46; // eax@99 | |
5654 int v47; // eax@100 | |
5655 int v48; // eax@101 | |
5656 int v49; // eax@102 | |
5657 unsigned __int16 v50; // ax@113 | |
5658 char v51; // di@113 | |
5659 unsigned int v52; // eax@113 | |
5660 int v53; // edi@113 | |
5661 signed int i; // ecx@113 | |
5662 unsigned __int16 v55; // ax@118 | |
5663 char v56; // si@118 | |
5664 unsigned int v57; // eax@118 | |
5665 int v58; // esi@121 | |
5666 signed int j; // ecx@121 | |
1064 | 5667 int base_value; // edi@126 |
5668 int attrib_modif; // eax@126 | |
0 | 5669 signed int v62; // [sp-4h] [bp-30h]@26 |
5670 signed int v63; // [sp-4h] [bp-30h]@80 | |
5671 int v64; // [sp+Ch] [bp-20h]@104 | |
5672 int v65; // [sp+10h] [bp-1Ch]@104 | |
5673 int v66; // [sp+14h] [bp-18h]@104 | |
5674 int v67; // [sp+18h] [bp-14h]@104 | |
5675 int v68; // [sp+1Ch] [bp-10h]@69 | |
5676 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
1080 | 5677 int skill_bonus; // [sp+24h] [bp-8h]@1 |
0 | 5678 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 |
5679 int a1; // [sp+34h] [bp+8h]@21 | |
5680 int a1a; // [sp+34h] [bp+8h]@74 | |
5681 signed int a1b; // [sp+34h] [bp+8h]@94 | |
1064 | 5682 int multiplier; |
5683 int arm_bonus; | |
5684 int lvl_avl[4]; | |
0 | 5685 |
5686 v2 = this; | |
1080 | 5687 skill_bonus = 0; |
0 | 5688 v69 = 0; |
1064 | 5689 multiplier =0; |
5690 arm_bonus =0; | |
0 | 5691 v71 = (ITEM_EQUIP_TYPE)0; |
1064 | 5692 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
5693 v4 = armmaster_skill; | |
0 | 5694 v5 = 1; |
1064 | 5695 if ( armmaster_skill ) |
5696 { | |
5697 armaster_mastery = SkillToMastery(armmaster_skill); | |
0 | 5698 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
5699 { | |
1064 | 5700 if ( armaster_mastery == 4 ) |
5701 multiplier =2; | |
5702 else if ( armaster_mastery == 3 ) | |
5703 multiplier =1; | |
5704 } | |
5705 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) | |
5706 { | |
5707 if ( armaster_mastery == 4 ) | |
5708 multiplier =2; | |
5709 else if ( armaster_mastery >= 2 ) | |
5710 multiplier =1; | |
5711 } | |
5712 arm_bonus=(armmaster_skill&0x3F)*multiplier; | |
5713 } | |
5714 | |
5715 | |
0 | 5716 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) |
5717 { | |
1064 | 5718 base_value = pBaseHealthPerLevelByClass[classType]; |
5719 attrib_modif = GetBodybuilding(); | |
5720 return base_value * attrib_modif; | |
0 | 5721 } |
5722 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
5723 { | |
1064 | 5724 base_value = pBaseManaPerLevelByClass[classType]; |
5725 attrib_modif = GetMeditation(); | |
5726 return base_value * attrib_modif; | |
5727 } | |
5728 if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS ) | |
5729 { | |
5730 a1b = 0; | |
5731 v71 = (ITEM_EQUIP_TYPE)0; | |
5732 | |
5733 for (j=0; j<16; ++j) | |
5734 { | |
5735 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) | |
5736 { | |
5737 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; | |
5738 v44=pItemsTable->pItems[curr_item].uSkillType; | |
5739 switch (v44) | |
5740 { | |
5741 | |
5742 case PLAYER_SKILL_STAFF: | |
5743 | |
5744 lvl_avl[0]=0; | |
5745 lvl_avl[1]=1; | |
5746 lvl_avl[2]=0; | |
5747 lvl_avl[3]=0; | |
5748 break; | |
5749 case PLAYER_SKILL_SWORD: | |
5750 case PLAYER_SKILL_SPEAR: | |
5751 lvl_avl[0]=0; | |
5752 lvl_avl[1]=0; | |
5753 lvl_avl[2]=0; | |
5754 lvl_avl[3]=1; | |
5755 break; | |
5756 case PLAYER_SKILL_SHIELD: | |
5757 a1b = 1; | |
5758 lvl_avl[0]=1; | |
5759 lvl_avl[1]=0; | |
5760 lvl_avl[2]=1; | |
5761 lvl_avl[3]=0; | |
5762 break; | |
5763 case PLAYER_SKILL_LEATHER: | |
5764 v71 = (ITEM_EQUIP_TYPE)1; | |
5765 lvl_avl[0]=1; | |
5766 lvl_avl[1]=0; | |
5767 lvl_avl[2]=1; | |
5768 lvl_avl[3]=0; | |
5769 | |
5770 break; | |
5771 case PLAYER_SKILL_CHAIN: | |
5772 a1b = 1; | |
5773 lvl_avl[0]=1; | |
5774 lvl_avl[1]=0; | |
5775 lvl_avl[2]=0; | |
5776 lvl_avl[3]=0; | |
5777 break; | |
5778 case PLAYER_SKILL_PLATE: | |
5779 a1b = 1; | |
5780 lvl_avl[0]=1; | |
5781 lvl_avl[1]=0; | |
5782 lvl_avl[2]=0; | |
5783 lvl_avl[3]=0; | |
5784 break; | |
5785 default: | |
5786 continue; | |
5787 } | |
5788 | |
5789 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); | |
5790 v51 = v50; | |
5791 v52 = SkillToMastery(v50); | |
5792 v53 = v51 & 0x3F; | |
5793 for ( i = 0; i < (signed int)v52; ++i ) | |
5794 { | |
5795 if ( lvl_avl[i] ) | |
1080 | 5796 skill_bonus += v53; |
1064 | 5797 } |
5798 | |
5799 } | |
5800 } | |
5801 | |
5802 lvl_avl[0]=1; | |
5803 lvl_avl[1]=1; | |
5804 lvl_avl[2]=1; | |
5805 lvl_avl[3]=0; | |
5806 | |
5807 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
5808 v56 = v55; | |
5809 v57 = SkillToMastery(v55); | |
5810 if ( !a1b && (!v71 || v57 == 4) ) | |
5811 { | |
5812 v58 = v56 & 0x3F; | |
5813 for ( j = 0; j < (signed int)v57; ++j ) | |
5814 { | |
1069 | 5815 if ( lvl_avl[j] ) |
1080 | 5816 skill_bonus += v58; |
1064 | 5817 } |
5818 } | |
1080 | 5819 return skill_bonus; |
1064 | 5820 |
5821 | |
5822 } | |
5823 | |
1080 | 5824 if (a2 == CHARACTER_ATTRIBUTE_ATTACK) |
5825 { | |
5826 | |
5827 if ( v2->IsUnarmed() == 1 ) | |
5828 { | |
5829 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5830 v34 = v33; | |
5831 if ( !v33 ) | |
5832 return skill_bonus; | |
5833 if ( SkillToMastery(v33) >= 3 ) | |
5834 multiplier = 2; | |
5835 else | |
5836 multiplier=1; | |
5837 v30 = multiplier * (v34 & 0x3F); | |
5838 return arm_bonus + v30; | |
5839 } | |
5840 v35 = (ITEM_EQUIP_TYPE)0; | |
5841 v68 = 0; | |
5842 for (i=0; i<16 ; ++i) | |
5843 { | |
5844 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5845 { | |
5846 v37 = v2->pEquipment.pIndices[i]-1; | |
5847 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) | |
5848 break; | |
5849 } | |
5850 } | |
5851 if ( i >= 16 ) | |
5852 return skill_bonus; | |
5853 | |
5854 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5855 a1a = v2->GetActualSkillLevel(v38); | |
5856 v39= SkillToMastery(a1a); | |
5857 v71 = (ITEM_EQUIP_TYPE)0; | |
5858 switch (v38) | |
5859 { | |
5860 case PLAYER_SKILL_STAFF: | |
5861 v71 = (ITEM_EQUIP_TYPE)1; | |
5862 if ( v39 == 4 ) | |
5863 { | |
5864 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5865 v41 = v40; | |
5866 | |
5867 if ( v40 ) | |
5868 { | |
5869 if ( SkillToMastery(v40) >= 3 ) | |
5870 multiplier = 2; | |
5871 else | |
5872 multiplier=1; | |
5873 v68 = multiplier * (v41 & 0x3F); | |
5874 } | |
5875 } | |
5876 break; | |
5877 case PLAYER_SKILL_SWORD: | |
5878 case PLAYER_SKILL_DAGGER: | |
5879 case PLAYER_SKILL_AXE: | |
5880 case PLAYER_SKILL_SPEAR: | |
5881 case PLAYER_SKILL_MACE: | |
5882 v71 = (ITEM_EQUIP_TYPE)1; | |
5883 break; | |
5884 case PLAYER_SKILL_BLASTER: | |
5885 | |
5886 switch (v39) | |
5887 { | |
5888 case 0: multiplier=1; break; | |
5889 case 1: multiplier=3; break; | |
5890 case 3: multiplier=3; break; | |
5891 case 4: multiplier=5; break; | |
5892 } | |
5893 v5 = multiplier; | |
5894 return v5 * (a1a & 0x3F); | |
5895 break; | |
5896 } | |
5897 | |
5898 | |
5899 | |
5900 v30 = v68 + v71 * (a1a & 0x3F); | |
5901 return (int)((char *)v69 + v30); | |
5902 | |
5903 } | |
5904 | |
5905 | |
0 | 5906 if ( a2 != 9 ) |
5907 { | |
1080 | 5908 |
0 | 5909 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) |
1080 | 5910 return skill_bonus; |
0 | 5911 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
5912 { | |
5913 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
1080 | 5914 return skill_bonus; |
0 | 5915 v71 = (ITEM_EQUIP_TYPE)0; |
5916 v9 = &v2->pEquipment; | |
5917 while ( 1 ) | |
5918 { | |
5919 if ( v2->HasItemEquipped(v71) ) | |
5920 { | |
118 | 5921 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; |
5922 LOBYTE(v12) = this->GetActualSkillLevel(v11); | |
0 | 5923 a1 = v12; |
5924 SkillToMastery(v12); | |
5925 v13 = v11 - 5; | |
5926 if ( !v13 ) | |
5927 return a1 & 0x3F; | |
5928 if ( v13 == 2 ) | |
5929 break; | |
5930 } | |
5931 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5932 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5933 if ( (signed int)v71 >= 16 ) | |
1080 | 5934 return skill_bonus; |
0 | 5935 } |
5936 v14 = a1; | |
5937 v15 = 1; | |
5938 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5939 { | |
5940 v62 = 5; | |
5941 goto LABEL_31; | |
5942 } | |
5943 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5944 { | |
5945 v62 = 3; | |
5946 goto LABEL_31; | |
5947 } | |
5948 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5949 goto LABEL_32; | |
5950 goto LABEL_30; | |
5951 } | |
5952 if ( v2->IsUnarmed() ) | |
5953 { | |
5954 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5955 v14 = v18; | |
5956 if ( !v18 ) | |
1080 | 5957 return skill_bonus; |
0 | 5958 v15 = 0; |
5959 v19 = SkillToMastery(v18); | |
5960 if ( (signed int)v19 < 3 ) | |
5961 { | |
5962 if ( (signed int)v19 >= 2 ) | |
5963 v15 = 1; | |
5964 LABEL_32: | |
5965 v16 = v14; | |
5966 return v15 * (v16 & 0x3F); | |
5967 } | |
5968 LABEL_30: | |
5969 v62 = 2; | |
5970 LABEL_31: | |
5971 v15 = v62; | |
5972 goto LABEL_32; | |
5973 } | |
5974 v20 = (ITEM_EQUIP_TYPE)0; | |
5975 while ( 1 ) | |
5976 { | |
5977 if ( v2->HasItemEquipped(v20) ) | |
5978 { | |
118 | 5979 v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5980 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5981 break; | |
5982 } | |
5983 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5984 if ( (signed int)v20 >= 16 ) | |
1080 | 5985 return skill_bonus; |
0 | 5986 } |
5987 v71 = (ITEM_EQUIP_TYPE)0; | |
5988 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5989 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5990 v25 = v24; | |
5991 v26 = SkillToMastery(v24); | |
5992 if ( !v23 ) | |
5993 { | |
5994 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5995 { | |
5996 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5997 LOBYTE(v25) = v31; | |
5998 if ( v31 ) | |
5999 { | |
6000 v15 = 0; | |
6001 v32 = SkillToMastery(v31); | |
6002 if ( (signed int)v32 < 3 ) | |
6003 { | |
6004 if ( (signed int)v32 >= 2 ) | |
6005 v15 = 1; | |
6006 } | |
6007 else | |
6008 { | |
6009 v15 = 2; | |
6010 } | |
6011 v16 = v25; | |
6012 return v15 * (v16 & 0x3F); | |
6013 } | |
6014 } | |
6015 goto LABEL_55; | |
6016 } | |
6017 if ( v23 == PLAYER_SKILL_DAGGER ) | |
6018 { | |
6019 v29 = SkillToMastery(v25); | |
6020 v28 = __OFSUB__(v29, 4); | |
6021 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
6022 } | |
6023 else | |
6024 { | |
6025 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
6026 goto LABEL_55; | |
6027 if ( v23 > PLAYER_SKILL_SPEAR ) | |
6028 { | |
6029 if ( v23 == PLAYER_SKILL_MACE ) | |
6030 { | |
6031 v28 = __OFSUB__(v26, 2); | |
118 | 6032 v27 = v26 - 2 < 0; |
0 | 6033 goto LABEL_53; |
6034 } | |
6035 LABEL_55: | |
6036 v30 = v71 * (v25 & 0x3F); | |
6037 return (int)((char *)v69 + v30); | |
6038 } | |
6039 v28 = __OFSUB__(v26, 3); | |
118 | 6040 v27 = v26 - 3 < 0; |
0 | 6041 } |
6042 LABEL_53: | |
6043 if ( !(v27 ^ v28) ) | |
6044 v71 = (ITEM_EQUIP_TYPE)1; | |
6045 goto LABEL_55; | |
6046 } | |
1080 | 6047 |
6048 | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
6049 assert(false && "Unknown attribute!"); |
0 | 6050 } |
6051 | |
6052 //----- (00490109) -------------------------------------------------------- | |
6053 // faces are: 0 1 2 3 human males | |
6054 // 4 5 6 7 human females | |
6055 // 8 9 elf males | |
6056 // 10 11 elf females | |
6057 // 12 13 dwarf males | |
6058 // 14 15 dwarf females | |
6059 // 16 17 goblin males | |
6060 // 18 19 goblin females | |
6061 // 20 lich male | |
6062 // 21 lich female | |
6063 // 22 underwater suits (unused) | |
6064 // 23 zombie male | |
6065 // 24 zombie female | |
6066 enum CHARACTER_RACE Player::GetRace() | |
6067 { | |
1014 | 6068 if ( uCurrentFace > 15 ) |
6069 { | |
6070 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 6071 return CHARACTER_RACE_GOBLIN; |
6072 } | |
6073 else | |
6074 { | |
1014 | 6075 if ( uCurrentFace >= 12 ) |
0 | 6076 { |
6077 return CHARACTER_RACE_DWARF; | |
6078 } | |
6079 else | |
6080 { | |
1014 | 6081 |
6082 if ( uCurrentFace <= 7 ) | |
0 | 6083 { |
6084 return CHARACTER_RACE_HUMAN; | |
6085 } | |
6086 else | |
6087 { | |
1014 | 6088 if ( uCurrentFace <= 11 ) |
0 | 6089 return CHARACTER_RACE_ELF; |
6090 } | |
6091 } | |
6092 } | |
6093 return CHARACTER_RACE_HUMAN; | |
6094 } | |
6095 | |
6096 //----- (00490141) -------------------------------------------------------- | |
187 | 6097 PLAYER_SEX Player::GetSexByVoice() |
0 | 6098 { |
6099 signed int result; // eax@1 | |
6100 | |
6101 result = 0; | |
6102 switch ( this->uVoiceID ) | |
6103 { | |
6104 case 0u: | |
6105 case 1u: | |
6106 case 2u: | |
6107 case 3u: | |
6108 case 8u: | |
6109 case 9u: | |
6110 case 0xCu: | |
6111 case 0xDu: | |
6112 case 0x10u: | |
6113 case 0x11u: | |
6114 case 0x14u: | |
6115 case 0x17u: | |
187 | 6116 return SEX_MALE; |
6117 | |
0 | 6118 case 4u: |
6119 case 5u: | |
6120 case 6u: | |
6121 case 7u: | |
6122 case 0xAu: | |
6123 case 0xBu: | |
6124 case 0xEu: | |
6125 case 0xFu: | |
6126 case 0x12u: | |
6127 case 0x13u: | |
6128 case 0x15u: | |
6129 case 0x18u: | |
187 | 6130 return SEX_FEMALE; |
6131 | |
0 | 6132 default: |
187 | 6133 assert(false); |
6134 } | |
0 | 6135 } |
6136 | |
6137 //----- (00490188) -------------------------------------------------------- | |
6138 void Player::SetInitialStats() | |
6139 { | |
6140 auto v1 = GetRace(); | |
290 | 6141 uMight = StatTable[v1][0].uBaseValue; |
6142 uIntelligence = StatTable[v1][1].uBaseValue; | |
6143 uWillpower = StatTable[v1][2].uBaseValue; | |
6144 uEndurance = StatTable[v1][3].uBaseValue; | |
6145 uAccuracy = StatTable[v1][4].uBaseValue; | |
6146 uSpeed = StatTable[v1][5].uBaseValue; | |
6147 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 6148 } |
6149 | |
6150 //----- (004901FC) -------------------------------------------------------- | |
1021 | 6151 void Player::SetSexByVoice() |
6152 { | |
6153 switch ( this->uVoiceID) | |
0 | 6154 { |
6155 case 0: | |
6156 case 1: | |
6157 case 2: | |
6158 case 3: | |
6159 case 8: | |
6160 case 9: | |
6161 case 0xC: | |
6162 case 0xD: | |
6163 case 0x10: | |
6164 case 0x11: | |
6165 case 0x14: | |
6166 case 0x17: | |
1021 | 6167 this->uSex = SEX_MALE; |
0 | 6168 break; |
6169 case 4: | |
6170 case 5: | |
6171 case 6: | |
6172 case 7: | |
6173 case 0xA: | |
6174 case 0xB: | |
6175 case 0xE: | |
6176 case 0xF: | |
6177 case 0x12: | |
6178 case 0x13: | |
6179 case 0x15: | |
6180 case 0x18: | |
1021 | 6181 this->uSex = SEX_FEMALE; |
0 | 6182 break; |
6183 default: | |
6184 break; | |
6185 } | |
1021 | 6186 |
0 | 6187 } |
6188 | |
6189 //----- (0049024A) -------------------------------------------------------- | |
135 | 6190 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 6191 { |
6192 sLevelModifier = 0; | |
6193 sAgeModifier = 0; | |
6194 | |
135 | 6195 classType = cls; |
0 | 6196 uLuckBonus = 0; |
6197 uSpeedBonus = 0; | |
6198 uAccuracyBonus = 0; | |
6199 uEnduranceBonus = 0; | |
6200 uWillpowerBonus = 0; | |
6201 uIntelligenceBonus = 0; | |
6202 uMightBonus = 0; | |
6203 uLevel = 1; | |
6204 uExperience = 251 + rand() % 100; | |
6205 uBirthYear = 1147 - rand() % 6; | |
6206 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 6207 memset(_guilds_member_bits, 0, 64); |
0 | 6208 memset(&spellbook, 0, sizeof(PlayerSpells)); |
6209 | |
6210 for (uint i = 0; i < 37; ++i) | |
6211 { | |
135 | 6212 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 6213 continue; |
6214 | |
6215 pActiveSkills[i] = 1; | |
6216 | |
6217 switch (i) | |
6218 { | |
886 | 6219 case PLAYER_SKILL_FIRE: |
6220 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 6221 |
6222 extern bool all_magic; | |
6223 if ( all_magic == true ) | |
6224 { | |
6225 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
6226 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
6227 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
6228 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
6229 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
6230 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
6231 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
6232 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
6233 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
6234 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
6235 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
6236 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
6237 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 6238 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 6239 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
6240 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
6241 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
6242 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
6243 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
6244 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
6245 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
6246 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
6247 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
6248 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
6249 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6250 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
6251 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
6252 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
6253 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
6254 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 6255 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
6256 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
6257 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 6258 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
6259 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 6260 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
6261 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
6262 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
6263 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
6264 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
6265 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
6266 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
6267 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
6268 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
6269 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
6270 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
6271 } | |
486 | 6272 break; |
886 | 6273 case PLAYER_SKILL_AIR: |
6274 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
6275 break; | |
6276 case PLAYER_SKILL_WATER: | |
6277 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
6278 break; | |
6279 case PLAYER_SKILL_EARTH: | |
6280 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
6281 break; | |
6282 case PLAYER_SKILL_SPIRIT: | |
6283 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
6284 break; | |
6285 case PLAYER_SKILL_MIND: | |
6286 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
6287 break; | |
6288 case PLAYER_SKILL_BODY: | |
6289 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 6290 |
6291 if ( all_magic == true ) | |
6292 { | |
6293 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
6294 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
6295 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
6296 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
6297 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
6298 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
6299 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
6300 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
6301 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
6302 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
6303 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
6304 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 6305 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 6306 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
6307 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
6308 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
6309 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
6310 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
6311 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
6312 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
6313 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
6314 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
6315 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 6316 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 6317 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
6318 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
6319 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
6320 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
6321 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
6322 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
6323 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
6324 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
6325 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
6326 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
6327 } | |
569 | 6328 break; |
886 | 6329 case PLAYER_SKILL_LIGHT: |
6330 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
6331 break; | |
6332 case PLAYER_SKILL_DARK: | |
6333 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
6334 break; | |
0 | 6335 } |
6336 } | |
6337 | |
6338 sHealth = GetMaxHealth(); | |
6339 sMana = GetMaxMana(); | |
6340 } | |
6341 | |
6342 //----- (004903C9) -------------------------------------------------------- | |
821 | 6343 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
6344 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6345 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6346 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6347 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6348 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6349 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6350 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6351 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6352 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6353 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6354 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6355 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6356 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6357 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6358 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6359 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6360 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6361 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6362 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6363 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6364 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6365 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6366 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6367 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6368 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6369 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6370 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6371 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6372 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6373 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6374 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6375 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6376 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6377 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6378 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
6379 ++counter; |
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 } |
0 | 6382 } |
6383 | |
6384 | |
6385 | |
6386 //----- (0049048D) -------------------------------------------------------- | |
6387 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
6388 void Player::DecreaseAttribute(int eAttribute) | |
6389 { | |
6390 int v2; // eax@1 | |
6391 int pBaseValue; // ecx@1 | |
6392 int pDroppedStep; // ebx@1 | |
6393 int pStep; // esi@1 | |
6394 unsigned __int16 result; // ax@7 | |
6395 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
6396 | |
6397 v2 = eAttribute + 7 * GetRace(); | |
290 | 6398 pBaseValue = StatTable[0][v2].uBaseValue; |
6399 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 6400 uMinValue = pBaseValue - 2; |
290 | 6401 pStep = StatTable[0][v2].uBaseStep; |
1272 | 6402 unsigned short* AttrToChange = nullptr; |
6403 switch ( eAttribute ) | |
6404 { | |
6405 case CHARACTER_ATTRIBUTE_STRENGTH: | |
6406 AttrToChange = &this->uMight; | |
6407 break; | |
6408 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
6409 AttrToChange = &this->uIntelligence; | |
6410 break; | |
6411 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
6412 AttrToChange = &this->uWillpower; | |
6413 break; | |
6414 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
6415 AttrToChange = &this->uEndurance; | |
6416 break; | |
6417 case CHARACTER_ATTRIBUTE_ACCURACY: | |
6418 AttrToChange = &this->uAccuracy; | |
6419 break; | |
6420 case CHARACTER_ATTRIBUTE_SPEED: | |
6421 AttrToChange = &this->uSpeed; | |
6422 break; | |
6423 case CHARACTER_ATTRIBUTE_LUCK: | |
6424 AttrToChange = &this->uLuck; | |
6425 break; | |
6426 } | |
6427 if ( *AttrToChange <= pBaseValue ) | |
6428 pStep = pDroppedStep; | |
6429 if ( *AttrToChange - pStep >= uMinValue ) | |
6430 *AttrToChange -= pStep; | |
0 | 6431 } |
6432 | |
6433 //----- (004905F5) -------------------------------------------------------- | |
6434 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
1273 | 6435 void Player::IncreaseAttribute( int eAttribute ) |
6436 { | |
6437 int raceId; // eax@1 | |
6438 int maxValue; // ebx@1 | |
6439 signed int baseStep; // edi@1 | |
6440 signed int tmp; // eax@17 | |
0 | 6441 signed int result; // eax@18 |
1273 | 6442 int baseValue; // [sp+Ch] [bp-8h]@1 |
6443 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
6444 unsigned short* statToChange; | |
6445 | |
6446 raceId = GetRace(); | |
6447 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
6448 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
6449 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
6450 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
6451 PlayerCreation_GetUnspentAttributePointCount(); | |
6452 switch ( eAttribute ) | |
6453 { | |
6454 case 0: | |
6455 statToChange = &this->uMight; | |
6456 break; | |
6457 case 1: | |
6458 statToChange = &this->uIntelligence; | |
6459 break; | |
6460 case 2: | |
6461 statToChange = &this->uWillpower; | |
6462 break; | |
6463 case 3: | |
6464 statToChange = &this->uEndurance; | |
6465 break; | |
6466 case 4: | |
6467 statToChange = &this->uAccuracy; | |
6468 break; | |
6469 case 5: | |
6470 statToChange = &this->uSpeed; | |
6471 break; | |
6472 case 6: | |
6473 statToChange = &this->uLuck; | |
6474 default: | |
6475 assert(false); | |
6476 return; | |
6477 break; | |
6478 } | |
6479 if ( *statToChange < baseValue ) | |
6480 { | |
6481 tmp = baseStep; | |
6482 baseStep = droppedStep; | |
6483 droppedStep = tmp; | |
6484 } | |
6485 result = PlayerCreation_GetUnspentAttributePointCount(); | |
6486 if ( result >= droppedStep ) | |
6487 { | |
6488 if ( baseStep + *statToChange <= maxValue ) | |
6489 *statToChange += baseStep; | |
6490 } | |
0 | 6491 } |
6492 | |
6493 //----- (0049070F) -------------------------------------------------------- | |
6494 void Player::Zero() | |
6495 { | |
6496 this->sLevelModifier = 0; | |
6497 this->sACModifier = 0; | |
6498 this->uLuckBonus = 0; | |
6499 this->uAccuracyBonus = 0; | |
6500 this->uSpeedBonus = 0; | |
6501 this->uEnduranceBonus = 0; | |
6502 this->uWillpowerBonus = 0; | |
6503 this->uIntelligenceBonus = 0; | |
6504 this->uMightBonus = 0; | |
6505 this->field_100 = 0; | |
6506 this->field_FC = 0; | |
6507 this->field_F8 = 0; | |
6508 this->field_F4 = 0; | |
6509 this->field_F0 = 0; | |
6510 this->field_EC = 0; | |
6511 this->field_E8 = 0; | |
6512 this->field_E4 = 0; | |
6513 this->field_E0 = 0; | |
766 | 6514 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6515 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6516 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6517 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6518 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6519 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6520 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6521 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6522 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6523 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6524 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6525 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
6526 this->uFullHealthBonus = 0; |
0 | 6527 } |
6528 | |
6529 //----- (004907E7) -------------------------------------------------------- | |
299 | 6530 unsigned int Player::GetStatColor(int uStat) |
0 | 6531 { |
6532 __int16 uWhite; // si@1 | |
290 | 6533 int attribute_value; // edx@1 |
299 | 6534 unsigned __int8 pBaseAttrValue; // of@1 |
0 | 6535 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6536 __int16 uRed; // [sp+Ch] [bp-4h]@1 | |
6537 | |
1014 | 6538 uRed = TargetColor(255, 35, 0); |
6539 uGreen = TargetColor(0, 255, 0); | |
6540 uWhite = TargetColor(255, 255, 255); | |
299 | 6541 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; |
290 | 6542 |
0 | 6543 switch (uStat) |
6544 { | |
6545 case 0: attribute_value = uMight; break; | |
6546 case 1: attribute_value = uIntelligence; break; | |
6547 case 2: attribute_value = uWillpower; break; | |
6548 case 3: attribute_value = uEndurance; break; | |
290 | 6549 case 4: attribute_value = uAccuracy; break; |
6550 case 5: attribute_value = uSpeed; break; | |
0 | 6551 case 6: attribute_value = uLuck; break; |
6552 }; | |
6553 | |
299 | 6554 if ( attribute_value == pBaseAttrValue ) |
290 | 6555 return uWhite; |
299 | 6556 else if ( attribute_value > pBaseAttrValue ) |
290 | 6557 return uGreen; |
0 | 6558 else |
290 | 6559 return uRed; |
0 | 6560 } |
6561 | |
6562 //----- (004908A8) -------------------------------------------------------- | |
6563 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
6564 { | |
1014 | 6565 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
6566 { | |
6567 pConditions[uCondition]=0i64; | |
6568 return true; | |
0 | 6569 } |
6570 else | |
1014 | 6571 return false; |
0 | 6572 } |
6573 | |
6574 //----- (004680ED) -------------------------------------------------------- | |
1019 | 6575 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 6576 { |
6577 Player *v3; // esi@1 | |
6578 signed int v5; // eax@17 | |
6579 int v8; // edx@39 | |
6580 char *v13; // eax@45 | |
6581 signed int v15; // edi@68 | |
6582 int v16; // edx@73 | |
6583 unsigned __int16 v17; // edi@73 | |
6584 unsigned int v18; // eax@73 | |
6585 const char *v22; // eax@84 | |
6586 int scroll_id; // esi@96 | |
6587 int v25; // eax@109 | |
6588 int v26; // eax@113 | |
6589 int new_mana_val; // edi@114 | |
6590 signed __int64 v28; // qax@120 | |
6591 __int64 v30; // edi@137 | |
6592 __int64 v32; // ST3C_4@137 | |
6593 __int64 v34; // ST34_4@137 | |
6594 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
6595 const char *v66; // [sp-4h] [bp-30h]@69 | |
6596 signed int v67; // [sp-4h] [bp-30h]@77 | |
6597 const char *v68; // [sp-4h] [bp-30h]@89 | |
6598 char v72; // [sp+20h] [bp-Ch]@68 | |
6599 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 6600 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 6601 Player *thisb; // [sp+28h] [bp-4h]@1 |
6602 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
6603 | |
6604 thisb = this; | |
6605 v3 = &pParty->pPlayers[player_num-1]; | |
6606 v73 = 1; | |
6607 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) ) | |
6608 return; | |
6609 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 6610 { |
1021 | 6611 if ( pParty->pPickedItem.uItemID == 160 ) |
6612 { | |
6613 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6614 } | |
6615 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 6616 { |
1021 | 6617 new_mana_val = v3->sMana; |
6618 new_mana_val += 2; | |
6619 if ( new_mana_val > v3->GetMaxMana() ) | |
6620 new_mana_val = v3->GetMaxMana(); | |
6621 v3->PlaySound(SPEECH_36, 0); | |
6622 } | |
6623 else if ( pParty->pPickedItem.uItemID == 162 ) | |
6624 { | |
6625 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 6626 v3->PlaySound(SPEECH_36, 0); |
1021 | 6627 |
6628 } | |
6629 else | |
6630 { | |
6631 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6632 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
|
6633 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 6634 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6635 return; | |
1019 | 6636 } |
1032 | 6637 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
6638 | |
6639 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6640 { | |
6641 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6642 } | |
6643 if ( v73 ) | |
6644 { | |
6645 if ( pParty->bTurnBasedModeOn ) | |
6646 { | |
6647 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6648 thisb->SetRecoveryTime(100); | |
6649 pTurnEngine->_40471C(); | |
6650 } | |
6651 else | |
6652 { | |
6653 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6654 } | |
6655 } | |
6656 pMouse->RemoveHoldingItem(); | |
6657 return; | |
6658 | |
1021 | 6659 |
6660 } | |
6661 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 6662 { |
1021 | 6663 switch ( pParty->pPickedItem.uItemID ) |
6664 { | |
6665 case 221: //Catalyst | |
6666 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
6667 break; | |
6668 case 222: //Cure Wounds | |
6669 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
6670 pParty->pPlayers[player_num-1].Heal(v25); | |
6671 v3->PlaySound(SPEECH_36, 0); | |
6672 break; | |
6673 case 223: //Magic Potion | |
6674 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
6675 new_mana_val = v3->sMana; | |
6676 new_mana_val += v26; | |
6677 if ( new_mana_val > v3->GetMaxMana() ) | |
6678 new_mana_val = v3->GetMaxMana(); | |
6679 v3->PlaySound(SPEECH_36, 0); | |
6680 break; | |
6681 case 224: //Cure Weakness | |
6682 v3->pConditions[Condition_Weak] = 0i64; | |
6683 v3->PlaySound(SPEECH_36, 0); | |
6684 break; | |
6685 case 225: //Cure Disease | |
6686 v3->pConditions[Condition_Disease3] = 0i64; | |
6687 v3->pConditions[Condition_Disease2] = 0i64; | |
6688 v3->pConditions[Condition_Disease1] = 0i64; | |
6689 v3->PlaySound(SPEECH_36, 0); | |
6690 break; | |
6691 case 226: //Cure Poison | |
6692 v3->pConditions[Condition_Poison3] = 0i64; | |
6693 v3->pConditions[Condition_Poison2] = 0i64; | |
6694 v3->pConditions[Condition_Poison1] = 0i64; | |
6695 v3->PlaySound(SPEECH_36, 0); | |
6696 break; | |
6697 case 227: //Awaken | |
6698 v3->pConditions[Condition_Sleep] = 0i64; | |
6699 v3->PlaySound(SPEECH_36, 0); | |
6700 break; | |
6701 case 228: //Haste | |
6702 if ( !v3->pConditions[Condition_Weak] ) | |
6703 { | |
6704 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6705 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6706 v3->PlaySound(SPEECH_36, 0); | |
6707 } | |
6708 break; | |
6709 case 229: //Heroism | |
6710 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6711 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6712 v3->PlaySound(SPEECH_36, 0); | |
6713 break; | |
6714 case 230: //Bless | |
6715 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6716 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6717 v3->PlaySound(SPEECH_36, 0); | |
6718 break; | |
6719 case 231: //Preservation | |
1032 | 6720 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6721 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6722 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6723 v3->PlaySound(SPEECH_36, 0); | |
6724 break; | |
6725 case 232: //Shield | |
1032 | 6726 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6727 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6728 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6729 v3->PlaySound(SPEECH_36, 0); | |
6730 break; | |
6731 case 234: //Stoneskin | |
6732 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
6733 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
6734 v3->PlaySound(SPEECH_36, 0); | |
6735 break; | |
6736 case 235: //Water Breathing | |
6737 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
6738 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
6739 break; | |
6740 case 237: //Remove Fear | |
6741 v3->pConditions[Condition_Fear] = 0i64; | |
6742 v3->PlaySound(SPEECH_36, 0); | |
6743 break; | |
6744 case 238: //Remove Curse | |
6745 v3->pConditions[Condition_Cursed] = 0i64; | |
6746 v3->PlaySound(SPEECH_36, 0); | |
6747 break; | |
6748 case 239: //Cure Insanity | |
6749 v3->pConditions[Condition_Insane] = 0i64; | |
6750 v3->PlaySound(SPEECH_36, 0); | |
6751 break; | |
6752 case 240: //Might Boost | |
1032 | 6753 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6754 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6755 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6756 v3->PlaySound(SPEECH_36, 0); | |
6757 break; | |
6758 case 241: //Intellect Boost | |
1032 | 6759 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6760 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6761 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6762 v3->PlaySound(SPEECH_36, 0); | |
6763 break; | |
6764 case 242: //Personality Boost | |
1032 | 6765 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6766 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6767 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6768 v3->PlaySound(SPEECH_36, 0); | |
6769 break; | |
6770 case 243://Endurance Boost | |
1032 | 6771 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6772 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6773 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6774 v3->PlaySound(SPEECH_36, 0); | |
6775 break; | |
6776 case 244: //Speed Boost | |
1032 | 6777 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6778 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6779 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6780 v3->PlaySound(SPEECH_36, 0); | |
6781 break; | |
6782 case 245: //Accuracy Boost | |
1032 | 6783 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6784 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6785 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6786 v3->PlaySound(SPEECH_36, 0); | |
6787 break; | |
6788 case 251: //Cure Paralysis | |
6789 v3->pConditions[Condition_Paralyzed] = 0i64; | |
6790 v3->PlaySound(SPEECH_36, 0); | |
6791 break; | |
6792 case 252://Divine Restoration | |
6793 v30 = v3->pConditions[Condition_Dead]; | |
6794 v32 = v3->pConditions[Condition_Pertified]; | |
6795 v34 = v3->pConditions[Condition_Eradicated]; | |
6796 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
6797 v3->pConditions[Condition_Dead] = v30; | |
6798 v3->pConditions[Condition_Pertified] = v32; | |
6799 v3->pConditions[Condition_Eradicated] = v34; | |
6800 v3->PlaySound(SPEECH_36, 0); | |
6801 break; | |
6802 case 253: //Divine Cure | |
6803 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6804 pParty->pPlayers[player_num-1].Heal(v25); | |
6805 v3->PlaySound(SPEECH_36, 0); | |
6806 break; | |
6807 case 254: //Divine Power | |
6808 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6809 new_mana_val = v3->sMana; | |
6810 new_mana_val += v26; | |
6811 if ( new_mana_val > v3->GetMaxMana() ) | |
6812 new_mana_val = v3->GetMaxMana(); | |
6813 v3->PlaySound(SPEECH_36, 0); | |
6814 break; | |
6815 case 255: //Luck Boost | |
1032 | 6816 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6817 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6818 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6819 v3->PlaySound(SPEECH_36, 0); | |
6820 break; | |
6821 case 256: //Fire Resistance | |
1032 | 6822 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6823 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6824 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6825 v3->PlaySound(SPEECH_36, 0); | |
1032 | 6826 break; |
1021 | 6827 case 257: //Air Resistance |
1032 | 6828 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6829 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6830 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6831 v3->PlaySound(SPEECH_36, 0); | |
6832 break; | |
6833 case 258: //Water Resistance | |
1032 | 6834 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6835 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6836 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6837 v3->PlaySound(SPEECH_36, 0); | |
6838 break; | |
6839 case 259: //Earth Resistance | |
1032 | 6840 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6841 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6842 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6843 v3->PlaySound(SPEECH_36, 0); | |
6844 break; | |
6845 case 260: //Mind Resistance | |
1032 | 6846 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6847 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6848 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6849 v3->PlaySound(SPEECH_36, 0); | |
6850 break; | |
6851 case 261: //Body Resistance | |
1032 | 6852 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6853 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6854 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6855 v3->PlaySound(SPEECH_36, 0); | |
6856 break; | |
6857 case 262: //Stone to Flesh | |
6858 v3->pConditions[Condition_Pertified] = 0i64; | |
6859 v3->PlaySound(SPEECH_36, 0); | |
6860 break; | |
6861 case 264: //Pure Luck | |
6862 if ( !v3->pure_luck_used ) | |
6863 { | |
6864 v3->uLuck += 50; | |
6865 v3->pure_luck_used = 1; | |
6866 } | |
6867 v3->PlaySound(SPEECH_36, 0); | |
6868 break; | |
6869 case 265: //Pure Speed | |
6870 if ( !v3->pure_speed_used ) | |
6871 { | |
6872 v3->uSpeed += 50; | |
6873 v3->pure_speed_used = 1; | |
6874 } | |
6875 v3->PlaySound(SPEECH_36, 0); | |
6876 break; | |
6877 case 266: //Pure Intellect | |
6878 if ( !v3->pure_intellect_used ) | |
6879 { | |
6880 v3->uIntelligence += 50; | |
6881 v3->pure_intellect_used = 1; | |
6882 } | |
6883 v3->PlaySound(SPEECH_36, 0); | |
6884 break; | |
6885 case 267: //Pure Endurance | |
6886 if ( !v3->pure_endurance_used ) | |
6887 { | |
6888 v3->uEndurance += 50; | |
6889 v3->pure_endurance_used = 1; | |
6890 } | |
6891 v3->PlaySound(SPEECH_36, 0); | |
6892 break; | |
6893 case 268: //Pure Personality | |
6894 if ( !v3->pure_willpower_used ) | |
6895 { | |
6896 v3->uWillpower += 50; | |
6897 v3->pure_willpower_used = 1; | |
6898 } | |
6899 v3->PlaySound(SPEECH_36, 0); | |
6900 break; | |
6901 case 269: //Pure Accuracy | |
6902 if ( !v3->pure_accuracy_used ) | |
6903 { | |
6904 v3->uAccuracy += 50; | |
6905 v3->pure_accuracy_used = 1; | |
6906 } | |
6907 v3->PlaySound(SPEECH_36, 0); | |
6908 break; | |
6909 case 270: //Pure Might | |
6910 if ( !v3->pure_might_used ) | |
6911 { | |
6912 v3->uMight += 50; | |
6913 v3->pure_might_used = 1; | |
6914 } | |
6915 v3->PlaySound(SPEECH_36, 0); | |
6916 break; | |
6917 case 271: //Rejuvenation | |
6918 v3->sAgeModifier = 0; | |
6919 v3->PlaySound(SPEECH_36, 0); | |
6920 break; | |
6921 | |
6922 default: | |
6923 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6924 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
|
6925 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 6926 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6927 return; | |
1032 | 6928 } |
6929 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
6930 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6931 { | |
6932 if ( !v73 ) | |
6933 { | |
6934 pMouse->RemoveHoldingItem(); | |
6935 return; | |
6936 } | |
6937 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 6938 } |
1032 | 6939 if ( v73 ) |
6940 { | |
6941 if ( pParty->bTurnBasedModeOn ) | |
6942 { | |
6943 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6944 thisb->SetRecoveryTime(100); | |
6945 pTurnEngine->_40471C(); | |
6946 } | |
6947 else | |
6948 { | |
6949 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6950 } | |
6951 } | |
6952 pMouse->RemoveHoldingItem(); | |
6953 return; | |
6954 | |
1021 | 6955 } |
6956 | |
6957 | |
6958 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
6959 { | |
6960 | |
6961 | |
6962 if ( pCurrentScreen == SCREEN_CASTING ) | |
6963 return; | |
6964 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
6965 { | |
6966 | |
6967 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6968 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6969 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6970 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6971 return; |
6972 } | |
6973 if ( bUnderwater == 1 ) | |
6974 { | |
1032 | 6975 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
6976 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 6977 return; |
6978 } | |
6979 dword_50C9AC = 1; | |
6980 scroll_id = pParty->pPickedItem.uItemID - 299; | |
6981 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
6982 { | |
6983 pMouse->RemoveHoldingItem(); | |
6984 pGUIWindow_CurrentMenu->Release(); | |
6985 pIcons_LOD->_4114F2(); | |
6986 pCurrentScreen = SCREEN_GAME; | |
6987 viewparams->bRedrawGameUI = 1; | |
6988 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
6989 } | |
6990 else | |
6991 { | |
6992 _720984_unused = pParty->pPickedItem.uItemID; | |
6993 pMouse->RemoveHoldingItem(); | |
6994 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
6995 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
6996 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
6997 { | |
6998 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6999 } | |
7000 } | |
7001 return; | |
7002 } | |
7003 | |
7004 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
7005 | |
7006 { | |
7007 v15 = pParty->pPickedItem.uItemID - 400; | |
7008 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
7009 if ( v72 ) | |
7010 { | |
7011 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7012 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
|
7013 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7014 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7015 return; |
7016 } | |
7017 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
7018 { | |
7019 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7020 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
|
7021 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7022 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7023 return; |
7024 } | |
7025 v16 = v15 % 11 + 1; | |
7026 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
7027 v18 = SkillToMastery(v17) - 1; | |
1032 | 7028 switch (v18) |
7029 { | |
7030 case 0: v67 = 4; break; | |
7031 case 1: v67 = 7; break; | |
7032 case 2: v67 = 10; break; | |
7033 case 3: v67 = 11; break; | |
7034 default: | |
7035 v67 = player_num; | |
7036 } | |
7037 | |
7038 if ( v16 > v67 || !v17 ) | |
1021 | 7039 { |
1032 | 7040 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7041 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
|
7042 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7043 v3->PlaySound((PlayerSpeech)20, 0); |
7044 return; | |
7045 } | |
7046 // v72 = 1; | |
7047 v3->PlaySound(SPEECH_21, 0); | |
7048 v73 = 0; | |
7049 | |
7050 | |
7051 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
7052 { | |
7053 if ( !v73 ) | |
1021 | 7054 { |
1032 | 7055 pMouse->RemoveHoldingItem(); |
7056 return; | |
7057 } | |
7058 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
7059 } | |
7060 if ( v73 ) | |
7061 { | |
7062 if ( pParty->bTurnBasedModeOn ) | |
7063 { | |
7064 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
7065 thisb->SetRecoveryTime(100); | |
7066 pTurnEngine->_40471C(); | |
1021 | 7067 } |
7068 else | |
7069 { | |
1032 | 7070 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 7071 } |
7072 } | |
1032 | 7073 pMouse->RemoveHoldingItem(); |
7074 return; | |
7075 | |
1021 | 7076 } |
7077 | |
7078 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
7079 | |
7080 { | |
7081 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
7082 { | |
7083 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 7084 v3->PlaySound(SPEECH_37, 0); |
1021 | 7085 return; |
7086 } | |
7087 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7088 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7089 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7090 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7091 return; |
7092 } | |
7093 else | |
7094 { | |
1019 | 7095 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 7096 { |
7097 thisa = pParty->uCurrentMonthWeek + 1; | |
7098 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 7099 v74 = NULL; |
1021 | 7100 else |
7101 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
7102 switch ( pParty->uCurrentMonth ) | |
7103 { | |
1019 | 7104 case 0: |
1021 | 7105 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7106 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7107 break; |
1019 | 7108 case 1: |
1021 | 7109 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7110 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7111 break; |
1019 | 7112 case 2: |
1021 | 7113 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7114 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7115 break; |
1019 | 7116 case 3: |
1021 | 7117 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7118 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7119 break; |
1019 | 7120 case 4: |
1021 | 7121 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7122 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7123 break; |
1019 | 7124 case 5: |
1021 | 7125 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7126 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7127 break; |
1019 | 7128 case 6: |
1021 | 7129 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7130 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 7131 break; |
1019 | 7132 case 7: |
1021 | 7133 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7134 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 7135 break; |
1019 | 7136 case 8: |
1021 | 7137 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7138 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 7139 break; |
0 | 7140 case 9u: |
1021 | 7141 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7142 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 7143 break; |
1019 | 7144 case 10: |
1021 | 7145 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7146 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 7147 break; |
1019 | 7148 case 11: |
1021 | 7149 v8 = rand() % 6; |
7150 switch (v8) | |
7151 { | |
7152 case 0: | |
7153 v3->sResFireBase += thisa; | |
7154 v13 = pGlobalTXT_LocalizationStrings[87]; | |
7155 break; | |
7156 case 1: | |
7157 v3->sResAirBase += thisa; | |
7158 v13 = pGlobalTXT_LocalizationStrings[6]; | |
7159 break; | |
7160 case 2: | |
7161 v3->sResWaterBase += thisa; | |
7162 v13 = pGlobalTXT_LocalizationStrings[240]; | |
7163 break; | |
7164 case 3: | |
7165 v3->sResEarthBase += thisa; | |
7166 v13 = pGlobalTXT_LocalizationStrings[70]; | |
7167 break; | |
7168 case 4: | |
7169 v3->sResMindBase += thisa; | |
7170 v13 = pGlobalTXT_LocalizationStrings[142]; | |
7171 break; | |
7172 case 5: | |
7173 v3->sResBodyBase += thisa; | |
7174 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 7175 break; |
1021 | 7176 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7177 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 7178 break; |
7179 | |
7180 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7181 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 7182 pMouse->RemoveHoldingItem(); |
7183 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
7184 v3->PlaySound(SPEECH_93, 0); | |
1032 | 7185 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7186 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 7187 { |
1021 | 7188 v3->SetCondition(Condition_Eradicated, 0); |
7189 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 7190 } |
1021 | 7191 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
7192 { | |
7193 v3->SetCondition(Condition_Dead, 0); | |
7194 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7195 } | |
7196 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
7197 { | |
7198 v3->SetCondition(Condition_Pertified, 0); | |
7199 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
7200 } | |
1019 | 7201 return; |
1021 | 7202 } |
7203 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
7204 { | |
7205 Party::GiveFood(1u); | |
7206 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
7207 | |
7208 } | |
7209 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
7210 { | |
7211 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
7212 return; | |
7213 } | |
7214 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
7215 { | |
7216 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
7217 return; | |
7218 } | |
7219 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
7220 { | |
7221 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
7222 return; | |
7223 } | |
1032 | 7224 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 7225 { |
7226 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 7227 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 7228 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
7229 v3->AddVariable(VAR_NumSkillPoints, 2); | |
7230 } | |
7231 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
7232 { | |
7233 sub_44C28F_open_nwc_dungeon(); | |
7234 return; | |
7235 } | |
0 | 7236 else |
1021 | 7237 { |
7238 | |
7239 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7240 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
|
7241 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 7242 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 7243 return; |
7244 } | |
1032 | 7245 |
0 | 7246 pMouse->RemoveHoldingItem(); |
7247 return; | |
7248 } | |
1021 | 7249 |
7250 } | |
0 | 7251 |
7252 //----- (00449BB4) -------------------------------------------------------- | |
484 | 7253 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 7254 { |
0 | 7255 Player *v3; // esi@1 |
7256 signed int v4; // edi@1 | |
7257 unsigned int v5; // eax@8 | |
7258 int v6; // eax@9 | |
7259 enum CHARACTER_RACE v7; // eax@11 | |
7260 signed int v8; // eax@17 | |
7261 unsigned __int8 v9; // sf@17 | |
7262 unsigned __int8 v10; // of@17 | |
7263 int v11; // eax@19 | |
7264 unsigned int v12; // eax@20 | |
484 | 7265 unsigned int test_bit_value; // eax@25 |
7266 unsigned __int8 our_bit_value; // cl@25 | |
0 | 7267 signed int v15; // ecx@28 |
7268 ItemGen *v16; // eax@28 | |
7269 char v17; // zf@31 | |
7270 int v18; // edi@90 | |
7271 DDM_DLV_Header *v19; // eax@122 | |
7272 char v20; // cl@124 | |
7273 DDM_DLV_Header *v21; // eax@126 | |
7274 unsigned int v22; // edi@129 | |
100 | 7275 Player *v23; // esi@134 |
0 | 7276 ItemGen *v24; // ecx@135 |
7277 signed int v25; // edx@135 | |
7278 ITEM_EQUIP_TYPE v26; // ebx@155 | |
7279 char *v27; // edi@155 | |
7280 int v28; // ebx@161 | |
7281 int v29; // eax@161 | |
7282 | |
469 | 7283 v6 = 0; |
0 | 7284 v3 = this; |
7285 v4 = -1; | |
469 | 7286 if ( VarNum > VAR_AutoNotes ) |
7287 { | |
7288 switch ( VarNum ) | |
0 | 7289 { |
7290 case VAR_Invisible: | |
1167 | 7291 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 7292 return true; |
484 | 7293 return false; |
0 | 7294 case VAR_NumDeaths: |
7295 v4 = pParty->uNumDeaths; | |
469 | 7296 return v4 >= pValue; |
0 | 7297 case VAR_NumBounties: |
7298 v4 = pParty->uNumBountiesCollected; | |
469 | 7299 return v4 >= pValue; |
0 | 7300 case VAR_PrisonTerms: |
7301 v4 = pParty->uNumPrisonTerms; | |
469 | 7302 return v4 >= pValue; |
0 | 7303 case VAR_ArenaWinsPage: |
7304 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 7305 return v4 >= pValue; |
0 | 7306 case VAR_ArenaWinsSquire: |
7307 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 7308 return v4 >= pValue; |
0 | 7309 case VAR_ArenaWinsKnight: |
7310 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 7311 return v4 >= pValue; |
0 | 7312 case VAR_ArenaWinsLord: |
7313 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 7314 return v4 >= pValue; |
0 | 7315 case VAR_ReputationInCurrentLocation: |
7316 v19 = &pOutdoor->ddm; | |
7317 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7318 v19 = &pIndoor->dlv; | |
469 | 7319 v6 = v19->uReputation >= pValue; |
7320 return v6; | |
0 | 7321 case VAR_History_28|VAR_Sex: |
7322 v21 = &pOutdoor->ddm; | |
7323 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7324 v21 = &pIndoor->dlv; | |
469 | 7325 v6 = v21->field_C_alert == pValue; |
0 | 7326 return v6; |
7327 case VAR_MonthEquals2|VAR_Sex: | |
7328 case VAR_MonthEquals2|VAR_Class: | |
7329 case VAR_Counter1: | |
7330 case VAR_Counter2: | |
7331 case VAR_Counter3: | |
7332 case VAR_Counter4: | |
7333 case VAR_Counter5: | |
7334 case VAR_Counter6: | |
7335 case VAR_Counter7: | |
7336 case VAR_Counter8: | |
469 | 7337 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
7338 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
7339 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
7340 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
7341 return true; | |
7342 return false; | |
0 | 7343 case VAR_NumSkillPoints: |
7344 v4 = this->uSkillPoints; | |
469 | 7345 return v4 >= pValue; |
0 | 7346 case VAR_CircusPrises: |
7347 v4 = 0; | |
100 | 7348 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 7349 do |
7350 { | |
469 | 7351 v24 = v23->pInventoryItems; |
0 | 7352 v25 = 138; |
7353 do | |
7354 { | |
7355 switch ( v24->uItemID ) | |
7356 { | |
7357 case 0x1D6u: | |
7358 ++v4; | |
7359 break; | |
7360 case 0x1D7u: | |
7361 v4 += 3; | |
7362 break; | |
7363 case 0x1DDu: | |
7364 v4 += 5; | |
7365 break; | |
7366 } | |
7367 ++v24; | |
7368 --v25; | |
7369 } | |
7370 while ( v25 ); | |
100 | 7371 ++v23; |
0 | 7372 } |
100 | 7373 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 7374 return v4 >= pValue; |
0 | 7375 case VAR_MonthEquals2: |
469 | 7376 v6 = pParty->uCurrentMonth == pValue; |
7377 return v6; | |
0 | 7378 case VAR_IsFlying: |
7379 if ( pParty->bFlying | |
1167 | 7380 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 7381 return true; |
7382 return false; | |
0 | 7383 case VAR_HiredNPCHasSpeciality: |
469 | 7384 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 7385 return v6; |
7386 case VAR_NPCs2: | |
469 | 7387 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 7388 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 7389 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7390 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 7391 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 7392 return v4 >= pValue; |
7393 v4 = pValue; | |
7394 return v4 >= pValue; | |
0 | 7395 case VAR_ItemEquipped: |
7396 v26 = (ITEM_EQUIP_TYPE)0; | |
7397 v27 = (char *)&this->pEquipment; | |
7398 break; | |
7399 case VAR_GoldInBank: | |
7400 v4 = pParty->uNumGoldInBank; | |
469 | 7401 return v4 >= pValue; |
0 | 7402 case VAR_ThieverySkill|0x80: |
7403 v28 = GetActualMight(); | |
7404 v29 = v3->GetBaseStrength(); | |
7405 goto LABEL_168; | |
7406 case VAR_DisarmTrapSkill|0x80: | |
7407 v28 = GetActualIntelligence(); | |
7408 v29 = v3->GetBaseIntelligence(); | |
7409 goto LABEL_168; | |
7410 case VAR_MonthEquals: | |
7411 v28 = GetActualWillpower(); | |
7412 v29 = v3->GetBaseWillpower(); | |
7413 goto LABEL_168; | |
7414 case VAR_MonthEquals|VAR_Sex: | |
7415 v28 = GetActualEndurance(); | |
7416 v29 = v3->GetBaseEndurance(); | |
7417 goto LABEL_168; | |
7418 case VAR_IdentifyMonsterSkill|0x80: | |
7419 v28 = GetActualSpeed(); | |
7420 v29 = v3->GetBaseSpeed(); | |
7421 goto LABEL_168; | |
7422 case VAR_ArmsmasterSkill|0x80: | |
7423 v28 = GetActualAccuracy(); | |
7424 v29 = v3->GetBaseAccuracy(); | |
7425 goto LABEL_168; | |
7426 case VAR_MonthEquals|VAR_MaxHP: | |
7427 v28 = GetActualLuck(); | |
7428 v29 = v3->GetBaseLuck(); | |
7429 LABEL_168: | |
7430 v10 = __OFSUB__(v28, v29); | |
7431 v9 = v28 - v29 < 0; | |
7432 LABEL_169: | |
7433 if ( v9 ^ v10 ) | |
469 | 7434 return v4 >= pValue; |
7435 return true; | |
0 | 7436 default: |
469 | 7437 return v4 >= pValue; |
0 | 7438 } |
7439 while ( !v3->HasItemEquipped(v26) | |
654 | 7440 || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) |
0 | 7441 { |
7442 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
7443 v27 += 4; | |
7444 if ( (signed int)v26 >= 16 ) | |
469 | 7445 return false; |
7446 } | |
7447 return true; | |
7448 } | |
7449 if ( VarNum == VAR_AutoNotes ) | |
0 | 7450 { |
1033 | 7451 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
7452 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 7453 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7454 return false; | |
7455 return true; | |
469 | 7456 } |
7457 if ( VarNum <= VAR_BaseLuck ) | |
7458 { | |
7459 if ( VarNum != VAR_BaseLuck ) | |
7460 { | |
7461 switch ( VarNum ) | |
0 | 7462 { |
7463 case VAR_Hour: | |
469 | 7464 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
7465 return true; | |
7466 return false; | |
0 | 7467 case VAR_DayOfYear: |
469 | 7468 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
7469 v6 = v5 == pValue; | |
7470 return v6; | |
0 | 7471 case VAR_DayOfWeek: |
469 | 7472 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
7473 v6 = v5 == pValue; | |
0 | 7474 return v6; |
7475 case VAR_Sex: | |
469 | 7476 if ( pValue == (CHARACTER_RACE)this->uSex ) |
7477 return true; | |
7478 return v4 >= pValue; | |
0 | 7479 case VAR_Class: |
135 | 7480 v7 = (CHARACTER_RACE)this->classType; |
469 | 7481 if ( pValue == v7 ) |
7482 return true; | |
7483 return v4 >= pValue; | |
0 | 7484 case VAR_Race: |
7485 v7 = GetRace(); | |
469 | 7486 if ( pValue == v7 ) |
7487 return true; | |
7488 return v4 >= pValue; | |
0 | 7489 case VAR_CurrentHP: |
7490 v4 = this->sHealth; | |
469 | 7491 return v4 >= pValue; |
0 | 7492 case VAR_MaxHP: |
7493 v8 = GetMaxHealth(); | |
7494 v10 = __OFSUB__(v3->sHealth, v8); | |
7495 v9 = v3->sHealth - v8 < 0; | |
7496 goto LABEL_169; | |
7497 case VAR_CurrentSP: | |
7498 v4 = this->sMana; | |
469 | 7499 return v4 >= pValue; |
0 | 7500 case VAR_MaxSP: |
7501 v11 = GetMaxMana(); | |
7502 v10 = __OFSUB__(v3->sMana, v11); | |
7503 v9 = v3->sMana - v11 < 0; | |
7504 goto LABEL_169; | |
7505 case VAR_ActualAC: | |
7506 v12 = GetActualAC(); | |
7507 goto _j_cmp_against_arg; | |
7508 case VAR_ACModifier: | |
7509 v4 = this->sACModifier; | |
469 | 7510 return v4 >= pValue; |
0 | 7511 case VAR_BaseLevel: |
7512 v4 = this->uLevel; | |
469 | 7513 return v4 >= pValue; |
0 | 7514 case VAR_LevelModifier: |
7515 v4 = this->sLevelModifier; | |
469 | 7516 return v4 >= pValue; |
0 | 7517 case VAR_Age: |
7518 v12 = GetActualAge(); | |
7519 goto _j_cmp_against_arg; | |
7520 case VAR_Award: | |
1033 | 7521 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
7522 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 7523 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
7524 return true; | |
7525 return false; | |
0 | 7526 case VAR_Experience: |
7527 v4 = LODWORD(this->uExperience); | |
469 | 7528 return v4 >= pValue; |
0 | 7529 case VAR_QBits_QuestsDone: |
484 | 7530 test_bit_value = 0x80u >> (pValue - 1) % 8; |
7531 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
7532 if ( test_bit_value & our_bit_value ) | |
478 | 7533 return true; |
7534 return false; | |
0 | 7535 case VAR_PlayerItemInHands: |
7536 v15 = 0; | |
7537 v16 = v3->pInventoryItems; | |
7538 break; | |
7539 case VAR_FixedGold: | |
7540 v4 = pParty->uNumGold; | |
469 | 7541 return v4 >= pValue; |
0 | 7542 case VAR_MightBonus: |
7543 v4 = this->uMightBonus; | |
469 | 7544 return v4 >= pValue; |
0 | 7545 case VAR_IntellectBonus: |
7546 v4 = this->uIntelligenceBonus; | |
469 | 7547 return v4 >= pValue; |
0 | 7548 case VAR_PersonalityBonus: |
7549 v4 = this->uWillpowerBonus; | |
469 | 7550 return v4 >= pValue; |
0 | 7551 case VAR_EnduranceBonus: |
7552 v4 = this->uEnduranceBonus; | |
469 | 7553 return v4 >= pValue; |
0 | 7554 case VAR_SpeedBonus: |
7555 v4 = this->uSpeedBonus; | |
469 | 7556 return v4 >= pValue; |
0 | 7557 case VAR_AccuracyBonus: |
7558 v4 = this->uAccuracyBonus; | |
469 | 7559 return v4 >= pValue; |
0 | 7560 case VAR_LuckBonus: |
7561 v4 = this->uLuckBonus; | |
469 | 7562 return v4 >= pValue; |
0 | 7563 case VAR_BaseMight: |
7564 v4 = this->uMight; | |
469 | 7565 return v4 >= pValue; |
0 | 7566 case VAR_BaseIntellect: |
7567 v4 = this->uIntelligence; | |
469 | 7568 return v4 >= pValue; |
0 | 7569 case VAR_BasePersonality: |
7570 v4 = this->uWillpower; | |
469 | 7571 return v4 >= pValue; |
0 | 7572 case VAR_BaseEndurance: |
7573 v4 = this->uEndurance; | |
469 | 7574 return v4 >= pValue; |
0 | 7575 case VAR_BaseSpeed: |
7576 v4 = this->uSpeed; | |
469 | 7577 return v4 >= pValue; |
0 | 7578 case VAR_BaseAccuracy: |
7579 v4 = this->uAccuracy; | |
469 | 7580 return v4 >= pValue; |
0 | 7581 case VAR_FixedFood: |
7582 v4 = pParty->uNumFoodRations; | |
469 | 7583 return v4 >= pValue; |
0 | 7584 default: |
469 | 7585 return v4 >= pValue; |
7586 } | |
7587 while ( v16->uItemID != pValue ) | |
0 | 7588 { |
7589 ++v15; | |
7590 ++v16; | |
7591 if ( v15 >= 138 ) | |
7592 { | |
469 | 7593 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 7594 return v6; |
7595 } | |
7596 } | |
469 | 7597 return true; |
0 | 7598 } |
7599 v4 = this->uLuck; | |
469 | 7600 return v4 >= pValue; |
7601 } | |
7602 if ( VarNum <= VAR_MagicResistance ) | |
7603 { | |
7604 if ( VarNum == VAR_MagicResistance ) | |
0 | 7605 { |
7606 v4 = this->sResMagicBase; | |
7607 } | |
7608 else | |
7609 { | |
469 | 7610 switch ( VarNum ) |
0 | 7611 { |
7612 case VAR_FireResistance: | |
7613 v4 = this->sResFireBase; | |
469 | 7614 return v4 >= pValue; |
0 | 7615 case VAR_AirResistance: |
7616 v4 = this->sResAirBase; | |
469 | 7617 return v4 >= pValue; |
0 | 7618 case VAR_WaterResistance: |
7619 v4 = this->sResWaterBase; | |
469 | 7620 return v4 >= pValue; |
0 | 7621 case VAR_EarthResistance: |
7622 v4 = this->sResEarthBase; | |
469 | 7623 return v4 >= pValue; |
0 | 7624 case VAR_SpiritResistance: |
7625 v4 = this->sResSpiritBase; | |
469 | 7626 return v4 >= pValue; |
0 | 7627 case VAR_MindResistance: |
7628 v4 = this->sResMindBase; | |
469 | 7629 return v4 >= pValue; |
0 | 7630 case VAR_BodyResistance: |
7631 v4 = this->sResBodyBase; | |
469 | 7632 return v4 >= pValue; |
0 | 7633 case VAR_LightResistance: |
7634 v4 = this->sResLightBase; | |
469 | 7635 return v4 >= pValue; |
0 | 7636 case VAR_DarkResistance: |
7637 v4 = this->sResDarkBase; | |
469 | 7638 return v4 >= pValue; |
0 | 7639 case VAR_ActualMight: |
7640 v12 = GetActualMight(); | |
7641 goto _j_cmp_against_arg; | |
7642 case VAR_ActualIntellect: | |
7643 v12 = GetActualIntelligence(); | |
7644 goto _j_cmp_against_arg; | |
7645 case VAR_ActualPersonality: | |
7646 v12 = GetActualWillpower(); | |
7647 goto _j_cmp_against_arg; | |
7648 case VAR_ActualEndurance: | |
7649 v12 = GetActualEndurance(); | |
7650 goto _j_cmp_against_arg; | |
7651 case VAR_ActualSpeed: | |
7652 v12 = GetActualSpeed(); | |
7653 goto _j_cmp_against_arg; | |
7654 case VAR_ActualAccuracy: | |
7655 v12 = GetActualAccuracy(); | |
7656 goto _j_cmp_against_arg; | |
7657 case VAR_ActualLuck: | |
7658 v12 = GetActualLuck(); | |
7659 _j_cmp_against_arg: | |
7660 v4 = v12; | |
7661 break; | |
7662 default: | |
469 | 7663 return v4 >= pValue; |
7664 } | |
7665 } | |
7666 return v4 >= pValue; | |
7667 } | |
7668 if ( VarNum <= VAR_DisarmTrapSkill ) | |
7669 { | |
7670 if ( VarNum != VAR_DisarmTrapSkill ) | |
7671 { | |
7672 if ( VarNum <= VAR_MindResistanceBonus ) | |
7673 { | |
7674 switch ( VarNum ) | |
0 | 7675 { |
7676 case VAR_MindResistanceBonus: | |
7677 v4 = this->sResMindBonus; | |
7678 break; | |
7679 case VAR_FireResistanceBonus: | |
7680 v4 = this->sResFireBonus; | |
7681 break; | |
7682 case VAR_AirResistanceBonus: | |
7683 v4 = this->sResAirBonus; | |
7684 break; | |
7685 case VAR_WaterResistanceBonus: | |
7686 v4 = this->sResWaterBonus; | |
7687 break; | |
7688 case VAR_EarthResistanceBonus: | |
7689 v4 = this->sResEarthBonus; | |
7690 break; | |
7691 case VAR_SpiritResistanceBonus: | |
7692 v4 = this->sResSpiritBonus; | |
7693 break; | |
7694 } | |
469 | 7695 return v4 >= pValue; |
7696 } | |
7697 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 7698 { |
7699 v4 = this->sResBodyBonus; | |
469 | 7700 return v4 >= pValue; |
7701 } | |
7702 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 7703 { |
7704 v4 = this->sResLightBonus; | |
469 | 7705 return v4 >= pValue; |
7706 } | |
7707 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 7708 { |
7709 v4 = this->sResDarkBonus; | |
469 | 7710 return v4 >= pValue; |
7711 } | |
7712 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 7713 { |
7714 v4 = this->sResMagicBonus; | |
469 | 7715 return v4 >= pValue; |
7716 } | |
7717 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
7718 return v4 >= pValue; | |
0 | 7719 } |
7720 LABEL_90: | |
469 | 7721 v18 = *((short *)&this->pConditions[16] + VarNum); |
7722 if ( pValue <= 63 ) | |
0 | 7723 v4 = v18 & 0x3F; |
7724 else | |
469 | 7725 v4 = pValue & v18; |
7726 return v4 >= pValue; | |
7727 } | |
7728 if ( VarNum == 104 ) | |
0 | 7729 goto LABEL_90; |
469 | 7730 if ( (signed int)VarNum <= 104 ) |
7731 return v4 >= pValue; | |
7732 if ( (signed int)VarNum > 0x79 ) | |
7733 { | |
7734 if ( VarNum != 122 ) | |
7735 { | |
7736 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
7737 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
7738 return v4 >= pValue; | |
0 | 7739 } |
7740 v4 = GetMajorConditionIdx(); | |
7741 if ( v4 != 18 ) | |
7742 { | |
469 | 7743 return v4 >= pValue; |
7744 } | |
7745 v4 = pValue; | |
7746 return v4 >= pValue; | |
7747 } | |
1072 | 7748 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 7749 } |
7750 | |
7751 | |
7752 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 7753 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7754 { | |
7755 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
|
7756 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
|
7757 unsigned int v5_unused; // edi@1 |
0 | 7758 unsigned int v6; // esi@13 |
7759 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
|
7760 signed int v8_unused; // eax@17 |
0 | 7761 ItemGen *v9; // ecx@17 |
7762 int v10; // eax@21 | |
7763 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
|
7764 Player *unused12; // ecx@44 |
0 | 7765 char *v13; // ecx@45 |
7766 Player *v14; // ecx@49 | |
7767 int v15; // ecx@86 | |
7768 int v16; // esi@106 | |
7769 char v17; // al@106 | |
7770 int v18; // eax@107 | |
7771 Player *v19; // ecx@112 | |
7772 Player *v20; // ecx@127 | |
7773 int v21; // eax@127 | |
7774 int v22; // eax@145 | |
7775 char v23; // zf@146 | |
7776 DDM_DLV_Header *v24; // ecx@148 | |
7777 signed int v25; // eax@172 | |
7778 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
|
7779 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
|
7780 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 7781 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
|
7782 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
|
7783 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
|
7784 |
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
|
7785 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
|
7786 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
|
7787 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7788 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
|
7789 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7790 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
|
7791 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
|
7792 } |
7ef8ae7ce42a
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 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7794 assert(currPlayerId != -1); |
492 | 7795 if ( var_type > VAR_AutoNotes ) |
7796 { | |
7797 if ( var_type <= VAR_GoldInBank ) | |
7798 { | |
7799 if ( var_type == VAR_GoldInBank ) | |
7800 { | |
7801 pParty->uNumGoldInBank = var_value; | |
0 | 7802 return; |
7803 } | |
492 | 7804 if ( var_type <= VAR_Counter8 ) |
7805 { | |
7806 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7807 { |
492 | 7808 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7809 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7810 } |
7811 else | |
7812 { | |
492 | 7813 switch ( var_type ) |
0 | 7814 { |
7815 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 7816 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 7817 break; |
7818 case VAR_NPCs2: | |
7819 pParty->field_709 = 0; | |
492 | 7820 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 7821 pParty->CountHirelings(); |
7822 viewparams->bRedrawGameUI = true; | |
0 | 7823 break; |
7824 case VAR_NumSkillPoints: | |
492 | 7825 this->uSkillPoints = var_value; |
0 | 7826 break; |
7827 } | |
7828 } | |
7829 return; | |
7830 } | |
492 | 7831 if ( var_type < VAR_Counter9 ) |
0 | 7832 return; |
492 | 7833 if ( (signed int)var_type <= 0x112 ) |
7834 { | |
7835 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7836 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7837 } |
7838 else | |
7839 { | |
492 | 7840 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 7841 { |
7842 v24 = &pOutdoor->ddm; | |
7843 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7844 v24 = &pIndoor->dlv; | |
492 | 7845 v24->uReputation = var_value; |
7846 if ( var_value > 10000 ) | |
0 | 7847 v24->uReputation = 10000; |
7848 return; | |
7849 } | |
492 | 7850 if ( var_type <= VAR_ReputationInCurrentLocation |
7851 || var_type > VAR_History_28 | |
7852 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
7853 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7854 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 7855 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7856 v23) ) |
7857 return; | |
7858 bFlashHistoryBook = 1; | |
7859 } | |
492 | 7860 v25 = 8 * currPlayerId + 400; |
862 | 7861 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
|
7862 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 7863 return; |
7864 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7865 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7866 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7867 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7868 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
|
7869 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7870 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7871 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7872 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7873 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7874 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7875 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7876 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7877 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7878 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7879 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7880 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7881 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7882 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7883 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7884 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7885 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7886 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7887 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7888 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7889 return; |
0 | 7890 } |
492 | 7891 if ( var_type == VAR_AutoNotes ) |
7892 { | |
7893 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
|
7894 //&& (&dword_723718_autonote_related)[8 * a3] ) |
492 | 7895 && pAutonoteTxt[var_value-1].pText ) |
7896 { | |
7897 v20 = pPlayers[currPlayerId + 1]; | |
187 | 7898 v20->PlaySound(SPEECH_96, 0); |
492 | 7899 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
0 | 7900 bFlashAutonotesBook = 1; |
981 | 7901 _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
|
7902 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 7903 } |
492 | 7904 _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
|
7905 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7906 return; |
0 | 7907 } |
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
|
7908 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
|
7909 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7910 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
|
7911 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7912 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
|
7913 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
|
7914 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
|
7915 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
|
7916 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
|
7917 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
|
7918 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7919 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7920 for (int i = 0; i < 138; i++) |
0 | 7921 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7922 v9 = &this->pInventoryItems[i]; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7923 if (v9->uItemID == 615) |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7924 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
|
7925 } |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7926 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
|
7927 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7928 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
|
7929 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7930 *(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
|
7931 } |
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
|
7932 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
|
7933 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
|
7934 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
|
7935 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
|
7936 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
|
7937 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
|
7938 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
|
7939 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
|
7940 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
|
7941 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
|
7942 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
|
7943 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
|
7944 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
|
7945 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
|
7946 { |
7ef8ae7ce42a
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->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
|
7948 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
|
7949 } |
7ef8ae7ce42a
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 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
|
7951 { |
7ef8ae7ce42a
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 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
|
7953 this->uVoiceID = 20; |
0 | 7954 } |
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
|
7955 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
|
7956 } |
7ef8ae7ce42a
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 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
|
7958 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
|
7959 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
|
7960 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
|
7961 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
|
7962 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
|
7963 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
|
7964 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
|
7965 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
|
7966 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
|
7967 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
|
7968 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
|
7969 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
|
7970 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
|
7971 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
|
7972 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
|
7973 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
|
7974 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
|
7975 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
|
7976 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
|
7977 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
|
7978 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
|
7979 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
|
7980 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
|
7981 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
|
7982 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
|
7983 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
|
7984 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
|
7985 //&& 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
|
7986 && 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
|
7987 { |
7ef8ae7ce42a
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 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
|
7989 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7990 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
|
7991 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7992 _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
|
7993 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
|
7994 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
|
7995 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
|
7996 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7997 case VAR_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
|
7998 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
|
7999 // && (&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
|
8000 && pQuestTable[var_value-1] ) |
0 | 8001 { |
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
|
8002 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
|
8003 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
|
8004 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
|
8005 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8006 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
|
8007 } |
7ef8ae7ce42a
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 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
|
8009 _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
|
8010 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
|
8011 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
|
8012 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
|
8013 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
|
8014 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
|
8015 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
|
8016 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
|
8017 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
|
8018 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
|
8019 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
|
8020 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
|
8021 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
|
8022 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
|
8023 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
|
8024 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
|
8025 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
|
8026 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
|
8027 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
|
8028 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
|
8029 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8030 case VAR_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
|
8031 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
|
8032 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8033 case VAR_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
|
8034 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
|
8035 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
|
8036 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
|
8037 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
|
8038 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
|
8039 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8040 case VAR_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
|
8041 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
|
8042 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
|
8043 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
|
8044 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
|
8045 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
|
8046 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
|
8047 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
|
8048 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
|
8049 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
|
8050 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
|
8051 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
|
8052 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
|
8053 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
|
8054 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
|
8055 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
|
8056 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8057 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
|
8058 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
|
8059 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
|
8060 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8061 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
|
8062 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
|
8063 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
|
8064 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8065 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
|
8066 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
|
8067 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
|
8068 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8069 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
|
8070 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
|
8071 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
|
8072 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8073 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
|
8074 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
|
8075 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
|
8076 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8077 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
|
8078 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
|
8079 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
|
8080 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8081 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
|
8082 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
|
8083 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
|
8084 } |
0 | 8085 LABEL_111: |
187 | 8086 v26 = SPEECH_91; |
0 | 8087 LABEL_112: |
492 | 8088 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8089 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
|
8090 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8091 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8092 return; |
0 | 8093 } |
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
|
8094 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
|
8095 { |
492 | 8096 switch ( var_type ) |
0 | 8097 { |
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
|
8098 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
|
8099 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
|
8100 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
|
8101 goto LABEL_111; |
0 | 8102 case VAR_ActualIntellect: |
8103 LABEL_68: | |
492 | 8104 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 8105 goto LABEL_111; |
8106 case VAR_ActualPersonality: | |
8107 LABEL_69: | |
492 | 8108 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 8109 goto LABEL_111; |
8110 case VAR_ActualEndurance: | |
8111 LABEL_70: | |
492 | 8112 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 8113 goto LABEL_111; |
8114 case VAR_ActualSpeed: | |
8115 LABEL_71: | |
492 | 8116 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 8117 goto LABEL_111; |
8118 case VAR_ActualAccuracy: | |
8119 LABEL_72: | |
492 | 8120 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 8121 goto LABEL_111; |
8122 case VAR_ActualLuck: | |
8123 LABEL_73: | |
492 | 8124 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 8125 goto LABEL_111; |
8126 case VAR_FireResistance: | |
492 | 8127 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
|
8128 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8129 goto LABEL_112; |
0 | 8130 case VAR_AirResistance: |
492 | 8131 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
|
8132 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8133 goto LABEL_112; |
0 | 8134 case VAR_WaterResistance: |
492 | 8135 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
|
8136 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8137 goto LABEL_112; |
0 | 8138 case VAR_EarthResistance: |
492 | 8139 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
|
8140 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8141 goto LABEL_112; |
0 | 8142 case VAR_SpiritResistance: |
492 | 8143 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
|
8144 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8145 goto LABEL_112; |
0 | 8146 case VAR_MindResistance: |
492 | 8147 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
|
8148 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8149 goto LABEL_112; |
0 | 8150 case VAR_BodyResistance: |
492 | 8151 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
|
8152 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8153 goto LABEL_112; |
0 | 8154 case VAR_LightResistance: |
492 | 8155 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
|
8156 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8157 goto LABEL_112; |
0 | 8158 case VAR_DarkResistance: |
492 | 8159 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
|
8160 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8161 goto LABEL_112; |
0 | 8162 case VAR_MagicResistance: |
492 | 8163 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 8164 v26 = 92; |
8165 goto LABEL_112; | |
8166 default: | |
8167 return; | |
8168 } | |
8169 return; | |
8170 } | |
8171 HIWORD(v15) = 0; | |
492 | 8172 if ( var_type > VAR_DisarmTrapSkill ) |
8173 { | |
8174 if ( var_type != VAR_LearningSkill ) | |
8175 { | |
8176 if ( var_type <= VAR_LearningSkill ) | |
0 | 8177 return; |
492 | 8178 if ( var_type <= VAR_Eradicated ) |
8179 { | |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
8180 this->SetCondition(var_type - 105, 1); |
0 | 8181 } |
8182 else | |
8183 { | |
492 | 8184 if ( var_type != VAR_MajorCondition ) |
0 | 8185 { |
492 | 8186 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8187 byte_5E4C15[var_type] = var_value; | |
0 | 8188 return; |
8189 } | |
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
|
8190 memset(this, 0, 0xA0u); |
0 | 8191 } |
8192 } | |
8193 else | |
8194 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8195 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
|
8196 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8197 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8198 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8199 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8200 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8201 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8202 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8203 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8204 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
|
8205 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8206 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8207 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8208 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8209 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8210 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
8211 return; |
0 | 8212 } |
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
|
8213 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 8214 { |
8215 switch ( var_type ) | |
0 | 8216 { |
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
|
8217 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
|
8218 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 8219 break; |
8220 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
|
8221 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 8222 break; |
8223 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
|
8224 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 8225 break; |
8226 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
|
8227 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 8228 break; |
8229 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
|
8230 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
|
8231 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
|
8232 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
|
8233 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
|
8234 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
|
8235 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
|
8236 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
|
8237 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
|
8238 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
|
8239 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
|
8240 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
|
8241 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
|
8242 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
|
8243 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
|
8244 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
|
8245 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
|
8246 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
|
8247 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
|
8248 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
|
8249 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 8250 break; |
8251 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
|
8252 assert("Unexpected var_type" && false); |
0 | 8253 return; |
8254 break; | |
8255 } | |
8256 goto LABEL_111; | |
8257 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8258 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
|
8259 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8260 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8261 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8262 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8263 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8264 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8265 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8266 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
|
8267 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8268 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
|
8269 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
|
8270 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
|
8271 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8272 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
8273 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8274 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
|
8275 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
8276 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
|
8277 } |
0 | 8278 |
8279 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 8280 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 8281 { |
8282 char v3; // bl@1 | |
8283 Player *v4; // esi@1 | |
8284 signed int uPlayerIdx; // edi@1 | |
8285 int v6; // eax@15 | |
8286 unsigned int v7; // esi@18 | |
8287 int *v8; // ebx@21 | |
8288 int v9; // eax@22 | |
8289 signed int v10; // eax@24 | |
8290 int v11; // eax@27 | |
8291 __int16 *v12; // esi@28 | |
8292 Player *v13; // ecx@34 | |
8293 Player *v14; // ecx@36 | |
8294 char *v15; // ecx@37 | |
8295 unsigned __int8 v16; // cf@38 | |
8296 Player *v17; // ecx@42 | |
8297 __int16 *v18; // esi@53 | |
8298 __int16 *v19; // esi@62 | |
8299 char *v20; // esi@107 | |
8300 __int16 v21; // dx@107 | |
8301 int v22; // ecx@107 | |
8302 Player *v23; // ecx@132 | |
8303 int v24; // eax@132 | |
8304 int v25; // eax@150 | |
8305 char v26; // zf@151 | |
8306 DDM_DLV_Header *v27; // eax@153 | |
8307 signed int v28; // eax@176 | |
8308 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 8309 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 8310 int v31; // [sp-4h] [bp-3Ch]@84 |
8311 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
8312 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
8313 char v34; // [sp+37h] [bp-1h]@1 | |
8314 | |
8315 auto Dst = this; | |
8316 v3 = 0; | |
8317 v34 = 0; | |
8318 v4 = Dst; | |
8319 uPlayerIdx = 0; | |
8320 if ( Dst == pPlayers[2] ) | |
8321 uPlayerIdx = 1; | |
310 | 8322 else if ( Dst == pPlayers[3] ) |
8323 uPlayerIdx = 2; | |
8324 else if ( Dst == pPlayers[4] ) | |
8325 uPlayerIdx = 3; | |
8326 | |
8327 if ( var_type <= VAR_AutoNotes ) | |
8328 { | |
8329 if ( var_type != VAR_AutoNotes ) | |
8330 { | |
8331 if ( var_type <= VAR_ActualMight ) | |
8332 { | |
8333 if ( var_type != VAR_ActualMight ) | |
0 | 8334 { |
310 | 8335 switch ( var_type ) |
0 | 8336 { |
8337 case VAR_RandomGold: | |
8338 if ( !val ) | |
8339 val = 1; | |
8340 v6 = rand(); | |
8341 party_finds_gold(v6 % val + 1, 1); | |
8342 GameUI_DrawFoodAndGold(); | |
8343 return; | |
8344 case VAR_RandomFood: | |
8345 if ( !val ) | |
8346 val = 1; | |
8347 v7 = rand() % val + 1; | |
8348 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8349 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
|
8350 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8351 GameUI_DrawFoodAndGold(); |
8352 goto _play_sound; | |
8353 case VAR_Sex: | |
8354 Dst->uSex = (PLAYER_SEX)val; | |
8355 goto _play_anim_and_exit; | |
8356 case VAR_Class: | |
135 | 8357 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 8358 goto _play_anim_and_exit; |
8359 case VAR_CurrentHP: | |
8360 v8 = &Dst->sHealth; | |
8361 *v8 += val; | |
8362 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
8363 goto _play_anim_and_exit; | |
8364 v9 = v4->GetMaxHealth(); | |
8365 goto LABEL_23; | |
8366 case VAR_MaxHP: | |
8367 v10 = Dst->GetMaxHealth(); | |
8368 v4->_health_related = 0; | |
8369 v4->uFullHealthBonus = 0; | |
8370 v4->sHealth = v10; | |
8371 return; | |
8372 case VAR_CurrentSP: | |
8373 v8 = &Dst->sMana; | |
8374 *v8 += val; | |
8375 if ( Dst->sMana > GetMaxMana() ) | |
8376 { | |
8377 v9 = v4->GetMaxMana(); | |
8378 LABEL_23: | |
8379 *v8 = v9; | |
8380 } | |
8381 goto _play_anim_and_exit; | |
8382 case VAR_MaxSP: | |
8383 v11 = GetMaxMana(); | |
8384 v4->_mana_related = 0; | |
8385 v4->uFullManaBonus = 0; | |
8386 v4->sMana = v11; | |
8387 return; | |
8388 case VAR_ACModifier: | |
8389 v12 = &Dst->sACModifier; | |
8390 goto LABEL_29; | |
8391 case VAR_BaseLevel: | |
8392 v12 = (__int16 *)&Dst->uLevel; | |
8393 goto LABEL_29; | |
8394 case VAR_LevelModifier: | |
8395 v12 = &Dst->sLevelModifier; | |
8396 LABEL_29: | |
8397 *v12 += val; | |
8398 if ( *v12 > 255 ) | |
8399 *v12 = 255; | |
8400 goto _play_anim_and_exit; | |
8401 case VAR_Age: | |
8402 Dst->sAgeModifier += val; | |
8403 return; | |
8404 case VAR_Award: | |
8405 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 8406 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
8407 | |
492 | 8408 && pAwards[val].pText ) |
0 | 8409 { |
8410 v14 = pPlayers[uPlayerIdx + 1]; | |
8411 v34 = 1; | |
8412 v3 = 1; | |
187 | 8413 v14->PlaySound(SPEECH_96, 0); |
0 | 8414 } |
735 | 8415 v15 = (char *)v4->_guilds_member_bits; |
0 | 8416 goto LABEL_44; |
8417 case VAR_Experience: | |
8418 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
8419 LODWORD(Dst->uExperience) += val; | |
8420 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
8421 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
8422 Dst->uExperience = 4000000000i64; | |
8423 goto _play_anim_and_exit; | |
8424 case VAR_QBits_QuestsDone: | |
484 | 8425 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
|
8426 //&& (&dword_722F10)[4 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8427 && pQuestTable[val-1] ) |
0 | 8428 { |
501 | 8429 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 8430 bFlashQuestBook = 1; |
8431 v34 = 1; | |
8432 v3 = 1; | |
501 | 8433 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 8434 } |
484 | 8435 v15 = (char *)pParty->_quest_bits; |
0 | 8436 LABEL_44: |
8437 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
8438 goto LABEL_173; | |
8439 case VAR_PlayerItemInHands: | |
8440 item.Reset(); | |
8441 item.Reset(); | |
8442 item.uAttributes = 1; | |
8443 item.uItemID = val; | |
8444 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 8445 pParty->pIsArtifactFound[val-500] = 1; |
0 | 8446 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
8447 { | |
8448 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
8449 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
8450 } | |
8451 pParty->SetHoldingItem(&item); | |
8452 return; | |
8453 case VAR_FixedGold: | |
8454 party_finds_gold(val, 1); | |
8455 return; | |
8456 case VAR_BaseMight: | |
8457 v18 = (__int16 *)&Dst->uMight; | |
8458 goto LABEL_82; | |
8459 case VAR_BaseIntellect: | |
8460 v18 = (__int16 *)&Dst->uIntelligence; | |
8461 goto LABEL_82; | |
8462 case VAR_BasePersonality: | |
8463 v18 = (__int16 *)&Dst->uWillpower; | |
8464 goto LABEL_82; | |
8465 case VAR_BaseEndurance: | |
8466 v18 = (__int16 *)&Dst->uEndurance; | |
8467 goto LABEL_82; | |
8468 case VAR_BaseSpeed: | |
8469 v18 = (__int16 *)&Dst->uSpeed; | |
8470 goto LABEL_82; | |
8471 case VAR_BaseAccuracy: | |
8472 v18 = (__int16 *)&Dst->uAccuracy; | |
8473 goto LABEL_82; | |
8474 case VAR_BaseLuck: | |
8475 v18 = (__int16 *)&Dst->uLuck; | |
8476 goto LABEL_82; | |
8477 case VAR_FixedFood: | |
8478 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8479 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8480 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8481 if ( pParty->uNumFoodRations > 0xFFFF ) |
8482 Party::SetFood(0xFFFFu); | |
8483 goto _play_sound; | |
8484 case VAR_MightBonus: | |
8485 goto LABEL_62; | |
8486 case VAR_IntellectBonus: | |
8487 goto LABEL_66; | |
8488 case VAR_PersonalityBonus: | |
8489 goto LABEL_67; | |
8490 case VAR_EnduranceBonus: | |
8491 goto LABEL_68; | |
8492 case VAR_SpeedBonus: | |
8493 goto LABEL_69; | |
8494 case VAR_AccuracyBonus: | |
8495 goto LABEL_70; | |
8496 case VAR_LuckBonus: | |
8497 goto LABEL_71; | |
8498 default: | |
8499 return; | |
8500 } | |
8501 return; | |
8502 } | |
8503 LABEL_62: | |
8504 v19 = (__int16 *)&Dst->uMightBonus; | |
8505 goto LABEL_113; | |
8506 } | |
310 | 8507 if ( var_type <= VAR_FireResistanceBonus ) |
8508 { | |
8509 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 8510 { |
310 | 8511 switch ( var_type ) |
0 | 8512 { |
8513 case VAR_ActualIntellect: | |
8514 LABEL_66: | |
8515 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
8516 goto LABEL_113; | |
8517 case VAR_ActualPersonality: | |
8518 LABEL_67: | |
8519 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
8520 goto LABEL_113; | |
8521 case VAR_ActualEndurance: | |
8522 LABEL_68: | |
8523 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
8524 goto LABEL_113; | |
8525 case VAR_ActualSpeed: | |
8526 LABEL_69: | |
8527 v19 = (__int16 *)&Dst->uSpeedBonus; | |
8528 goto LABEL_113; | |
8529 case VAR_ActualAccuracy: | |
8530 LABEL_70: | |
8531 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
8532 goto LABEL_113; | |
8533 case VAR_ActualLuck: | |
8534 LABEL_71: | |
8535 v19 = (__int16 *)&Dst->uLuckBonus; | |
8536 goto LABEL_113; | |
8537 case VAR_FireResistance: | |
8538 v18 = &Dst->sResFireBase; | |
8539 goto LABEL_82; | |
8540 case VAR_AirResistance: | |
8541 v18 = &Dst->sResAirBase; | |
8542 goto LABEL_82; | |
8543 case VAR_WaterResistance: | |
8544 v18 = &Dst->sResWaterBase; | |
8545 goto LABEL_82; | |
8546 case VAR_EarthResistance: | |
8547 v18 = &Dst->sResEarthBase; | |
8548 goto LABEL_82; | |
8549 case VAR_SpiritResistance: | |
8550 v18 = &Dst->sResSpiritBase; | |
8551 goto LABEL_82; | |
8552 case VAR_MindResistance: | |
8553 v18 = &Dst->sResMindBase; | |
8554 goto LABEL_82; | |
8555 case VAR_BodyResistance: | |
8556 v18 = &Dst->sResBodyBase; | |
8557 goto LABEL_82; | |
8558 case VAR_LightResistance: | |
8559 v18 = &Dst->sResLightBase; | |
8560 goto LABEL_82; | |
8561 case VAR_DarkResistance: | |
8562 v18 = &Dst->sResDarkBase; | |
8563 goto LABEL_82; | |
8564 case VAR_MagicResistance: | |
8565 v18 = &Dst->sResMagicBase; | |
8566 LABEL_82: | |
8567 *v18 += val; | |
8568 if ( *v18 > 255 ) | |
8569 *v18 = 255; | |
8570 v31 = 0; | |
8571 v29 = 92; | |
8572 goto LABEL_116; | |
8573 default: | |
8574 return; | |
8575 } | |
8576 return; | |
8577 } | |
8578 v19 = &Dst->sResFireBonus; | |
8579 LABEL_113: | |
8580 *v19 += val; | |
8581 if ( *v19 > 255 ) | |
8582 *v19 = 255; | |
8583 v31 = 0; | |
187 | 8584 v29 = SPEECH_91; |
0 | 8585 LABEL_116: |
8586 v3 = 1; | |
187 | 8587 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 8588 goto _play_anim_and_maybe_sound; |
8589 } | |
310 | 8590 if ( var_type <= VAR_DisarmTrapSkill ) |
8591 { | |
8592 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 8593 { |
310 | 8594 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 8595 { |
310 | 8596 switch ( var_type ) |
0 | 8597 { |
8598 case VAR_BodyResistanceBonus: | |
8599 v19 = &Dst->sResBodyBonus; | |
8600 break; | |
8601 case VAR_AirResistanceBonus: | |
8602 v19 = &Dst->sResAirBonus; | |
8603 break; | |
8604 case VAR_WaterResistanceBonus: | |
8605 v19 = &Dst->sResWaterBonus; | |
8606 break; | |
8607 case VAR_EarthResistanceBonus: | |
8608 v19 = &Dst->sResEarthBonus; | |
8609 break; | |
8610 case VAR_SpiritResistanceBonus: | |
8611 v19 = &Dst->sResSpiritBonus; | |
8612 break; | |
8613 default: | |
310 | 8614 if ( var_type != 62 ) |
0 | 8615 return; |
8616 v19 = &Dst->sResMindBonus; | |
8617 break; | |
8618 } | |
8619 goto LABEL_113; | |
8620 } | |
310 | 8621 if ( var_type == VAR_LightResistanceBonus ) |
0 | 8622 { |
8623 v19 = &Dst->sResLightBonus; | |
8624 goto LABEL_113; | |
8625 } | |
310 | 8626 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 8627 { |
8628 v19 = &Dst->sResDarkBonus; | |
8629 goto LABEL_113; | |
8630 } | |
310 | 8631 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 8632 { |
8633 v19 = &Dst->sResMagicBonus; | |
8634 goto LABEL_113; | |
8635 } | |
310 | 8636 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 8637 return; |
8638 } | |
8639 goto LABEL_106; | |
8640 } | |
310 | 8641 if ( var_type == VAR_LearningSkill ) |
0 | 8642 { |
8643 LABEL_106: | |
8644 if ( val <= VAR_BodyResistanceBonus ) | |
8645 { | |
310 | 8646 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 8647 } |
8648 else | |
8649 { | |
310 | 8650 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 8651 v21 = *(short *)v20; |
8652 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
8653 if ( v22 > 60 ) | |
8654 LOWORD(v22) = 60; | |
8655 LOBYTE(v21) = v21 & 0xC0; | |
8656 *(short *)v20 = v22 | v21; | |
8657 } | |
8658 goto _play_anim_and_exit; | |
8659 } | |
310 | 8660 if ( var_type <= VAR_LearningSkill ) |
0 | 8661 return; |
310 | 8662 if ( var_type <= VAR_Eradicated ) |
8663 { | |
8664 Dst->SetCondition(var_type - 105, 0); | |
0 | 8665 } |
8666 else | |
8667 { | |
310 | 8668 if ( var_type != VAR_MajorCondition ) |
0 | 8669 { |
310 | 8670 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 8671 { |
310 | 8672 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
8673 byte_5E4C15[var_type] += val; | |
0 | 8674 else |
310 | 8675 byte_5E4C15[var_type] = -1; |
0 | 8676 } |
8677 return; | |
8678 } | |
8679 memset(Dst, 0, 0xA0u); | |
8680 } | |
8681 _play_anim_and_exit: | |
8682 v3 = 1; | |
8683 _play_anim_and_maybe_sound: | |
8684 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
8685 _maybe_play_sound: | |
8686 if ( v3 != 1 ) | |
8687 return; | |
8688 goto _play_sound; | |
8689 } | |
8690 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
|
8691 //&& (&dword_723718_autonote_related)[8 * val] ) |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8692 && pAutonoteTxt[val-1].pText ) |
0 | 8693 { |
8694 v23 = pPlayers[uPlayerIdx + 1]; | |
8695 v34 = 1; | |
187 | 8696 v23->PlaySound(SPEECH_96, 0); |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
8697 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
0 | 8698 bFlashAutonotesBook = 1; |
981 | 8699 _506568_autonote_type = v24; |
0 | 8700 } |
8701 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
8702 v3 = 1; | |
8703 LABEL_173: | |
8704 if ( v34 != 1 ) | |
8705 goto _maybe_play_sound; | |
8706 goto _play_anim_and_maybe_sound; | |
8707 } | |
310 | 8708 if ( var_type > VAR_GoldInBank ) |
8709 { | |
8710 if ( var_type == 307 ) | |
0 | 8711 { |
8712 pParty->uNumDeaths += val; | |
8713 goto LABEL_173; | |
8714 } | |
310 | 8715 switch ( var_type ) |
0 | 8716 { |
8717 case 308: | |
8718 pParty->uNumBountiesCollected += val; | |
8719 break; | |
8720 case 309: | |
8721 pParty->uNumPrisonTerms += val; | |
8722 break; | |
8723 case 310: | |
8724 pParty->uNumArenaPageWins += val; | |
8725 break; | |
8726 case 311: | |
8727 pParty->uNumArenaSquireWins += val; | |
8728 break; | |
8729 case 312: | |
8730 pParty->uNumArenaKnightWins += val; | |
8731 break; | |
8732 case 313: | |
8733 pParty->uNumArenaLordWins += val; | |
8734 break; | |
8735 } | |
8736 } | |
8737 else | |
8738 { | |
310 | 8739 if ( var_type == VAR_GoldInBank ) |
0 | 8740 { |
8741 pParty->uNumGoldInBank += val; | |
8742 return; | |
8743 } | |
310 | 8744 if ( var_type <= VAR_Counter8 ) |
8745 { | |
8746 if ( (signed int)var_type >= 245 ) | |
8747 { | |
8748 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
8749 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 8750 } |
8751 else | |
8752 { | |
310 | 8753 switch ( var_type ) |
0 | 8754 { |
8755 case VAR_MonthEquals|VAR_CurrentSP: | |
8756 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
8757 break; | |
8758 case VAR_NPCs2: | |
8759 pParty->field_709 = 0; | |
8760 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 8761 pParty->CountHirelings(); |
8762 viewparams->bRedrawGameUI = true; | |
0 | 8763 break; |
8764 case VAR_NumSkillPoints: | |
8765 Dst->uSkillPoints += val; | |
8766 break; | |
8767 } | |
8768 } | |
8769 return; | |
8770 } | |
310 | 8771 if ( var_type < VAR_Counter9 ) |
0 | 8772 return; |
310 | 8773 if ( (signed int)var_type <= 274 ) |
8774 { | |
8775 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
8776 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 8777 goto _play_sound; |
8778 } | |
310 | 8779 if ( var_type != VAR_ReputationInCurrentLocation ) |
8780 { | |
8781 if ( var_type <= VAR_ReputationInCurrentLocation | |
8782 || var_type > VAR_History_28 | |
8783 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
8784 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 8785 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 8786 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 8787 v26) ) |
8788 return; | |
8789 bFlashHistoryBook = 1; | |
8790 _play_sound: | |
8791 v28 = 8 * uPlayerIdx + 400; | |
862 | 8792 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 8793 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
8794 return; | |
8795 } | |
8796 v27 = &pOutdoor->ddm; | |
8797 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8798 v27 = &pIndoor->dlv; | |
8799 v27->uReputation += val; | |
8800 if ( v27->uReputation > 10000 ) | |
8801 v27->uReputation = 10000; | |
8802 } | |
8803 } | |
8804 // 506568: using guessed type int dword_506568; | |
8805 // 507948: using guessed type char bFlashHistoryBook; | |
8806 // 507949: using guessed type char bFlashAutonotesBook; | |
8807 // 50794A: using guessed type char bFlashQuestBook; | |
8808 // 72371C: using guessed type int dword_72371C[]; | |
8809 // 723E80: using guessed type int dword_723E80_award_related[]; | |
8810 | |
8811 | |
8812 | |
8813 | |
8814 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 8815 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 8816 { |
8817 unsigned int v3; // ebx@1 | |
8818 signed int v4; // esi@1 | |
501 | 8819 bool result; // eax@8 |
0 | 8820 int v6; // esi@11 |
8821 int v7; // edi@14 | |
8822 signed int v8; // eax@17 | |
8823 char *v9; // eax@20 | |
8824 char v10; // sf@20 | |
8825 char *v11; // ecx@26 | |
8826 char *v12; // ecx@27 | |
8827 __int64 v13; // qax@27 | |
8828 unsigned __int8 v14; // cf@27 | |
501 | 8829 int *v15; // edx@29 |
0 | 8830 char *v16; // eax@90 |
8831 char *v17; // ecx@94 | |
501 | 8832 int v18; // esi@97 |
0 | 8833 signed int v19; // edx@97 |
8834 char *v20; // ecx@98 | |
8835 int v21; // eax@100 | |
8836 __int16 v22; // dx@112 | |
8837 int v23; // [sp-8h] [bp-14h]@45 | |
8838 signed int v24; // [sp-4h] [bp-10h]@4 | |
8839 int v25; // [sp-4h] [bp-10h]@45 | |
8840 | |
8841 v3 = 0; | |
605 | 8842 v4 = uActiveCharacter - 1; |
501 | 8843 result = false; |
8844 if ( (signed int)VarNum > 222 ) | |
8845 { | |
8846 if ( (signed int)VarNum <= 307 ) | |
8847 { | |
8848 if ( VarNum == 307 ) | |
8849 { | |
8850 pParty->uNumDeaths -= (unsigned int)pValue; | |
8851 return pValue; | |
8852 } | |
8853 if ( VarNum == 223 ) | |
0 | 8854 { |
8855 v11 = (char *)pParty->_autonote_bits; | |
501 | 8856 v22 = (short)pValue - 1; |
0 | 8857 } |
8858 else | |
8859 { | |
501 | 8860 if ( VarNum != 231 ) |
0 | 8861 { |
501 | 8862 switch ( VarNum ) |
0 | 8863 { |
8864 case 232: | |
501 | 8865 VarNum = (VariableType)0; |
1094 | 8866 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 8867 result = (bool) pValue; |
8868 dword_5B65CC = 0; | |
8869 if ( (int)VarNum == pValue ) | |
0 | 8870 { |
501 | 8871 dword_5B65CC = (int)pValue; |
0 | 8872 } |
8873 else | |
8874 { | |
8875 pParty->field_709 = 0; | |
501 | 8876 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 8877 pParty->CountHirelings(); |
8878 viewparams->bRedrawGameUI = true; | |
0 | 8879 } |
8880 break; | |
8881 case 241: | |
8882 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8883 { | |
8884 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 8885 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 8886 { |
605 | 8887 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 8888 { |
8889 v21 = *(int *)v20; | |
8890 if ( (char)*(int *)v20 < 0 ) | |
8891 { | |
8892 LOBYTE(v21) = v21 & 0x7F; | |
8893 *(int *)v20 = v21; | |
8894 } | |
8895 } | |
8896 v20 += 76; | |
8897 } | |
8898 } | |
605 | 8899 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 8900 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 8901 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 8902 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
8903 pParty->field_709 = 0; | |
1035 | 8904 pParty->CountHirelings(); |
0 | 8905 break; |
8906 case 243: | |
8907 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8908 result = *v17 != NULL; |
501 | 8909 if ( (unsigned int)pValue <= *(int *)v17 ) |
8910 { | |
8911 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8912 result = (v17 != NULL); |
501 | 8913 } |
0 | 8914 else |
8915 *(int *)v17 = 0; | |
8916 break; | |
8917 case 275: | |
8918 v16 = (char *)&pOutdoor->ddm; | |
8919 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8920 v16 = (char *)&pIndoor->dlv; | |
501 | 8921 *((int *)v16 + 2) -= (int)pValue; |
0 | 8922 if ( *((int *)v16 + 2) < -10000 ) |
8923 *((int *)v16 + 2) = -10000; | |
8924 break; | |
8925 case 306: | |
501 | 8926 result = VarNum - 306; |
8927 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
8928 { | |
8929 result = (bool)pValue; | |
8930 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 8931 } |
0 | 8932 else |
8933 LABEL_88: | |
8934 dword_5B65C4 = 1; | |
8935 break; | |
8936 } | |
501 | 8937 return result; |
0 | 8938 } |
8939 v11 = this->field_1A50; | |
501 | 8940 v22 = (signed __int16)pValue; |
0 | 8941 } |
8942 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 8943 return result; |
8944 } | |
8945 switch ( VarNum ) | |
0 | 8946 { |
8947 case 308: | |
501 | 8948 result = (bool)pValue; |
8949 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 8950 break; |
8951 case 309: | |
501 | 8952 result = (bool)pValue; |
8953 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 8954 break; |
8955 case 310: | |
501 | 8956 result = (bool)pValue; |
8957 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 8958 break; |
8959 case 311: | |
501 | 8960 result = (bool)pValue; |
8961 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 8962 break; |
8963 case 312: | |
501 | 8964 result = (bool)pValue; |
8965 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 8966 break; |
8967 case 313: | |
501 | 8968 result = (bool)pValue; |
8969 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 8970 break; |
8971 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8972 assert(false && "Function not returning any value!"); |
0 | 8973 } |
8974 else | |
8975 { | |
501 | 8976 if ( (signed int)VarNum >= 123 ) |
8977 { | |
8978 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 8979 } |
8980 else | |
8981 { | |
501 | 8982 switch ( VarNum ) |
0 | 8983 { |
8984 case VAR_RandomGold: | |
501 | 8985 v6 = rand() % (signed int)pValue + 1; |
0 | 8986 if ( v6 > pParty->uNumGold ) |
8987 v6 = pParty->uNumGold; | |
8988 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8989 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8990 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 8991 GameUI_DrawFoodAndGold(); |
501 | 8992 return result; |
0 | 8993 case VAR_RandomFood: |
501 | 8994 v7 = rand() % (signed int)pValue + 1; |
0 | 8995 if ( v7 > pParty->uNumFoodRations ) |
8996 v7 = pParty->uNumFoodRations; | |
8997 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8998 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8999 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 9000 GameUI_DrawFoodAndGold(); |
605 | 9001 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9002 v8 = 8 * v4 + 400; | |
862 | 9003 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9004 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9005 return result; |
0 | 9006 case VAR_CurrentHP: |
1036 | 9007 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 9008 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9009 v8 = 8 * v4 + 400; | |
862 | 9010 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9011 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9012 return result; | |
0 | 9013 case VAR_CurrentSP: |
9014 v9 = (char *)&this->sMana; | |
501 | 9015 v10 = this->sMana - (signed int)pValue < 0; |
9016 *(int *)v9 -= (int)pValue; | |
0 | 9017 if ( v10 ) |
9018 *(int *)v9 = 0; | |
605 | 9019 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9020 v8 = 8 * v4 + 400; | |
862 | 9021 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9022 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9023 return result; | |
0 | 9024 case VAR_ACModifier: |
501 | 9025 this->sACModifier -= (unsigned __int8)pValue; |
605 | 9026 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9027 v8 = 8 * v4 + 400; | |
862 | 9028 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9029 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9030 return result; | |
0 | 9031 case VAR_BaseLevel: |
501 | 9032 this->uLevel -= (unsigned __int8)pValue; |
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_LevelModifier: |
501 | 9039 this->sLevelModifier -= (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_Age: |
501 | 9046 this->sAgeModifier -= (signed __int16)pValue; |
9047 return result; | |
0 | 9048 case VAR_Award: |
605 | 9049 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
9050 return result; | |
0 | 9051 case VAR_Experience: |
9052 v12 = (char *)&this->uExperience; | |
501 | 9053 v13 = (signed int)pValue; |
9054 v14 = *(int *)v12 < (unsigned int)pValue; | |
9055 *(int *)v12 -= (int)pValue; | |
0 | 9056 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 9057 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9058 v8 = 8 * v4 + 400; | |
862 | 9059 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9060 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9061 return result; | |
0 | 9062 case VAR_QBits_QuestsDone: |
501 | 9063 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 9064 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 9065 return true; |
0 | 9066 case VAR_PlayerItemInHands: |
501 | 9067 v15 = this->pInventoryIndices; |
0 | 9068 break; |
9069 case VAR_FixedGold: | |
501 | 9070 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 9071 goto LABEL_88; |
501 | 9072 Party::TakeGold((unsigned int)pValue); |
9073 return result; | |
0 | 9074 case VAR_MightBonus: |
9075 case VAR_ActualMight: | |
501 | 9076 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 9077 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9078 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9079 v8 = 8 * v4 + 400; | |
862 | 9080 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9081 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9082 return result; | |
0 | 9083 case VAR_IntellectBonus: |
9084 case VAR_ActualIntellect: | |
501 | 9085 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 9086 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9087 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9088 v8 = 8 * v4 + 400; | |
862 | 9089 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9090 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9091 return result; | |
0 | 9092 case VAR_PersonalityBonus: |
9093 case VAR_ActualPersonality: | |
501 | 9094 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 9095 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9096 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9097 v8 = 8 * v4 + 400; | |
862 | 9098 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9099 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9100 return result; | |
0 | 9101 case VAR_EnduranceBonus: |
9102 case VAR_ActualEndurance: | |
501 | 9103 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 9104 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9105 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9106 v8 = 8 * v4 + 400; | |
862 | 9107 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9108 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9109 return result; | |
0 | 9110 case VAR_SpeedBonus: |
9111 case VAR_ActualSpeed: | |
501 | 9112 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 9113 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9114 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9115 v8 = 8 * v4 + 400; | |
862 | 9116 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9117 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9118 return result; | |
0 | 9119 case VAR_AccuracyBonus: |
9120 case VAR_ActualAccuracy: | |
501 | 9121 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 9122 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9123 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9124 v8 = 8 * v4 + 400; | |
862 | 9125 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9126 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9127 return result; | |
0 | 9128 case VAR_LuckBonus: |
9129 case VAR_ActualLuck: | |
501 | 9130 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 9131 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9132 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9133 v8 = 8 * v4 + 400; | |
862 | 9134 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9135 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9136 return result; | |
0 | 9137 case VAR_BaseMight: |
501 | 9138 this->uMight -= (unsigned __int16)pValue; |
605 | 9139 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9140 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9141 v8 = 8 * v4 + 400; | |
862 | 9142 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9143 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9144 return result; | |
0 | 9145 case VAR_BaseIntellect: |
501 | 9146 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 9147 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9148 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9149 v8 = 8 * v4 + 400; | |
862 | 9150 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9151 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9152 return result; | |
0 | 9153 case VAR_BasePersonality: |
501 | 9154 this->uWillpower -= (unsigned __int16)pValue; |
605 | 9155 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9156 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9157 v8 = 8 * v4 + 400; | |
862 | 9158 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9159 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9160 return result; | |
0 | 9161 case VAR_BaseEndurance: |
501 | 9162 this->uEndurance -= (unsigned __int16)pValue; |
605 | 9163 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9164 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9165 v8 = 8 * v4 + 400; | |
862 | 9166 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9167 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9168 return result; | |
0 | 9169 case VAR_BaseSpeed: |
501 | 9170 this->uSpeed -= (unsigned __int16)pValue; |
605 | 9171 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9172 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9173 v8 = 8 * v4 + 400; | |
862 | 9174 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9175 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9176 return result; | |
0 | 9177 case VAR_BaseAccuracy: |
501 | 9178 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 9179 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9180 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9181 v8 = 8 * v4 + 400; | |
862 | 9182 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9183 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9184 return result; | |
0 | 9185 case VAR_BaseLuck: |
501 | 9186 this->uLuck -= (unsigned __int16)pValue; |
605 | 9187 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9188 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9189 v8 = 8 * v4 + 400; | |
862 | 9190 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9191 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9192 return result; | |
0 | 9193 case VAR_FireResistance: |
501 | 9194 this->sResFireBase -= (signed __int16)pValue; |
605 | 9195 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9196 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9197 v8 = 8 * v4 + 400; | |
862 | 9198 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9199 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9200 return result; | |
0 | 9201 case VAR_AirResistance: |
501 | 9202 this->sResAirBase -= (signed __int16)pValue; |
605 | 9203 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9204 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9205 v8 = 8 * v4 + 400; | |
862 | 9206 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9207 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9208 return result; | |
0 | 9209 case VAR_WaterResistance: |
501 | 9210 this->sResWaterBase -= (signed __int16)pValue; |
605 | 9211 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9212 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9213 v8 = 8 * v4 + 400; | |
862 | 9214 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9215 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9216 return result; | |
0 | 9217 case VAR_EarthResistance: |
501 | 9218 this->sResEarthBase -= (signed __int16)pValue; |
605 | 9219 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9220 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9221 v8 = 8 * v4 + 400; | |
862 | 9222 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9223 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9224 return result; | |
0 | 9225 case VAR_SpiritResistance: |
501 | 9226 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 9227 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9228 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9229 v8 = 8 * v4 + 400; | |
862 | 9230 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9231 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9232 return result; | |
0 | 9233 case VAR_MindResistance: |
501 | 9234 this->sResMindBase -= (signed __int16)pValue; |
605 | 9235 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9236 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9237 v8 = 8 * v4 + 400; | |
862 | 9238 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9239 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9240 return result; | |
0 | 9241 case VAR_BodyResistance: |
501 | 9242 this->sResBodyBase -= (signed __int16)pValue; |
605 | 9243 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9244 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9245 v8 = 8 * v4 + 400; | |
862 | 9246 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9247 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9248 return result; | |
0 | 9249 case VAR_LightResistance: |
501 | 9250 this->sResLightBase -= (signed __int16)pValue; |
605 | 9251 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9252 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9253 v8 = 8 * v4 + 400; | |
862 | 9254 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9255 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9256 return result; | |
0 | 9257 case VAR_DarkResistance: |
501 | 9258 this->sResDarkBase -= (signed __int16)pValue; |
605 | 9259 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9260 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9261 v8 = 8 * v4 + 400; | |
862 | 9262 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9263 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9264 return result; | |
0 | 9265 case VAR_MagicResistance: |
501 | 9266 this->sResMagicBase -= (signed __int16)pValue; |
605 | 9267 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9268 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9269 v8 = 8 * v4 + 400; | |
862 | 9270 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9271 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9272 return result; | |
0 | 9273 case VAR_FireResistanceBonus: |
501 | 9274 this->sResFireBonus -= (signed __int16)pValue; |
605 | 9275 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9276 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9277 v8 = 8 * v4 + 400; | |
862 | 9278 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9279 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9280 return result; | |
0 | 9281 case VAR_AirResistanceBonus: |
501 | 9282 this->sResAirBonus -= (signed __int16)pValue; |
605 | 9283 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
9284 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9285 v8 = 8 * v4 + 400; | |
862 | 9286 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9287 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9288 return result; | |
0 | 9289 case VAR_WaterResistanceBonus: |
501 | 9290 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 9291 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9292 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9293 v8 = 8 * v4 + 400; | |
862 | 9294 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9295 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9296 return result; | |
0 | 9297 case VAR_EarthResistanceBonus: |
501 | 9298 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 9299 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9300 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9301 v8 = 8 * v4 + 400; | |
862 | 9302 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9303 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9304 return result; | |
0 | 9305 case VAR_SpiritResistanceBonus: |
501 | 9306 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 9307 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9308 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9309 v8 = 8 * v4 + 400; | |
862 | 9310 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9311 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9312 return result; | |
0 | 9313 case VAR_MindResistanceBonus: |
501 | 9314 this->sResMindBonus -= (signed __int16)pValue; |
605 | 9315 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9316 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9317 v8 = 8 * v4 + 400; | |
862 | 9318 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9319 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9320 return result; | |
0 | 9321 case VAR_BodyResistanceBonus: |
501 | 9322 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 9323 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9324 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9325 v8 = 8 * v4 + 400; | |
862 | 9326 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9327 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9328 return result; | |
0 | 9329 case VAR_LightResistanceBonus: |
501 | 9330 this->sResLightBonus -= (signed __int16)pValue; |
605 | 9331 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9332 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9333 v8 = 8 * v4 + 400; | |
862 | 9334 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9335 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9336 return result; | |
0 | 9337 case VAR_DarkResistanceBonus: |
501 | 9338 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 9339 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
9340 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
9341 v8 = 8 * v4 + 400; | |
862 | 9342 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9343 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9344 return result; | |
0 | 9345 case VAR_MagicResistanceBonus: |
501 | 9346 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 9347 v25 = 0; |
187 | 9348 v23 = SPEECH_91; |
9349 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 9350 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9351 v8 = 8 * v4 + 400; | |
862 | 9352 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9353 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9354 return result; | |
0 | 9355 case VAR_FixedFood: |
501 | 9356 Party::TakeFood((unsigned int)pValue); |
605 | 9357 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9358 v8 = 8 * v4 + 400; | |
862 | 9359 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9360 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9361 return result; | |
0 | 9362 case VAR_StaffSkill: |
9363 case VAR_SwordSkill: | |
9364 case VAR_DaggerSkill: | |
9365 case VAR_AxeSkill: | |
9366 case VAR_SpearSkill: | |
9367 case VAR_BowSkill: | |
9368 case VAR_MaceSkill: | |
9369 case VAR_BlasterSkill: | |
9370 case VAR_ShieldSkill: | |
9371 case VAR_LeatherSkill: | |
9372 case VAR_SkillChain: | |
9373 case VAR_PlateSkill: | |
9374 case VAR_FireSkill: | |
9375 case VAR_AirSkill: | |
9376 case VAR_WaterSkill: | |
9377 case VAR_EarthSkill: | |
9378 case VAR_SpiritSkill: | |
9379 case VAR_MindSkill: | |
9380 case VAR_BodySkill: | |
9381 case VAR_LightSkill: | |
9382 case VAR_DarkSkill: | |
9383 case VAR_IdentifyItemSkill: | |
9384 case VAR_MerchantSkill: | |
9385 case VAR_RepairSkill: | |
9386 case VAR_BodybuildingSkill: | |
9387 case VAR_MeditationSkill: | |
9388 case VAR_PerceptionSkill: | |
9389 case VAR_DiplomacySkill: | |
9390 case VAR_DisarmTrapSkill: | |
9391 case VAR_LearningSkill: | |
501 | 9392 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 9393 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9394 v8 = 8 * v4 + 400; | |
862 | 9395 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 9396 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
9397 return result; | |
0 | 9398 case VAR_Cursed: |
9399 case VAR_Weak: | |
9400 case VAR_Asleep: | |
9401 case VAR_Afraid: | |
9402 case VAR_Drunk: | |
9403 case VAR_Insane: | |
9404 case VAR_PoisonedGreen: | |
9405 case VAR_DiseasedGreen: | |
9406 case VAR_PoisonedYellow: | |
9407 case VAR_DiseasedYellow: | |
9408 case VAR_PoisonedRed: | |
9409 case VAR_DiseasedRed: | |
9410 case VAR_Paralyzed: | |
9411 case VAR_Unconsious: | |
9412 case VAR_Dead: | |
9413 case VAR_Stoned: | |
9414 case VAR_Eradicated: | |
1071 | 9415 //*((int *)this + 2 * VarNum - 210) = 0; |
9416 //*((int *)this + 2 * result - 209) = 0; | |
9417 this->pConditions[VarNum] = 0; | |
0 | 9418 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
9419 v8 = 8 * v4 + 400; | |
862 | 9420 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 9421 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 9422 return result; |
605 | 9423 default: |
9424 return result; | |
9425 } | |
9426 for (v3 = 1; v3 < 126; v3++) | |
9427 { | |
9428 if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) | |
0 | 9429 { |
605 | 9430 RemoveItemAtInventoryIndex(v3); |
501 | 9431 return true; |
0 | 9432 } |
605 | 9433 } |
501 | 9434 if ( pParty->pPickedItem.uItemID == pValue ) |
9435 { | |
605 | 9436 pMouse->RemoveHoldingItem(); |
9437 return true; | |
9438 } | |
9439 return false; | |
0 | 9440 } |
9441 } | |
9442 } | |
9443 // 5B65C4: using guessed type int dword_5B65C4; | |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9444 // 5B65CC: using guessed type int dword_5B65CC; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9445 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9446 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9447 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9448 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9449 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9450 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9451 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9452 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9453 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9454 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9455 //int v6; // eax@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9456 unsigned int v7; // eax@3 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9457 ItemGen _this; // [sp+Ch] [bp-30h]@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9458 //Player *v9; // [sp+30h] [bp-Ch]@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9459 int v10; // [sp+34h] [bp-8h]@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9460 int *v11; // [sp+38h] [bp-4h]@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9461 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9462 static unsigned char byte_4E8398[200] = // 4E8398 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9463 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9464 1, // EQUIP_OFF_HAND |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9465 1, // EQUIP_MAIN_HAND |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9466 2, // EQUIP_BOW |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9467 3, // EQUIP_ARMOUR |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9468 0, // EQUIP_SHIELD |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9469 4, // EQUIP_HELMET |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9470 5, // EQUIP_BELT |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9471 6, // EQUIP_CLOAK |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9472 7, // EQUIP_GAUNTLETS |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9473 8, // EQUIP_BOOTS |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9474 10, // EQUIP_RING |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9475 9, // EQUIP_AMULET |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9476 1, // EQUIP_WAND |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9477 0, // EQUIP_REAGENT |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9478 0, // EQUIP_POTION |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9479 0, // EQUIP_SPELL_SCROLL |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9480 0, // EQUIP_BOOK |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9481 0, // EQUIP_MESSAGE_SCROLL |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9482 0, // EQUIP_GOLD |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9483 0, // EQUIP_GEM |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9484 0, // EQUIP_NONE |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9485 // ??? |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9486 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9487 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9488 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9489 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9490 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9491 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9492 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9493 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9494 }; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9495 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9496 _this.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9497 v2 = byte_4E8398[uEquipType]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9498 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9499 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9500 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9501 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9502 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9503 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9504 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9505 v5 = (int)((char *)v3 + 4 * (9 * v4 - 9)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9506 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9507 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9508 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9509 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9510 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9511 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9512 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9513 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9514 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9515 v7 = v3->FindFreeInventorySlot(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9516 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9517 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9518 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9519 memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9520 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9521 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9522 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9523 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
9524 } |