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