Mercurial > mm7
annotate Player.cpp @ 1565:58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
author | Grumpy7 |
---|---|
date | Sun, 08 Sep 2013 04:10:22 +0200 |
parents | 461c2eca401b |
children | 9f8b3e904e14 |
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 |
1016 | 5 #include "stru6.h" |
6 | |
0 | 7 #include "Player.h" |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
1297 | 29 #include "SpriteObject.h" |
30 #include "DecalBuilder.h" | |
0 | 31 |
32 | |
33 | |
34 | |
35 | |
36 /* 381 */ | |
37 #pragma pack(push, 1) | |
290 | 38 struct PlayerCreation_AttributeProps |
0 | 39 { |
40 unsigned __int8 uBaseValue; | |
41 char uMaxValue; | |
42 char uDroppedStep; | |
43 char uBaseStep; | |
44 }; | |
45 #pragma pack(pop) | |
46 | |
47 | |
48 #pragma pack(push, 1) | |
290 | 49 |
50 | |
51 | |
0 | 52 #pragma pack(pop) |
290 | 53 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
54 { | |
55 {{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},}, | |
56 {{ 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},}, | |
57 {{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},}, | |
58 {{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 | 59 }; |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 // available skills per class ( 9 classes X 37 skills ) | |
67 // 0 - not available | |
68 // 1 - available | |
69 // 2 - primary skill | |
70 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
71 { | |
72 {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}, | |
73 {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}, | |
74 {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}, | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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}, | |
79 {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}, | |
80 {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 | |
81 }; | |
82 | |
83 | |
1374 | 84 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398 |
85 { | |
86 1, // EQUIP_OFF_HAND | |
87 1, // EQUIP_MAIN_HAND | |
88 2, // EQUIP_BOW | |
89 3, // EQUIP_ARMOUR | |
90 0, // EQUIP_SHIELD | |
91 4, // EQUIP_HELMET | |
92 5, // EQUIP_BELT | |
93 6, // EQUIP_CLOAK | |
94 7, // EQUIP_GAUNTLETS | |
95 8, // EQUIP_BOOTS | |
96 10, // EQUIP_RING | |
97 9, // EQUIP_AMULET | |
98 1, // EQUIP_WAND | |
99 0, // EQUIP_REAGENT | |
100 0, // EQUIP_POTION | |
101 0, // EQUIP_SPELL_SCROLL | |
102 0, // EQUIP_BOOK | |
103 0, // EQUIP_MESSAGE_SCROLL | |
104 0, // EQUIP_GOLD | |
105 0, // EQUIP_GEM | |
106 0 // EQUIP_NONE | |
107 }; | |
0 | 108 |
109 | |
110 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
111 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
112 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}; | |
113 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}; | |
114 | |
1325 | 115 unsigned char pConditionAttributeModifier[7][19] = |
116 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might | |
117 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence | |
118 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower | |
119 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance | |
120 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy | |
121 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed | |
122 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck | |
123 | |
124 unsigned char pAgingAttributeModifier[7][4] = | |
125 {{100, 75, 40, 10}, //Might | |
126 {100, 150, 100, 10}, //Intelligence | |
127 {100, 150, 100, 10}, //Willpower | |
128 {100, 75, 40, 10}, //Endurance | |
129 {100, 100, 40, 10}, //Accuracy | |
130 {100, 100, 40, 10}, //Speed | |
131 {100, 100, 100, 100}}; //Luck | |
0 | 132 |
1036 | 133 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 134 |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
135 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 | 136 |
1036 | 137 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 138 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 139 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
140 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 | 141 |
142 | |
816 | 143 unsigned short base_recovery_times_per_weapon_type[12] = |
144 { | |
145 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
146 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
147 60, // PLAYER_SKILL_DAGGER | |
148 100, // PLAYER_SKILL_AXE | |
149 80, // PLAYER_SKILL_SPEAR | |
150 100, // PLAYER_SKILL_BOW | |
151 80, // PLAYER_SKILL_MACE | |
152 30, // PLAYER_SKILL_BLASTER | |
153 10, // PLAYER_SKILL_SHIELD | |
154 10, // PLAYER_SKILL_LEATHER | |
155 20, // PLAYER_SKILL_CHAIN | |
156 30 // PLAYER_SKILL_PLATE | |
157 }; | |
158 | |
159 | |
0 | 160 |
161 //----- (00490913) -------------------------------------------------------- | |
1459 | 162 int PlayerCreation_GetUnspentAttributePointCount() |
0 | 163 { |
164 signed int v0; // edi@1 | |
1273 | 165 int raceId; // ebx@2 |
0 | 166 signed int v4; // eax@17 |
167 int v5; // edx@18 | |
168 signed int v6; // ecx@18 | |
1273 | 169 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 |
170 | |
171 remainingStatPoints = 50; | |
0 | 172 v0 = 50; |
1273 | 173 for (int playerNum = 0; playerNum < 4; playerNum++) |
174 { | |
175 raceId = pParty->pPlayers[playerNum].GetRace(); | |
176 for (int statNum = 0; statNum <= 6; statNum++) | |
177 { | |
178 switch ( statNum ) | |
0 | 179 { |
1273 | 180 case 0: |
181 v0 = pParty->pPlayers[playerNum].uMight; | |
182 break; | |
183 case 1: | |
184 v0 = pParty->pPlayers[playerNum].uIntelligence; | |
185 break; | |
186 case 2: | |
187 v0 = pParty->pPlayers[playerNum].uWillpower; | |
188 break; | |
189 case 3: | |
190 v0 = pParty->pPlayers[playerNum].uEndurance; | |
191 break; | |
192 case 4: | |
193 v0 = pParty->pPlayers[playerNum].uAccuracy; | |
194 break; | |
195 case 5: | |
196 v0 = pParty->pPlayers[playerNum].uSpeed; | |
197 break; | |
198 case 6: | |
199 v0 = pParty->pPlayers[playerNum].uLuck; | |
200 break; | |
201 } | |
202 v4 = StatTable[raceId][statNum].uBaseValue; | |
203 if ( v0 >= v4 ) | |
204 { | |
205 v5 = StatTable[raceId][statNum].uDroppedStep; | |
206 v6 = StatTable[raceId][statNum].uBaseStep; | |
0 | 207 } |
208 else | |
209 { | |
1273 | 210 v5 = StatTable[raceId][statNum].uBaseStep; |
211 v6 = StatTable[raceId][statNum].uDroppedStep; | |
0 | 212 } |
1273 | 213 remainingStatPoints += v5 * (v4 - v0) / v6; |
214 } | |
215 } | |
216 return remainingStatPoints; | |
0 | 217 } |
218 | |
219 | |
220 | |
221 //----- (00427730) -------------------------------------------------------- | |
222 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
223 { | |
1275 | 224 if (sMana >= (signed int)uRequiredMana) |
225 { | |
226 sMana -= (signed int)uRequiredMana; | |
488 | 227 return true; |
228 } | |
229 | |
230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
231 return false; | |
0 | 232 } |
233 | |
234 | |
235 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 236 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
237 { | |
0 | 238 float v6; // ST04_4@1 |
1014 | 239 signed int item_value; // eax@1 |
240 signed int sell_price; // ebx@1 | |
241 | |
242 item_value =pOwnItems[item_index].GetValue(); | |
243 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
244 sell_price = GetPriceSell(item_value, v6); | |
245 if ( pOwnItems[item_index].Broken() ) | |
246 sell_price = 1; | |
247 if ( sell_price < 1 ) | |
248 sell_price = 1; | |
249 RemoveItemAtInventoryIndex(inventory_idnx); | |
250 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 251 } |
252 | |
253 | |
254 | |
255 //----- (0043EEF3) -------------------------------------------------------- | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
256 bool Player::NothingOrJustBlastersEquipped() |
0 | 257 { |
1014 | 258 signed int item_idx; // esi@1 |
259 signed int item_id; // esi@1 | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
260 for (int i = 0; i < 16; ++i) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
261 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
262 item_idx = pEquipment.pIndices[i]; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
263 if (item_idx) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
264 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
265 item_id = pOwnItems[item_idx - 1].uItemID; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
266 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
267 return false; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
268 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
269 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
270 return true; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
271 } |
1014 | 272 |
0 | 273 |
274 | |
275 | |
276 //----- (004B8040) -------------------------------------------------------- | |
1036 | 277 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
278 { | |
279 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 280 } |
281 | |
282 //----- (004B807C) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
283 int Player::GetTempleHealCostModifier(float a2) |
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 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 int conditionTimeMultiplier; // esi@1 |
0 | 287 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 290 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 conditionIdx = GetMajorConditionIdx(); |
1275 | 292 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
293 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
295 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
296 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
297 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
298 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
299 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
300 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 } |
1350 | 304 else |
305 { | |
1275 | 306 conditionTimeMultiplier = 1; |
307 baseConditionMultiplier = 1; | |
1350 | 308 if (conditionIdx < 14) |
309 { | |
310 for (int i = 0; i <= 13; i++) | |
311 { | |
312 v6 = GetConditionDayOfWeek(i); | |
313 if ( v6 > conditionTimeMultiplier ) | |
314 conditionTimeMultiplier = v6; | |
315 } | |
316 } | |
1275 | 317 } |
318 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
319 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
320 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
321 return result; |
0 | 322 } |
323 | |
324 //----- (004B8102) -------------------------------------------------------- | |
917 | 325 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 326 { |
327 signed int v3; // esi@1 | |
328 signed int result; // eax@3 | |
329 | |
1275 | 330 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 331 if ( v3 > uRealValue ) |
332 v3 = uRealValue; | |
0 | 333 result = 1; |
334 if ( v3 >= 1 ) | |
335 result = v3; | |
336 return result; | |
337 } | |
338 | |
339 //----- (004B8142) -------------------------------------------------------- | |
749 | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
341 { | |
1275 | 342 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 343 |
344 if (price < uRealValue) | |
345 price = uRealValue; | |
346 return price; | |
0 | 347 } |
348 | |
349 //----- (004B8179) -------------------------------------------------------- | |
916 | 350 int Player::GetPriceIdentification(float a2) |
0 | 351 { |
352 signed int v2; // esi@1 | |
353 int v3; // ecx@1 | |
354 signed int result; // eax@3 | |
355 | |
1275 | 356 v2 = (signed int)(a2 * 50.0); |
0 | 357 v3 = v2 * (100 - GetMerchant()) / 100; |
358 if ( v3 < v2 / 3 ) | |
359 v3 = v2 / 3; | |
360 result = 1; | |
361 if ( v3 >= 1 ) | |
362 result = v3; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B81C3) -------------------------------------------------------- | |
916 | 367 int Player::GetPriceRepair(int a2, float a3) |
0 | 368 { |
369 signed int v3; // esi@1 | |
370 int v4; // ecx@1 | |
371 signed int result; // eax@3 | |
372 | |
1275 | 373 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 374 v4 = v3 * (100 - GetMerchant()) / 100; |
375 if ( v4 < v3 / 3 ) | |
376 v4 = v3 / 3; | |
377 result = 1; | |
378 if ( v4 >= 1 ) | |
379 result = v4; | |
380 return result; | |
381 } | |
382 | |
383 //----- (004B8213) -------------------------------------------------------- | |
1275 | 384 int Player::GetBaseSellingPrice(int a2, float a3) |
385 { | |
386 signed int v3; // qax@1 | |
387 | |
388 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
389 if ( v3 < 1 ) | |
390 v3 = 1; | |
0 | 391 return v3; |
392 } | |
393 | |
394 //----- (004B8233) -------------------------------------------------------- | |
1275 | 395 int Player::GetBaseBuyingPrice(int a2, float a3) |
396 { | |
397 signed int v3; // qax@1 | |
398 | |
399 v3 = (signed int)((double)a2 * a3); | |
400 if ( v3 < 1 ) | |
401 v3 = 1; | |
0 | 402 return v3; |
403 } | |
404 | |
405 //----- (004B824B) -------------------------------------------------------- | |
1275 | 406 int Player::GetBaseIdentifyPrice(float a2) |
407 { | |
408 signed int v2; // qax@1 | |
409 | |
410 v2 = (signed int)(a2 * 50.0); | |
411 if ( v2 < 1 ) | |
412 v2 = 1; | |
0 | 413 return v2; |
414 } | |
415 | |
416 //----- (004B8265) -------------------------------------------------------- | |
1275 | 417 int Player::GetBaseRepairPrice(int a2, float a3) |
418 { | |
419 signed int v3; // qax@1 | |
420 | |
421 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
422 if ( v3 < 1 ) | |
423 v3 = 1; | |
0 | 424 return v3; |
425 } | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 432 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
433 { |
0 | 434 signed int v2; // eax@1 |
336 | 435 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 436 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
437 { | |
438 return false; | |
439 } | |
440 else | |
441 { | |
442 if (GetMajorConditionIdx() == Condition_Zombie) | |
443 { | |
444 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
445 { | |
446 return false; | |
447 } | |
448 else | |
449 { | |
450 return true; | |
451 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
452 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
453 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
454 { |
1348 | 455 return true; |
456 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
457 } |
0 | 458 } |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
1351 | 468 |
1012 | 469 item_idx = *pitem_index; |
470 if ( item_idx >125 || item_idx < 0 ) | |
471 { | |
472 return 0; | |
473 } | |
474 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
475 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 476 if ( inv_index < 0 ) |
477 { | |
478 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
479 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 480 } |
481 | |
482 return inv_index; | |
0 | 483 } |
484 | |
485 | |
486 | |
487 //----- (004160CA) -------------------------------------------------------- | |
1012 | 488 void Player::ItemsEnchant( int enchant_count ) |
489 { | |
490 int avalible_items; // ebx@1 | |
491 int i; // edx@8 | |
492 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
493 | |
494 avalible_items = 0; | |
495 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
496 | |
1349 | 497 for (i = 0; i < 138; ++i) |
498 { | |
499 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
500 item_index_tabl[avalible_items++] = i; | |
501 } | |
1012 | 502 |
503 if ( avalible_items ) | |
504 { | |
505 if ( enchant_count ) | |
506 { | |
1349 | 507 for ( i = 0; i < enchant_count; ++i ) |
508 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
509 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
510 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 511 } |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
517 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 518 } |
519 } | |
520 } | |
0 | 521 } |
522 | |
523 //----- (004948B1) -------------------------------------------------------- | |
187 | 524 void Player::PlaySound(PlayerSpeech speech, int a3) |
525 { | |
1351 | 526 signed int speechCount = 0; // esi@4 |
527 signed int expressionCount = 0; // esi@4 | |
528 int pickedVariant; // esi@10 | |
248 | 529 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 530 signed int pSoundID; // ecx@19 |
1351 | 531 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
532 int expressionVariantArray[5]; | |
533 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
534 unsigned int expressionDuration = 0; | |
187 | 535 |
1351 | 536 pickedSoundID = 0; |
203 | 537 if (uVoicesVolumeMultiplier) |
0 | 538 { |
1351 | 539 for (int i = 0; i < 2; i++) |
540 { | |
1406 | 541 if ( SoundSetAction[speech][i] ) |
542 { | |
543 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 544 speechCount++; |
545 } | |
546 } | |
547 if ( speechCount ) | |
548 { | |
549 pickedVariant = speechVariantArray[rand() % speechCount]; | |
550 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
551 if (numberOfSubvariants > 0) | |
552 { | |
553 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 554 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 555 } |
556 } | |
557 } | |
558 | |
559 for (int i = 0; i < 5; i++) | |
560 { | |
1406 | 561 if ( SoundSetAction[speech][i + 3] ) |
562 { | |
563 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 564 expressionCount++; |
565 } | |
566 } | |
567 if ( expressionCount ) | |
568 { | |
569 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
570 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
571 { | |
1406 | 572 pSoundID = 0; |
573 if ( pSoundList->sNumSounds ) | |
574 { | |
1351 | 575 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 576 { |
1406 | 577 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
578 pSoundID = i; | |
0 | 579 } |
580 } | |
1406 | 581 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 582 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
583 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
584 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
585 } |
0 | 586 } |
587 // 4948B1: using guessed type int var_1C[5]; | |
588 | |
589 //----- (00494A25) -------------------------------------------------------- | |
187 | 590 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
591 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
592 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
593 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
594 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
595 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
598 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
599 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
600 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
601 else |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
602 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
604 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
605 if (v3 >= 2 && v3 <= 11 && v3 != 8 && !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR)) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
606 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
607 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
608 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
609 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
610 } |
0 | 611 this->uExpressionTimePassed = 0; |
612 if ( !a3 ) | |
613 { | |
187 | 614 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
615 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
616 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
617 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
618 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
619 } |
187 | 620 expression = new_expression; |
0 | 621 viewparams->bRedrawGameUI = 1; |
622 } | |
623 | |
624 //----- (0049327B) -------------------------------------------------------- | |
1355 | 625 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 ) |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
626 { |
135 | 627 if ( this->classType == uClass ) |
0 | 628 { |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
629 return true; |
0 | 630 } |
631 else | |
632 { | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
633 if (!a3) |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
634 { |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
635 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
636 } |
0 | 637 switch ( uClass ) |
638 { | |
639 case 0x1Au: | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
640 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); |
0 | 641 case 0x1Bu: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
642 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); |
0 | 643 case 0x22u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
644 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
0 | 645 case 0x23u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
646 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
0 | 647 break; |
648 default: | |
1545 | 649 Error("Should not be able to get here (%u)", uClass); |
0 | 650 break; |
651 } | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
652 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
653 } |
0 | 654 } |
655 | |
656 | |
657 //----- (00492C0B) -------------------------------------------------------- | |
658 bool Player::CanAct() | |
659 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
660 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
661 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
662 this->IsPertified() || this->IsEradicated() ) |
1355 | 663 return false; |
0 | 664 else |
1355 | 665 return true; |
0 | 666 } |
667 | |
668 //----- (00492C40) -------------------------------------------------------- | |
669 bool Player::CanSteal() | |
670 { | |
1355 | 671 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 672 } |
673 | |
674 //----- (00492C4E) -------------------------------------------------------- | |
675 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
676 { | |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
677 switch (uItemID) |
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
678 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
679 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
680 case ITEM_RELIC_OLD_NICK: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
681 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
682 case ITEM_RELIC_TALEDONS_HELM: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
683 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
684 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
685 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
686 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
687 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
688 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
689 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
690 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break; |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
691 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
692 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
693 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
694 |
0 | 695 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
696 void Player::SetCondition( unsigned int uConditionIdx, int a3 ) |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
697 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
698 signed int player_sex; // ecx@77 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
699 signed int remainig_player; // ebx@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
700 int players_before; // [sp+10h] [bp-4h]@2 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
701 int players_after; // [sp+20h] [bp+Ch]@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
702 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
703 if ( pConditions[uConditionIdx] ) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
704 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
705 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
706 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
707 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
708 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
709 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
710 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
711 switch ( uConditionIdx ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
712 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
713 case Condition_Cursed: PlaySound(SPEECH_30, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
714 case Condition_Weak: PlaySound(SPEECH_25, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
715 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
716 case Condition_Fear: PlaySound(SPEECH_26, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 case Condition_Drunk: PlaySound(SPEECH_31, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
718 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 719 case Condition_Poison1: |
720 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
721 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 722 case Condition_Disease1: |
723 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
724 case Condition_Disease3: PlaySound(SPEECH_28, 0);break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 case Condition_Paralyzed: break; //nosound |
1014 | 726 case Condition_Unconcious: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
727 PlaySound(SPEECH_32, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
728 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
729 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
730 break; |
1014 | 731 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
732 PlaySound(SPEECH_33, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
733 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
734 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
735 if ( sMana > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
736 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
737 break; |
1014 | 738 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
739 PlaySound(SPEECH_34, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
740 break; |
1014 | 741 case Condition_Eradicated: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
742 PlaySound(SPEECH_35, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
743 if (sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
744 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
745 if ( sMana > 0 ) |
1014 | 746 sMana = 0; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
747 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
748 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
749 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
750 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
751 memset(&pConditions[0], 0, sizeof(pConditions)); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
752 sHealth = GetMaxHealth(); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
753 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
754 player_sex = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
755 uPrevFace = uCurrentFace; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
756 uPrevVoiceID = uVoiceID; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
757 if (IsMale()) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
758 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
759 uCurrentFace = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
760 uVoiceID = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
761 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
762 else |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
763 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
764 uCurrentFace = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
765 uVoiceID = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
766 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
767 PlaySound(SPEECH_99, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
768 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
769 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
770 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
771 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
772 for (int i = 1; i < 5; ++i) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
773 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
774 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 ++players_before; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
777 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
778 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
780 remainig_player = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
781 players_after = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
782 for (int i = 1; i < 5; ++i) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
783 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
784 if ( pPlayers[i]->CanAct() ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
785 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
786 remainig_player = i; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
787 ++players_after; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
788 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
789 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
790 if (( players_before == 2 ) && ( players_after == 1 )) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
791 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
792 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
793 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
794 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
795 } |
0 | 796 |
797 //----- (00492528) -------------------------------------------------------- | |
798 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
799 { | |
1363 | 800 Texture *texture; // esi@1 |
801 unsigned int slotWidth; // ebx@1 | |
802 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
803 | |
804 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
805 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
806 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 807 if ( !areWeLoadingTexture ) |
808 { | |
1363 | 809 texture->Release(); |
1006 | 810 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 811 } |
1555 | 812 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions"); |
1363 | 813 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
814 { | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
815 for (unsigned int x = 0; x < slotWidth; x++) |
1363 | 816 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
817 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 818 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
819 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
820 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
821 return false; |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
822 } |
1363 | 823 } |
824 } | |
825 return true; | |
826 } | |
827 return false; | |
0 | 828 } |
829 // 506128: using guessed type int areWeLoadingTexture; | |
830 | |
831 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
832 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
833 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
834 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
835 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
836 if (pInventoryItemList[i].uItemID == 0) |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
837 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
838 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
839 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
840 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
841 return -1; |
0 | 842 } |
843 | |
844 //----- (00492600) -------------------------------------------------------- | |
845 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
846 { | |
847 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
848 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
849 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
850 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 if ( freeSlot == -1 ) |
0 | 852 { |
853 if ( uActiveCharacter ) | |
201 | 854 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
855 return 0; |
0 | 856 } |
857 else | |
858 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
859 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
860 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
861 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 862 } |
863 return result; | |
864 } | |
865 // 506128: using guessed type int areWeLoadingTexture; | |
866 | |
867 //----- (00492700) -------------------------------------------------------- | |
868 int Player::HasSkill(unsigned int uSkillType) | |
869 { | |
1374 | 870 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
871 { | |
872 return 1; | |
0 | 873 } |
874 else | |
875 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
876 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
877 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 878 return 0; |
879 } | |
0 | 880 } |
881 | |
882 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
883 void Player::WearItem( unsigned int uItemID ) |
0 | 884 { |
1010 | 885 int item_body_anch; // edi@6 |
886 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
887 item_indx = FindFreeInventoryListSlot(); |
1010 | 888 |
889 if ( item_indx != -1 ) | |
890 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
891 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 892 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
893 pEquipment.pIndices[item_body_anch] = item_indx + 1; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
894 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 895 } |
896 } | |
897 | |
898 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
899 int Player::AddItem(int index, unsigned int uItemID) |
0 | 900 { |
1374 | 901 int xStartValue = 0; |
902 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
903 if ( index == -1 ) |
0 | 904 { |
1385 | 905 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
906 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
907 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
0 | 908 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
909 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
910 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
911 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID); |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
912 } |
0 | 913 } |
1385 | 914 } |
0 | 915 return 0; |
916 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
917 if ( !CanFitItem(index, uItemID) ) |
0 | 918 { |
919 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
920 return 0; | |
921 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
922 return CreateItemInInventory(index, uItemID); |
0 | 923 } |
924 | |
925 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
926 int Player::AddItem2(int index, ItemGen *Src) |
0 | 927 { |
928 pItemsTable->SetSpecialBonus(Src); | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
929 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
930 if ( index == -1 ) |
0 | 931 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
932 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
933 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
934 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
1385 | 935 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
936 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) ) |
0 | 937 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
938 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src); |
0 | 939 } |
1385 | 940 } |
0 | 941 } |
942 return 0; | |
943 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
944 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 945 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
946 return CreateItemInInventory2(index, Src); |
0 | 947 } |
948 | |
949 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
950 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 951 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
952 signed int freeSlot; // ebx@1 |
0 | 953 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
954 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
955 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
956 if ( freeSlot == -1 ) |
0 | 957 { |
958 result = 0; | |
959 } | |
960 else | |
961 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
962 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
963 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
964 result = freeSlot + 1; |
0 | 965 } |
966 return result; | |
967 } | |
968 // 506128: using guessed type int areWeLoadingTexture; | |
969 | |
970 //----- (0049298B) -------------------------------------------------------- | |
1385 | 971 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
972 { |
1014 | 973 Texture *item_texture; // esi@1 |
974 int *pInvPos; // esi@4 | |
975 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
976 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
977 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
978 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 979 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
980 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 981 if ( !areWeLoadingTexture ) |
982 { | |
1014 | 983 item_texture->Release(); |
1006 | 984 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 985 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
986 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
987 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
988 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
989 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
990 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
991 memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
992 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
993 } |
1014 | 994 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
995 pInventoryMatrix[index] = itemListPos + 1; |
0 | 996 } |
278 | 997 |
0 | 998 // 506128: using guessed type int areWeLoadingTexture; |
999 | |
1000 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1001 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1002 { |
1014 | 1003 ItemGen *item_in_slot; // ecx@1 |
1004 Texture *item_texture; // esi@1 | |
1005 unsigned int slot_height; // ebp@1 | |
1006 int *pInvPos; // edx@4 | |
1007 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1008 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1009 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1010 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1011 item_in_slot->Reset(); | |
1012 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1013 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1014 if ( !areWeLoadingTexture ) |
1015 { | |
1014 | 1016 item_texture->Release(); |
1006 | 1017 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1018 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1019 if ( slot_width > 0 ) |
1014 | 1020 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1021 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1022 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1023 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1024 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1025 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1026 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1027 } |
0 | 1028 } |
1029 // 506128: using guessed type int areWeLoadingTexture; | |
1030 | |
1031 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1032 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1033 { | |
1034 unsigned int idemId; // edx@1 | |
1035 signed int equipType; // esi@1 | |
1036 float multiplier; // ST04_4@26 | |
1037 int price; // edi@26 | |
1038 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1039 int itemValue; | |
1040 | |
1041 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1042 idemId = pItem->uItemID; | |
1043 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1044 itemValue = pItem->GetValue(); | |
1045 | |
1046 switch (building_type) | |
1047 { | |
1411 | 1048 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1049 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1050 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1051 if (equipType > EQUIP_BOW) |
1386 | 1052 return 4; |
1053 break; | |
1411 | 1054 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1055 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1056 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1057 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1058 return 4; |
1059 break; | |
1411 | 1060 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1061 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1062 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1063 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1064 return 4; |
1065 break; | |
1411 | 1066 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1067 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1068 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1069 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1070 return 4; |
1071 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1072 default: |
1545 | 1073 Error("(%u)", building_type); |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1074 break; |
1386 | 1075 } |
1076 if (pItem->Stolen()) | |
1077 return 6; | |
1078 | |
1079 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1080 switch (ShopMenuType) | |
1081 { | |
1082 case 2: | |
1083 price = GetBuyingPrice(itemValue, multiplier); | |
1084 break; | |
1085 case 3: | |
917 | 1086 if (pItem->Broken()) |
1386 | 1087 price = 1; |
917 | 1088 else |
1386 | 1089 price = this->GetPriceSell(itemValue, multiplier); |
1090 break; | |
1091 case 4: | |
1092 price = this->GetPriceIdentification(multiplier); | |
1093 break; | |
1094 case 5: | |
1095 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1096 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1097 default: |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1098 Error("(%u)", ShopMenuType); |
1386 | 1099 break; |
1100 } | |
1101 if ( merchantLevel ) | |
1102 { | |
1103 if (price == itemValue) | |
1104 { | |
1105 return 3; | |
1106 } | |
917 | 1107 else |
1386 | 1108 { |
1109 return 2; | |
1110 } | |
1111 } | |
0 | 1112 else |
1386 | 1113 { |
1114 return 1; | |
1115 } | |
0 | 1116 } |
1117 | |
1118 //----- (0049107D) -------------------------------------------------------- | |
1119 int Player::GetBodybuilding() | |
1120 { | |
1010 | 1121 int v1; // al@1 |
0 | 1122 |
1123 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1124 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1125 return multiplier * (v1 & 0x3F); |
0 | 1126 } |
1127 | |
1128 //----- (004910A8) -------------------------------------------------------- | |
607 | 1129 int Player::GetMeditation() |
0 | 1130 { |
1010 | 1131 int v1; // al@1 |
0 | 1132 |
1133 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1134 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1135 return multiplier * (v1 & 0x3F); |
0 | 1136 } |
1137 | |
1138 //----- (004910D3) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1139 bool Player::CanIdentify( ItemGen *pItem ) |
0 | 1140 { |
1141 unsigned __int16 v2; // ax@1 | |
1142 int v5; // edi@7 | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
1143 |
652 | 1144 if (CheckHiredNPCSpeciality(Scholar)) |
1145 return true; | |
0 | 1146 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1147 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1148 if ( (signed int)SkillToMastery(v2) >= 4 ) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1149 return true; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1150 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1151 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1152 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1153 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St; |
0 | 1154 } |
1155 | |
1156 //----- (00491151) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1157 bool Player::CanRepair( ItemGen *pItem ) |
0 | 1158 { |
1159 unsigned __int16 v2; // ax@1 | |
1160 int v5; // edi@7 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1161 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1162 ItemDesc* v7 = &pItemsTable->pItems[pItem->uItemID]; |
652 | 1163 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || |
1164 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1165 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1166 return true; | |
1167 | |
1010 | 1168 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1169 if ( (signed int)SkillToMastery(v2) >= 4 ) |
0 | 1170 return true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1171 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1172 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1173 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1174 return v5 >= v7->uItemID_Rep_St; |
0 | 1175 } |
1176 | |
1177 //----- (004911F3) -------------------------------------------------------- | |
1178 int Player::GetMerchant() | |
1179 { | |
1180 unsigned __int16 v2; // ax@1 | |
1181 int v5; // edi@1 | |
1182 int v7; // eax@3 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1183 |
607 | 1184 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1185 if ( SkillToMastery(v2) >= 4 ) |
0 | 1186 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1187 |
0 | 1188 v7 = GetPartyReputation(); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1189 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1190 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1191 if (v5 == 0) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1192 { |
0 | 1193 return -v7; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1194 } |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1195 return v5 - v7 + 7; |
0 | 1196 } |
1197 | |
1198 //----- (0049125A) -------------------------------------------------------- | |
1199 int Player::GetPerception() | |
1200 { | |
1201 unsigned __int16 v2; // ax@1 | |
1202 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1203 |
1010 | 1204 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1205 if ( SkillToMastery(v2) >= 4 ) |
0 | 1206 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1207 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1208 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1209 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1210 return v5; |
0 | 1211 } |
1212 | |
1213 //----- (004912B0) -------------------------------------------------------- | |
1214 int Player::GetDisarmTrap() | |
1215 { | |
1216 unsigned __int16 v2; // ax@1 | |
1217 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1218 |
1010 | 1219 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 1220 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1221 return 10000; | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1222 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1223 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1224 if ( HasEnchantedItemEquipped(35) ) //only the real skill level is supposed to be added again, not the multiplied value |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1225 multiplier++; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1226 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1227 return v5; |
0 | 1228 } |
1229 | |
1230 //----- (00491317) -------------------------------------------------------- | |
1231 char Player::GetLearningPercent() | |
1232 { | |
1233 int v2; // eax@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1234 |
1010 | 1235 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1236 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1237 return multiplier * v2 + 9; |
0 | 1238 } |
1239 | |
1240 //----- (0048C6AF) -------------------------------------------------------- | |
1241 Player::Player() | |
1242 { | |
1243 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1244 memset(pInventoryMatrix, 0, 126 * sizeof(int)); |
0 | 1245 for (uint i = 0; i < 126; ++i) |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1246 pInventoryItemList[i].Reset(); |
0 | 1247 for (uint i = 0; i < 12; ++i) |
1248 pEquippedItems[i].Reset(); | |
1249 | |
1250 | |
1251 for (uint i = 0; i < 24; ++i) | |
1252 { | |
1253 pPlayerBuffs[i].uSkill = 0; | |
1254 pPlayerBuffs[i].uSkill = 0; | |
1255 pPlayerBuffs[i].uPower = 0; | |
1256 pPlayerBuffs[i].uExpireTime = 0; | |
1257 pPlayerBuffs[i].uCaster = 0; | |
1258 pPlayerBuffs[i].uFlags = 0; | |
1259 } | |
1260 | |
1261 pName[0] = 0; | |
1014 | 1262 uCurrentFace = 0; |
0 | 1263 uVoiceID = 0; |
1264 memset(pConditions, 0, 20 * sizeof(__int64)); | |
1265 | |
1266 field_BB = 0; | |
1267 | |
1268 uMight = uMightBonus = 0; | |
1269 uIntelligence = uIntelligenceBonus = 0; | |
1270 uWillpower = uWillpowerBonus = 0; | |
1271 uEndurance = uEnduranceBonus = 0; | |
1272 uSpeed = uSpeedBonus = 0; | |
1273 uAccuracy = uAccuracyBonus = 0; | |
1274 uLuck = uLuckBonus = 0; | |
1275 uLevel = sLevelModifier = 0; | |
1276 sAgeModifier = 0; | |
1388
60d4885eb107
sACModifier zeroed in player constructor so AC is not always 0(or -some value) ingame
Grumpy7
parents:
1387
diff
changeset
|
1277 sACModifier = 0; |
0 | 1278 |
1019 | 1279 // memset(field_1F5, 0, 30); |
1280 pure_luck_used=0; | |
1281 pure_speed_used=0; | |
1282 pure_intellect_used=0; | |
1283 pure_endurance_used=0; | |
1284 pure_willpower_used=0; | |
1285 pure_accuracy_used=0; | |
1286 pure_might_used=0; | |
0 | 1287 |
1288 sResFireBase = sResFireBonus = 0; | |
1289 sResAirBase = sResAirBonus = 0; | |
1290 sResWaterBase = sResWaterBonus = 0; | |
1291 sResEarthBase = sResEarthBonus = 0; | |
1292 sResMagicBase = sResMagicBonus = 0; | |
1293 sResSpiritBase = sResSpiritBonus = 0; | |
1294 sResMindBase = sResMindBonus = 0; | |
1295 sResBodyBase = sResBodyBonus = 0; | |
1296 sResLightBase = sResLightBonus = 0; | |
1297 sResDarkBase = sResDarkBonus = 0; | |
1298 | |
1299 uTimeToRecovery = 0; | |
1300 | |
1301 uSkillPoints = 0; | |
1302 | |
1303 sHealth = 0; | |
1304 uFullHealthBonus = 0; | |
1305 _health_related = 0; | |
1306 | |
1307 sMana = 0; | |
1308 uFullManaBonus = 0; | |
1309 _mana_related = 0; | |
1310 | |
1311 uQuickSpell = 0; | |
1312 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
1313 | |
1314 _some_attack_bonus = 0; | |
1315 field_1A91 = 0; | |
1316 _melee_dmg_bonus = 0; | |
1317 field_1A93 = 0; | |
1318 _ranged_atk_bonus = 0; | |
1319 field_1A95 = 0; | |
1320 _ranged_dmg_bonus = 0; | |
1321 field_1A97 = 0; | |
1322 | |
130 | 1323 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 1324 uExpressionTimePassed = 0; |
1325 uExpressionTimeLength = 0; | |
1326 | |
1327 uNumDivineInterventionCastsThisDay = 0; | |
1328 uNumArmageddonCasts = 0; | |
1329 uNumFireSpikeCasts = 0; | |
1330 | |
1331 memset(field_1988, 0, 49 * sizeof(int)); | |
1332 memset(field_1A50, 0, 64 * sizeof(char)); | |
1333 | |
1334 field_E0 = 0; | |
1335 field_E4 = 0; | |
1336 field_E8 = 0; | |
1337 field_EC = 0; | |
1338 field_F0 = 0; | |
1339 field_F4 = 0; | |
1340 field_F8 = 0; | |
1341 field_FC = 0; | |
1342 field_100 = 0; | |
1343 field_104 = 0; | |
198 | 1344 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1345 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1346 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1347 |
198 | 1348 lastOpenedSpellbookPage = 0; |
0 | 1349 } |
1350 | |
1351 //----- (0048C6F6) -------------------------------------------------------- | |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1352 bool Party::AddItemToParty(ItemGen *pItem) //TODO move to party.cpp |
0 | 1353 { |
1354 unsigned int v2; // eax@1 | |
1355 char *v5; // eax@8 | |
1356 Texture *v7; // ebx@10 | |
1357 signed int v8; // esi@10 | |
1358 Player *v9; // edi@11 | |
1359 int v10; // eax@11 | |
1360 int v21; // [sp+24h] [bp-4h]@10 | |
1361 | |
1362 v2 = pItem->uItemID; | |
222 | 1363 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1364 pItem->SetIdentified(); |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1365 |
0 | 1366 v5 = pItemsTable->pItems[v2].pIconName; |
1367 if ( v5 ) | |
1368 { | |
973 | 1369 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1370 v21 = areWeLoadingTexture; |
1371 v8 = 0; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1372 int startId = uActiveCharacter >= 0 ? uActiveCharacter - 1 : 0; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1373 for (int i = 0; i < 4; i++) |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1374 { |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1375 v9 = &pPlayers[(startId + i) % 4]; //start with current active player, then cycle right if item won't fit |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1376 v10 = v9->AddItem(-1, pItem->uItemID); |
0 | 1377 if ( v10 ) |
1378 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1379 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1380 pItem->Reset(); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1381 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1382 v9->PlaySound(SPEECH_60, 0); |
0 | 1383 if ( !v21 ) |
1384 { | |
1385 v7->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1388 return true; |
0 | 1389 } |
1390 } | |
1391 if ( !v21 ) | |
1392 { | |
1393 v7->Release(); | |
1006 | 1394 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1395 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1396 return false; |
0 | 1397 } |
1398 else | |
1399 { | |
1400 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1401 return false; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1402 } |
0 | 1403 } |
1404 // 506128: using guessed type int areWeLoadingTexture; | |
1405 | |
1406 //----- (0048C855) -------------------------------------------------------- | |
1407 int Player::GetBaseStrength() | |
1408 { | |
1409 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1410 } | |
1411 | |
1412 //----- (0048C86C) -------------------------------------------------------- | |
1413 int Player::GetBaseIntelligence() | |
1414 { | |
1415 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1416 } | |
1417 | |
1418 //----- (0048C883) -------------------------------------------------------- | |
1419 int Player::GetBaseWillpower() | |
1420 { | |
1421 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1422 } | |
1423 | |
1424 //----- (0048C89A) -------------------------------------------------------- | |
1425 int Player::GetBaseEndurance() | |
1426 { | |
1427 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1428 } | |
1429 | |
1430 //----- (0048C8B1) -------------------------------------------------------- | |
1431 int Player::GetBaseAccuracy() | |
1432 { | |
1433 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1434 } | |
1435 | |
1436 //----- (0048C8C8) -------------------------------------------------------- | |
1437 int Player::GetBaseSpeed() | |
1438 { | |
1439 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1440 } | |
1441 | |
1442 //----- (0048C8DF) -------------------------------------------------------- | |
1443 int Player::GetBaseLuck() | |
1444 { | |
1445 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1446 } | |
1447 | |
1448 //----- (0048C8F6) -------------------------------------------------------- | |
1449 int Player::GetBaseLevel() | |
1450 { | |
1451 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1452 } | |
1453 | |
1454 //----- (0048C90D) -------------------------------------------------------- | |
1455 int Player::GetActualLevel() | |
1456 { | |
1457 return uLevel + sLevelModifier + | |
1458 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1459 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1460 } | |
1461 | |
1462 //----- (0048C93C) -------------------------------------------------------- | |
1463 int Player::GetActualMight() | |
1464 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1465 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus); |
0 | 1466 } |
1467 | |
1468 //----- (0048C9C2) -------------------------------------------------------- | |
1469 int Player::GetActualIntelligence() | |
1470 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1471 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus); |
0 | 1472 } |
1473 | |
1474 //----- (0048CA3F) -------------------------------------------------------- | |
1475 int Player::GetActualWillpower() | |
1476 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1477 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus); |
0 | 1478 } |
1479 | |
1480 //----- (0048CABC) -------------------------------------------------------- | |
1481 int Player::GetActualEndurance() | |
1482 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1483 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus); |
0 | 1484 } |
1485 | |
1486 //----- (0048CB39) -------------------------------------------------------- | |
1487 int Player::GetActualAccuracy() | |
1488 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1489 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus); |
0 | 1490 } |
1491 | |
1492 //----- (0048CBB6) -------------------------------------------------------- | |
1493 int Player::GetActualSpeed() | |
1494 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1495 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus); |
0 | 1496 } |
1497 | |
1498 //----- (0048CC33) -------------------------------------------------------- | |
1499 int Player::GetActualLuck() | |
1500 { | |
1036 | 1501 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1502 | |
1503 npc_luck_bonus = 0; | |
652 | 1504 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1505 npc_luck_bonus = 5; |
652 | 1506 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1507 npc_luck_bonus += 20; |
652 | 1508 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1509 npc_luck_bonus += 10; |
1324 | 1510 |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1511 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus) |
1325 | 1512 + npc_luck_bonus; |
1513 } | |
1514 | |
1515 //----- (new function) -------------------------------------------------------- | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1516 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::* attrValue, unsigned short Player::* attrBonus ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1517 { |
1324 | 1518 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1519 uint uAgeingMultiplier = 100; | |
1520 for (uint i = 0; i < 4; ++i) | |
1325 | 1521 { |
1324 | 1522 if (uActualAge >= pAgeingTable[i]) |
1325 | 1523 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1524 else | |
1525 break; | |
1526 } | |
1527 | |
1528 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1529 int magicBonus = GetMagicalBonus(attrId); | |
1530 int itemBonus = GetItemsBonus(attrId, 0); | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1531 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 |
1325 | 1532 + magicBonus |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1533 + itemBonus |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1534 + this->*attrBonus; |
0 | 1535 } |
1536 | |
1537 //----- (0048CCF5) -------------------------------------------------------- | |
1538 int Player::GetActualAttack(int a2) | |
1539 { | |
1540 int v3; // eax@1 | |
1541 int v4; // edi@1 | |
1542 int v5; // ebx@1 | |
1543 int v6; // ebp@1 | |
1544 | |
1545 v3 = GetActualAccuracy(); | |
1036 | 1546 v4 = GetParameterBonus(v3); |
0 | 1547 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1548 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1549 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + this->_some_attack_bonus; |
0 | 1550 } |
1551 | |
1552 //----- (0048CD45) -------------------------------------------------------- | |
1553 int Player::GetMeleeDamageMinimal() | |
1554 { | |
1555 int v2; // eax@1 | |
1556 int v3; // esi@1 | |
1557 int v4; // esi@1 | |
1558 int v5; // esi@1 | |
1559 signed int result; // eax@1 | |
1036 | 1560 |
0 | 1561 v2 = GetActualMight(); |
1036 | 1562 v3 = GetParameterBonus(v2); |
0 | 1563 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1564 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1565 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1566 if ( result < 1 ) | |
1567 result = 1; | |
0 | 1568 return result; |
1569 } | |
1570 | |
1571 //----- (0048CD90) -------------------------------------------------------- | |
1572 int Player::GetMeleeDamageMaximal() | |
1573 { | |
1574 int v2; // eax@1 | |
1575 int v3; // esi@1 | |
1576 int v4; // esi@1 | |
1577 int v5; // esi@1 | |
1578 int v6; // esi@1 | |
1579 signed int result; // eax@1 | |
1580 | |
1581 v2 = GetActualMight(); | |
1036 | 1582 v3 = GetParameterBonus(v2); |
0 | 1583 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1584 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1585 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
0 | 1586 result = 1; |
1587 if ( v6 >= 1 ) | |
1588 result = v6; | |
1589 return result; | |
1590 } | |
1591 | |
1592 //----- (0048CDDB) -------------------------------------------------------- | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1593 int Player::CalculateMeleeDamageTo( bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1594 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1595 int dmgSum; // esi@62 |
0 | 1596 signed int result; // eax@64 |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1597 int mainWpnDmg; // [sp+18h] [bp-8h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1598 int offHndWpnDmg; // [sp+1Ch] [bp-4h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1599 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1600 offHndWpnDmg = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1601 mainWpnDmg = 0; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1602 if ( IsUnarmed() ) |
0 | 1603 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1604 mainWpnDmg = rand() % 3 + 1; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1605 } |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1606 else |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1607 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1608 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1609 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1610 ItemGen *mainHandItemGen = &this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1611 int itemId = mainHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1612 bool addOneDice = false; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1613 if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1614 addOneDice = true; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1615 mainWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(mainHandItemGen, uTargetActorID, addOneDice); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1616 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1617 if ( !ignoreOffhand ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1618 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1619 if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) |
0 | 1620 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1621 ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1622 int itemId = offHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1623 if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) |
0 | 1624 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1625 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); |
0 | 1626 } |
1627 } | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1628 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1629 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1630 dmgSum = mainWpnDmg + offHndWpnDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1631 if ( !ignoreSkillBonus ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1632 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1633 int might = GetActualMight(); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1634 int mightBonus = GetParameterBonus(might); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1635 int mightAndSkillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightBonus; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1636 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus; |
0 | 1637 } |
1638 result = 1; | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1639 if ( dmgSum >= 1 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1640 result = dmgSum; |
0 | 1641 return result; |
1642 } | |
1643 | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1644 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1645 int Player::CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1646 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1647 int itemId = weapon->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1648 int diceCount = pItemsTable->pItems[itemId].uDamageDice; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1649 if (addOneDice) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1650 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1651 diceCount++; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1652 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1653 int diceSides = pItemsTable->pItems[itemId].uDamageRoll; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1654 int diceResult = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1655 for (int i = 0; i < diceCount; i++) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1656 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1657 diceResult += rand() % diceSides + 1; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1658 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1659 int totalDmg = pItemsTable->pItems[itemId].uDamageMod + diceResult; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1660 if ( uTargetActorID > 0) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1661 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1662 int enchType = weapon->uSpecEnchantmentType; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1663 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1664 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1665 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1666 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1667 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1668 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1669 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1670 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1671 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1672 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1673 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1674 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1675 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 )) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1676 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1677 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1678 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1679 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1680 if ( (signed int)SkillToMastery(this->pActiveSkills[2]) >= 3 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1681 && pItemsTable->pItems[itemId].uSkillType == 2 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1682 && rand() % 100 < 10 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1683 totalDmg *= 3; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1684 return totalDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1685 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1686 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1687 |
0 | 1688 //----- (0048D0B9) -------------------------------------------------------- |
1689 int Player::GetRangedAttack() | |
1690 { | |
1691 int v2; // eax@1 | |
1692 int v3; // edi@3 | |
1693 int v4; // eax@4 | |
1694 int v5; // edi@4 | |
1695 int v6; // edi@4 | |
1696 int v7; // edi@4 | |
1697 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1698 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1699 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) |
0 | 1700 { |
1701 v4 = GetActualAccuracy(); | |
1036 | 1702 v5 = GetParameterBonus(v4); |
0 | 1703 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
1704 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1705 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; |
0 | 1706 } |
1707 else | |
1708 { | |
1709 v3 = GetActualAttack(1); | |
1710 } | |
1711 return v3; | |
1712 } | |
1713 | |
1714 //----- (0048D124) -------------------------------------------------------- | |
1715 int Player::GetRangedDamageMin() | |
1716 { | |
1717 int v2; // edi@1 | |
1718 int v3; // edi@1 | |
1719 int v4; // edi@1 | |
1720 int result; // eax@6 | |
1721 | |
1040 | 1722 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
1723 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1724 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1725 if ( v4 >= 1 ) |
1726 result = v4; | |
1727 else | |
1728 result = 0; | |
1729 return result; | |
1730 } | |
1731 | |
1732 //----- (0048D191) -------------------------------------------------------- | |
1733 int Player::GetRangedDamageMax() | |
1734 { | |
1735 int v2; // edi@1 | |
1736 int v3; // edi@1 | |
1737 int v4; // edi@1 | |
1738 int result; // eax@6 | |
1739 | |
1040 | 1740 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
1741 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1742 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1743 if ( v4 >= 1 ) |
1744 result = v4; | |
1745 else | |
1746 result = 0; | |
1747 return result; | |
1748 } | |
1749 | |
1750 //----- (0048D1FE) -------------------------------------------------------- | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1751 int Player::CalculateRangedDamageTo( int a2 ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1752 { |
0 | 1753 ItemGen *v4; // ebx@2 |
1754 unsigned int v5; // edi@2 | |
1755 int v9; // esi@5 | |
1756 int v10; // ebx@6 | |
1757 signed int v15; // [sp+8h] [bp-Ch]@2 | |
1758 int v17; // [sp+10h] [bp-4h]@1 | |
1759 | |
1760 v17 = 0; | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1761 if ( !HasItemEquipped(EQUIP_BOW) ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1762 return 0; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1763 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
0 | 1764 v5 = v4->uItemID; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1765 v15 = pItemsTable->pItems[v5].uDamageRoll; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1766 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1767 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1768 int v7 = rand() % v15; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1769 v17 += v7 + 1; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1770 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1771 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
0 | 1772 if ( a2 ) |
1773 { | |
377 | 1774 v10 = v4->uSpecEnchantmentType; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1775 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1776 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1777 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1778 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1779 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1780 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1781 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1782 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1783 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1784 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1785 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1786 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1787 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1788 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1789 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1790 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1791 } |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1792 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
0 | 1793 } |
1794 | |
1795 //----- (0048D2EA) -------------------------------------------------------- | |
1796 char *Player::GetMeleeDamageString() | |
1797 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1798 signed int itemid; // eax@1 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1799 int min_damage; // edi@3 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1800 int max_damage; // eax@3 |
0 | 1801 |
1802 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1803 | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1804 if (pEquipment.uMainHand >= 0) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1805 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1806 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1807 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1808 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1809 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1810 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1811 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1812 return player__getmeleedamagestring_static_buff; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1813 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1814 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1815 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1816 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1817 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1818 } |
0 | 1819 else |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1820 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1821 min_damage = GetMeleeDamageMinimal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1822 max_damage = GetMeleeDamageMaximal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1823 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1824 if ( min_damage == max_damage ) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1825 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1826 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1827 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1828 else |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1829 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1830 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1831 } |
1036 | 1832 return player__getmeleedamagestring_static_buff; |
0 | 1833 } |
1834 | |
1835 //----- (0048D396) -------------------------------------------------------- | |
1836 char *Player::GetRangedDamageString() | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1837 { |
1036 | 1838 signed int itemid; // eax@1 |
1839 int min_damage; // edi@3 | |
1840 int max_damage; // eax@3 | |
1841 | |
1842 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1843 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1844 if (pEquipment.uMainHand >= 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1845 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1846 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1847 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1848 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1849 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1850 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1851 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1852 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1853 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1854 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1855 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1856 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1857 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1858 } |
0 | 1859 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1860 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1861 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1862 max_damage = GetRangedDamageMax(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1863 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1864 if ( max_damage > 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1865 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1866 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1867 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1868 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1869 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1870 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1871 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1872 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1873 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1874 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1875 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1876 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1877 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1878 } |
1036 | 1879 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1880 } |
0 | 1881 |
1882 //----- (0048D45A) -------------------------------------------------------- | |
1883 bool Player::CanTrainToNextLevel() | |
1884 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1885 int lvl = this->uLevel + 1; |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1886 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); |
1564 | 1887 return this->uExperience >= neededExp; |
0 | 1888 } |
1889 | |
1890 //----- (0048D498) -------------------------------------------------------- | |
1891 unsigned int Player::GetExperienceDisplayColor() | |
1892 { | |
1893 if ( CanTrainToNextLevel() ) | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1894 return ui_character_bonus_text_color; |
0 | 1895 else |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1896 return ui_character_default_text_color; |
0 | 1897 } |
1898 | |
1899 //----- (0048D4B3) -------------------------------------------------------- | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1900 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg ) |
1561 | 1901 { |
1036 | 1902 int resist_value; // edi@8 |
1903 int player_luck; // eax@21 | |
1904 signed int res_rand_divider; // ebx@2 | |
1905 int armor_skill; // eax@29 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1906 |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1907 if ( classType == PLAYER_CLASS_LICH && (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND || dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY || dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT )) //TODO: determine if spirit resistance should be handled by body res. modifier |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1908 return 0; |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1909 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1910 resist_value = 0; |
1036 | 1911 switch(dmg_type) |
1912 { | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1913 case DMGT_FIRE: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1914 case DMGT_ELECTR: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1915 case DMGT_COLD: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); break; |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1916 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break; |
1036 | 1917 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1918 case DMGT_SPIRIT: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_SPIRIT);break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1919 case DMGT_MIND: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1920 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break; |
1036 | 1921 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1922 |
1036 | 1923 player_luck = GetActualLuck(); |
1924 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
1925 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1926 if ( GetParameterBonus(player_luck) + resist_value > 0 ) |
1036 | 1927 { |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1928 for (int i = 0; i < 4; i++) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1929 { |
1036 | 1930 if ( rand() % res_rand_divider >= 30 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1931 dmg >>= 1; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1932 else |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1933 break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1934 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1935 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1936 if (( dmg_type == DMGT_PHISYCAL ) && ( pEquipment.uArmor )) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1937 { |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1938 if (!pOwnItems[pEquipment.uArmor - 1].Broken()) |
0 | 1939 { |
1036 | 1940 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
1941 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 1942 { |
1036 | 1943 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1944 return dmg / 2; |
0 | 1945 } |
1036 | 1946 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 1947 { |
1036 | 1948 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1949 return dmg * 2 / 3; |
0 | 1950 } |
1951 } | |
1036 | 1952 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1953 return dmg; |
0 | 1954 } |
1955 | |
1956 //----- (0048D62C) -------------------------------------------------------- | |
816 | 1957 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
1958 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1959 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 1960 } |
1961 | |
1962 //----- (0048D651) -------------------------------------------------------- | |
816 | 1963 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
1964 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1965 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 1966 } |
1967 | |
1968 //----- (0048D676) -------------------------------------------------------- | |
1969 bool Player::IsUnarmed() | |
1970 { | |
1561 | 1971 return !HasItemEquipped(EQUIP_MAIN_HAND) && |
1972 (!HasItemEquipped(EQUIP_OFF_HAND) || GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD); | |
0 | 1973 } |
1974 | |
1975 //----- (0048D6AA) -------------------------------------------------------- | |
1976 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
1977 { | |
1978 auto i = pEquipment.pIndices[uEquipIndex]; | |
1979 if (i) | |
1080 | 1980 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 1981 else |
1982 return false; | |
0 | 1983 } |
1984 | |
1985 //----- (0048D6D0) -------------------------------------------------------- | |
1986 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
1987 { | |
1988 for (uint i = 0; i < 16; ++i) | |
1989 { | |
1990 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 1991 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 1992 return true; |
1993 } | |
1994 return false; | |
1995 } | |
1996 | |
1997 //----- (0048D709) -------------------------------------------------------- | |
1080 | 1998 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
1563 | 1999 { |
2000 return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); | |
2001 } | |
2002 | |
2003 bool Player::WearsItemAnyWhere(int item_id) | |
2004 { | |
2005 for (int i = 0; i < 16; i++) | |
2006 { | |
2007 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i)) | |
2008 { | |
2009 return true; | |
2010 } | |
2011 } | |
2012 return false; | |
0 | 2013 } |
2014 | |
2015 //----- (0048D76C) -------------------------------------------------------- | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
2016 bool Player::StealFromShop(ItemGen *a2, int a3, int reputation, int a5, int *a6) |
0 | 2017 { |
2018 unsigned __int16 v6; // cx@8 | |
2019 int v7; // edi@8 | |
2020 unsigned int v8; // ebx@8 | |
2021 unsigned int v9; // esi@8 | |
2022 int v10; // eax@8 | |
2023 int v11; // edi@12 | |
2024 bool result; // eax@13 | |
2025 | |
2026 if ( !a2 | |
2027 || this->pConditions[16] | |
2028 || this->pConditions[14] | |
2029 || this->pConditions[15] | |
2030 || this->pConditions[4] | |
2031 || this->pConditions[13] | |
2032 || this->pConditions[2] ) | |
2033 { | |
2034 result = 0; | |
2035 } | |
2036 else | |
2037 { | |
2038 v6 = this->pActiveSkills[34]; | |
2039 v7 = v6 & 0x3F; | |
2040 v8 = SkillToMastery(v6); | |
2041 v9 = a2->GetValue(); | |
2042 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
2043 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
2044 v9 *= 3; | |
2045 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
2046 *a6 = 100 * (reputation + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); |
0 | 2047 if ( rand() % 100 >= 5 ) |
2048 { | |
2049 if ( *a6 > v11 ) | |
2050 result = *a6 - v11 < 500; | |
2051 else | |
2052 result = 2; | |
2053 } | |
2054 else | |
2055 { | |
2056 result = 0; | |
2057 } | |
2058 } | |
2059 return result; | |
2060 } | |
2061 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2062 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2063 | |
2064 //----- (0048D88B) -------------------------------------------------------- | |
2065 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2066 { | |
2067 Player *v4; // esi@1 | |
2068 Actor *v5; // edi@1 | |
2069 unsigned __int16 v6; // cx@10 | |
2070 int v7; // ebx@10 | |
2071 unsigned int v8; // esi@10 | |
2072 int v9; // eax@10 | |
2073 int v10; // esi@10 | |
2074 int v11; // eax@13 | |
2075 signed int v12; // ebx@15 | |
2076 signed int v13; // edx@15 | |
2077 int v14; // ecx@15 | |
2078 unsigned __int16 v15; // si@21 | |
2079 unsigned int v16; // ebx@24 | |
2080 int v17; // esi@24 | |
2081 const void *v18; // eax@29 | |
2082 unsigned int v19; // esi@31 | |
2083 int v20; // eax@34 | |
2084 char v21; // zf@36 | |
2085 unsigned int v22; // ST0C_4@39 | |
2086 char *v23; // esi@39 | |
2087 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2088 int v26; // [sp-8h] [bp-44h]@40 | |
2089 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2090 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2091 int v29; // [sp+30h] [bp-Ch]@10 | |
2092 int v30; // [sp+34h] [bp-8h]@10 | |
2093 Player *v31; // [sp+38h] [bp-4h]@1 | |
2094 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2095 | |
2096 v4 = this; | |
2097 v5 = &pActors[uActorID]; | |
2098 v31 = this; | |
2099 if ( &pActors[uActorID] | |
2100 && !this->pConditions[16] | |
2101 && !this->pConditions[14] | |
2102 && !this->pConditions[15] | |
2103 && !this->pConditions[4] | |
2104 && !this->pConditions[13] | |
2105 && !this->pConditions[2] ) | |
2106 { | |
2107 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2108 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2109 v6 = v4->pActiveSkills[34]; | |
2110 v7 = v6 & 0x3F; | |
2111 v8 = SkillToMastery(v6); | |
2112 v9 = rand(); | |
2113 v28 = 4 * v8; | |
2114 v30 = dword_4EDEA0[v8]; | |
2115 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2116 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2117 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2118 { | |
322 | 2119 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2120 _steal_perma = 0; |
2121 v26 = (int)v31->pName; | |
2122 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2123 } | |
2124 else | |
2125 { | |
2126 v11 = rand(); | |
2127 if ( v11 % 100 >= 40 ) | |
2128 { | |
2129 if ( v11 % 100 >= 70 ) | |
2130 { | |
2131 v19 = 0; | |
2132 if ( v7 > 0 ) | |
2133 { | |
2134 do | |
2135 { | |
2136 --v7; | |
2137 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2138 } | |
2139 while ( v7 ); | |
2140 } | |
2141 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2142 return _steal_perma; | |
377 | 2143 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2144 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2145 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2146 v21 = *(int *)v20 == v19; |
2147 *(int *)v20 -= v19; | |
2148 if ( v21 ) | |
2149 v5->array_000234[3].uItemID = 0; | |
2150 if ( v19 ) | |
2151 { | |
2152 party_finds_gold(v19, 2); | |
2153 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2154 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2155 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2156 LABEL_43: |
2157 ShowStatusBarString(v23, 2u); | |
2158 return _steal_perma; | |
2159 } | |
2160 } | |
2161 else | |
2162 { | |
2163 v27.Reset(); | |
2164 v12 = 0; | |
2165 v13 = 0; | |
2166 v14 = (int)v5->array_000234; | |
2167 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2168 { | |
2169 ++v13; | |
2170 v14 += 36; | |
2171 if ( v13 >= 4 ) | |
2172 goto LABEL_21; | |
2173 } | |
2174 v12 = 1; | |
2175 LABEL_21: | |
2176 v15 = v5->uCarriedItemID; | |
2177 if ( v15 || v12 ) | |
2178 { | |
2179 v27.Reset(); | |
2180 if ( v15 ) | |
2181 { | |
2182 v16 = (signed __int16)v15; | |
2183 v5->uCarriedItemID = 0; | |
2184 v27.uItemID = (signed __int16)v15; | |
2185 v17 = (signed __int16)v15; | |
2186 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2187 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2188 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2189 { | |
2190 if ( v16 != 220 ) | |
570 | 2191 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2192 } |
2193 } | |
2194 else | |
2195 { | |
2196 v18 = &v5->array_000234[rand() % 4]; | |
2197 memcpy(&v27, v18, sizeof(v27)); | |
2198 ((ItemGen *)v18)->Reset(); | |
2199 v16 = v27.uItemID; | |
2200 } | |
2201 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2202 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2203 pTmpBuf2.data(), |
0 | 2204 pGlobalTXT_LocalizationStrings[304], |
2205 v31->pName, | |
2206 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2207 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2208 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2209 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2210 pMouse->SetCursorBitmapFromItemID(v16); | |
2211 return _steal_perma; | |
2212 } | |
2213 } | |
2214 } | |
2215 v26 = (int)v31->pName; | |
2216 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2217 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2218 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2219 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2220 goto LABEL_43; |
2221 } | |
2222 return 0; | |
2223 } | |
2224 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2225 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2226 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2227 | |
2228 //----- (0048DBB9) -------------------------------------------------------- | |
2229 void Player::Heal(int amount) | |
2230 { | |
1010 | 2231 signed int max_health; // eax@3 |
2232 | |
2233 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
2234 { | |
2235 max_health = GetMaxHealth(); | |
2236 if ( pConditions[Condition_Zombie] ) | |
2237 max_health /= 2; | |
2238 sHealth += amount; | |
2239 if ( sHealth > max_health ) | |
2240 sHealth = max_health; | |
2241 if ( pConditions[Condition_Unconcious] ) | |
2242 { | |
2243 if ( sHealth > 0 ) | |
2244 { | |
2245 pConditions[Condition_Unconcious] = 0i64; | |
0 | 2246 } |
2247 } | |
2248 } | |
2249 } | |
2250 | |
2251 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2252 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2253 { | |
2254 signed int recieved_dmg; // eax@1 | |
2255 unsigned int armor_indx; // eax@8 | |
2256 bool broke_armor; | |
2257 | |
2258 pConditions[Condition_Sleep] = 0i64; | |
2259 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
2260 sHealth -= recieved_dmg; | |
2261 broke_armor = sHealth <= -10; | |
2262 if ( sHealth < 1 ) // | |
2263 { | |
2264 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
2265 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 2266 { |
1019 | 2267 SetCondition(Condition_Unconcious, 0); |
0 | 2268 } |
2269 else | |
2270 { | |
1019 | 2271 SetCondition(Condition_Dead, 0); |
1036 | 2272 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
2273 if ( sHealth > 0 ) | |
2274 sHealth = 0; | |
2275 } | |
2276 if (broke_armor ) | |
2277 { | |
2278 armor_indx = pEquipment.uArmor; | |
2279 if ( armor_indx ) | |
0 | 2280 { |
1036 | 2281 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 2282 { |
1036 | 2283 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 2284 } |
2285 } | |
2286 } | |
2287 } | |
1036 | 2288 if ( recieved_dmg && CanAct() ) |
187 | 2289 PlaySound(SPEECH_24, 0); |
1036 | 2290 return recieved_dmg; |
0 | 2291 } |
2292 | |
2293 //----- (0048DCF6) -------------------------------------------------------- | |
2294 int Player::_48DCF6(int a2, Actor *pActor) | |
2295 { | |
2296 signed int v3; // edi@1 | |
2297 signed int v4; // ebx@1 | |
2298 Player *v5; // esi@1 | |
2299 int v6; // eax@2 | |
2300 int v7; // eax@5 | |
2301 int v8; // eax@8 | |
2302 int v9; // ebx@8 | |
2303 int v10; // eax@8 | |
2304 int v11; // ebx@8 | |
2305 signed int v12; // edx@9 | |
2306 ItemGen *v13; // eax@9 | |
2307 int v14; // edx@16 | |
2308 unsigned int v15; // edx@17 | |
2309 int v16; // edx@26 | |
2310 unsigned int v17; // edx@27 | |
2311 signed int v19; // edx@38 | |
2312 int *v20; // ecx@38 | |
2313 signed int v21; // eax@40 | |
2314 int v22; // eax@49 | |
2315 signed int v23; // ebx@49 | |
2316 unsigned int v24; // eax@60 | |
2317 int v25; // ecx@61 | |
2318 int v26; // ebx@74 | |
2319 void *v27; // ecx@76 | |
2320 unsigned int v28; // ebx@78 | |
2321 signed int result; // eax@86 | |
2322 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2323 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2324 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2325 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2326 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2327 int v35; // [sp-Ch] [bp-ACh]@56 | |
2328 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2329 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2330 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2331 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2332 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2333 int v41; // [sp-4h] [bp-A4h]@51 | |
2334 int v42; // [sp-4h] [bp-A4h]@56 | |
2335 int v43; // [sp-4h] [bp-A4h]@57 | |
2336 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2337 int v45; // [sp-4h] [bp-A4h]@68 | |
2338 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2339 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2340 int v48; // [sp+9Ch] [bp-4h]@1 | |
2341 | |
2342 v3 = 0; | |
2343 v4 = 0; | |
2344 v5 = this; | |
2345 v47 = 0; | |
2346 v48 = 0; | |
2347 switch ( a2 ) | |
2348 { | |
2349 case 1: | |
2350 v6 = GetActualWillpower(); | |
2351 goto LABEL_46; | |
2352 case 2: | |
2353 case 3: | |
2354 case 4: | |
2355 case 9: | |
2356 case 10: | |
2357 case 11: | |
2358 case 13: | |
2359 case 21: | |
2360 v6 = GetActualEndurance(); | |
2361 goto LABEL_46; | |
2362 case 5: | |
2363 case 12: | |
2364 case 23: | |
2365 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2366 goto LABEL_5; | |
2367 case 15: | |
2368 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2369 goto LABEL_5; | |
2370 case 6: | |
2371 case 7: | |
2372 case 8: | |
2373 case 14: | |
2374 case 16: | |
2375 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2376 LABEL_5: | |
2377 v7 = GetActualResistance(v40); | |
2378 goto LABEL_47; | |
2379 case 22: | |
2380 v8 = GetActualWillpower(); | |
1036 | 2381 v9 = GetParameterBonus(v8); |
0 | 2382 v10 = GetActualIntelligence(); |
1036 | 2383 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2384 break; |
2385 case 17: | |
2386 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2387 v13 = this->pInventoryItemList; |
0 | 2388 do |
2389 { | |
315 | 2390 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 2391 v46[v4++] = v12; |
2392 ++v12; | |
2393 ++v13; | |
2394 } | |
2395 while ( v12 < 138 ); | |
2396 goto LABEL_36; | |
2397 case 18: | |
2398 v14 = 0; | |
2399 do | |
2400 { | |
2401 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2402 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2403 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2404 if ( v15 == EQUIP_ARMOUR ) |
898 | 2405 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2406 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2407 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2408 } |
2409 v14 = v15 + 1; | |
2410 } | |
2411 while ( v14 < 16 ); | |
2412 goto LABEL_36; | |
2413 case 19: | |
2414 v16 = 0; | |
2415 do | |
2416 { | |
2417 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2418 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2419 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2420 if ( v17 == 2 ) |
2421 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2422 if ( (!v17 || v17 == 1) | |
816 | 2423 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2424 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2425 } |
2426 v16 = v17 + 1; | |
2427 } | |
2428 while ( v16 < 16 ); | |
2429 LABEL_36: | |
2430 if ( !v4 ) | |
2431 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2432 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2433 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2434 break; | |
2435 case 20: | |
2436 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2437 v20 = this->pInventoryMatrix; |
0 | 2438 do |
2439 { | |
2440 if ( *v20 > 0 ) | |
2441 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2442 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2443 if ( v21 > 0 ) |
2444 { | |
2445 if ( v21 <= 134 ) | |
2446 v46[v4++] = v19; | |
2447 } | |
2448 } | |
2449 ++v19; | |
2450 ++v20; | |
2451 } | |
2452 while ( v19 < 126 ); | |
2453 if ( !v4 ) | |
2454 goto LABEL_87; | |
2455 v47 = (unsigned __int8)v46[rand() % v4]; | |
2456 v6 = GetActualAccuracy(); | |
2457 LABEL_46: | |
1036 | 2458 v7 = GetParameterBonus(v6); |
0 | 2459 LABEL_47: |
2460 v11 = v7; | |
2461 break; | |
2462 default: | |
2463 v11 = 0; | |
2464 break; | |
2465 } | |
2466 v22 = GetActualLuck(); | |
1036 | 2467 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2468 if ( rand() % v23 >= 30 ) |
2469 { | |
2470 LABEL_87: | |
2471 result = 0; | |
2472 } | |
2473 else | |
2474 { | |
2475 switch ( a2 ) | |
2476 { | |
2477 case 1: | |
2478 v41 = 1; | |
2479 v36 = 0; | |
2480 goto LABEL_56; | |
2481 case 2: | |
2482 v41 = 1; | |
2483 v36 = 1; | |
2484 goto LABEL_56; | |
2485 case 3: | |
2486 v41 = 1; | |
2487 v36 = 2; | |
2488 goto LABEL_56; | |
2489 case 23: | |
2490 v41 = 1; | |
2491 v36 = 3; | |
2492 goto LABEL_56; | |
2493 case 4: | |
2494 v41 = 1; | |
2495 v36 = 4; | |
2496 LABEL_56: | |
2497 SetCondition(v36, v41); | |
2498 v42 = 0; | |
2499 v37 = 0; | |
2500 v35 = 0; | |
2501 v34 = 0; | |
2502 v33 = -1; | |
2503 v32 = 0; | |
2504 v31 = 0; | |
2505 v30 = (SoundID)221; | |
2506 goto LABEL_83; | |
2507 case 5: | |
2508 v43 = 1; | |
2509 v38 = 5; | |
2510 goto LABEL_70; | |
2511 case 6: | |
2512 case 7: | |
2513 case 8: | |
2514 if ( a2 == 6 ) | |
2515 { | |
2516 v44 = 6; | |
2517 goto LABEL_60; | |
2518 } | |
2519 v25 = 2 * (a2 != 8) + 8; | |
2520 goto LABEL_65; | |
2521 case 9: | |
2522 if ( a2 == 6 ) | |
2523 { | |
2524 v44 = 7; | |
2525 LABEL_60: | |
2526 v24 = v44; | |
2527 } | |
2528 else | |
2529 { | |
2530 v25 = 2 * (a2 != 8) + 9; | |
2531 LABEL_65: | |
2532 v24 = v25; | |
2533 } | |
2534 SetCondition(v24, 1); | |
2535 v42 = 0; | |
2536 v37 = 0; | |
2537 v35 = 0; | |
2538 v34 = 0; | |
2539 v33 = -1; | |
2540 v32 = 0; | |
2541 v31 = 0; | |
2542 v30 = (SoundID)222; | |
2543 LABEL_83: | |
2544 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2545 do | |
2546 { | |
2547 LABEL_84: | |
2548 if ( v5 == pPlayers[v3 + 1] ) | |
2549 break; | |
2550 ++v3; | |
2551 } | |
2552 while ( v3 < 4 ); | |
2553 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2554 result = 1; | |
2555 break; | |
2556 case 12: | |
2557 v43 = 1; | |
2558 v38 = 12; | |
2559 goto LABEL_70; | |
2560 case 15: | |
2561 v45 = 1; | |
2562 v39 = 15; | |
2563 goto LABEL_73; | |
2564 case 13: | |
2565 v43 = 1; | |
2566 v38 = 13; | |
2567 LABEL_70: | |
2568 SetCondition(v38, v43); | |
2569 v42 = 0; | |
2570 v37 = 0; | |
2571 v35 = 0; | |
2572 v34 = 0; | |
2573 v33 = -1; | |
2574 v32 = 0; | |
2575 v31 = 0; | |
2576 v30 = (SoundID)224; | |
2577 goto LABEL_83; | |
2578 case 14: | |
2579 v45 = 1; | |
2580 v39 = 14; | |
2581 goto LABEL_73; | |
2582 case 16: | |
2583 v45 = 1; | |
2584 v39 = 16; | |
2585 LABEL_73: | |
2586 SetCondition(v39, v45); | |
2587 v42 = 0; | |
2588 v37 = 0; | |
2589 v35 = 0; | |
2590 v34 = 0; | |
2591 v33 = -1; | |
2592 v32 = 0; | |
2593 v31 = 0; | |
2594 v30 = (SoundID)225; | |
2595 goto LABEL_83; | |
2596 case 17: | |
2597 case 18: | |
2598 case 19: | |
2599 v26 = v48; | |
2600 if ( *(char *)(v48 + 21) & 2 ) | |
2601 goto LABEL_84; | |
187 | 2602 PlaySound(SPEECH_40, 0); |
0 | 2603 *(int *)(v26 + 20) |= 2u; |
2604 goto LABEL_79; | |
2605 case 20: | |
187 | 2606 PlaySound(SPEECH_40, 0); |
0 | 2607 v27 = pActor->array_000234; |
2608 if ( pActor->array_000234[0].uItemID ) | |
2609 { | |
2610 v27 = &pActor->array_000234[1]; | |
2611 if ( pActor->array_000234[1].uItemID ) | |
2612 goto LABEL_84; | |
2613 } | |
2614 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2615 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2616 RemoveItemAtInventoryIndex(v28); |
2617 LABEL_79: | |
2618 v42 = 0; | |
2619 v37 = 0; | |
2620 v35 = 0; | |
2621 v34 = 0; | |
2622 v33 = -1; | |
2623 v32 = 0; | |
2624 v31 = 0; | |
2625 v30 = (SoundID)47; | |
2626 goto LABEL_83; | |
2627 case 21: | |
187 | 2628 PlaySound(SPEECH_42, 0); |
0 | 2629 ++v5->sAgeModifier; |
2630 goto LABEL_82; | |
2631 case 22: | |
187 | 2632 PlaySound(SPEECH_41, 0); |
0 | 2633 v5->sMana = 0; |
2634 LABEL_82: | |
2635 v42 = 0; | |
2636 v37 = 0; | |
2637 v35 = 0; | |
2638 v34 = 0; | |
2639 v33 = -1; | |
2640 v32 = 0; | |
2641 v31 = 0; | |
2642 v30 = (SoundID)226; | |
2643 goto LABEL_83; | |
2644 default: | |
2645 goto LABEL_87; | |
2646 } | |
2647 } | |
2648 return result; | |
2649 } | |
324 | 2650 |
0 | 2651 // 48DCF6: using guessed type char var_94[140]; |
2652 | |
2653 //----- (0048E1A3) -------------------------------------------------------- | |
2654 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2655 { | |
1091 | 2656 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2657 } |
2658 | |
2659 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2660 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2661 { | |
2662 ItemGen *weapon = nullptr; | |
2663 ItemDesc *weapon_desc = nullptr; | |
2664 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2665 if (bRangedAttack) | |
0 | 2666 { |
2667 if ( !HasItemEquipped(EQUIP_BOW) ) | |
2668 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2669 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 2670 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2671 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
2672 goto LABEL_17; | |
2673 } | |
2674 else if ( IsUnarmed() == 1 ) | |
2675 { | |
2676 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
2677 { | |
2678 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 2679 goto LABEL_17; |
2680 } | |
2681 } | |
816 | 2682 |
2683 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
2684 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2685 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2686 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2687 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2688 { | |
2689 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2690 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2691 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2692 } | |
0 | 2693 else |
816 | 2694 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2695 } | |
1010 | 2696 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2697 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2698 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2699 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2700 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2701 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2702 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2703 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2704 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2705 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2706 } | |
2707 } | |
2708 | |
0 | 2709 LABEL_17: |
816 | 2710 uint armour_recovery = 0; |
0 | 2711 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2712 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2713 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2714 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
2715 | |
2716 float armour_recovery_multipliers[4]; | |
2717 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
2718 { | |
2719 armour_recovery_multipliers[0] = 1.0f; | |
2720 armour_recovery_multipliers[1] = 0; | |
2721 armour_recovery_multipliers[2] = 0; | |
2722 armour_recovery_multipliers[3] = 0; | |
2723 } | |
2724 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2725 { | |
2726 armour_recovery_multipliers[0] = 1.0f; | |
2727 armour_recovery_multipliers[1] = 0.5f; | |
2728 armour_recovery_multipliers[2] = 0; | |
2729 armour_recovery_multipliers[3] = 0; | |
2730 } | |
2731 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2732 { | |
2733 armour_recovery_multipliers[0] = 1.0f; | |
2734 armour_recovery_multipliers[1] = 0.5f; | |
2735 armour_recovery_multipliers[2] = 0.5f; | |
2736 armour_recovery_multipliers[3] = 0; | |
0 | 2737 } |
2738 else | |
2739 { | |
1545 | 2740 Error("Unknown armour type"); // what kind of armour is that? |
816 | 2741 armour_recovery_multipliers[0] = 1.0f; |
2742 armour_recovery_multipliers[1] = 1.0f; | |
2743 armour_recovery_multipliers[2] = 1.0f; | |
2744 armour_recovery_multipliers[3] = 1.0f; | |
2745 } | |
2746 | |
2747 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
2748 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
2749 } | |
2750 | |
2751 uint shield_recovery = 0; | |
2752 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2753 { | |
2754 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
2755 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2756 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2757 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2758 | |
2759 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
2760 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
2761 } | |
2762 | |
1036 | 2763 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2764 sword_axe_bow_recovery_reduction = 0; |
2765 bool shooting_laser = false; | |
2766 if (weapon_desc) | |
2767 { | |
2768 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2769 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2770 { | |
2771 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2772 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2773 } | |
2774 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2775 shooting_laser = true; | |
2776 } | |
2777 | |
2778 uint armsmaster_recovery_reduction = 0; | |
2779 if (!bRangedAttack && !shooting_laser) | |
2780 { | |
2781 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2782 { | |
2783 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2784 if (SkillToMastery(armsmaster_level) >= 4) | |
2785 armsmaster_recovery_reduction *= 2; | |
2786 } | |
2787 } | |
2788 | |
2789 uint v41 = 0; | |
2790 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 2791 v41 = 25; |
816 | 2792 |
2793 uint weapon_enchantment_recovery_reduction = 0; | |
2794 if ( weapon ) | |
2795 { | |
2796 if (weapon->uSpecEnchantmentType == 59 || | |
2797 weapon->uSpecEnchantmentType == 41 || | |
2798 weapon->uSpecEnchantmentType == 500) | |
2799 weapon_enchantment_recovery_reduction = 20; | |
2800 } | |
2801 | |
2802 | |
2803 int recovery = weapon_recovery + | |
2804 armour_recovery + | |
2805 shield_recovery | |
2806 - armsmaster_recovery_reduction | |
2807 - weapon_enchantment_recovery_reduction | |
2808 - v41 | |
2809 - sword_axe_bow_recovery_reduction | |
2810 - player_speed_recovery_reduction; | |
2811 | |
2812 if (recovery < 0) | |
2813 recovery = 0; | |
2814 return recovery; | |
0 | 2815 } |
2816 | |
2817 //----- (0048E4F8) -------------------------------------------------------- | |
2818 int Player::GetMaxHealth() | |
2819 { | |
2820 int v3; // esi@1 | |
2821 int v4; // esi@1 | |
2822 int v6; // esi@1 | |
2823 | |
1036 | 2824 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2825 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2826 v6 = uFullHealthBonus |
135 | 2827 + pBaseHealthByClass[classType / 4] |
0 | 2828 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2829 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2830 if (v6 <= 0) | |
2831 return 1; | |
2832 return v6; | |
2833 } | |
2834 | |
2835 //----- (0048E565) -------------------------------------------------------- | |
2836 int Player::GetMaxMana() | |
2837 { | |
2838 int v2; // eax@2 | |
2839 int v3; // esi@4 | |
2840 int v4; // eax@5 | |
2841 int v5; // esi@5 | |
2842 int v6; // eax@5 | |
2843 int v7; // esi@6 | |
2844 int v8; // esi@6 | |
2845 int v9; // esi@6 | |
2846 int result; // eax@7 | |
1116 | 2847 |
135 | 2848 switch (classType) |
0 | 2849 { |
1116 | 2850 case PLAYER_CLASS_ROGUE: |
2851 case PLAYER_CLASS_SPY: | |
2852 case PLAYER_CLASS_ASSASSIN: | |
2853 case PLAYER_CLASS_ARCHER: | |
2854 case PLAYER_CLASS_WARRIOR_MAGE: | |
2855 case PLAYER_CLASS_MASTER_ARCHER: | |
2856 case PLAYER_CLASS_SNIPER: | |
2857 case PLAYER_CLASS_SORCERER: | |
2858 case PLAYER_CLASS_WIZARD: | |
2859 case PLAYER_CLASS_ARCHMAGE: | |
2860 case PLAYER_CLASS_LICH: | |
0 | 2861 v2 = GetActualIntelligence(); |
1036 | 2862 v3 = GetParameterBonus(v2); |
1116 | 2863 break; |
2864 case PLAYER_CLASS_INITIATE: | |
2865 case PLAYER_CLASS_MASTER: | |
2866 case PLAYER_CLASS_NINJA: | |
2867 case PLAYER_CLASS_PALADIN: | |
2868 case PLAYER_CLASS_CRUSADER: | |
2869 case PLAYER_CLASS_HERO: | |
2870 case PLAYER_CLASS_VILLIAN: | |
2871 case PLAYER_CLASS_CLERIC: | |
2872 case PLAYER_CLASS_PRIEST: | |
2873 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2874 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2875 v2 = GetActualWillpower(); |
1036 | 2876 v3 = GetParameterBonus(v2); |
1116 | 2877 break; |
2878 case PLAYER_CLASS_HUNTER: | |
2879 case PLAYER_CLASS_RANGER_LORD: | |
2880 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2881 case PLAYER_CLASS_DRUID: | |
2882 case PLAYER_CLASS_GREAT_DRUID: | |
2883 case PLAYER_CLASS_ARCH_DRUID: | |
2884 case PLAYER_CLASS_WARLOCK: | |
0 | 2885 v4 = GetActualWillpower(); |
1036 | 2886 v5 = GetParameterBonus(v4); |
0 | 2887 v6 = GetActualIntelligence(); |
1036 | 2888 v3 = GetParameterBonus(v6) + v5; |
0 | 2889 break; |
2890 default: | |
1116 | 2891 return 0; |
0 | 2892 break; |
2893 } | |
1116 | 2894 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2895 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2896 v9 = uFullManaBonus | |
2897 + pBaseManaByClass[classType / 4] | |
2898 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2899 + v8; | |
2900 return max(0,v9); | |
0 | 2901 } |
2902 | |
2903 //----- (0048E656) -------------------------------------------------------- | |
2904 int Player::GetBaseAC() | |
2905 { | |
2906 Player *v1; // edi@1 | |
2907 int v2; // eax@1 | |
2908 int v3; // esi@1 | |
2909 int v4; // esi@1 | |
2910 int v5; // esi@1 | |
2911 int result; // eax@2 | |
2912 | |
2913 v1 = this; | |
2914 v2 = GetActualSpeed(); | |
1036 | 2915 v3 = GetParameterBonus(v2); |
0 | 2916 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2917 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2918 if ( v5 >= 1 ) | |
2919 result = v5; | |
2920 else | |
2921 result = 0; | |
2922 return result; | |
2923 } | |
2924 | |
2925 //----- (0048E68F) -------------------------------------------------------- | |
2926 int Player::GetActualAC() | |
2927 { | |
2928 Player *v1; // edi@1 | |
2929 int v2; // eax@1 | |
2930 int v3; // esi@1 | |
2931 int v4; // esi@1 | |
2932 int v5; // esi@1 | |
2933 int v6; // esi@1 | |
2934 int result; // eax@2 | |
2935 | |
2936 v1 = this; | |
2937 v2 = GetActualSpeed(); | |
1036 | 2938 v3 = GetParameterBonus(v2); |
0 | 2939 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2940 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2941 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
2942 if ( v6 >= 1 ) | |
2943 result = v6; | |
2944 else | |
2945 result = 0; | |
2946 return result; | |
2947 } | |
2948 | |
2949 //----- (0048E6DC) -------------------------------------------------------- | |
2950 unsigned int Player::GetBaseAge() | |
2951 { | |
352 | 2952 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 2953 } |
2954 | |
2955 //----- (0048E72C) -------------------------------------------------------- | |
2956 unsigned int Player::GetActualAge() | |
2957 { | |
2958 return this->sAgeModifier + GetBaseAge(); | |
2959 } | |
2960 | |
2961 //----- (0048E73F) -------------------------------------------------------- | |
2962 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
2963 { | |
2964 Player *v2; // ebx@1 | |
2965 signed int v3; // esi@1 | |
2966 enum CHARACTER_RACE v4; // eax@1 | |
2967 signed int v5; // edi@8 | |
2968 char v6; // zf@9 | |
2969 int v7; // esi@20 | |
2970 int result; // eax@21 | |
2971 signed int v9; // [sp-4h] [bp-10h]@11 | |
2972 | |
2973 v2 = this; | |
2974 v3 = 0; | |
2975 v4 = GetRace(); | |
2976 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
2977 { | |
2978 v5 = 0; | |
2979 goto LABEL_16; | |
2980 } | |
2981 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
2982 { | |
2983 v5 = 1; | |
2984 LABEL_16: | |
2985 v6 = v4 == 2; | |
2986 goto LABEL_17; | |
2987 } | |
2988 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
2989 { | |
2990 v6 = v4 == 3; | |
2991 v5 = 2; | |
2992 goto LABEL_17; | |
2993 } | |
2994 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
2995 { | |
2996 v5 = 3; | |
2997 v6 = v4 == 3; | |
2998 goto LABEL_17; | |
2999 } | |
3000 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3001 { | |
3002 v5 = 7; | |
3003 if ( v4 != 1 ) | |
3004 goto LABEL_20; | |
3005 v9 = 10; | |
3006 LABEL_19: | |
3007 v3 = v9; | |
3008 goto LABEL_20; | |
3009 } | |
3010 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3011 { | |
3012 v5 = 8; | |
3013 v6 = v4 == 0; | |
3014 LABEL_17: | |
3015 if ( !v6 ) | |
3016 goto LABEL_20; | |
3017 v9 = 5; | |
3018 goto LABEL_19; | |
3019 } | |
3020 v5 = 0; | |
3021 LABEL_20: | |
3022 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3023 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3024 result = v7 + *(&v2->sResFireBase + v5); |
3025 return result; | |
3026 } | |
3027 | |
3028 //----- (0048E7D0) -------------------------------------------------------- | |
3029 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3030 { | |
3031 signed int v2; // edi@1 | |
3032 Player *v3; // esi@1 | |
3033 enum CHARACTER_RACE v4; // ebx@1 | |
3034 char v6; // zf@18 | |
3035 int v7; // ebx@28 | |
3036 int result; // eax@28 | |
3037 signed int v9; // [sp+10h] [bp-8h]@1 | |
3038 signed int v10; // [sp+14h] [bp-4h]@1 | |
3039 | |
3040 v2 = 0; | |
3041 v3 = this; | |
3042 v10 = 0; | |
3043 v9 = 0; | |
3044 v4 = GetRace(); | |
652 | 3045 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3046 v10 = 20; |
3047 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3048 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3049 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3050 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3051 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3052 && HasItemEquipped(EQUIP_ARMOUR) | |
3053 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3054 v10 += v3->pActiveSkills[9] & 0x3F; | |
3055 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3056 goto LABEL_25; | |
3057 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3058 { | |
3059 v2 = 1; | |
3060 LABEL_25: | |
3061 v6 = v4 == 2; | |
3062 LABEL_26: | |
3063 if ( v6 ) | |
3064 v9 = 5; | |
3065 goto LABEL_28; | |
3066 } | |
3067 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3068 { | |
3069 v6 = v4 == 3; | |
3070 v2 = 2; | |
3071 goto LABEL_26; | |
3072 } | |
3073 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3074 { | |
3075 v2 = 3; | |
3076 if ( v4 == 3 ) | |
3077 v10 += 5; | |
3078 } | |
3079 else | |
3080 { | |
3081 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3082 { | |
3083 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3084 goto LABEL_28; | |
3085 v2 = 8; | |
3086 v6 = v4 == 0; | |
3087 goto LABEL_26; | |
3088 } | |
3089 v2 = 7; | |
3090 if ( v4 == 1 ) | |
3091 v9 = 10; | |
3092 } | |
3093 LABEL_28: | |
3094 v7 = GetItemsBonus(a2, 0); | |
3095 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3096 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3097 { |
3098 if ( result > 200 ) | |
3099 result = 200; | |
3100 } | |
3101 return result; | |
3102 } | |
3103 | |
3104 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3105 bool Player::Recover(int dt) |
3106 { | |
3107 //Player *v2; // esi@1 | |
0 | 3108 signed __int64 v3; // qax@1 |
816 | 3109 //bool result; // eax@4 |
3110 | |
3111 //v2 = this; | |
3112 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3113 | |
3114 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3115 | |
3116 if (uTimeToRecovery > v3) | |
3117 { | |
3118 uTimeToRecovery -= v3; | |
3119 return true; | |
0 | 3120 } |
3121 else | |
3122 { | |
816 | 3123 uTimeToRecovery = 0; |
3124 viewparams->bRedrawGameUI = true; | |
3125 if (!uActiveCharacter) | |
0 | 3126 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3127 return false; |
3128 } | |
0 | 3129 } |
3130 | |
3131 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3132 void Player::SetRecoveryTime(signed int rec) |
3133 { | |
1545 | 3134 Assert(rec >= 0); |
816 | 3135 |
3136 if (rec > uTimeToRecovery) | |
3137 uTimeToRecovery = rec; | |
3138 | |
3139 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3140 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3141 |
3142 viewparams->bRedrawGameUI = true; | |
0 | 3143 } |
3144 // 50C0C4: using guessed type int some_active_character; | |
3145 | |
3146 //----- (0048E9B7) -------------------------------------------------------- | |
3147 void Player::RandomizeName() | |
3148 { | |
3149 if (!uExpressionTimePassed) | |
3150 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3151 } | |
3152 | |
3153 //----- (0048E9F4) -------------------------------------------------------- | |
3154 unsigned int Player::GetMajorConditionIdx() | |
3155 { | |
3156 for (uint i = 0; i < 18; ++i) | |
3157 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3158 return pConditionImportancyTable[i]; | |
3159 | |
3160 return 18; | |
3161 } | |
3162 | |
3163 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3164 int Player::GetParameterBonus( int player_parameter ) |
3165 { | |
3166 int i; // eax@1 | |
3167 i = 0; | |
3168 while (param_to_bonus_table[i]) | |
3169 { | |
3170 if (player_parameter >= param_to_bonus_table[i]) | |
3171 break; | |
3172 ++i; | |
3173 } | |
3174 return parameter_to_bonus_value[i]; | |
0 | 3175 } |
3176 | |
3177 //----- (0048EA46) -------------------------------------------------------- | |
3178 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3179 { | |
1032 | 3180 int inv_indx; // eax@3 |
3181 | |
3182 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3183 { | |
3184 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3185 continue; | |
3186 inv_indx = pEquipment.pIndices[i] - 1; | |
3187 if (a2==17) | |
3188 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3189 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3190 return 50; |
3191 } | |
3192 if (a2==24) | |
3193 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3194 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3195 return 5; |
3196 } | |
3197 } | |
3198 return 0; | |
0 | 3199 } |
3200 | |
3201 //----- (0048EAAE) -------------------------------------------------------- | |
3202 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3203 { | |
3204 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3205 // signed int v4; // eax@1 |
0 | 3206 int v5; // edi@1 |
3207 Player *v6; // ebx@1 | |
3208 Player *v8; // ecx@48 | |
3209 int v9; // eax@49 | |
3210 int v10; // edx@49 | |
3211 Player *v11; // ecx@55 | |
3212 int v12; // eax@56 | |
3213 int v13; // edx@56 | |
3214 int v14; // ecx@58 | |
3215 int v15; // eax@58 | |
3216 Player *v16; // ecx@61 | |
3217 int v17; // eax@62 | |
3218 Player *v18; // ecx@66 | |
3219 int v19; // eax@67 | |
3220 int v20; // eax@69 | |
3221 Player *v21; // ecx@75 | |
3222 int v22; // eax@76 | |
3223 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3224 //int v24; // eax@79 |
0 | 3225 int v25; // ecx@80 |
3226 int v26; // edi@80 | |
3227 Player *v27; // ecx@84 | |
3228 int v28; // eax@85 | |
3229 int v29; // edx@85 | |
3230 Player *v30; // ecx@96 | |
3231 int v31; // ebp@97 | |
3232 int v32; // eax@98 | |
3233 unsigned int v33; // eax@100 | |
3234 int v34; // eax@103 | |
3235 char v35; // zf@104 | |
3236 char v36; // zf@107 | |
3237 unsigned __int8 v37; // zf@119 | |
3238 char v38; // sf@119 | |
3239 unsigned __int8 v39; // of@119 | |
3240 char v40; // zf@122 | |
3241 char v41; // zf@145 | |
3242 char v42; // zf@164 | |
3243 char v43; // zf@173 | |
3244 char v44; // zf@189 | |
3245 char v45; // zf@198 | |
3246 char v46; // zf@239 | |
3247 int v47; // eax@268 | |
3248 int v48; // eax@269 | |
3249 int v49; // eax@291 | |
3250 char v50; // zf@295 | |
3251 int v51; // eax@306 | |
3252 int v52; // eax@307 | |
3253 char v53; // zf@312 | |
3254 char v54; // zf@336 | |
3255 char v55; // zf@348 | |
3256 int v56; // eax@365 | |
3257 int v57; // ebx@368 | |
3258 signed int v58; // [sp-4h] [bp-20h]@10 | |
3259 signed int v59; // [sp-4h] [bp-20h]@71 | |
3260 signed int v60; // [sp-4h] [bp-20h]@347 | |
3261 int v61; // [sp+10h] [bp-Ch]@1 | |
3262 int v62; // [sp+14h] [bp-8h]@1 | |
3263 int v63; // [sp+18h] [bp-4h]@101 | |
3264 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3265 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3266 bool no_skills; |
0 | 3267 |
3268 v3 = attr; | |
3269 v5 = 0; | |
3270 v6 = this; | |
3271 v62 = 0; | |
3272 v61 = 0; | |
3273 | |
1040 | 3274 |
3275 no_skills=false; | |
0 | 3276 switch (attr) |
3277 { | |
1040 | 3278 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3279 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3280 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3281 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3282 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3283 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3284 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3285 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3286 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3287 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3288 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3289 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3290 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3291 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3292 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3293 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3294 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3295 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3296 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3297 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3298 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3299 default: | |
3300 no_skills=true; | |
0 | 3301 } |
1040 | 3302 if (!no_skills) |
0 | 3303 { |
1040 | 3304 if ( !this->pActiveSkills[v58] ) |
3305 return 0; | |
0 | 3306 } |
1040 | 3307 |
0 | 3308 if ( (signed int)attr > 28 ) |
3309 { | |
3310 if ( (signed int)attr < 29 ) | |
3311 return v5 + v62 + v61; | |
1040 | 3312 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3313 { |
3314 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3315 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3316 return v5 + v62 + v61; |
3317 } | |
1040 | 3318 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3319 { |
3320 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3321 return v5 + v62 + v61; | |
1040 | 3322 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3323 v5 = pItemsTable->pItems[v57].uDamageMod; |
3324 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3325 v5 += v56; |
3326 return v5 + v62 + v61; | |
3327 } | |
3328 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3329 { |
3330 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3331 return v5 + v62 + v61; | |
1040 | 3332 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3333 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3334 LABEL_365: | |
3335 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3336 LABEL_366: | |
3337 v5 += v56; | |
3338 return v5 + v62 + v61; | |
3339 } | |
3340 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3341 return v5 + v62 + v61; | |
3342 LABEL_95: | |
3343 v65 = 0; | |
3344 while ( 1 ) | |
3345 { | |
3346 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3347 goto LABEL_361; | |
898 | 3348 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3349 if ( v3 == 9 ) |
3350 { | |
816 | 3351 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3352 if ( v32 >= 3 ) |
3353 { | |
3354 if ( v32 <= 11 ) | |
3355 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3356 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3357 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3358 } | |
3359 } | |
3360 } | |
3361 v63 = (int)((char *)v6 + 36 * v31); | |
3362 attra = (ItemGen *)(v63 + 532); | |
377 | 3363 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3364 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3365 { |
3366 v34 = attra->uItemID; | |
3367 switch ( attra->uItemID ) | |
3368 { | |
3369 case 0x1F4u: | |
3370 v35 = v3 == 5; | |
3371 goto LABEL_105; | |
3372 case 0x1F5u: | |
3373 v36 = v3 == 0; | |
3374 goto LABEL_108; | |
3375 case 0x1F6u: | |
3376 if ( v3 == 21 ) | |
3377 v61 += 10; | |
3378 v36 = v3 == 2; | |
3379 goto LABEL_108; | |
3380 case 0x1F7u: | |
3381 if ( v3 == 17 ) | |
3382 v61 += 5; | |
3383 if ( v3 == 18 ) | |
3384 v61 += 5; | |
3385 v36 = v3 == 6; | |
3386 goto LABEL_108; | |
3387 case 0x1F8u: | |
3388 goto LABEL_118; | |
3389 case 0x1F9u: | |
3390 v40 = v3 == 3; | |
3391 goto LABEL_123; | |
3392 case 0x1FAu: | |
3393 v35 = v3 == 10; | |
3394 goto LABEL_105; | |
3395 case 0x1FEu: | |
3396 v35 = v3 == 4; | |
3397 goto LABEL_105; | |
3398 case 0x1FFu: | |
3399 if ( v3 == 23 ) | |
3400 v61 += 10; | |
3401 if ( v3 == 22 ) | |
3402 v61 += 10; | |
3403 goto LABEL_361; | |
3404 case 0x200u: | |
3405 if ( v3 == 36 ) | |
3406 { | |
3407 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3408 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3409 } | |
3410 v36 = v3 == 5; | |
3411 LABEL_108: | |
3412 if ( v36 ) | |
3413 v5 += 40; | |
3414 goto LABEL_361; | |
3415 case 0x201u: | |
3416 if ( v3 == 39 ) | |
3417 { | |
3418 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3419 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3420 v62 = v34; | |
3421 } | |
3422 goto LABEL_136; | |
3423 case 0x202u: | |
3424 if ( !v3 ) | |
3425 v5 += 150; | |
3426 if ( v3 == 1 ) | |
3427 v5 -= 40; | |
3428 if ( v3 == 2 ) | |
3429 v5 -= 40; | |
3430 goto LABEL_145; | |
3431 case 0x203u: | |
3432 if ( v3 == 42 ) | |
3433 { | |
3434 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3435 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3436 } | |
3437 if ( v3 == 43 ) | |
3438 v61 += 15; | |
3439 goto LABEL_361; | |
3440 case 0x204u: | |
3441 if ( v3 == 17 ) | |
3442 v61 += 5; | |
3443 if ( v3 == 18 ) | |
3444 v61 += 5; | |
3445 if ( v3 == 6 ) | |
3446 v5 += 50; | |
3447 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3448 goto LABEL_166; | |
3449 v42 = v3 == 15; | |
3450 goto LABEL_165; | |
3451 case 0x205u: | |
3452 if ( v3 == 18 ) | |
3453 v61 += 5; | |
3454 goto LABEL_361; | |
3455 case 0x206u: | |
3456 if ( !v3 ) | |
3457 v5 += 100; | |
3458 if ( v3 == 3 ) | |
3459 v5 += 100; | |
3460 v43 = v3 == 9; | |
3461 goto LABEL_174; | |
3462 case 0x207u: | |
3463 if ( v3 == 45 ) | |
3464 v61 += 5; | |
3465 if ( v3 == 15 ) | |
3466 v5 -= 10; | |
3467 v42 = v3 == 14; | |
3468 LABEL_165: | |
3469 if ( v42 ) | |
3470 LABEL_166: | |
3471 v5 -= 10; | |
3472 goto LABEL_361; | |
3473 case 0x208u: | |
3474 v35 = v3 == 3; | |
3475 goto LABEL_105; | |
3476 case 0x209u: | |
3477 if ( v3 == 2 ) | |
3478 v5 += 15; | |
3479 if ( !v3 ) | |
3480 v5 += 15; | |
3481 v41 = v3 == 6; | |
3482 goto LABEL_146; | |
3483 case 0x20Au: | |
3484 if ( v3 == 46 ) | |
3485 v61 += 15; | |
3486 v44 = v3 == 3; | |
3487 goto LABEL_190; | |
3488 case 0x20Bu: | |
3489 if ( v3 == 34 ) | |
3490 { | |
3491 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3492 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3493 } | |
3494 if ( v3 == 12 ) | |
3495 v5 += 50; | |
3496 if ( v3 == 2 ) | |
3497 v5 += 30; | |
3498 v45 = v3 == 9; | |
3499 goto LABEL_199; | |
3500 case 0x20Cu: | |
3501 if ( !v3 ) | |
3502 v5 += 75; | |
3503 goto LABEL_145; | |
3504 case 0x20Du: | |
3505 if ( v3 == 5 ) | |
3506 v5 += 50; | |
3507 if ( v3 == 6 ) | |
3508 v5 += 50; | |
3509 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3510 goto LABEL_374; | |
3511 v43 = v3 == 15; | |
3512 LABEL_174: | |
3513 if ( v43 ) | |
3514 LABEL_374: | |
3515 v5 -= 15; | |
3516 goto LABEL_361; | |
3517 case 0x20Eu: | |
3518 if ( v3 == 4 ) | |
3519 v5 += 150; | |
3520 if ( v3 == 44 ) | |
3521 v61 += 5; | |
3522 if ( v3 == 9 ) | |
3523 v5 -= 25; | |
3524 goto LABEL_361; | |
3525 case 0x20Fu: | |
3526 if ( v3 == 39 ) | |
3527 { | |
3528 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3529 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3530 v62 = v34; | |
3531 } | |
3532 if ( v3 == 40 ) | |
3533 { | |
3534 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3535 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3536 } | |
3537 LABEL_145: | |
3538 v41 = v3 == 5; | |
3539 LABEL_146: | |
3540 if ( v41 ) | |
3541 v5 -= 40; | |
3542 goto LABEL_361; | |
3543 case 0x210u: | |
3544 if ( v3 == 38 ) | |
3545 { | |
3546 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3547 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3548 } | |
3549 if ( !v3 ) | |
3550 v5 += 75; | |
3551 v44 = v3 == 11; | |
3552 LABEL_190: | |
3553 if ( v44 ) | |
3554 v5 -= 50; | |
3555 goto LABEL_361; | |
3556 case 0x211u: | |
3557 if ( v3 == 5 ) | |
3558 v5 += 100; | |
3559 if ( v3 == 4 ) | |
3560 v5 += 50; | |
3561 v35 = v3 == 11; | |
3562 LABEL_105: | |
3563 if ( v35 ) | |
3564 v5 += 50; | |
3565 goto LABEL_361; | |
3566 case 0x212u: | |
3567 if ( v3 == 1 ) | |
3568 v5 -= 20; | |
3569 v45 = v3 == 2; | |
3570 LABEL_199: | |
3571 if ( v45 ) | |
3572 v5 -= 20; | |
3573 goto LABEL_361; | |
3574 case 0x214u: | |
3575 if ( v3 == 1 ) | |
3576 v5 += 15; | |
3577 v46 = v3 == 2; | |
3578 goto LABEL_240; | |
3579 case 0x215u: | |
3580 if ( v3 == 5 ) | |
3581 v5 += 15; | |
3582 v46 = v3 == 4; | |
3583 goto LABEL_240; | |
3584 case 0x216u: | |
3585 if ( v3 == 10 ) | |
3586 v5 += 30; | |
3587 if ( !v3 ) | |
3588 v5 += 15; | |
3589 goto LABEL_315; | |
3590 case 0x217u: | |
3591 if ( v3 == 21 ) | |
3592 v61 += 5; | |
3593 if ( !v3 ) | |
3594 v5 += 15; | |
3595 goto LABEL_253; | |
3596 case 0x218u: | |
3597 goto LABEL_253; | |
3598 default: | |
3599 goto LABEL_361; | |
3600 } | |
3601 goto LABEL_361; | |
3602 } | |
3603 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3604 { | |
3605 if ( (signed int)v3 >= 0 ) | |
3606 { | |
3607 if ( (signed int)v3 <= 15 ) | |
3608 { | |
3609 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3610 } | |
3611 else | |
3612 { | |
3613 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3614 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3615 } | |
3616 } | |
3617 goto LABEL_361; | |
3618 } | |
3619 v34 = *(int *)(v63 + 544); | |
3620 if ( v34 > 48 ) | |
3621 { | |
3622 switch ( v34 ) | |
3623 { | |
3624 case 54: | |
3625 goto LABEL_315; | |
3626 case 49: | |
3627 if ( v3 == 6 ) | |
3628 goto LABEL_121; | |
3629 v50 = v3 == 1; | |
3630 goto LABEL_296; | |
3631 case 51: | |
3632 if ( v3 != 5 && v3 != 1 ) | |
3633 goto LABEL_309; | |
3634 goto LABEL_121; | |
3635 case 52: | |
3636 if ( v3 == 3 ) | |
3637 goto LABEL_121; | |
3638 v50 = v3 == 4; | |
3639 goto LABEL_296; | |
3640 case 53: | |
3641 if ( !v3 ) | |
3642 goto LABEL_121; | |
3643 v50 = v3 == 2; | |
3644 goto LABEL_296; | |
3645 case 55: | |
3646 v46 = v3 == 6; | |
3647 goto LABEL_240; | |
3648 case 56: | |
3649 if ( !v3 ) | |
3650 goto LABEL_351; | |
3651 v53 = v3 == 3; | |
3652 goto LABEL_350; | |
3653 case 57: | |
3654 if ( v3 == 1 ) | |
3655 goto LABEL_351; | |
3656 v53 = v3 == 2; | |
3657 goto LABEL_350; | |
3658 case 50: | |
3659 if ( v3 == 10 ) | |
3660 v5 += 30; | |
3661 goto LABEL_361; | |
3662 case 60: | |
3663 if ( v3 != 23 ) | |
3664 goto LABEL_336; | |
3665 if ( v5 >= 3 ) | |
3666 goto LABEL_361; | |
3667 v5 = 3; | |
3668 LABEL_336: | |
3669 v54 = v3 == 22; | |
3670 goto LABEL_345; | |
3671 case 61: | |
3672 if ( v3 != 17 ) | |
3673 goto LABEL_340; | |
3674 if ( v5 >= 3 ) | |
3675 goto LABEL_361; | |
3676 v5 = 3; | |
3677 LABEL_340: | |
3678 v54 = v3 == 18; | |
3679 goto LABEL_345; | |
3680 case 62: | |
3681 if ( v3 != 19 ) | |
3682 goto LABEL_344; | |
3683 if ( v5 >= 3 ) | |
3684 goto LABEL_361; | |
3685 v5 = 3; | |
3686 LABEL_344: | |
3687 v54 = v3 == 20; | |
3688 LABEL_345: | |
3689 if ( !v54 ) | |
3690 goto LABEL_361; | |
3691 if ( v5 >= 3 ) | |
3692 goto LABEL_361; | |
3693 v60 = 3; | |
3694 goto LABEL_360; | |
3695 case 67: | |
3696 v55 = v3 == 18; | |
3697 goto LABEL_357; | |
3698 case 68: | |
3699 v53 = v3 == 9; | |
3700 goto LABEL_350; | |
3701 case 69: | |
3702 if ( v3 == 11 ) | |
3703 v5 += 20; | |
3704 break; | |
3705 case 70: | |
3706 if ( v3 == 12 ) | |
3707 v5 += 10; | |
3708 v55 = v3 == 16; | |
3709 LABEL_357: | |
3710 if ( v55 && v5 < 2 ) | |
3711 { | |
3712 v60 = 2; | |
3713 LABEL_360: | |
3714 v5 = v60; | |
3715 } | |
3716 break; | |
3717 default: | |
3718 goto LABEL_361; | |
3719 } | |
3720 goto LABEL_361; | |
3721 } | |
3722 if ( v34 == 48 ) | |
3723 { | |
3724 if ( v3 == 9 ) | |
3725 v5 += 5; | |
3726 LABEL_315: | |
3727 v46 = v3 == 3; | |
3728 LABEL_240: | |
3729 if ( v46 ) | |
3730 v5 += 15; | |
3731 goto LABEL_361; | |
3732 } | |
3733 if ( v34 > 32 ) | |
3734 { | |
3735 if ( v34 > 44 ) | |
3736 { | |
3737 v51 = v34 - 45; | |
3738 if ( !v51 ) | |
3739 { | |
3740 if ( v3 == 5 ) | |
3741 goto LABEL_351; | |
3742 v53 = v3 == 4; | |
3743 LABEL_350: | |
3744 if ( v53 ) | |
3745 LABEL_351: | |
3746 v5 += 5; | |
3747 goto LABEL_361; | |
3748 } | |
3749 v52 = v51 - 1; | |
3750 if ( !v52 ) | |
3751 { | |
3752 v40 = v3 == 0; | |
3753 LABEL_123: | |
3754 if ( v40 ) | |
3755 v5 += 25; | |
3756 goto LABEL_361; | |
3757 } | |
3758 if ( v52 == 1 ) | |
3759 { | |
3760 LABEL_309: | |
3761 v50 = v3 == 8; | |
3762 goto LABEL_296; | |
3763 } | |
3764 } | |
3765 else | |
3766 { | |
3767 if ( v34 == 44 ) | |
3768 { | |
3769 v50 = v3 == 7; | |
3770 goto LABEL_296; | |
3771 } | |
3772 v34 -= 33; | |
3773 if ( !v34 ) | |
3774 { | |
3775 if ( v3 != 38 ) | |
3776 goto LABEL_361; | |
3777 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3778 goto LABEL_138; | |
3779 } | |
3780 --v34; | |
3781 if ( !v34 ) | |
3782 { | |
3783 if ( v3 != 36 ) | |
3784 goto LABEL_361; | |
3785 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3786 goto LABEL_138; | |
3787 } | |
3788 v49 = v34 - 8; | |
3789 if ( !v49 ) | |
3790 { | |
3791 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3792 ++v5; | |
3793 goto LABEL_361; | |
3794 } | |
3795 if ( v49 == 1 ) | |
3796 { | |
3797 if ( v3 != 3 && v3 != 7 ) | |
3798 { | |
3799 v50 = v3 == 9; | |
3800 LABEL_296: | |
3801 if ( !v50 ) | |
3802 goto LABEL_361; | |
3803 } | |
3804 LABEL_121: | |
3805 v5 += 10; | |
3806 goto LABEL_361; | |
3807 } | |
3808 } | |
3809 } | |
3810 else | |
3811 { | |
3812 if ( v34 == 32 ) | |
3813 { | |
3814 if ( v3 != 39 ) | |
3815 goto LABEL_361; | |
3816 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3817 goto LABEL_138; | |
3818 } | |
3819 if ( v34 > 28 ) | |
3820 { | |
3821 v34 -= 29; | |
3822 if ( v34 ) | |
3823 { | |
3824 --v34; | |
3825 if ( v34 ) | |
3826 { | |
3827 --v34; | |
3828 if ( v34 || v3 != 41 ) | |
3829 goto LABEL_361; | |
3830 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3831 } | |
3832 else | |
3833 { | |
3834 if ( v3 != 34 ) | |
3835 goto LABEL_361; | |
3836 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3837 } | |
3838 } | |
3839 else | |
3840 { | |
3841 if ( v3 != 37 ) | |
3842 goto LABEL_361; | |
3843 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3844 } | |
3845 goto LABEL_138; | |
3846 } | |
3847 if ( v34 == 28 ) | |
3848 { | |
3849 LABEL_136: | |
3850 if ( v3 == 42 ) | |
3851 { | |
3852 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3853 LABEL_138: | |
3854 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3855 goto LABEL_361; | |
3856 } | |
3857 } | |
3858 else | |
3859 { | |
3860 v47 = v34 - 1; | |
3861 if ( v47 ) | |
3862 { | |
3863 v48 = v47 - 1; | |
3864 if ( v48 ) | |
3865 { | |
3866 v34 = v48 - 24; | |
3867 if ( v34 ) | |
3868 { | |
3869 --v34; | |
3870 if ( v34 || v3 != 40 ) | |
3871 goto LABEL_361; | |
3872 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3873 } | |
3874 else | |
3875 { | |
3876 if ( v3 != 35 ) | |
3877 goto LABEL_361; | |
3878 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3879 } | |
3880 goto LABEL_138; | |
3881 } | |
3882 LABEL_118: | |
3883 if ( (signed int)v3 < 0 ) | |
3884 goto LABEL_361; | |
3885 v39 = __OFSUB__((int)v3, 6); | |
3886 v37 = v3 == 6; | |
3887 v38 = v3 - 6 < 0; | |
3888 } | |
3889 else | |
3890 { | |
3891 LABEL_253: | |
3892 if ( (signed int)v3 < 10 ) | |
3893 goto LABEL_361; | |
3894 v39 = __OFSUB__((int)v3, 15); | |
3895 v37 = v3 == 15; | |
3896 v38 = v3 - 15 < 0; | |
3897 } | |
3898 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3899 goto LABEL_121; | |
3900 } | |
3901 } | |
3902 LABEL_361: | |
3903 ++v65; | |
3904 if ( (signed int)v65 >= 16 ) | |
3905 return v5 + v62 + v61; | |
3906 } | |
3907 } | |
1040 | 3908 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 3909 { |
3910 if ( IsUnarmed() != 1 ) | |
3911 { | |
816 | 3912 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3913 { | |
3914 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3915 if ( v22 >= 0 ) |
3916 { | |
3917 if ( v22 <= 2 ) | |
3918 { | |
1040 | 3919 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 3920 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 3921 { |
3922 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
3923 v25 = pItemsTable->pItems[v23].uDamageDice; | |
3924 } | |
3925 else | |
3926 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3927 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3928 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 3929 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3930 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 3931 } |
3932 } | |
3933 } | |
1040 | 3934 |
3935 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
3936 { | |
3937 | |
3938 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
3939 if ((v28 < 0) || v28 > 2 ) | |
3940 return v5 + v62 + v61; | |
3941 } | |
1062 | 3942 v15 = pItemsTable->pItems[v23].uDamageMod; |
3943 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 3944 v5 += v15 + v14; |
1049 | 3945 return v5 + v62 + v61; |
0 | 3946 } |
3947 v59 = 3; | |
3948 LABEL_74: | |
3949 v5 = v59; | |
3950 return v5 + v62 + v61; | |
3951 } | |
3952 if ( (signed int)attr < 0 ) | |
3953 return v5 + v62 + v61; | |
1040 | 3954 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 3955 goto LABEL_95; |
1040 | 3956 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
3957 { | |
3958 if ( !Player::HasEnchantedItemEquipped(25) ) | |
3959 return v5 + v62 + v61; | |
3960 v5 = 5; | |
3961 return v5 + v62 + v61; | |
3962 } | |
3963 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 3964 return v5 + v62 + v61; |
1040 | 3965 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 3966 { |
3967 if ( IsUnarmed() == 1 ) | |
3968 { | |
3969 v5 = 0; | |
3970 return v5 + v62 + v61; | |
3971 } | |
816 | 3972 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3973 { | |
3974 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3975 if ( v17 >= 0 ) |
3976 { | |
3977 if ( v17 <= 2 ) | |
1040 | 3978 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 3979 } |
3980 } | |
865 | 3981 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 3982 return v5 + v62 + v61; |
1040 | 3983 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
3984 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3985 v5 += v56; | |
3986 return v5 + v62 + v61; | |
3987 } | |
3988 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 3989 { |
3990 if ( IsUnarmed() == 1 ) | |
3991 { | |
3992 v5 = 1; | |
3993 return v5 + v62 + v61; | |
3994 } | |
816 | 3995 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3996 { | |
3997 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3998 if ( v9 >= 0 ) |
3999 { | |
4000 if ( v9 <= 2 ) | |
4001 { | |
1040 | 4002 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4003 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4004 if ( !v6->pEquipment.uShield ) |
0 | 4005 { |
1040 | 4006 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4007 ++v5; |
4008 } | |
4009 } | |
4010 } | |
4011 } | |
1040 | 4012 |
4013 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4014 { | |
4015 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4016 if ((v12 < 0) || v12 > 2 ) | |
4017 return v5 + v62 + v61; | |
4018 } | |
4019 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4020 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4021 LABEL_88: |
4022 v5 += v15 + v14; | |
4023 } | |
4024 return v5 + v62 + v61; | |
4025 } | |
4026 | |
4027 //----- (0048F73C) -------------------------------------------------------- | |
4028 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4029 { | |
4030 int result; // eax@1 | |
4031 int v3; // eax@4 | |
4032 int v4; // ecx@5 | |
4033 | |
4034 switch (a2) | |
4035 { | |
4036 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4037 } | |
4038 | |
4039 result = 0; | |
4040 if ( (signed int)a2 > 10 ) | |
4041 { | |
4042 if ( (signed int)a2 <= 15 ) | |
4043 { | |
4044 switch ( a2 ) | |
4045 { | |
4046 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4047 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4048 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4049 break; |
4050 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4051 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4052 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4053 break; |
4054 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4055 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4056 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4057 break; |
4058 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4059 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4060 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4061 break; |
4062 default: | |
4063 if ( a2 != 14 ) | |
4064 return result; | |
4065 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4066 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4067 break; |
4068 } | |
4069 return v4 + v3; | |
4070 } | |
4071 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4072 { | |
4073 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4074 { | |
4075 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4076 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4077 return v4 + v3; |
4078 } | |
4079 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4080 return result; | |
4081 } | |
4082 return this->pPlayerBuffs[1].uPower; | |
4083 } | |
4084 if ( a2 == 10 ) | |
4085 { | |
4086 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4087 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4088 return v4 + v3; |
4089 } | |
4090 switch ( a2 ) | |
4091 { | |
4092 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4093 v3 = pPlayerBuffs[19].uPower; | |
4094 goto LABEL_5; | |
4095 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4096 v3 = pPlayerBuffs[17].uPower; | |
4097 goto LABEL_5; | |
4098 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4099 v3 = pPlayerBuffs[20].uPower; | |
4100 goto LABEL_5; | |
4101 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4102 v3 = pPlayerBuffs[16].uPower; | |
4103 goto LABEL_5; | |
4104 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4105 v3 = pPlayerBuffs[15].uPower; | |
4106 goto LABEL_5; | |
4107 case CHARACTER_ATTRIBUTE_SPEED: | |
4108 v3 = pPlayerBuffs[21].uPower; | |
4109 goto LABEL_5; | |
4110 case CHARACTER_ATTRIBUTE_LUCK: | |
4111 v3 = pPlayerBuffs[18].uPower; | |
4112 LABEL_5: | |
1167 | 4113 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4114 return v4 + v3; |
4115 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4116 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4117 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4118 return v4 + v3; |
4119 default: | |
4120 return result; | |
4121 } | |
4122 return result; | |
4123 } | |
4124 | |
4125 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4126 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4127 { | |
1064 | 4128 signed int bonus_value; // esi@1 |
4129 unsigned __int16 skill_value; // ax@126 | |
4130 int result; // al@127 | |
353 | 4131 |
1064 | 4132 bonus_value = 0; |
353 | 4133 switch (uSkillType) |
4134 { | |
4135 case PLAYER_SKILL_MONSTER_ID: | |
4136 { | |
652 | 4137 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4138 bonus_value = 6; |
652 | 4139 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4140 bonus_value += 6; |
4141 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4142 } |
4143 break; | |
4144 | |
4145 case PLAYER_SKILL_ARMSMASTER: | |
4146 { | |
652 | 4147 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4148 bonus_value = 2; |
652 | 4149 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4150 bonus_value += 3; |
4151 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4152 } |
4153 break; | |
4154 | |
4155 case PLAYER_SKILL_STEALING: | |
4156 { | |
652 | 4157 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4158 bonus_value = 8; |
4159 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4160 } |
4161 break; | |
4162 | |
4163 | |
4164 case PLAYER_SKILL_ALCHEMY: | |
4165 { | |
652 | 4166 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4167 bonus_value = 4; |
652 | 4168 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4169 bonus_value += 8; |
4170 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4171 } |
4172 break; | |
4173 | |
4174 case PLAYER_SKILL_LEARNING: | |
4175 { | |
652 | 4176 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4177 bonus_value = 10; |
652 | 4178 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4179 bonus_value += 15; |
652 | 4180 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4181 bonus_value += 5; |
4182 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4183 } |
4184 break; | |
4185 | |
4186 case PLAYER_SKILL_UNARMED: | |
4187 { | |
652 | 4188 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4189 bonus_value = 2; |
4190 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4191 } |
4192 break; | |
4193 | |
4194 case PLAYER_SKILL_DODGE: | |
4195 { | |
652 | 4196 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4197 bonus_value = 2; |
4198 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4199 } |
4200 break; | |
4201 | |
4202 case PLAYER_SKILL_BOW: | |
1064 | 4203 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4204 break; |
4205 case PLAYER_SKILL_SHIELD: | |
1064 | 4206 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4207 break; |
4208 | |
4209 case PLAYER_SKILL_EARTH: | |
652 | 4210 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4211 bonus_value = 2; |
652 | 4212 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4213 bonus_value += 3; |
652 | 4214 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4215 bonus_value += 4; |
353 | 4216 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4217 bonus_value += 3; |
4218 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4219 break; |
4220 case PLAYER_SKILL_FIRE: | |
652 | 4221 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4222 bonus_value = 2; |
652 | 4223 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4224 bonus_value += 3; |
652 | 4225 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4226 bonus_value += 4; |
353 | 4227 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4228 bonus_value += 3; |
4229 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4230 break; |
4231 case PLAYER_SKILL_AIR: | |
652 | 4232 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4233 bonus_value = 2; |
652 | 4234 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4235 bonus_value += 3; |
652 | 4236 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4237 bonus_value += 4; |
353 | 4238 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4239 bonus_value += 3; |
4240 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4241 break; |
4242 case PLAYER_SKILL_WATER: | |
652 | 4243 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4244 bonus_value = 2; |
652 | 4245 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4246 bonus_value += 3; |
652 | 4247 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4248 bonus_value += 4; |
353 | 4249 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4250 bonus_value += 3; |
4251 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4252 break; |
4253 case PLAYER_SKILL_SPIRIT: | |
652 | 4254 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4255 bonus_value = 2; |
652 | 4256 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4257 bonus_value += 3; |
652 | 4258 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4259 bonus_value += 4; |
4260 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4261 break; |
4262 case PLAYER_SKILL_MIND: | |
652 | 4263 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4264 bonus_value = 2; |
652 | 4265 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4266 bonus_value += 3; |
652 | 4267 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4268 bonus_value += 4; |
4269 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4270 break; |
4271 case PLAYER_SKILL_BODY: | |
652 | 4272 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4273 bonus_value = 2; |
652 | 4274 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4275 bonus_value += 3; |
652 | 4276 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4277 bonus_value += 4; |
4278 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4279 break; |
4280 case PLAYER_SKILL_LIGHT: | |
1064 | 4281 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4282 break; |
4283 case PLAYER_SKILL_DARK: | |
4284 { | |
1064 | 4285 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4286 } |
4287 break; | |
4288 | |
4289 case PLAYER_SKILL_MERCHANT: | |
4290 { | |
652 | 4291 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4292 bonus_value = 4; |
652 | 4293 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4294 bonus_value += 6; |
652 | 4295 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4296 bonus_value += 3; |
652 | 4297 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4298 bonus_value += 8; |
353 | 4299 } |
4300 break; | |
4301 | |
4302 case PLAYER_SKILL_PERCEPTION: | |
4303 { | |
652 | 4304 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4305 bonus_value = 6; |
652 | 4306 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4307 bonus_value += 5; |
353 | 4308 } |
4309 break; | |
4310 | |
0 | 4311 case PLAYER_SKILL_ITEM_ID: |
1064 | 4312 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4313 break; |
4314 case PLAYER_SKILL_MEDITATION: | |
1064 | 4315 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4316 break; |
0 | 4317 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4318 { |
652 | 4319 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4320 bonus_value = 4; |
652 | 4321 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4322 bonus_value += 6; |
652 | 4323 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4324 bonus_value += 8; |
4325 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4326 } |
4327 break; | |
4328 } | |
4329 | |
1064 | 4330 skill_value = pActiveSkills[uSkillType]; |
4331 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4332 result = bonus_value + skill_value; | |
0 | 4333 else |
1064 | 4334 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4335 return result; |
4336 } | |
4337 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4338 |
0 | 4339 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4340 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE inSkill) //TODO: move the individual implementations to attribute classes once possible |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4341 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4342 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4343 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4344 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4345 int armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4346 if ( armmaster_skill > 0 ) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4347 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4348 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4349 if ( inSkill == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4350 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4351 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 0, 1, 2); |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4352 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4353 else if ( inSkill == CHARACTER_ATTRIBUTE_ATTACK ) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4354 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4355 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4356 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4357 armsMasterBonus = multiplier * (armmaster_skill & 0x3F); |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4358 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4359 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4360 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4361 { |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4362 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4363 if (HasItemEquipped(EQUIP_BOW)) |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4364 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4365 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4366 int multiplier = GetMultiplierForSkillLevel(bowSkillLevel, 0, 0, 0, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4367 return multiplier * (bowSkillLevel & 0x3F); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4368 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4369 return 0; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4370 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4371 case CHARACTER_ATTRIBUTE_HEALTH: |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4372 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4373 int base_value = pBaseHealthPerLevelByClass[classType]; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4374 int attrib_modif = GetBodybuilding(); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4375 return base_value * attrib_modif; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4376 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4377 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4378 case CHARACTER_ATTRIBUTE_MANA: |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4379 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4380 int base_value = pBaseManaPerLevelByClass[classType]; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4381 int attrib_modif = GetMeditation(); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4382 return base_value * attrib_modif; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4383 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4384 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4385 case CHARACTER_ATTRIBUTE_AC_BONUS: |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4386 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4387 bool wearingArmor = false; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4388 bool wearingLeather = false; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4389 unsigned int ACSum = 0; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4390 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4391 for (int j = 0; j < 16; ++j) |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4392 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4393 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) |
1538 | 4394 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4395 int curr_item = pOwnItems[pEquipment.pIndices[j] - 1].uItemID; |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4396 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4397 int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4398 int multiplier = 0; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4399 switch (itemSkillType) |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4400 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4401 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4402 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 1, 1, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4403 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4404 case PLAYER_SKILL_SWORD: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4405 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4406 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 0, 0, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4407 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4408 case PLAYER_SKILL_SHIELD: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4409 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4410 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4411 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4412 case PLAYER_SKILL_LEATHER: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4413 wearingLeather = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4414 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4415 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4416 case PLAYER_SKILL_CHAIN: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4417 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4418 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4419 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4420 case PLAYER_SKILL_PLATE: |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4421 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4422 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4423 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4424 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4425 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4426 } |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4427 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4428 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4429 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4430 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4431 int multiplier = GetMultiplierForSkillLevel(dodgeSkillLevel, 1, 2, 3, 3); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4432 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) ) |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4433 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4434 ACSum += multiplier * (dodgeSkillLevel & 0x3F); |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4435 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4436 return ACSum; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4437 } |
1538 | 4438 break; |
4439 case CHARACTER_ATTRIBUTE_ATTACK: | |
4440 if ( this->IsUnarmed() ) | |
4441 { | |
4442 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4443 if (!unarmedSkill) | |
4444 { | |
4445 return 0; | |
4446 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4447 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4448 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4449 } | |
4450 for (int i = 0; i < 16; ++i) | |
4451 { | |
4452 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4453 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4454 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4455 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4456 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4457 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4458 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4459 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4460 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4461 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4462 return multiplier * (currentItemSkillLevel & 0x3F); |
4463 } | |
4464 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4465 { | |
4466 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4467 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4468 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4469 } | |
4470 else | |
4471 { | |
4472 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4473 } | |
4474 } | |
4475 } | |
4476 } | |
4477 return 0; | |
4478 break; | |
4479 | |
4480 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4481 for (int i = 0; i < 16; i++) | |
4482 { | |
4483 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4484 { | |
4485 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4486 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4487 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4488 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4489 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4490 return multiplier * (currentItemSkillLevel & 0x3F); |
4491 } | |
4492 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4493 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4494 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4495 return multiplier * (currentItemSkillLevel & 0x3F); |
4496 } | |
4497 } | |
4498 } | |
4499 return 0; | |
4500 break; | |
4501 | |
4502 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4503 if ( this->IsUnarmed() ) | |
4504 { | |
4505 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4506 if ( !unarmedSkillLevel ) | |
4507 { | |
4508 return 0; | |
4509 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4510 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4511 return multiplier * (unarmedSkillLevel & 0x3F); |
4512 } | |
4513 for (int i = 0; i < 16; i++) | |
4514 { | |
4515 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4516 { | |
4517 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4518 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4519 { | |
4520 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4521 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4522 int baseSkillBonus; | |
4523 int multiplier; | |
4524 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4525 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4526 case PLAYER_SKILL_STAFF: |
1538 | 4527 if ( SkillToMastery(currItemSkillLevel) >= 4 && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4528 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4529 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4530 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4531 return multiplier * (unarmedSkillLevel & 0x3F); |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4532 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4533 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4534 { |
1538 | 4535 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4536 } |
1538 | 4537 break; |
4538 | |
4539 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4540 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4541 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4542 return armsMasterBonus + baseSkillBonus; | |
4543 break; | |
4544 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4545 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4546 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4547 return armsMasterBonus + baseSkillBonus; | |
4548 break; | |
4549 case PLAYER_SKILL_MACE: | |
4550 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4551 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4552 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4553 return armsMasterBonus + baseSkillBonus; | |
4554 break; | |
4555 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4556 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4557 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4558 return armsMasterBonus + baseSkillBonus; | |
4559 break; | |
1535 | 4560 } |
1533 | 4561 } |
1535 | 4562 } |
1538 | 4563 } |
4564 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4565 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4566 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4567 return 0; |
1533 | 4568 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4569 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4570 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4571 unsigned int Player::GetMultiplierForSkillLevel(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4) |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4572 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4573 int masteryLvl = SkillToMastery(skillValue); |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4574 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4575 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4576 case 1: return mult1; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4577 case 2: return mult2; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4578 case 3: return mult3; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4579 case 4: return mult4; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4580 } |
1545 | 4581 Error("(%u)", masteryLvl); |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4582 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4583 } |
0 | 4584 //----- (00490109) -------------------------------------------------------- |
4585 // faces are: 0 1 2 3 human males | |
4586 // 4 5 6 7 human females | |
4587 // 8 9 elf males | |
4588 // 10 11 elf females | |
4589 // 12 13 dwarf males | |
4590 // 14 15 dwarf females | |
4591 // 16 17 goblin males | |
4592 // 18 19 goblin females | |
4593 // 20 lich male | |
4594 // 21 lich female | |
4595 // 22 underwater suits (unused) | |
4596 // 23 zombie male | |
4597 // 24 zombie female | |
4598 enum CHARACTER_RACE Player::GetRace() | |
4599 { | |
1014 | 4600 if ( uCurrentFace > 15 ) |
4601 { | |
4602 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4603 return CHARACTER_RACE_GOBLIN; |
4604 } | |
4605 else | |
4606 { | |
1014 | 4607 if ( uCurrentFace >= 12 ) |
0 | 4608 { |
4609 return CHARACTER_RACE_DWARF; | |
4610 } | |
4611 else | |
4612 { | |
1014 | 4613 |
4614 if ( uCurrentFace <= 7 ) | |
0 | 4615 { |
4616 return CHARACTER_RACE_HUMAN; | |
4617 } | |
4618 else | |
4619 { | |
1014 | 4620 if ( uCurrentFace <= 11 ) |
0 | 4621 return CHARACTER_RACE_ELF; |
4622 } | |
4623 } | |
4624 } | |
4625 return CHARACTER_RACE_HUMAN; | |
4626 } | |
4627 | |
4628 //----- (00490141) -------------------------------------------------------- | |
187 | 4629 PLAYER_SEX Player::GetSexByVoice() |
0 | 4630 { |
4631 signed int result; // eax@1 | |
4632 | |
4633 result = 0; | |
4634 switch ( this->uVoiceID ) | |
4635 { | |
4636 case 0u: | |
4637 case 1u: | |
4638 case 2u: | |
4639 case 3u: | |
4640 case 8u: | |
4641 case 9u: | |
4642 case 0xCu: | |
4643 case 0xDu: | |
4644 case 0x10u: | |
4645 case 0x11u: | |
4646 case 0x14u: | |
4647 case 0x17u: | |
187 | 4648 return SEX_MALE; |
4649 | |
0 | 4650 case 4u: |
4651 case 5u: | |
4652 case 6u: | |
4653 case 7u: | |
4654 case 0xAu: | |
4655 case 0xBu: | |
4656 case 0xEu: | |
4657 case 0xFu: | |
4658 case 0x12u: | |
4659 case 0x13u: | |
4660 case 0x15u: | |
4661 case 0x18u: | |
187 | 4662 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4663 } |
1545 | 4664 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4665 return SEX_MALE; |
0 | 4666 } |
4667 | |
4668 //----- (00490188) -------------------------------------------------------- | |
4669 void Player::SetInitialStats() | |
4670 { | |
4671 auto v1 = GetRace(); | |
290 | 4672 uMight = StatTable[v1][0].uBaseValue; |
4673 uIntelligence = StatTable[v1][1].uBaseValue; | |
4674 uWillpower = StatTable[v1][2].uBaseValue; | |
4675 uEndurance = StatTable[v1][3].uBaseValue; | |
4676 uAccuracy = StatTable[v1][4].uBaseValue; | |
4677 uSpeed = StatTable[v1][5].uBaseValue; | |
4678 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4679 } |
4680 | |
4681 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4682 void Player::SetSexByVoice() |
4683 { | |
4684 switch ( this->uVoiceID) | |
0 | 4685 { |
4686 case 0: | |
4687 case 1: | |
4688 case 2: | |
4689 case 3: | |
4690 case 8: | |
4691 case 9: | |
4692 case 0xC: | |
4693 case 0xD: | |
4694 case 0x10: | |
4695 case 0x11: | |
4696 case 0x14: | |
4697 case 0x17: | |
1021 | 4698 this->uSex = SEX_MALE; |
0 | 4699 break; |
4700 case 4: | |
4701 case 5: | |
4702 case 6: | |
4703 case 7: | |
4704 case 0xA: | |
4705 case 0xB: | |
4706 case 0xE: | |
4707 case 0xF: | |
4708 case 0x12: | |
4709 case 0x13: | |
4710 case 0x15: | |
4711 case 0x18: | |
1021 | 4712 this->uSex = SEX_FEMALE; |
0 | 4713 break; |
4714 default: | |
4715 break; | |
4716 } | |
1021 | 4717 |
0 | 4718 } |
4719 | |
4720 //----- (0049024A) -------------------------------------------------------- | |
135 | 4721 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4722 { |
4723 sLevelModifier = 0; | |
4724 sAgeModifier = 0; | |
4725 | |
135 | 4726 classType = cls; |
0 | 4727 uLuckBonus = 0; |
4728 uSpeedBonus = 0; | |
4729 uAccuracyBonus = 0; | |
4730 uEnduranceBonus = 0; | |
4731 uWillpowerBonus = 0; | |
4732 uIntelligenceBonus = 0; | |
4733 uMightBonus = 0; | |
4734 uLevel = 1; | |
4735 uExperience = 251 + rand() % 100; | |
4736 uBirthYear = 1147 - rand() % 6; | |
4737 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4738 memset(_achieved_awards_bits, 0, 64); |
0 | 4739 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4740 | |
4741 for (uint i = 0; i < 37; ++i) | |
4742 { | |
135 | 4743 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4744 continue; |
4745 | |
4746 pActiveSkills[i] = 1; | |
4747 | |
4748 switch (i) | |
4749 { | |
886 | 4750 case PLAYER_SKILL_FIRE: |
4751 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4752 |
4753 extern bool all_magic; | |
4754 if ( all_magic == true ) | |
4755 { | |
4756 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4757 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4758 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4759 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4760 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4761 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4762 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4763 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4764 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4765 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4766 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4767 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4768 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4769 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4770 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4771 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4772 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4773 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4774 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4775 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4776 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4777 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4778 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4779 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4780 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4781 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4782 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4783 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4784 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4785 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4786 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4787 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4788 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4789 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4790 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4791 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4792 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4793 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4794 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4795 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4796 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4797 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4798 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4799 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4800 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4801 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4802 } | |
486 | 4803 break; |
886 | 4804 case PLAYER_SKILL_AIR: |
4805 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4806 break; | |
4807 case PLAYER_SKILL_WATER: | |
4808 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4809 break; | |
4810 case PLAYER_SKILL_EARTH: | |
4811 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4812 break; | |
4813 case PLAYER_SKILL_SPIRIT: | |
4814 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4815 break; | |
4816 case PLAYER_SKILL_MIND: | |
4817 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4818 break; | |
4819 case PLAYER_SKILL_BODY: | |
4820 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4821 |
4822 if ( all_magic == true ) | |
4823 { | |
4824 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4825 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4826 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4827 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4828 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4829 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4830 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4831 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4832 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4833 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4834 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4835 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4836 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4837 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4838 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4839 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4840 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4841 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4842 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4843 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4844 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4845 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4846 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4847 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4848 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4849 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4850 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4851 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4852 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4853 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4854 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4855 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4856 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4857 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4858 } | |
569 | 4859 break; |
886 | 4860 case PLAYER_SKILL_LIGHT: |
4861 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4862 break; | |
4863 case PLAYER_SKILL_DARK: | |
4864 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4865 break; | |
0 | 4866 } |
4867 } | |
4868 | |
4869 sHealth = GetMaxHealth(); | |
4870 sMana = GetMaxMana(); | |
4871 } | |
4872 | |
4873 //----- (004903C9) -------------------------------------------------------- | |
821 | 4874 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4875 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4876 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4877 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4878 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4879 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4880 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4881 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4882 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4883 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4884 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4885 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4886 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4887 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4888 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4889 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4890 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4891 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4892 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4893 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4894 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4895 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4896 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4897 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4898 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4899 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4900 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4901 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4902 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4903 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4904 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4905 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4906 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4907 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4908 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4909 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4910 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4911 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4912 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4913 |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
4914 return (PLAYER_SKILL_TYPE)37; |
0 | 4915 } |
4916 | |
4917 | |
4918 | |
4919 //----- (0049048D) -------------------------------------------------------- | |
4920 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
4921 void Player::DecreaseAttribute(int eAttribute) | |
4922 { | |
4923 int v2; // eax@1 | |
4924 int pBaseValue; // ecx@1 | |
4925 int pDroppedStep; // ebx@1 | |
4926 int pStep; // esi@1 | |
4927 unsigned __int16 result; // ax@7 | |
4928 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
4929 | |
4930 v2 = eAttribute + 7 * GetRace(); | |
290 | 4931 pBaseValue = StatTable[0][v2].uBaseValue; |
4932 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 4933 uMinValue = pBaseValue - 2; |
290 | 4934 pStep = StatTable[0][v2].uBaseStep; |
1272 | 4935 unsigned short* AttrToChange = nullptr; |
4936 switch ( eAttribute ) | |
4937 { | |
4938 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4939 AttrToChange = &this->uMight; | |
4940 break; | |
4941 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4942 AttrToChange = &this->uIntelligence; | |
4943 break; | |
4944 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4945 AttrToChange = &this->uWillpower; | |
4946 break; | |
4947 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4948 AttrToChange = &this->uEndurance; | |
4949 break; | |
4950 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4951 AttrToChange = &this->uAccuracy; | |
4952 break; | |
4953 case CHARACTER_ATTRIBUTE_SPEED: | |
4954 AttrToChange = &this->uSpeed; | |
4955 break; | |
4956 case CHARACTER_ATTRIBUTE_LUCK: | |
4957 AttrToChange = &this->uLuck; | |
4958 break; | |
4959 } | |
4960 if ( *AttrToChange <= pBaseValue ) | |
4961 pStep = pDroppedStep; | |
4962 if ( *AttrToChange - pStep >= uMinValue ) | |
4963 *AttrToChange -= pStep; | |
0 | 4964 } |
4965 | |
4966 //----- (004905F5) -------------------------------------------------------- | |
1458 | 4967 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 4968 void Player::IncreaseAttribute( int eAttribute ) |
4969 { | |
4970 int raceId; // eax@1 | |
4971 int maxValue; // ebx@1 | |
4972 signed int baseStep; // edi@1 | |
4973 signed int tmp; // eax@17 | |
0 | 4974 signed int result; // eax@18 |
1273 | 4975 int baseValue; // [sp+Ch] [bp-8h]@1 |
4976 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
4977 unsigned short* statToChange; | |
4978 | |
4979 raceId = GetRace(); | |
4980 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
4981 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
4982 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
4983 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
4984 PlayerCreation_GetUnspentAttributePointCount(); | |
4985 switch ( eAttribute ) | |
4986 { | |
4987 case 0: | |
4988 statToChange = &this->uMight; | |
4989 break; | |
4990 case 1: | |
4991 statToChange = &this->uIntelligence; | |
4992 break; | |
4993 case 2: | |
4994 statToChange = &this->uWillpower; | |
4995 break; | |
4996 case 3: | |
4997 statToChange = &this->uEndurance; | |
4998 break; | |
4999 case 4: | |
5000 statToChange = &this->uAccuracy; | |
5001 break; | |
5002 case 5: | |
5003 statToChange = &this->uSpeed; | |
5004 break; | |
5005 case 6: | |
5006 statToChange = &this->uLuck; | |
5007 default: | |
1545 | 5008 Error("(%u)", eAttribute); |
1273 | 5009 } |
5010 if ( *statToChange < baseValue ) | |
5011 { | |
5012 tmp = baseStep; | |
5013 baseStep = droppedStep; | |
5014 droppedStep = tmp; | |
5015 } | |
5016 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5017 if ( result >= droppedStep ) | |
5018 { | |
5019 if ( baseStep + *statToChange <= maxValue ) | |
5020 *statToChange += baseStep; | |
5021 } | |
0 | 5022 } |
5023 | |
5024 //----- (0049070F) -------------------------------------------------------- | |
5025 void Player::Zero() | |
5026 { | |
5027 this->sLevelModifier = 0; | |
5028 this->sACModifier = 0; | |
5029 this->uLuckBonus = 0; | |
5030 this->uAccuracyBonus = 0; | |
5031 this->uSpeedBonus = 0; | |
5032 this->uEnduranceBonus = 0; | |
5033 this->uWillpowerBonus = 0; | |
5034 this->uIntelligenceBonus = 0; | |
5035 this->uMightBonus = 0; | |
5036 this->field_100 = 0; | |
5037 this->field_FC = 0; | |
5038 this->field_F8 = 0; | |
5039 this->field_F4 = 0; | |
5040 this->field_F0 = 0; | |
5041 this->field_EC = 0; | |
5042 this->field_E8 = 0; | |
5043 this->field_E4 = 0; | |
5044 this->field_E0 = 0; | |
766 | 5045 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5046 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5047 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5048 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5049 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5050 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5051 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5052 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5053 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5054 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5055 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5056 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5057 this->uFullHealthBonus = 0; |
0 | 5058 } |
5059 | |
5060 //----- (004907E7) -------------------------------------------------------- | |
299 | 5061 unsigned int Player::GetStatColor(int uStat) |
0 | 5062 { |
290 | 5063 int attribute_value; // edx@1 |
1393 | 5064 |
5065 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5066 switch (uStat) |
5067 { | |
5068 case 0: attribute_value = uMight; break; | |
5069 case 1: attribute_value = uIntelligence; break; | |
5070 case 2: attribute_value = uWillpower; break; | |
5071 case 3: attribute_value = uEndurance; break; | |
290 | 5072 case 4: attribute_value = uAccuracy; break; |
5073 case 5: attribute_value = uSpeed; break; | |
0 | 5074 case 6: attribute_value = uLuck; break; |
5075 }; | |
5076 | |
1393 | 5077 if (attribute_value == base_attribute_value) |
5078 return ui_character_stat_default_color; | |
5079 else if (attribute_value > base_attribute_value) | |
5080 return ui_character_stat_buffed_color; | |
0 | 5081 else |
1393 | 5082 return ui_character_stat_debuffed_color; |
0 | 5083 } |
5084 | |
5085 //----- (004908A8) -------------------------------------------------------- | |
5086 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5087 { | |
1014 | 5088 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5089 { | |
1393 | 5090 pConditions[uCondition] = 0i64; |
1014 | 5091 return true; |
0 | 5092 } |
5093 else | |
1014 | 5094 return false; |
0 | 5095 } |
5096 | |
5097 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5098 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5099 { |
5100 Player *v3; // esi@1 | |
5101 signed int v5; // eax@17 | |
5102 int v8; // edx@39 | |
5103 char *v13; // eax@45 | |
5104 signed int v15; // edi@68 | |
5105 int v16; // edx@73 | |
5106 unsigned __int16 v17; // edi@73 | |
5107 unsigned int v18; // eax@73 | |
5108 const char *v22; // eax@84 | |
5109 int scroll_id; // esi@96 | |
5110 int v25; // eax@109 | |
5111 int v26; // eax@113 | |
5112 int new_mana_val; // edi@114 | |
5113 signed __int64 v28; // qax@120 | |
5114 __int64 v30; // edi@137 | |
5115 __int64 v32; // ST3C_4@137 | |
5116 __int64 v34; // ST34_4@137 | |
5117 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5118 const char *v66; // [sp-4h] [bp-30h]@69 | |
5119 signed int v67; // [sp-4h] [bp-30h]@77 | |
5120 const char *v68; // [sp-4h] [bp-30h]@89 | |
5121 char v72; // [sp+20h] [bp-Ch]@68 | |
5122 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5123 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5124 Player *thisb; // [sp+28h] [bp-4h]@1 |
5125 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5126 | |
5127 thisb = this; | |
5128 v3 = &pParty->pPlayers[player_num-1]; | |
5129 v73 = 1; | |
1340 | 5130 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5131 return; |
5132 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5133 { |
1021 | 5134 if ( pParty->pPickedItem.uItemID == 160 ) |
5135 { | |
5136 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5137 } | |
5138 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5139 { |
1021 | 5140 new_mana_val = v3->sMana; |
5141 new_mana_val += 2; | |
5142 if ( new_mana_val > v3->GetMaxMana() ) | |
5143 new_mana_val = v3->GetMaxMana(); | |
5144 v3->PlaySound(SPEECH_36, 0); | |
5145 } | |
5146 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5147 { | |
5148 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5149 v3->PlaySound(SPEECH_36, 0); |
1021 | 5150 |
5151 } | |
5152 else | |
5153 { | |
5154 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5155 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
|
5156 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5157 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5158 return; | |
1019 | 5159 } |
1032 | 5160 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5161 | |
5162 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5163 { | |
5164 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5165 } | |
5166 if ( v73 ) | |
5167 { | |
5168 if ( pParty->bTurnBasedModeOn ) | |
5169 { | |
5170 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5171 thisb->SetRecoveryTime(100); | |
1448 | 5172 pTurnEngine->ApplyPlayerAction(); |
1032 | 5173 } |
5174 else | |
5175 { | |
5176 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5177 } | |
5178 } | |
5179 pMouse->RemoveHoldingItem(); | |
5180 return; | |
5181 | |
1021 | 5182 |
5183 } | |
5184 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5185 { |
1021 | 5186 switch ( pParty->pPickedItem.uItemID ) |
5187 { | |
5188 case 221: //Catalyst | |
5189 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5190 break; | |
5191 case 222: //Cure Wounds | |
5192 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5193 pParty->pPlayers[player_num-1].Heal(v25); | |
5194 v3->PlaySound(SPEECH_36, 0); | |
5195 break; | |
5196 case 223: //Magic Potion | |
5197 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5198 new_mana_val = v3->sMana; | |
5199 new_mana_val += v26; | |
5200 if ( new_mana_val > v3->GetMaxMana() ) | |
5201 new_mana_val = v3->GetMaxMana(); | |
5202 v3->PlaySound(SPEECH_36, 0); | |
5203 break; | |
5204 case 224: //Cure Weakness | |
5205 v3->pConditions[Condition_Weak] = 0i64; | |
5206 v3->PlaySound(SPEECH_36, 0); | |
5207 break; | |
5208 case 225: //Cure Disease | |
5209 v3->pConditions[Condition_Disease3] = 0i64; | |
5210 v3->pConditions[Condition_Disease2] = 0i64; | |
5211 v3->pConditions[Condition_Disease1] = 0i64; | |
5212 v3->PlaySound(SPEECH_36, 0); | |
5213 break; | |
5214 case 226: //Cure Poison | |
5215 v3->pConditions[Condition_Poison3] = 0i64; | |
5216 v3->pConditions[Condition_Poison2] = 0i64; | |
5217 v3->pConditions[Condition_Poison1] = 0i64; | |
5218 v3->PlaySound(SPEECH_36, 0); | |
5219 break; | |
5220 case 227: //Awaken | |
5221 v3->pConditions[Condition_Sleep] = 0i64; | |
5222 v3->PlaySound(SPEECH_36, 0); | |
5223 break; | |
5224 case 228: //Haste | |
5225 if ( !v3->pConditions[Condition_Weak] ) | |
5226 { | |
5227 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5228 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5229 v3->PlaySound(SPEECH_36, 0); | |
5230 } | |
5231 break; | |
5232 case 229: //Heroism | |
5233 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5234 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5235 v3->PlaySound(SPEECH_36, 0); | |
5236 break; | |
5237 case 230: //Bless | |
5238 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5239 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5240 v3->PlaySound(SPEECH_36, 0); | |
5241 break; | |
5242 case 231: //Preservation | |
1032 | 5243 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5244 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5245 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5246 v3->PlaySound(SPEECH_36, 0); | |
5247 break; | |
5248 case 232: //Shield | |
1032 | 5249 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5250 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5251 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5252 v3->PlaySound(SPEECH_36, 0); | |
5253 break; | |
5254 case 234: //Stoneskin | |
5255 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5256 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5257 v3->PlaySound(SPEECH_36, 0); | |
5258 break; | |
5259 case 235: //Water Breathing | |
5260 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5261 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5262 break; | |
5263 case 237: //Remove Fear | |
5264 v3->pConditions[Condition_Fear] = 0i64; | |
5265 v3->PlaySound(SPEECH_36, 0); | |
5266 break; | |
5267 case 238: //Remove Curse | |
5268 v3->pConditions[Condition_Cursed] = 0i64; | |
5269 v3->PlaySound(SPEECH_36, 0); | |
5270 break; | |
5271 case 239: //Cure Insanity | |
5272 v3->pConditions[Condition_Insane] = 0i64; | |
5273 v3->PlaySound(SPEECH_36, 0); | |
5274 break; | |
5275 case 240: //Might Boost | |
1032 | 5276 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5277 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5278 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5279 v3->PlaySound(SPEECH_36, 0); | |
5280 break; | |
5281 case 241: //Intellect Boost | |
1032 | 5282 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5283 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5284 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5285 v3->PlaySound(SPEECH_36, 0); | |
5286 break; | |
5287 case 242: //Personality Boost | |
1032 | 5288 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5289 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5290 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5291 v3->PlaySound(SPEECH_36, 0); | |
5292 break; | |
5293 case 243://Endurance Boost | |
1032 | 5294 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5295 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5296 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5297 v3->PlaySound(SPEECH_36, 0); | |
5298 break; | |
5299 case 244: //Speed Boost | |
1032 | 5300 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5301 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5302 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5303 v3->PlaySound(SPEECH_36, 0); | |
5304 break; | |
5305 case 245: //Accuracy Boost | |
1032 | 5306 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5307 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5308 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5309 v3->PlaySound(SPEECH_36, 0); | |
5310 break; | |
5311 case 251: //Cure Paralysis | |
5312 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5313 v3->PlaySound(SPEECH_36, 0); | |
5314 break; | |
5315 case 252://Divine Restoration | |
5316 v30 = v3->pConditions[Condition_Dead]; | |
5317 v32 = v3->pConditions[Condition_Pertified]; | |
5318 v34 = v3->pConditions[Condition_Eradicated]; | |
5319 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5320 v3->pConditions[Condition_Dead] = v30; | |
5321 v3->pConditions[Condition_Pertified] = v32; | |
5322 v3->pConditions[Condition_Eradicated] = v34; | |
5323 v3->PlaySound(SPEECH_36, 0); | |
5324 break; | |
5325 case 253: //Divine Cure | |
5326 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5327 pParty->pPlayers[player_num-1].Heal(v25); | |
5328 v3->PlaySound(SPEECH_36, 0); | |
5329 break; | |
5330 case 254: //Divine Power | |
5331 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5332 new_mana_val = v3->sMana; | |
5333 new_mana_val += v26; | |
5334 if ( new_mana_val > v3->GetMaxMana() ) | |
5335 new_mana_val = v3->GetMaxMana(); | |
5336 v3->PlaySound(SPEECH_36, 0); | |
5337 break; | |
5338 case 255: //Luck Boost | |
1032 | 5339 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5340 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5341 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5342 v3->PlaySound(SPEECH_36, 0); | |
5343 break; | |
5344 case 256: //Fire Resistance | |
1032 | 5345 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5346 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5347 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5348 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5349 break; |
1021 | 5350 case 257: //Air Resistance |
1032 | 5351 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5352 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5353 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5354 v3->PlaySound(SPEECH_36, 0); | |
5355 break; | |
5356 case 258: //Water Resistance | |
1032 | 5357 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5358 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5359 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5360 v3->PlaySound(SPEECH_36, 0); | |
5361 break; | |
5362 case 259: //Earth Resistance | |
1032 | 5363 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5364 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5365 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5366 v3->PlaySound(SPEECH_36, 0); | |
5367 break; | |
5368 case 260: //Mind Resistance | |
1032 | 5369 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5370 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5371 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5372 v3->PlaySound(SPEECH_36, 0); | |
5373 break; | |
5374 case 261: //Body Resistance | |
1032 | 5375 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5376 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5377 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5378 v3->PlaySound(SPEECH_36, 0); | |
5379 break; | |
5380 case 262: //Stone to Flesh | |
5381 v3->pConditions[Condition_Pertified] = 0i64; | |
5382 v3->PlaySound(SPEECH_36, 0); | |
5383 break; | |
5384 case 264: //Pure Luck | |
5385 if ( !v3->pure_luck_used ) | |
5386 { | |
5387 v3->uLuck += 50; | |
5388 v3->pure_luck_used = 1; | |
5389 } | |
5390 v3->PlaySound(SPEECH_36, 0); | |
5391 break; | |
5392 case 265: //Pure Speed | |
5393 if ( !v3->pure_speed_used ) | |
5394 { | |
5395 v3->uSpeed += 50; | |
5396 v3->pure_speed_used = 1; | |
5397 } | |
5398 v3->PlaySound(SPEECH_36, 0); | |
5399 break; | |
5400 case 266: //Pure Intellect | |
5401 if ( !v3->pure_intellect_used ) | |
5402 { | |
5403 v3->uIntelligence += 50; | |
5404 v3->pure_intellect_used = 1; | |
5405 } | |
5406 v3->PlaySound(SPEECH_36, 0); | |
5407 break; | |
5408 case 267: //Pure Endurance | |
5409 if ( !v3->pure_endurance_used ) | |
5410 { | |
5411 v3->uEndurance += 50; | |
5412 v3->pure_endurance_used = 1; | |
5413 } | |
5414 v3->PlaySound(SPEECH_36, 0); | |
5415 break; | |
5416 case 268: //Pure Personality | |
5417 if ( !v3->pure_willpower_used ) | |
5418 { | |
5419 v3->uWillpower += 50; | |
5420 v3->pure_willpower_used = 1; | |
5421 } | |
5422 v3->PlaySound(SPEECH_36, 0); | |
5423 break; | |
5424 case 269: //Pure Accuracy | |
5425 if ( !v3->pure_accuracy_used ) | |
5426 { | |
5427 v3->uAccuracy += 50; | |
5428 v3->pure_accuracy_used = 1; | |
5429 } | |
5430 v3->PlaySound(SPEECH_36, 0); | |
5431 break; | |
5432 case 270: //Pure Might | |
5433 if ( !v3->pure_might_used ) | |
5434 { | |
5435 v3->uMight += 50; | |
5436 v3->pure_might_used = 1; | |
5437 } | |
5438 v3->PlaySound(SPEECH_36, 0); | |
5439 break; | |
5440 case 271: //Rejuvenation | |
5441 v3->sAgeModifier = 0; | |
5442 v3->PlaySound(SPEECH_36, 0); | |
5443 break; | |
5444 | |
5445 default: | |
5446 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5447 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
|
5448 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5449 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5450 return; | |
1032 | 5451 } |
5452 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5453 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5454 { | |
5455 if ( !v73 ) | |
5456 { | |
5457 pMouse->RemoveHoldingItem(); | |
5458 return; | |
5459 } | |
5460 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5461 } |
1032 | 5462 if ( v73 ) |
5463 { | |
5464 if ( pParty->bTurnBasedModeOn ) | |
5465 { | |
5466 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5467 thisb->SetRecoveryTime(100); | |
1448 | 5468 pTurnEngine->ApplyPlayerAction(); |
1032 | 5469 } |
5470 else | |
5471 { | |
5472 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5473 } | |
5474 } | |
5475 pMouse->RemoveHoldingItem(); | |
5476 return; | |
5477 | |
1021 | 5478 } |
5479 | |
5480 | |
5481 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5482 { | |
5483 | |
5484 | |
5485 if ( pCurrentScreen == SCREEN_CASTING ) | |
5486 return; | |
5487 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5488 { | |
5489 | |
5490 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5491 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5492 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5493 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5494 return; |
5495 } | |
5496 if ( bUnderwater == 1 ) | |
5497 { | |
1032 | 5498 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5499 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5500 return; |
5501 } | |
5502 dword_50C9AC = 1; | |
5503 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5504 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5505 { | |
5506 pMouse->RemoveHoldingItem(); | |
5507 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5508 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5509 pCurrentScreen = SCREEN_GAME; |
5510 viewparams->bRedrawGameUI = 1; | |
5511 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5512 } | |
5513 else | |
5514 { | |
5515 _720984_unused = pParty->pPickedItem.uItemID; | |
5516 pMouse->RemoveHoldingItem(); | |
5517 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5518 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5519 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5520 { | |
5521 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5522 } | |
5523 } | |
5524 return; | |
5525 } | |
5526 | |
5527 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5528 | |
5529 { | |
5530 v15 = pParty->pPickedItem.uItemID - 400; | |
5531 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5532 if ( v72 ) | |
5533 { | |
5534 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5535 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
|
5536 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5537 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5538 return; |
5539 } | |
5540 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5541 { | |
5542 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5543 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
|
5544 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5545 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5546 return; |
5547 } | |
5548 v16 = v15 % 11 + 1; | |
5549 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5550 v18 = SkillToMastery(v17) - 1; | |
1032 | 5551 switch (v18) |
5552 { | |
5553 case 0: v67 = 4; break; | |
5554 case 1: v67 = 7; break; | |
5555 case 2: v67 = 10; break; | |
5556 case 3: v67 = 11; break; | |
5557 default: | |
5558 v67 = player_num; | |
5559 } | |
5560 | |
5561 if ( v16 > v67 || !v17 ) | |
1021 | 5562 { |
1032 | 5563 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5564 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
|
5565 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5566 v3->PlaySound((PlayerSpeech)20, 0); |
5567 return; | |
5568 } | |
5569 // v72 = 1; | |
5570 v3->PlaySound(SPEECH_21, 0); | |
5571 v73 = 0; | |
5572 | |
5573 | |
5574 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5575 { | |
5576 if ( !v73 ) | |
1021 | 5577 { |
1032 | 5578 pMouse->RemoveHoldingItem(); |
5579 return; | |
5580 } | |
5581 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5582 } | |
5583 if ( v73 ) | |
5584 { | |
5585 if ( pParty->bTurnBasedModeOn ) | |
5586 { | |
5587 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5588 thisb->SetRecoveryTime(100); | |
1448 | 5589 pTurnEngine->ApplyPlayerAction(); |
1021 | 5590 } |
5591 else | |
5592 { | |
1032 | 5593 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5594 } |
5595 } | |
1032 | 5596 pMouse->RemoveHoldingItem(); |
5597 return; | |
5598 | |
1021 | 5599 } |
5600 | |
5601 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5602 | |
5603 { | |
5604 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5605 { | |
5606 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5607 v3->PlaySound(SPEECH_37, 0); |
1021 | 5608 return; |
5609 } | |
5610 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5611 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5612 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5613 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5614 return; |
5615 } | |
5616 else | |
1459 | 5617 { |
5618 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5619 { | |
1021 | 5620 thisa = pParty->uCurrentMonthWeek + 1; |
5621 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5622 v74 = NULL; |
1021 | 5623 else |
5624 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5625 switch ( pParty->uCurrentMonth ) | |
5626 { | |
1019 | 5627 case 0: |
1021 | 5628 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5629 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5630 break; |
1019 | 5631 case 1: |
1021 | 5632 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5633 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5634 break; |
1019 | 5635 case 2: |
1021 | 5636 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5637 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5638 break; |
1019 | 5639 case 3: |
1021 | 5640 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5641 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5642 break; |
1019 | 5643 case 4: |
1021 | 5644 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5645 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5646 break; |
1019 | 5647 case 5: |
1021 | 5648 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5649 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5650 break; |
1019 | 5651 case 6: |
1021 | 5652 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5653 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5654 break; |
1019 | 5655 case 7: |
1021 | 5656 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5657 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5658 break; |
1019 | 5659 case 8: |
1021 | 5660 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5661 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5662 break; |
0 | 5663 case 9u: |
1021 | 5664 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5665 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5666 break; |
1019 | 5667 case 10: |
1021 | 5668 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5669 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5670 break; |
1019 | 5671 case 11: |
1021 | 5672 v8 = rand() % 6; |
5673 switch (v8) | |
5674 { | |
5675 case 0: | |
5676 v3->sResFireBase += thisa; | |
5677 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5678 break; | |
5679 case 1: | |
5680 v3->sResAirBase += thisa; | |
5681 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5682 break; | |
5683 case 2: | |
5684 v3->sResWaterBase += thisa; | |
5685 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5686 break; | |
5687 case 3: | |
5688 v3->sResEarthBase += thisa; | |
5689 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5690 break; | |
5691 case 4: | |
5692 v3->sResMindBase += thisa; | |
5693 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5694 break; | |
5695 case 5: | |
5696 v3->sResBodyBase += thisa; | |
5697 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5698 break; |
1021 | 5699 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5700 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5701 break; |
5702 | |
5703 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5704 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5705 pMouse->RemoveHoldingItem(); |
1459 | 5706 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5707 v3->PlaySound(SPEECH_93, 0); |
1032 | 5708 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5709 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5710 { |
1021 | 5711 v3->SetCondition(Condition_Eradicated, 0); |
5712 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5713 } |
1021 | 5714 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5715 { | |
5716 v3->SetCondition(Condition_Dead, 0); | |
5717 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5718 } | |
5719 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5720 { | |
5721 v3->SetCondition(Condition_Pertified, 0); | |
5722 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5723 } | |
1019 | 5724 return; |
1021 | 5725 } |
5726 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5727 { |
1021 | 5728 Party::GiveFood(1u); |
1459 | 5729 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5730 } | |
1021 | 5731 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5732 { | |
1459 | 5733 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5734 return; |
5735 } | |
5736 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5737 { | |
1459 | 5738 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5739 return; |
5740 } | |
5741 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5742 { | |
1459 | 5743 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5744 return; |
5745 } | |
1032 | 5746 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5747 { |
5748 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5749 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5750 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5751 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5752 } | |
5753 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5754 { | |
1459 | 5755 TeleportToNWCDungeon(); |
1021 | 5756 return; |
5757 } | |
0 | 5758 else |
1021 | 5759 { |
5760 | |
5761 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5762 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
|
5763 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5764 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5765 return; |
5766 } | |
1032 | 5767 |
0 | 5768 pMouse->RemoveHoldingItem(); |
5769 return; | |
5770 } | |
1021 | 5771 |
5772 } | |
0 | 5773 |
5774 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5775 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5776 { |
0 | 5777 Player *v3; // esi@1 |
5778 signed int v4; // edi@1 | |
5779 unsigned int v5; // eax@8 | |
5780 int v6; // eax@9 | |
5781 enum CHARACTER_RACE v7; // eax@11 | |
5782 signed int v8; // eax@17 | |
5783 unsigned __int8 v9; // sf@17 | |
5784 unsigned __int8 v10; // of@17 | |
5785 int v11; // eax@19 | |
5786 unsigned int v12; // eax@20 | |
484 | 5787 unsigned int test_bit_value; // eax@25 |
5788 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5789 signed int v15; // ecx@28 |
5790 ItemGen *v16; // eax@28 | |
5791 char v17; // zf@31 | |
5792 int v18; // edi@90 | |
5793 DDM_DLV_Header *v19; // eax@122 | |
5794 char v20; // cl@124 | |
5795 DDM_DLV_Header *v21; // eax@126 | |
5796 unsigned int v22; // edi@129 | |
100 | 5797 Player *v23; // esi@134 |
0 | 5798 ItemGen *v24; // ecx@135 |
5799 signed int v25; // edx@135 | |
5800 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5801 char *v27; // edi@155 | |
5802 int v28; // ebx@161 | |
5803 int v29; // eax@161 | |
5804 | |
469 | 5805 v6 = 0; |
0 | 5806 v3 = this; |
5807 v4 = -1; | |
469 | 5808 if ( VarNum > VAR_AutoNotes ) |
5809 { | |
5810 switch ( VarNum ) | |
0 | 5811 { |
5812 case VAR_Invisible: | |
1167 | 5813 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5814 return true; |
484 | 5815 return false; |
0 | 5816 case VAR_NumDeaths: |
5817 v4 = pParty->uNumDeaths; | |
469 | 5818 return v4 >= pValue; |
0 | 5819 case VAR_NumBounties: |
5820 v4 = pParty->uNumBountiesCollected; | |
469 | 5821 return v4 >= pValue; |
0 | 5822 case VAR_PrisonTerms: |
5823 v4 = pParty->uNumPrisonTerms; | |
469 | 5824 return v4 >= pValue; |
0 | 5825 case VAR_ArenaWinsPage: |
5826 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5827 return v4 >= pValue; |
0 | 5828 case VAR_ArenaWinsSquire: |
5829 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5830 return v4 >= pValue; |
0 | 5831 case VAR_ArenaWinsKnight: |
5832 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5833 return v4 >= pValue; |
0 | 5834 case VAR_ArenaWinsLord: |
5835 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5836 return v4 >= pValue; |
0 | 5837 case VAR_ReputationInCurrentLocation: |
5838 v19 = &pOutdoor->ddm; | |
5839 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5840 v19 = &pIndoor->dlv; | |
469 | 5841 v6 = v19->uReputation >= pValue; |
5842 return v6; | |
0 | 5843 case VAR_History_28|VAR_Sex: |
5844 v21 = &pOutdoor->ddm; | |
5845 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5846 v21 = &pIndoor->dlv; | |
469 | 5847 v6 = v21->field_C_alert == pValue; |
0 | 5848 return v6; |
5849 case VAR_MonthEquals2|VAR_Sex: | |
5850 case VAR_MonthEquals2|VAR_Class: | |
5851 case VAR_Counter1: | |
5852 case VAR_Counter2: | |
5853 case VAR_Counter3: | |
5854 case VAR_Counter4: | |
5855 case VAR_Counter5: | |
5856 case VAR_Counter6: | |
5857 case VAR_Counter7: | |
5858 case VAR_Counter8: | |
469 | 5859 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5860 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5861 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5862 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5863 return true; | |
5864 return false; | |
0 | 5865 case VAR_NumSkillPoints: |
5866 v4 = this->uSkillPoints; | |
469 | 5867 return v4 >= pValue; |
0 | 5868 case VAR_CircusPrises: |
5869 v4 = 0; | |
100 | 5870 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5871 do |
5872 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5873 v24 = v23->pInventoryItemList; |
0 | 5874 v25 = 138; |
5875 do | |
5876 { | |
5877 switch ( v24->uItemID ) | |
5878 { | |
5879 case 0x1D6u: | |
5880 ++v4; | |
5881 break; | |
5882 case 0x1D7u: | |
5883 v4 += 3; | |
5884 break; | |
5885 case 0x1DDu: | |
5886 v4 += 5; | |
5887 break; | |
5888 } | |
5889 ++v24; | |
5890 --v25; | |
5891 } | |
5892 while ( v25 ); | |
100 | 5893 ++v23; |
0 | 5894 } |
100 | 5895 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5896 return v4 >= pValue; |
0 | 5897 case VAR_MonthEquals2: |
469 | 5898 v6 = pParty->uCurrentMonth == pValue; |
5899 return v6; | |
0 | 5900 case VAR_IsFlying: |
5901 if ( pParty->bFlying | |
1167 | 5902 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5903 return true; |
5904 return false; | |
0 | 5905 case VAR_HiredNPCHasSpeciality: |
469 | 5906 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 5907 return v6; |
5908 case VAR_NPCs2: | |
469 | 5909 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 5910 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 5911 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5912 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 5913 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 5914 return v4 >= pValue; |
5915 v4 = pValue; | |
5916 return v4 >= pValue; | |
0 | 5917 case VAR_ItemEquipped: |
5918 v26 = (ITEM_EQUIP_TYPE)0; | |
5919 v27 = (char *)&this->pEquipment; | |
5920 break; | |
5921 case VAR_GoldInBank: | |
5922 v4 = pParty->uNumGoldInBank; | |
469 | 5923 return v4 >= pValue; |
0 | 5924 case VAR_ThieverySkill|0x80: |
5925 v28 = GetActualMight(); | |
5926 v29 = v3->GetBaseStrength(); | |
5927 goto LABEL_168; | |
5928 case VAR_DisarmTrapSkill|0x80: | |
5929 v28 = GetActualIntelligence(); | |
5930 v29 = v3->GetBaseIntelligence(); | |
5931 goto LABEL_168; | |
5932 case VAR_MonthEquals: | |
5933 v28 = GetActualWillpower(); | |
5934 v29 = v3->GetBaseWillpower(); | |
5935 goto LABEL_168; | |
5936 case VAR_MonthEquals|VAR_Sex: | |
5937 v28 = GetActualEndurance(); | |
5938 v29 = v3->GetBaseEndurance(); | |
5939 goto LABEL_168; | |
5940 case VAR_IdentifyMonsterSkill|0x80: | |
5941 v28 = GetActualSpeed(); | |
5942 v29 = v3->GetBaseSpeed(); | |
5943 goto LABEL_168; | |
5944 case VAR_ArmsmasterSkill|0x80: | |
5945 v28 = GetActualAccuracy(); | |
5946 v29 = v3->GetBaseAccuracy(); | |
5947 goto LABEL_168; | |
5948 case VAR_MonthEquals|VAR_MaxHP: | |
5949 v28 = GetActualLuck(); | |
5950 v29 = v3->GetBaseLuck(); | |
5951 LABEL_168: | |
5952 v10 = __OFSUB__(v28, v29); | |
5953 v9 = v28 - v29 < 0; | |
5954 LABEL_169: | |
5955 if ( v9 ^ v10 ) | |
469 | 5956 return v4 >= pValue; |
5957 return true; | |
0 | 5958 default: |
469 | 5959 return v4 >= pValue; |
0 | 5960 } |
5961 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5962 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 5963 { |
5964 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
5965 v27 += 4; | |
5966 if ( (signed int)v26 >= 16 ) | |
469 | 5967 return false; |
5968 } | |
5969 return true; | |
5970 } | |
5971 if ( VarNum == VAR_AutoNotes ) | |
0 | 5972 { |
1033 | 5973 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
5974 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 5975 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
5976 return false; | |
5977 return true; | |
469 | 5978 } |
5979 if ( VarNum <= VAR_BaseLuck ) | |
5980 { | |
5981 if ( VarNum != VAR_BaseLuck ) | |
5982 { | |
5983 switch ( VarNum ) | |
0 | 5984 { |
5985 case VAR_Hour: | |
469 | 5986 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
5987 return true; | |
5988 return false; | |
0 | 5989 case VAR_DayOfYear: |
469 | 5990 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
5991 v6 = v5 == pValue; | |
5992 return v6; | |
0 | 5993 case VAR_DayOfWeek: |
469 | 5994 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
5995 v6 = v5 == pValue; | |
0 | 5996 return v6; |
5997 case VAR_Sex: | |
469 | 5998 if ( pValue == (CHARACTER_RACE)this->uSex ) |
5999 return true; | |
6000 return v4 >= pValue; | |
0 | 6001 case VAR_Class: |
135 | 6002 v7 = (CHARACTER_RACE)this->classType; |
469 | 6003 if ( pValue == v7 ) |
6004 return true; | |
6005 return v4 >= pValue; | |
0 | 6006 case VAR_Race: |
6007 v7 = GetRace(); | |
469 | 6008 if ( pValue == v7 ) |
6009 return true; | |
6010 return v4 >= pValue; | |
0 | 6011 case VAR_CurrentHP: |
6012 v4 = this->sHealth; | |
469 | 6013 return v4 >= pValue; |
0 | 6014 case VAR_MaxHP: |
6015 v8 = GetMaxHealth(); | |
6016 v10 = __OFSUB__(v3->sHealth, v8); | |
6017 v9 = v3->sHealth - v8 < 0; | |
6018 goto LABEL_169; | |
6019 case VAR_CurrentSP: | |
6020 v4 = this->sMana; | |
469 | 6021 return v4 >= pValue; |
0 | 6022 case VAR_MaxSP: |
6023 v11 = GetMaxMana(); | |
6024 v10 = __OFSUB__(v3->sMana, v11); | |
6025 v9 = v3->sMana - v11 < 0; | |
6026 goto LABEL_169; | |
6027 case VAR_ActualAC: | |
6028 v12 = GetActualAC(); | |
6029 goto _j_cmp_against_arg; | |
6030 case VAR_ACModifier: | |
6031 v4 = this->sACModifier; | |
469 | 6032 return v4 >= pValue; |
0 | 6033 case VAR_BaseLevel: |
6034 v4 = this->uLevel; | |
469 | 6035 return v4 >= pValue; |
0 | 6036 case VAR_LevelModifier: |
6037 v4 = this->sLevelModifier; | |
469 | 6038 return v4 >= pValue; |
0 | 6039 case VAR_Age: |
6040 v12 = GetActualAge(); | |
6041 goto _j_cmp_against_arg; | |
6042 case VAR_Award: | |
1033 | 6043 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6044 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6045 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6046 return true; | |
6047 return false; | |
0 | 6048 case VAR_Experience: |
6049 v4 = LODWORD(this->uExperience); | |
469 | 6050 return v4 >= pValue; |
0 | 6051 case VAR_QBits_QuestsDone: |
484 | 6052 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6053 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6054 if ( test_bit_value & our_bit_value ) | |
478 | 6055 return true; |
6056 return false; | |
0 | 6057 case VAR_PlayerItemInHands: |
6058 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6059 v16 = v3->pInventoryItemList; |
0 | 6060 break; |
6061 case VAR_FixedGold: | |
6062 v4 = pParty->uNumGold; | |
469 | 6063 return v4 >= pValue; |
0 | 6064 case VAR_MightBonus: |
6065 v4 = this->uMightBonus; | |
469 | 6066 return v4 >= pValue; |
0 | 6067 case VAR_IntellectBonus: |
6068 v4 = this->uIntelligenceBonus; | |
469 | 6069 return v4 >= pValue; |
0 | 6070 case VAR_PersonalityBonus: |
6071 v4 = this->uWillpowerBonus; | |
469 | 6072 return v4 >= pValue; |
0 | 6073 case VAR_EnduranceBonus: |
6074 v4 = this->uEnduranceBonus; | |
469 | 6075 return v4 >= pValue; |
0 | 6076 case VAR_SpeedBonus: |
6077 v4 = this->uSpeedBonus; | |
469 | 6078 return v4 >= pValue; |
0 | 6079 case VAR_AccuracyBonus: |
6080 v4 = this->uAccuracyBonus; | |
469 | 6081 return v4 >= pValue; |
0 | 6082 case VAR_LuckBonus: |
6083 v4 = this->uLuckBonus; | |
469 | 6084 return v4 >= pValue; |
0 | 6085 case VAR_BaseMight: |
6086 v4 = this->uMight; | |
469 | 6087 return v4 >= pValue; |
0 | 6088 case VAR_BaseIntellect: |
6089 v4 = this->uIntelligence; | |
469 | 6090 return v4 >= pValue; |
0 | 6091 case VAR_BasePersonality: |
6092 v4 = this->uWillpower; | |
469 | 6093 return v4 >= pValue; |
0 | 6094 case VAR_BaseEndurance: |
6095 v4 = this->uEndurance; | |
469 | 6096 return v4 >= pValue; |
0 | 6097 case VAR_BaseSpeed: |
6098 v4 = this->uSpeed; | |
469 | 6099 return v4 >= pValue; |
0 | 6100 case VAR_BaseAccuracy: |
6101 v4 = this->uAccuracy; | |
469 | 6102 return v4 >= pValue; |
0 | 6103 case VAR_FixedFood: |
6104 v4 = pParty->uNumFoodRations; | |
469 | 6105 return v4 >= pValue; |
0 | 6106 default: |
469 | 6107 return v4 >= pValue; |
6108 } | |
6109 while ( v16->uItemID != pValue ) | |
0 | 6110 { |
6111 ++v15; | |
6112 ++v16; | |
6113 if ( v15 >= 138 ) | |
6114 { | |
469 | 6115 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6116 return v6; |
6117 } | |
6118 } | |
469 | 6119 return true; |
0 | 6120 } |
6121 v4 = this->uLuck; | |
469 | 6122 return v4 >= pValue; |
6123 } | |
6124 if ( VarNum <= VAR_MagicResistance ) | |
6125 { | |
6126 if ( VarNum == VAR_MagicResistance ) | |
0 | 6127 { |
6128 v4 = this->sResMagicBase; | |
6129 } | |
6130 else | |
6131 { | |
469 | 6132 switch ( VarNum ) |
0 | 6133 { |
6134 case VAR_FireResistance: | |
6135 v4 = this->sResFireBase; | |
469 | 6136 return v4 >= pValue; |
0 | 6137 case VAR_AirResistance: |
6138 v4 = this->sResAirBase; | |
469 | 6139 return v4 >= pValue; |
0 | 6140 case VAR_WaterResistance: |
6141 v4 = this->sResWaterBase; | |
469 | 6142 return v4 >= pValue; |
0 | 6143 case VAR_EarthResistance: |
6144 v4 = this->sResEarthBase; | |
469 | 6145 return v4 >= pValue; |
0 | 6146 case VAR_SpiritResistance: |
6147 v4 = this->sResSpiritBase; | |
469 | 6148 return v4 >= pValue; |
0 | 6149 case VAR_MindResistance: |
6150 v4 = this->sResMindBase; | |
469 | 6151 return v4 >= pValue; |
0 | 6152 case VAR_BodyResistance: |
6153 v4 = this->sResBodyBase; | |
469 | 6154 return v4 >= pValue; |
0 | 6155 case VAR_LightResistance: |
6156 v4 = this->sResLightBase; | |
469 | 6157 return v4 >= pValue; |
0 | 6158 case VAR_DarkResistance: |
6159 v4 = this->sResDarkBase; | |
469 | 6160 return v4 >= pValue; |
0 | 6161 case VAR_ActualMight: |
6162 v12 = GetActualMight(); | |
6163 goto _j_cmp_against_arg; | |
6164 case VAR_ActualIntellect: | |
6165 v12 = GetActualIntelligence(); | |
6166 goto _j_cmp_against_arg; | |
6167 case VAR_ActualPersonality: | |
6168 v12 = GetActualWillpower(); | |
6169 goto _j_cmp_against_arg; | |
6170 case VAR_ActualEndurance: | |
6171 v12 = GetActualEndurance(); | |
6172 goto _j_cmp_against_arg; | |
6173 case VAR_ActualSpeed: | |
6174 v12 = GetActualSpeed(); | |
6175 goto _j_cmp_against_arg; | |
6176 case VAR_ActualAccuracy: | |
6177 v12 = GetActualAccuracy(); | |
6178 goto _j_cmp_against_arg; | |
6179 case VAR_ActualLuck: | |
6180 v12 = GetActualLuck(); | |
6181 _j_cmp_against_arg: | |
6182 v4 = v12; | |
6183 break; | |
6184 default: | |
469 | 6185 return v4 >= pValue; |
6186 } | |
6187 } | |
6188 return v4 >= pValue; | |
6189 } | |
6190 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6191 { | |
6192 if ( VarNum != VAR_DisarmTrapSkill ) | |
6193 { | |
6194 if ( VarNum <= VAR_MindResistanceBonus ) | |
6195 { | |
6196 switch ( VarNum ) | |
0 | 6197 { |
6198 case VAR_MindResistanceBonus: | |
6199 v4 = this->sResMindBonus; | |
6200 break; | |
6201 case VAR_FireResistanceBonus: | |
6202 v4 = this->sResFireBonus; | |
6203 break; | |
6204 case VAR_AirResistanceBonus: | |
6205 v4 = this->sResAirBonus; | |
6206 break; | |
6207 case VAR_WaterResistanceBonus: | |
6208 v4 = this->sResWaterBonus; | |
6209 break; | |
6210 case VAR_EarthResistanceBonus: | |
6211 v4 = this->sResEarthBonus; | |
6212 break; | |
6213 case VAR_SpiritResistanceBonus: | |
6214 v4 = this->sResSpiritBonus; | |
6215 break; | |
6216 } | |
469 | 6217 return v4 >= pValue; |
6218 } | |
6219 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6220 { |
6221 v4 = this->sResBodyBonus; | |
469 | 6222 return v4 >= pValue; |
6223 } | |
6224 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6225 { |
6226 v4 = this->sResLightBonus; | |
469 | 6227 return v4 >= pValue; |
6228 } | |
6229 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6230 { |
6231 v4 = this->sResDarkBonus; | |
469 | 6232 return v4 >= pValue; |
6233 } | |
6234 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6235 { |
6236 v4 = this->sResMagicBonus; | |
469 | 6237 return v4 >= pValue; |
6238 } | |
6239 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6240 return v4 >= pValue; | |
0 | 6241 } |
6242 LABEL_90: | |
469 | 6243 v18 = *((short *)&this->pConditions[16] + VarNum); |
6244 if ( pValue <= 63 ) | |
0 | 6245 v4 = v18 & 0x3F; |
6246 else | |
469 | 6247 v4 = pValue & v18; |
6248 return v4 >= pValue; | |
6249 } | |
6250 if ( VarNum == 104 ) | |
0 | 6251 goto LABEL_90; |
469 | 6252 if ( (signed int)VarNum <= 104 ) |
6253 return v4 >= pValue; | |
6254 if ( (signed int)VarNum > 0x79 ) | |
6255 { | |
6256 if ( VarNum != 122 ) | |
6257 { | |
6258 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6259 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6260 return v4 >= pValue; | |
0 | 6261 } |
6262 v4 = GetMajorConditionIdx(); | |
6263 if ( v4 != 18 ) | |
6264 { | |
469 | 6265 return v4 >= pValue; |
6266 } | |
6267 v4 = pValue; | |
6268 return v4 >= pValue; | |
6269 } | |
1072 | 6270 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6271 } |
6272 | |
6273 | |
6274 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6275 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6276 { | |
6277 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
|
6278 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
|
6279 unsigned int v5_unused; // edi@1 |
0 | 6280 unsigned int v6; // esi@13 |
6281 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
|
6282 signed int v8_unused; // eax@17 |
0 | 6283 ItemGen *v9; // ecx@17 |
6284 int v10; // eax@21 | |
6285 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
|
6286 Player *unused12; // ecx@44 |
0 | 6287 char *v13; // ecx@45 |
6288 Player *v14; // ecx@49 | |
6289 int v15; // ecx@86 | |
6290 int v16; // esi@106 | |
6291 char v17; // al@106 | |
6292 int v18; // eax@107 | |
6293 Player *v19; // ecx@112 | |
6294 Player *v20; // ecx@127 | |
6295 int v21; // eax@127 | |
6296 int v22; // eax@145 | |
6297 char v23; // zf@146 | |
6298 DDM_DLV_Header *v24; // ecx@148 | |
6299 signed int v25; // eax@172 | |
6300 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
|
6301 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
|
6302 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6303 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
|
6304 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
|
6305 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
|
6306 |
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
|
6307 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
|
6308 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
|
6309 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6310 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
|
6311 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6312 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
|
6313 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
|
6314 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6315 } |
1545 | 6316 |
6317 Assert(currPlayerId != -1); | |
492 | 6318 if ( var_type > VAR_AutoNotes ) |
6319 { | |
6320 if ( var_type <= VAR_GoldInBank ) | |
6321 { | |
6322 if ( var_type == VAR_GoldInBank ) | |
6323 { | |
6324 pParty->uNumGoldInBank = var_value; | |
0 | 6325 return; |
6326 } | |
492 | 6327 if ( var_type <= VAR_Counter8 ) |
6328 { | |
6329 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6330 { |
492 | 6331 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6332 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6333 } |
6334 else | |
6335 { | |
492 | 6336 switch ( var_type ) |
0 | 6337 { |
6338 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6339 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6340 break; |
6341 case VAR_NPCs2: | |
6342 pParty->field_709 = 0; | |
492 | 6343 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6344 pParty->CountHirelings(); |
6345 viewparams->bRedrawGameUI = true; | |
0 | 6346 break; |
6347 case VAR_NumSkillPoints: | |
492 | 6348 this->uSkillPoints = var_value; |
0 | 6349 break; |
6350 } | |
6351 } | |
6352 return; | |
6353 } | |
492 | 6354 if ( var_type < VAR_Counter9 ) |
0 | 6355 return; |
492 | 6356 if ( (signed int)var_type <= 0x112 ) |
6357 { | |
6358 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6359 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6360 } |
6361 else | |
6362 { | |
492 | 6363 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6364 { |
6365 v24 = &pOutdoor->ddm; | |
6366 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6367 v24 = &pIndoor->dlv; | |
492 | 6368 v24->uReputation = var_value; |
6369 if ( var_value > 10000 ) | |
0 | 6370 v24->uReputation = 10000; |
6371 return; | |
6372 } | |
492 | 6373 if ( var_type <= VAR_ReputationInCurrentLocation |
6374 || var_type > VAR_History_28 | |
6375 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6376 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6377 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6378 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6379 v23) ) |
6380 return; | |
6381 bFlashHistoryBook = 1; | |
6382 } | |
492 | 6383 v25 = 8 * currPlayerId + 400; |
862 | 6384 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
|
6385 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6386 return; |
6387 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6388 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6389 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6390 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6391 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
|
6392 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6393 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6394 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6395 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6396 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6397 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6398 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6399 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6400 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6401 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6402 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6403 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6404 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6405 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6406 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6407 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6408 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6409 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6410 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6411 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6412 return; |
0 | 6413 } |
492 | 6414 if ( var_type == VAR_AutoNotes ) |
6415 { | |
6416 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
|
6417 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6418 && pAutonoteTxt[var_value].pText ) |
492 | 6419 { |
6420 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6421 v20->PlaySound(SPEECH_96, 0); |
1453 | 6422 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6423 bFlashAutonotesBook = 1; |
1453 | 6424 _506568_autonote_type = pAutonoteTxt[var_value].eType; |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6425 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6426 } |
1453 | 6427 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6428 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6429 return; |
0 | 6430 } |
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
|
6431 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
|
6432 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6433 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
|
6434 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6435 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
|
6436 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
|
6437 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
|
6438 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
|
6439 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
|
6440 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
|
6441 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6442 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6443 for (int i = 0; i < 138; i++) |
0 | 6444 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6445 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6446 if (v9->uItemID == ITEM_LICH_JAR_EMPTY) |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6447 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
|
6448 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6449 if (v9 != NULL && v9->uItemID != ITEM_LICH_JAR_EMPTY) |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6450 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6451 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
|
6452 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6453 *(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
|
6454 } |
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
|
6455 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
|
6456 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
|
6457 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
|
6458 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
|
6459 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
|
6460 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
|
6461 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
|
6462 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
|
6463 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
|
6464 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
|
6465 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
|
6466 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
|
6467 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
|
6468 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
|
6469 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6470 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
|
6471 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
|
6472 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6473 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
|
6474 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6475 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
|
6476 this->uVoiceID = 20; |
0 | 6477 } |
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
|
6478 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
|
6479 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6480 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
|
6481 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
|
6482 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
|
6483 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
|
6484 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
|
6485 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
|
6486 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
|
6487 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
|
6488 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
|
6489 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
|
6490 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
|
6491 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
|
6492 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
|
6493 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
|
6494 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
|
6495 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
|
6496 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
|
6497 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
|
6498 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
|
6499 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
|
6500 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
|
6501 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
|
6502 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
|
6503 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
|
6504 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
|
6505 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
|
6506 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6507 pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) |
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
|
6508 //&& 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
|
6509 && 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
|
6510 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6511 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
|
6512 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6513 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
|
6514 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6515 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_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
|
6516 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
|
6517 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
|
6518 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
|
6519 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
|
6520 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
|
6521 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
|
6522 // && (&dword_722F10)[4 * a3] ) |
1310 | 6523 && pQuestTable[var_value] ) |
0 | 6524 { |
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
|
6525 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
|
6526 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
|
6527 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
|
6528 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6529 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
|
6530 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6531 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
|
6532 _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
|
6533 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
|
6534 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
|
6535 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
|
6536 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
|
6537 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
|
6538 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
|
6539 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
|
6540 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
|
6541 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
|
6542 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
|
6543 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
|
6544 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
|
6545 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
|
6546 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
|
6547 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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 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
|
6559 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
|
6560 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
|
6561 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
|
6562 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
|
6563 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
|
6564 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
|
6565 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
|
6566 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
|
6567 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
|
6568 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
|
6569 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
|
6570 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
|
6571 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
|
6572 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
|
6573 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
|
6574 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
|
6575 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
|
6576 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
|
6577 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
|
6578 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
|
6579 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6580 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
|
6581 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
|
6582 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
|
6583 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6584 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
|
6585 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
|
6586 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
|
6587 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6588 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
|
6589 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
|
6590 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
|
6591 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6592 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
|
6593 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
|
6594 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
|
6595 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6596 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
|
6597 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
|
6598 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
|
6599 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6600 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
|
6601 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
|
6602 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
|
6603 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6604 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
|
6605 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
|
6606 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
|
6607 } |
0 | 6608 LABEL_111: |
187 | 6609 v26 = SPEECH_91; |
0 | 6610 LABEL_112: |
492 | 6611 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6612 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
|
6613 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6614 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6615 return; |
0 | 6616 } |
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
|
6617 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
|
6618 { |
492 | 6619 switch ( var_type ) |
0 | 6620 { |
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
|
6621 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
|
6622 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
|
6623 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
|
6624 goto LABEL_111; |
0 | 6625 case VAR_ActualIntellect: |
6626 LABEL_68: | |
492 | 6627 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6628 goto LABEL_111; |
6629 case VAR_ActualPersonality: | |
6630 LABEL_69: | |
492 | 6631 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6632 goto LABEL_111; |
6633 case VAR_ActualEndurance: | |
6634 LABEL_70: | |
492 | 6635 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6636 goto LABEL_111; |
6637 case VAR_ActualSpeed: | |
6638 LABEL_71: | |
492 | 6639 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6640 goto LABEL_111; |
6641 case VAR_ActualAccuracy: | |
6642 LABEL_72: | |
492 | 6643 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6644 goto LABEL_111; |
6645 case VAR_ActualLuck: | |
6646 LABEL_73: | |
492 | 6647 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6648 goto LABEL_111; |
6649 case VAR_FireResistance: | |
492 | 6650 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
|
6651 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6652 goto LABEL_112; |
0 | 6653 case VAR_AirResistance: |
492 | 6654 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
|
6655 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6656 goto LABEL_112; |
0 | 6657 case VAR_WaterResistance: |
492 | 6658 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
|
6659 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6660 goto LABEL_112; |
0 | 6661 case VAR_EarthResistance: |
492 | 6662 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
|
6663 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6664 goto LABEL_112; |
0 | 6665 case VAR_SpiritResistance: |
492 | 6666 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
|
6667 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6668 goto LABEL_112; |
0 | 6669 case VAR_MindResistance: |
492 | 6670 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
|
6671 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6672 goto LABEL_112; |
0 | 6673 case VAR_BodyResistance: |
492 | 6674 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
|
6675 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6676 goto LABEL_112; |
0 | 6677 case VAR_LightResistance: |
492 | 6678 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
|
6679 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6680 goto LABEL_112; |
0 | 6681 case VAR_DarkResistance: |
492 | 6682 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
|
6683 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6684 goto LABEL_112; |
0 | 6685 case VAR_MagicResistance: |
492 | 6686 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6687 v26 = 92; |
6688 goto LABEL_112; | |
6689 default: | |
6690 return; | |
6691 } | |
6692 return; | |
6693 } | |
6694 HIWORD(v15) = 0; | |
492 | 6695 if ( var_type > VAR_DisarmTrapSkill ) |
6696 { | |
6697 if ( var_type != VAR_LearningSkill ) | |
6698 { | |
6699 if ( var_type <= VAR_LearningSkill ) | |
0 | 6700 return; |
492 | 6701 if ( var_type <= VAR_Eradicated ) |
6702 { | |
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
|
6703 this->SetCondition(var_type - 105, 1); |
0 | 6704 } |
6705 else | |
6706 { | |
492 | 6707 if ( var_type != VAR_MajorCondition ) |
0 | 6708 { |
492 | 6709 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6710 byte_5E4C15[var_type] = var_value; | |
0 | 6711 return; |
6712 } | |
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
|
6713 memset(this, 0, 0xA0u); |
0 | 6714 } |
6715 } | |
6716 else | |
6717 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6718 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
|
6719 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6720 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6721 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6722 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6723 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6724 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6725 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6726 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6727 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
|
6728 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6729 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6730 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6731 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6732 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6733 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6734 return; |
0 | 6735 } |
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
|
6736 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6737 { |
6738 switch ( var_type ) | |
0 | 6739 { |
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
|
6740 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
|
6741 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6742 break; |
6743 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
|
6744 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6745 break; |
6746 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
|
6747 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6748 break; |
6749 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
|
6750 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6751 break; |
6752 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
|
6753 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
|
6754 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
|
6755 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
|
6756 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
|
6757 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
|
6758 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
|
6759 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
|
6760 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
|
6761 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
|
6762 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
|
6763 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
|
6764 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
|
6765 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
|
6766 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
|
6767 case VAR_PhysicalResistanceBonus: |
1545 | 6768 Assert("VAR_PhysicalResistanceBonus variable unsupported" && false); |
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
|
6769 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
|
6770 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
|
6771 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
|
6772 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6773 break; |
6774 default: | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
6775 Error("Unexpected var_type: %u", var_type); |
0 | 6776 return; |
6777 break; | |
6778 } | |
6779 goto LABEL_111; | |
6780 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6781 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
|
6782 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6783 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6784 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6785 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6786 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6787 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6788 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6789 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
|
6790 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6791 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
|
6792 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
|
6793 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
|
6794 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6795 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6796 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6797 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
|
6798 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6799 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
|
6800 } |
0 | 6801 |
6802 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6803 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6804 { |
6805 char v3; // bl@1 | |
6806 Player *v4; // esi@1 | |
6807 signed int uPlayerIdx; // edi@1 | |
6808 int v6; // eax@15 | |
6809 unsigned int v7; // esi@18 | |
6810 int *v8; // ebx@21 | |
6811 int v9; // eax@22 | |
6812 signed int v10; // eax@24 | |
6813 int v11; // eax@27 | |
6814 __int16 *v12; // esi@28 | |
6815 Player *v13; // ecx@34 | |
6816 Player *v14; // ecx@36 | |
6817 char *v15; // ecx@37 | |
6818 unsigned __int8 v16; // cf@38 | |
6819 Player *v17; // ecx@42 | |
6820 __int16 *v18; // esi@53 | |
6821 __int16 *v19; // esi@62 | |
6822 char *v20; // esi@107 | |
6823 __int16 v21; // dx@107 | |
6824 int v22; // ecx@107 | |
6825 Player *v23; // ecx@132 | |
6826 int v24; // eax@132 | |
6827 int v25; // eax@150 | |
6828 char v26; // zf@151 | |
6829 DDM_DLV_Header *v27; // eax@153 | |
6830 signed int v28; // eax@176 | |
6831 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6832 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6833 int v31; // [sp-4h] [bp-3Ch]@84 |
6834 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6835 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6836 char v34; // [sp+37h] [bp-1h]@1 | |
6837 | |
6838 auto Dst = this; | |
6839 v3 = 0; | |
6840 v34 = 0; | |
6841 v4 = Dst; | |
6842 uPlayerIdx = 0; | |
6843 if ( Dst == pPlayers[2] ) | |
6844 uPlayerIdx = 1; | |
310 | 6845 else if ( Dst == pPlayers[3] ) |
6846 uPlayerIdx = 2; | |
6847 else if ( Dst == pPlayers[4] ) | |
6848 uPlayerIdx = 3; | |
6849 | |
6850 if ( var_type <= VAR_AutoNotes ) | |
6851 { | |
6852 if ( var_type != VAR_AutoNotes ) | |
6853 { | |
6854 if ( var_type <= VAR_ActualMight ) | |
6855 { | |
6856 if ( var_type != VAR_ActualMight ) | |
0 | 6857 { |
310 | 6858 switch ( var_type ) |
0 | 6859 { |
6860 case VAR_RandomGold: | |
6861 if ( !val ) | |
6862 val = 1; | |
6863 v6 = rand(); | |
6864 party_finds_gold(v6 % val + 1, 1); | |
6865 GameUI_DrawFoodAndGold(); | |
6866 return; | |
6867 case VAR_RandomFood: | |
6868 if ( !val ) | |
6869 val = 1; | |
6870 v7 = rand() % val + 1; | |
6871 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6872 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
|
6873 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6874 GameUI_DrawFoodAndGold(); |
6875 goto _play_sound; | |
6876 case VAR_Sex: | |
6877 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6878 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6879 goto _play_sound; | |
0 | 6880 case VAR_Class: |
135 | 6881 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6882 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6883 goto _play_sound; | |
0 | 6884 case VAR_CurrentHP: |
6885 v8 = &Dst->sHealth; | |
6886 *v8 += val; | |
6887 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6888 { |
6889 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6890 goto _play_sound; | |
6891 } | |
0 | 6892 v9 = v4->GetMaxHealth(); |
6893 goto LABEL_23; | |
6894 case VAR_MaxHP: | |
6895 v10 = Dst->GetMaxHealth(); | |
6896 v4->_health_related = 0; | |
6897 v4->uFullHealthBonus = 0; | |
6898 v4->sHealth = v10; | |
6899 return; | |
6900 case VAR_CurrentSP: | |
6901 v8 = &Dst->sMana; | |
6902 *v8 += val; | |
6903 if ( Dst->sMana > GetMaxMana() ) | |
6904 { | |
6905 v9 = v4->GetMaxMana(); | |
6906 LABEL_23: | |
6907 *v8 = v9; | |
6908 } | |
1507 | 6909 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6910 goto _play_sound; | |
0 | 6911 case VAR_MaxSP: |
6912 v11 = GetMaxMana(); | |
6913 v4->_mana_related = 0; | |
6914 v4->uFullManaBonus = 0; | |
6915 v4->sMana = v11; | |
6916 return; | |
6917 case VAR_ACModifier: | |
6918 v12 = &Dst->sACModifier; | |
6919 goto LABEL_29; | |
6920 case VAR_BaseLevel: | |
6921 v12 = (__int16 *)&Dst->uLevel; | |
6922 goto LABEL_29; | |
6923 case VAR_LevelModifier: | |
6924 v12 = &Dst->sLevelModifier; | |
6925 LABEL_29: | |
6926 *v12 += val; | |
6927 if ( *v12 > 255 ) | |
6928 *v12 = 255; | |
1507 | 6929 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6930 goto _play_sound; | |
0 | 6931 case VAR_Age: |
6932 Dst->sAgeModifier += val; | |
6933 return; | |
6934 case VAR_Award: | |
6935 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6936 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 6937 |
492 | 6938 && pAwards[val].pText ) |
0 | 6939 { |
6940 v14 = pPlayers[uPlayerIdx + 1]; | |
6941 v34 = 1; | |
6942 v3 = 1; | |
187 | 6943 v14->PlaySound(SPEECH_96, 0); |
0 | 6944 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6945 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 6946 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6947 if ( v34 != 1 ) | |
6948 { | |
6949 if ( v3 != 1 ) | |
6950 return; | |
6951 goto _play_sound; | |
6952 } | |
6953 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6954 if ( v3 != 1 ) | |
6955 return; | |
6956 goto _play_sound; | |
0 | 6957 case VAR_Experience: |
6958 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
6959 LODWORD(Dst->uExperience) += val; | |
6960 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
6961 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
6962 Dst->uExperience = 4000000000i64; | |
1507 | 6963 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6964 goto _play_sound; | |
0 | 6965 case VAR_QBits_QuestsDone: |
484 | 6966 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
|
6967 //&& (&dword_722F10)[4 * val] ) |
1310 | 6968 && pQuestTable[val] ) |
0 | 6969 { |
501 | 6970 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 6971 bFlashQuestBook = 1; |
6972 v34 = 1; | |
6973 v3 = 1; | |
501 | 6974 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 6975 } |
484 | 6976 v15 = (char *)pParty->_quest_bits; |
1507 | 6977 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6978 if ( v34 != 1 ) | |
6979 { | |
6980 if ( v3 != 1 ) | |
6981 return; | |
6982 goto _play_sound; | |
6983 } | |
6984 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6985 if ( v3 != 1 ) | |
6986 return; | |
6987 goto _play_sound; | |
0 | 6988 case VAR_PlayerItemInHands: |
6989 item.Reset(); | |
6990 item.Reset(); | |
6991 item.uAttributes = 1; | |
6992 item.uItemID = val; | |
6993 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 6994 pParty->pIsArtifactFound[val-500] = 1; |
0 | 6995 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
6996 { | |
6997 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
6998 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
6999 } | |
7000 pParty->SetHoldingItem(&item); | |
7001 return; | |
7002 case VAR_FixedGold: | |
7003 party_finds_gold(val, 1); | |
7004 return; | |
7005 case VAR_BaseMight: | |
7006 v18 = (__int16 *)&Dst->uMight; | |
7007 goto LABEL_82; | |
7008 case VAR_BaseIntellect: | |
7009 v18 = (__int16 *)&Dst->uIntelligence; | |
7010 goto LABEL_82; | |
7011 case VAR_BasePersonality: | |
7012 v18 = (__int16 *)&Dst->uWillpower; | |
7013 goto LABEL_82; | |
7014 case VAR_BaseEndurance: | |
7015 v18 = (__int16 *)&Dst->uEndurance; | |
7016 goto LABEL_82; | |
7017 case VAR_BaseSpeed: | |
7018 v18 = (__int16 *)&Dst->uSpeed; | |
7019 goto LABEL_82; | |
7020 case VAR_BaseAccuracy: | |
7021 v18 = (__int16 *)&Dst->uAccuracy; | |
7022 goto LABEL_82; | |
7023 case VAR_BaseLuck: | |
7024 v18 = (__int16 *)&Dst->uLuck; | |
7025 goto LABEL_82; | |
7026 case VAR_FixedFood: | |
7027 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7028 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7029 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7030 if ( pParty->uNumFoodRations > 0xFFFF ) |
7031 Party::SetFood(0xFFFFu); | |
7032 goto _play_sound; | |
7033 case VAR_MightBonus: | |
7034 goto LABEL_62; | |
7035 case VAR_IntellectBonus: | |
7036 goto LABEL_66; | |
7037 case VAR_PersonalityBonus: | |
7038 goto LABEL_67; | |
7039 case VAR_EnduranceBonus: | |
7040 goto LABEL_68; | |
7041 case VAR_SpeedBonus: | |
7042 goto LABEL_69; | |
7043 case VAR_AccuracyBonus: | |
7044 goto LABEL_70; | |
7045 case VAR_LuckBonus: | |
7046 goto LABEL_71; | |
7047 default: | |
7048 return; | |
7049 } | |
7050 return; | |
7051 } | |
7052 LABEL_62: | |
7053 v19 = (__int16 *)&Dst->uMightBonus; | |
7054 goto LABEL_113; | |
7055 } | |
310 | 7056 if ( var_type <= VAR_FireResistanceBonus ) |
7057 { | |
7058 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7059 { |
310 | 7060 switch ( var_type ) |
0 | 7061 { |
7062 case VAR_ActualIntellect: | |
7063 LABEL_66: | |
7064 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7065 goto LABEL_113; | |
7066 case VAR_ActualPersonality: | |
7067 LABEL_67: | |
7068 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7069 goto LABEL_113; | |
7070 case VAR_ActualEndurance: | |
7071 LABEL_68: | |
7072 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7073 goto LABEL_113; | |
7074 case VAR_ActualSpeed: | |
7075 LABEL_69: | |
7076 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7077 goto LABEL_113; | |
7078 case VAR_ActualAccuracy: | |
7079 LABEL_70: | |
7080 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7081 goto LABEL_113; | |
7082 case VAR_ActualLuck: | |
7083 LABEL_71: | |
7084 v19 = (__int16 *)&Dst->uLuckBonus; | |
7085 goto LABEL_113; | |
7086 case VAR_FireResistance: | |
7087 v18 = &Dst->sResFireBase; | |
7088 goto LABEL_82; | |
7089 case VAR_AirResistance: | |
7090 v18 = &Dst->sResAirBase; | |
7091 goto LABEL_82; | |
7092 case VAR_WaterResistance: | |
7093 v18 = &Dst->sResWaterBase; | |
7094 goto LABEL_82; | |
7095 case VAR_EarthResistance: | |
7096 v18 = &Dst->sResEarthBase; | |
7097 goto LABEL_82; | |
7098 case VAR_SpiritResistance: | |
7099 v18 = &Dst->sResSpiritBase; | |
7100 goto LABEL_82; | |
7101 case VAR_MindResistance: | |
7102 v18 = &Dst->sResMindBase; | |
7103 goto LABEL_82; | |
7104 case VAR_BodyResistance: | |
7105 v18 = &Dst->sResBodyBase; | |
7106 goto LABEL_82; | |
7107 case VAR_LightResistance: | |
7108 v18 = &Dst->sResLightBase; | |
7109 goto LABEL_82; | |
7110 case VAR_DarkResistance: | |
7111 v18 = &Dst->sResDarkBase; | |
7112 goto LABEL_82; | |
7113 case VAR_MagicResistance: | |
7114 v18 = &Dst->sResMagicBase; | |
7115 LABEL_82: | |
7116 *v18 += val; | |
7117 if ( *v18 > 255 ) | |
7118 *v18 = 255; | |
1507 | 7119 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7120 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7121 goto _play_sound; | |
0 | 7122 default: |
7123 return; | |
7124 } | |
7125 return; | |
7126 } | |
7127 v19 = &Dst->sResFireBonus; | |
7128 LABEL_113: | |
7129 *v19 += val; | |
7130 if ( *v19 > 255 ) | |
7131 *v19 = 255; | |
7132 v31 = 0; | |
187 | 7133 v29 = SPEECH_91; |
7134 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7135 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7136 goto _play_sound; | |
0 | 7137 } |
310 | 7138 if ( var_type <= VAR_DisarmTrapSkill ) |
7139 { | |
7140 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7141 { |
310 | 7142 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7143 { |
310 | 7144 switch ( var_type ) |
0 | 7145 { |
7146 case VAR_BodyResistanceBonus: | |
7147 v19 = &Dst->sResBodyBonus; | |
7148 break; | |
7149 case VAR_AirResistanceBonus: | |
7150 v19 = &Dst->sResAirBonus; | |
7151 break; | |
7152 case VAR_WaterResistanceBonus: | |
7153 v19 = &Dst->sResWaterBonus; | |
7154 break; | |
7155 case VAR_EarthResistanceBonus: | |
7156 v19 = &Dst->sResEarthBonus; | |
7157 break; | |
7158 case VAR_SpiritResistanceBonus: | |
7159 v19 = &Dst->sResSpiritBonus; | |
7160 break; | |
7161 default: | |
310 | 7162 if ( var_type != 62 ) |
0 | 7163 return; |
7164 v19 = &Dst->sResMindBonus; | |
7165 break; | |
7166 } | |
7167 goto LABEL_113; | |
7168 } | |
310 | 7169 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7170 { |
7171 v19 = &Dst->sResLightBonus; | |
7172 goto LABEL_113; | |
7173 } | |
310 | 7174 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7175 { |
7176 v19 = &Dst->sResDarkBonus; | |
7177 goto LABEL_113; | |
7178 } | |
310 | 7179 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7180 { |
7181 v19 = &Dst->sResMagicBonus; | |
7182 goto LABEL_113; | |
7183 } | |
310 | 7184 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7185 return; |
7186 } | |
7187 goto LABEL_106; | |
7188 } | |
310 | 7189 if ( var_type == VAR_LearningSkill ) |
0 | 7190 { |
7191 LABEL_106: | |
7192 if ( val <= VAR_BodyResistanceBonus ) | |
7193 { | |
310 | 7194 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7195 } |
7196 else | |
7197 { | |
310 | 7198 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7199 v21 = *(short *)v20; |
7200 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7201 if ( v22 > 60 ) | |
7202 LOWORD(v22) = 60; | |
7203 LOBYTE(v21) = v21 & 0xC0; | |
7204 *(short *)v20 = v22 | v21; | |
7205 } | |
1507 | 7206 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7207 goto _play_sound; | |
0 | 7208 } |
310 | 7209 if ( var_type <= VAR_LearningSkill ) |
0 | 7210 return; |
310 | 7211 if ( var_type <= VAR_Eradicated ) |
7212 { | |
7213 Dst->SetCondition(var_type - 105, 0); | |
0 | 7214 } |
7215 else | |
7216 { | |
310 | 7217 if ( var_type != VAR_MajorCondition ) |
0 | 7218 { |
310 | 7219 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7220 { |
310 | 7221 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7222 byte_5E4C15[var_type] += val; | |
0 | 7223 else |
310 | 7224 byte_5E4C15[var_type] = -1; |
0 | 7225 } |
7226 return; | |
7227 } | |
7228 memset(Dst, 0, 0xA0u); | |
7229 } | |
7230 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7231 goto _play_sound; | |
7232 } | |
7233 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
|
7234 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7235 && pAutonoteTxt[val].pText ) |
0 | 7236 { |
7237 v23 = pPlayers[uPlayerIdx + 1]; | |
7238 v34 = 1; | |
187 | 7239 v23->PlaySound(SPEECH_96, 0); |
1453 | 7240 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7241 bFlashAutonotesBook = 1; |
1453 | 7242 _506568_autonote_type = pAutonoteTxt[val].eType; |
7243 } | |
7244 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7245 v3 = 1; |
7246 if ( v34 != 1 ) | |
1507 | 7247 { |
7248 if ( v3 != 1 ) | |
7249 return; | |
7250 goto _play_sound; | |
7251 } | |
7252 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7253 if ( v3 != 1 ) | |
7254 return; | |
7255 goto _play_sound; | |
0 | 7256 } |
310 | 7257 if ( var_type > VAR_GoldInBank ) |
7258 { | |
7259 if ( var_type == 307 ) | |
0 | 7260 { |
7261 pParty->uNumDeaths += val; | |
1507 | 7262 if ( v34 != 1 ) |
7263 { | |
7264 if ( v3 != 1 ) | |
7265 return; | |
7266 goto _play_sound; | |
7267 } | |
7268 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7269 if ( v3 != 1 ) | |
7270 return; | |
7271 goto _play_sound; | |
0 | 7272 } |
310 | 7273 switch ( var_type ) |
0 | 7274 { |
7275 case 308: | |
7276 pParty->uNumBountiesCollected += val; | |
7277 break; | |
7278 case 309: | |
7279 pParty->uNumPrisonTerms += val; | |
7280 break; | |
7281 case 310: | |
7282 pParty->uNumArenaPageWins += val; | |
7283 break; | |
7284 case 311: | |
7285 pParty->uNumArenaSquireWins += val; | |
7286 break; | |
7287 case 312: | |
7288 pParty->uNumArenaKnightWins += val; | |
7289 break; | |
7290 case 313: | |
7291 pParty->uNumArenaLordWins += val; | |
7292 break; | |
7293 } | |
7294 } | |
7295 else | |
7296 { | |
310 | 7297 if ( var_type == VAR_GoldInBank ) |
0 | 7298 { |
7299 pParty->uNumGoldInBank += val; | |
7300 return; | |
7301 } | |
310 | 7302 if ( var_type <= VAR_Counter8 ) |
7303 { | |
7304 if ( (signed int)var_type >= 245 ) | |
7305 { | |
7306 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7307 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7308 } |
7309 else | |
7310 { | |
310 | 7311 switch ( var_type ) |
0 | 7312 { |
7313 case VAR_MonthEquals|VAR_CurrentSP: | |
7314 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7315 break; | |
7316 case VAR_NPCs2: | |
7317 pParty->field_709 = 0; | |
7318 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7319 pParty->CountHirelings(); |
7320 viewparams->bRedrawGameUI = true; | |
0 | 7321 break; |
7322 case VAR_NumSkillPoints: | |
7323 Dst->uSkillPoints += val; | |
7324 break; | |
7325 } | |
7326 } | |
7327 return; | |
7328 } | |
310 | 7329 if ( var_type < VAR_Counter9 ) |
0 | 7330 return; |
310 | 7331 if ( (signed int)var_type <= 274 ) |
7332 { | |
7333 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7334 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7335 goto _play_sound; |
7336 } | |
310 | 7337 if ( var_type != VAR_ReputationInCurrentLocation ) |
7338 { | |
7339 if ( var_type <= VAR_ReputationInCurrentLocation | |
7340 || var_type > VAR_History_28 | |
7341 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7342 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7343 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7344 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7345 v26) ) |
7346 return; | |
7347 bFlashHistoryBook = 1; | |
7348 _play_sound: | |
7349 v28 = 8 * uPlayerIdx + 400; | |
862 | 7350 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7351 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7352 return; | |
7353 } | |
7354 v27 = &pOutdoor->ddm; | |
7355 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7356 v27 = &pIndoor->dlv; | |
7357 v27->uReputation += val; | |
7358 if ( v27->uReputation > 10000 ) | |
7359 v27->uReputation = 10000; | |
7360 } | |
7361 } | |
7362 | |
7363 | |
7364 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7365 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7366 { |
7367 unsigned int v3; // ebx@1 | |
7368 signed int v4; // esi@1 | |
501 | 7369 bool result; // eax@8 |
0 | 7370 int v6; // esi@11 |
7371 int v7; // edi@14 | |
7372 signed int v8; // eax@17 | |
7373 char *v9; // eax@20 | |
7374 char v10; // sf@20 | |
7375 char *v11; // ecx@26 | |
7376 char *v12; // ecx@27 | |
7377 __int64 v13; // qax@27 | |
7378 unsigned __int8 v14; // cf@27 | |
501 | 7379 int *v15; // edx@29 |
0 | 7380 char *v16; // eax@90 |
7381 char *v17; // ecx@94 | |
501 | 7382 int v18; // esi@97 |
0 | 7383 signed int v19; // edx@97 |
7384 char *v20; // ecx@98 | |
7385 int v21; // eax@100 | |
7386 __int16 v22; // dx@112 | |
7387 int v23; // [sp-8h] [bp-14h]@45 | |
7388 signed int v24; // [sp-4h] [bp-10h]@4 | |
7389 int v25; // [sp-4h] [bp-10h]@45 | |
7390 | |
7391 v3 = 0; | |
605 | 7392 v4 = uActiveCharacter - 1; |
501 | 7393 result = false; |
7394 if ( (signed int)VarNum > 222 ) | |
7395 { | |
7396 if ( (signed int)VarNum <= 307 ) | |
7397 { | |
7398 if ( VarNum == 307 ) | |
7399 { | |
7400 pParty->uNumDeaths -= (unsigned int)pValue; | |
7401 return pValue; | |
7402 } | |
7403 if ( VarNum == 223 ) | |
0 | 7404 { |
7405 v11 = (char *)pParty->_autonote_bits; | |
501 | 7406 v22 = (short)pValue - 1; |
0 | 7407 } |
7408 else | |
7409 { | |
501 | 7410 if ( VarNum != 231 ) |
0 | 7411 { |
501 | 7412 switch ( VarNum ) |
0 | 7413 { |
7414 case 232: | |
501 | 7415 VarNum = (VariableType)0; |
1094 | 7416 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7417 result = (bool) pValue; |
7418 dword_5B65CC = 0; | |
7419 if ( (int)VarNum == pValue ) | |
0 | 7420 { |
501 | 7421 dword_5B65CC = (int)pValue; |
0 | 7422 } |
7423 else | |
7424 { | |
7425 pParty->field_709 = 0; | |
501 | 7426 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7427 pParty->CountHirelings(); |
7428 viewparams->bRedrawGameUI = true; | |
0 | 7429 } |
7430 break; | |
7431 case 241: | |
7432 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7433 { | |
7434 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7435 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7436 { |
605 | 7437 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7438 { |
7439 v21 = *(int *)v20; | |
7440 if ( (char)*(int *)v20 < 0 ) | |
7441 { | |
7442 LOBYTE(v21) = v21 & 0x7F; | |
7443 *(int *)v20 = v21; | |
7444 } | |
7445 } | |
7446 v20 += 76; | |
7447 } | |
7448 } | |
605 | 7449 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7450 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7451 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7452 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7453 pParty->field_709 = 0; | |
1035 | 7454 pParty->CountHirelings(); |
0 | 7455 break; |
7456 case 243: | |
7457 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7458 result = *v17 != NULL; |
501 | 7459 if ( (unsigned int)pValue <= *(int *)v17 ) |
7460 { | |
7461 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7462 result = (v17 != NULL); |
501 | 7463 } |
0 | 7464 else |
7465 *(int *)v17 = 0; | |
7466 break; | |
7467 case 275: | |
7468 v16 = (char *)&pOutdoor->ddm; | |
7469 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7470 v16 = (char *)&pIndoor->dlv; | |
501 | 7471 *((int *)v16 + 2) -= (int)pValue; |
0 | 7472 if ( *((int *)v16 + 2) < -10000 ) |
7473 *((int *)v16 + 2) = -10000; | |
7474 break; | |
7475 case 306: | |
501 | 7476 result = VarNum - 306; |
7477 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7478 { | |
7479 result = (bool)pValue; | |
7480 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7481 } |
0 | 7482 else |
7483 LABEL_88: | |
7484 dword_5B65C4 = 1; | |
7485 break; | |
7486 } | |
501 | 7487 return result; |
0 | 7488 } |
7489 v11 = this->field_1A50; | |
501 | 7490 v22 = (signed __int16)pValue; |
0 | 7491 } |
7492 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7493 return result; |
7494 } | |
7495 switch ( VarNum ) | |
0 | 7496 { |
7497 case 308: | |
501 | 7498 result = (bool)pValue; |
7499 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7500 break; |
7501 case 309: | |
501 | 7502 result = (bool)pValue; |
7503 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7504 break; |
7505 case 310: | |
501 | 7506 result = (bool)pValue; |
7507 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7508 break; |
7509 case 311: | |
501 | 7510 result = (bool)pValue; |
7511 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7512 break; |
7513 case 312: | |
501 | 7514 result = (bool)pValue; |
7515 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7516 break; |
7517 case 313: | |
501 | 7518 result = (bool)pValue; |
7519 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7520 break; |
7521 } | |
1545 | 7522 Error("Function not returning any value! (%u)", VarNum); |
0 | 7523 } |
7524 else | |
7525 { | |
501 | 7526 if ( (signed int)VarNum >= 123 ) |
7527 { | |
7528 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7529 } |
7530 else | |
7531 { | |
501 | 7532 switch ( VarNum ) |
0 | 7533 { |
7534 case VAR_RandomGold: | |
501 | 7535 v6 = rand() % (signed int)pValue + 1; |
0 | 7536 if ( v6 > pParty->uNumGold ) |
7537 v6 = pParty->uNumGold; | |
7538 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7539 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7540 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7541 GameUI_DrawFoodAndGold(); |
501 | 7542 return result; |
0 | 7543 case VAR_RandomFood: |
501 | 7544 v7 = rand() % (signed int)pValue + 1; |
0 | 7545 if ( v7 > pParty->uNumFoodRations ) |
7546 v7 = pParty->uNumFoodRations; | |
7547 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7548 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7549 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7550 GameUI_DrawFoodAndGold(); |
605 | 7551 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7552 v8 = 8 * v4 + 400; | |
862 | 7553 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7554 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7555 return result; |
0 | 7556 case VAR_CurrentHP: |
1036 | 7557 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7558 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7559 v8 = 8 * v4 + 400; | |
862 | 7560 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7561 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7562 return result; | |
0 | 7563 case VAR_CurrentSP: |
7564 v9 = (char *)&this->sMana; | |
501 | 7565 v10 = this->sMana - (signed int)pValue < 0; |
7566 *(int *)v9 -= (int)pValue; | |
0 | 7567 if ( v10 ) |
7568 *(int *)v9 = 0; | |
605 | 7569 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7570 v8 = 8 * v4 + 400; | |
862 | 7571 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7572 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7573 return result; | |
0 | 7574 case VAR_ACModifier: |
501 | 7575 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7576 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7577 v8 = 8 * v4 + 400; | |
862 | 7578 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7579 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7580 return result; | |
0 | 7581 case VAR_BaseLevel: |
501 | 7582 this->uLevel -= (unsigned __int8)pValue; |
605 | 7583 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7584 v8 = 8 * v4 + 400; | |
862 | 7585 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7586 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7587 return result; | |
0 | 7588 case VAR_LevelModifier: |
501 | 7589 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7590 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7591 v8 = 8 * v4 + 400; | |
862 | 7592 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7593 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7594 return result; | |
0 | 7595 case VAR_Age: |
501 | 7596 this->sAgeModifier -= (signed __int16)pValue; |
7597 return result; | |
0 | 7598 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7599 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7600 return result; |
0 | 7601 case VAR_Experience: |
7602 v12 = (char *)&this->uExperience; | |
501 | 7603 v13 = (signed int)pValue; |
7604 v14 = *(int *)v12 < (unsigned int)pValue; | |
7605 *(int *)v12 -= (int)pValue; | |
0 | 7606 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7607 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7608 v8 = 8 * v4 + 400; | |
862 | 7609 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7610 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7611 return result; | |
0 | 7612 case VAR_QBits_QuestsDone: |
501 | 7613 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7614 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7615 return true; |
0 | 7616 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7617 v15 = this->pInventoryMatrix; |
0 | 7618 break; |
7619 case VAR_FixedGold: | |
501 | 7620 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7621 goto LABEL_88; |
501 | 7622 Party::TakeGold((unsigned int)pValue); |
7623 return result; | |
0 | 7624 case VAR_MightBonus: |
7625 case VAR_ActualMight: | |
501 | 7626 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7627 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7628 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7629 v8 = 8 * v4 + 400; | |
862 | 7630 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7631 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7632 return result; | |
0 | 7633 case VAR_IntellectBonus: |
7634 case VAR_ActualIntellect: | |
501 | 7635 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7636 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7637 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7638 v8 = 8 * v4 + 400; | |
862 | 7639 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7640 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7641 return result; | |
0 | 7642 case VAR_PersonalityBonus: |
7643 case VAR_ActualPersonality: | |
501 | 7644 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7645 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7646 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7647 v8 = 8 * v4 + 400; | |
862 | 7648 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7649 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7650 return result; | |
0 | 7651 case VAR_EnduranceBonus: |
7652 case VAR_ActualEndurance: | |
501 | 7653 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7654 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7655 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7656 v8 = 8 * v4 + 400; | |
862 | 7657 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7658 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7659 return result; | |
0 | 7660 case VAR_SpeedBonus: |
7661 case VAR_ActualSpeed: | |
501 | 7662 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7663 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7664 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7665 v8 = 8 * v4 + 400; | |
862 | 7666 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7667 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7668 return result; | |
0 | 7669 case VAR_AccuracyBonus: |
7670 case VAR_ActualAccuracy: | |
501 | 7671 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7672 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7673 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7674 v8 = 8 * v4 + 400; | |
862 | 7675 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7676 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7677 return result; | |
0 | 7678 case VAR_LuckBonus: |
7679 case VAR_ActualLuck: | |
501 | 7680 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7681 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7682 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7683 v8 = 8 * v4 + 400; | |
862 | 7684 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7685 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7686 return result; | |
0 | 7687 case VAR_BaseMight: |
501 | 7688 this->uMight -= (unsigned __int16)pValue; |
605 | 7689 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7690 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7691 v8 = 8 * v4 + 400; | |
862 | 7692 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7693 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7694 return result; | |
0 | 7695 case VAR_BaseIntellect: |
501 | 7696 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 7697 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7698 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7699 v8 = 8 * v4 + 400; | |
862 | 7700 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7701 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7702 return result; | |
0 | 7703 case VAR_BasePersonality: |
501 | 7704 this->uWillpower -= (unsigned __int16)pValue; |
605 | 7705 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7706 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7707 v8 = 8 * v4 + 400; | |
862 | 7708 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7709 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7710 return result; | |
0 | 7711 case VAR_BaseEndurance: |
501 | 7712 this->uEndurance -= (unsigned __int16)pValue; |
605 | 7713 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7714 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7715 v8 = 8 * v4 + 400; | |
862 | 7716 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7717 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7718 return result; | |
0 | 7719 case VAR_BaseSpeed: |
501 | 7720 this->uSpeed -= (unsigned __int16)pValue; |
605 | 7721 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7722 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7723 v8 = 8 * v4 + 400; | |
862 | 7724 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7725 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7726 return result; | |
0 | 7727 case VAR_BaseAccuracy: |
501 | 7728 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 7729 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7730 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7731 v8 = 8 * v4 + 400; | |
862 | 7732 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7733 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7734 return result; | |
0 | 7735 case VAR_BaseLuck: |
501 | 7736 this->uLuck -= (unsigned __int16)pValue; |
605 | 7737 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7738 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7739 v8 = 8 * v4 + 400; | |
862 | 7740 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7741 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7742 return result; | |
0 | 7743 case VAR_FireResistance: |
501 | 7744 this->sResFireBase -= (signed __int16)pValue; |
605 | 7745 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7746 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7747 v8 = 8 * v4 + 400; | |
862 | 7748 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7749 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7750 return result; | |
0 | 7751 case VAR_AirResistance: |
501 | 7752 this->sResAirBase -= (signed __int16)pValue; |
605 | 7753 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7754 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7755 v8 = 8 * v4 + 400; | |
862 | 7756 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7757 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7758 return result; | |
0 | 7759 case VAR_WaterResistance: |
501 | 7760 this->sResWaterBase -= (signed __int16)pValue; |
605 | 7761 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7762 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7763 v8 = 8 * v4 + 400; | |
862 | 7764 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7765 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7766 return result; | |
0 | 7767 case VAR_EarthResistance: |
501 | 7768 this->sResEarthBase -= (signed __int16)pValue; |
605 | 7769 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7770 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7771 v8 = 8 * v4 + 400; | |
862 | 7772 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7773 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7774 return result; | |
0 | 7775 case VAR_SpiritResistance: |
501 | 7776 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 7777 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7778 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7779 v8 = 8 * v4 + 400; | |
862 | 7780 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7781 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7782 return result; | |
0 | 7783 case VAR_MindResistance: |
501 | 7784 this->sResMindBase -= (signed __int16)pValue; |
605 | 7785 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7786 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7787 v8 = 8 * v4 + 400; | |
862 | 7788 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7789 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7790 return result; | |
0 | 7791 case VAR_BodyResistance: |
501 | 7792 this->sResBodyBase -= (signed __int16)pValue; |
605 | 7793 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7794 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7795 v8 = 8 * v4 + 400; | |
862 | 7796 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7797 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7798 return result; | |
0 | 7799 case VAR_LightResistance: |
501 | 7800 this->sResLightBase -= (signed __int16)pValue; |
605 | 7801 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7802 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7803 v8 = 8 * v4 + 400; | |
862 | 7804 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7805 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7806 return result; | |
0 | 7807 case VAR_DarkResistance: |
501 | 7808 this->sResDarkBase -= (signed __int16)pValue; |
605 | 7809 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7810 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7811 v8 = 8 * v4 + 400; | |
862 | 7812 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7813 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7814 return result; | |
0 | 7815 case VAR_MagicResistance: |
501 | 7816 this->sResMagicBase -= (signed __int16)pValue; |
605 | 7817 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7818 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7819 v8 = 8 * v4 + 400; | |
862 | 7820 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7821 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7822 return result; | |
0 | 7823 case VAR_FireResistanceBonus: |
501 | 7824 this->sResFireBonus -= (signed __int16)pValue; |
605 | 7825 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7826 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7827 v8 = 8 * v4 + 400; | |
862 | 7828 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7829 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7830 return result; | |
0 | 7831 case VAR_AirResistanceBonus: |
501 | 7832 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7833 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7834 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7835 v8 = 8 * v4 + 400; | |
862 | 7836 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7837 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7838 return result; | |
0 | 7839 case VAR_WaterResistanceBonus: |
501 | 7840 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 7841 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7842 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7843 v8 = 8 * v4 + 400; | |
862 | 7844 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7845 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7846 return result; | |
0 | 7847 case VAR_EarthResistanceBonus: |
501 | 7848 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 7849 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7850 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7851 v8 = 8 * v4 + 400; | |
862 | 7852 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7853 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7854 return result; | |
0 | 7855 case VAR_SpiritResistanceBonus: |
501 | 7856 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 7857 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7858 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7859 v8 = 8 * v4 + 400; | |
862 | 7860 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7861 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7862 return result; | |
0 | 7863 case VAR_MindResistanceBonus: |
501 | 7864 this->sResMindBonus -= (signed __int16)pValue; |
605 | 7865 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7866 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7867 v8 = 8 * v4 + 400; | |
862 | 7868 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7869 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7870 return result; | |
0 | 7871 case VAR_BodyResistanceBonus: |
501 | 7872 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 7873 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7874 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7875 v8 = 8 * v4 + 400; | |
862 | 7876 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7877 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7878 return result; | |
0 | 7879 case VAR_LightResistanceBonus: |
501 | 7880 this->sResLightBonus -= (signed __int16)pValue; |
605 | 7881 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7882 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7883 v8 = 8 * v4 + 400; | |
862 | 7884 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7885 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7886 return result; | |
0 | 7887 case VAR_DarkResistanceBonus: |
501 | 7888 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7889 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7890 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7891 v8 = 8 * v4 + 400; | |
862 | 7892 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7893 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7894 return result; | |
0 | 7895 case VAR_MagicResistanceBonus: |
501 | 7896 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7897 v25 = 0; |
187 | 7898 v23 = SPEECH_91; |
7899 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7900 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7901 v8 = 8 * v4 + 400; | |
862 | 7902 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7903 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7904 return result; | |
0 | 7905 case VAR_FixedFood: |
501 | 7906 Party::TakeFood((unsigned int)pValue); |
605 | 7907 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7908 v8 = 8 * v4 + 400; | |
862 | 7909 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7910 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7911 return result; | |
0 | 7912 case VAR_StaffSkill: |
7913 case VAR_SwordSkill: | |
7914 case VAR_DaggerSkill: | |
7915 case VAR_AxeSkill: | |
7916 case VAR_SpearSkill: | |
7917 case VAR_BowSkill: | |
7918 case VAR_MaceSkill: | |
7919 case VAR_BlasterSkill: | |
7920 case VAR_ShieldSkill: | |
7921 case VAR_LeatherSkill: | |
7922 case VAR_SkillChain: | |
7923 case VAR_PlateSkill: | |
7924 case VAR_FireSkill: | |
7925 case VAR_AirSkill: | |
7926 case VAR_WaterSkill: | |
7927 case VAR_EarthSkill: | |
7928 case VAR_SpiritSkill: | |
7929 case VAR_MindSkill: | |
7930 case VAR_BodySkill: | |
7931 case VAR_LightSkill: | |
7932 case VAR_DarkSkill: | |
7933 case VAR_IdentifyItemSkill: | |
7934 case VAR_MerchantSkill: | |
7935 case VAR_RepairSkill: | |
7936 case VAR_BodybuildingSkill: | |
7937 case VAR_MeditationSkill: | |
7938 case VAR_PerceptionSkill: | |
7939 case VAR_DiplomacySkill: | |
7940 case VAR_DisarmTrapSkill: | |
7941 case VAR_LearningSkill: | |
501 | 7942 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 7943 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7944 v8 = 8 * v4 + 400; | |
862 | 7945 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7946 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7947 return result; | |
0 | 7948 case VAR_Cursed: |
7949 case VAR_Weak: | |
7950 case VAR_Asleep: | |
7951 case VAR_Afraid: | |
7952 case VAR_Drunk: | |
7953 case VAR_Insane: | |
7954 case VAR_PoisonedGreen: | |
7955 case VAR_DiseasedGreen: | |
7956 case VAR_PoisonedYellow: | |
7957 case VAR_DiseasedYellow: | |
7958 case VAR_PoisonedRed: | |
7959 case VAR_DiseasedRed: | |
7960 case VAR_Paralyzed: | |
7961 case VAR_Unconsious: | |
7962 case VAR_Dead: | |
7963 case VAR_Stoned: | |
7964 case VAR_Eradicated: | |
1071 | 7965 //*((int *)this + 2 * VarNum - 210) = 0; |
7966 //*((int *)this + 2 * result - 209) = 0; | |
7967 this->pConditions[VarNum] = 0; | |
0 | 7968 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7969 v8 = 8 * v4 + 400; | |
862 | 7970 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 7971 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7972 return result; |
605 | 7973 default: |
7974 return result; | |
7975 } | |
7976 for (v3 = 1; v3 < 126; v3++) | |
7977 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7978 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 7979 { |
605 | 7980 RemoveItemAtInventoryIndex(v3); |
501 | 7981 return true; |
0 | 7982 } |
605 | 7983 } |
501 | 7984 if ( pParty->pPickedItem.uItemID == pValue ) |
7985 { | |
605 | 7986 pMouse->RemoveHoldingItem(); |
7987 return true; | |
7988 } | |
7989 return false; | |
0 | 7990 } |
7991 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7992 |
1430 | 7993 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7994 return false; |
0 | 7995 } |
7996 // 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
|
7997 // 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
|
7998 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7999 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8000 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8001 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
|
8002 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8003 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8004 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8005 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8006 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8007 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8008 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8009 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8010 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
|
8011 //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
|
8012 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
|
8013 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
|
8014 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8015 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8016 _this.Reset(); |
1374 | 8017 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8018 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8019 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8020 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8021 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8022 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8023 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8024 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8025 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
|
8026 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8027 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8028 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8029 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8030 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8031 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8032 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8033 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8034 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8035 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8036 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8037 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8038 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8039 memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItemList[v7])); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8040 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8041 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8042 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8043 } |
1295 | 8044 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8045 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8046 |
1295 | 8047 //----- (0049387A) -------------------------------------------------------- |
1459 | 8048 int CycleCharacter(bool backwards) |
1295 | 8049 { |
8050 signed int result; // eax@1 | |
8051 signed int v2; // ecx@2 | |
8052 signed int v3; // ecx@8 | |
8053 | |
8054 result = uActiveCharacter; | |
1459 | 8055 if ( backwards ) |
1295 | 8056 { |
8057 v2 = 0; | |
8058 while ( 1 ) | |
8059 { | |
8060 --result; | |
8061 if ( result < 1 ) | |
8062 result = 4; | |
8063 if ( !pPlayers[result]->uTimeToRecovery ) | |
8064 break; | |
8065 ++v2; | |
8066 if ( v2 >= 4 ) | |
8067 return uActiveCharacter; | |
8068 } | |
8069 } | |
8070 else | |
8071 { | |
8072 v3 = 0; | |
8073 while ( 1 ) | |
8074 { | |
8075 ++result; | |
8076 if ( result > 4 ) | |
8077 result = 1; | |
8078 if ( !pPlayers[result]->uTimeToRecovery ) | |
8079 break; | |
8080 ++v3; | |
8081 if ( v3 >= 4 ) | |
8082 return uActiveCharacter; | |
8083 } | |
8084 } | |
8085 return result; | |
1297 | 8086 } |
8087 //----- (0043EE77) -------------------------------------------------------- | |
8088 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8089 { | |
8090 bool result; // eax@0 | |
8091 Player *v2; // edx@3 | |
8092 int v3; // ecx@3 | |
8093 Player **pPlayers; // esi@8 | |
1424 | 8094 //bool item_flag; |
1297 | 8095 Player *v6; // edx@9 |
8096 | |
1424 | 8097 //if ( a1 < 1 || a1 > 4 ) |
8098 //{ | |
8099 //if ( !a1 ) | |
8100 //{ | |
8101 //pPlayers = &::pPlayers[1]; | |
8102 //v5 = 604; | |
8103 //while ( 1 ) | |
1545 | 8104 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8105 for ( uint i = 1; i < 5; ++i ) |
1424 | 8106 { |
8107 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8108 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8109 return false; | |
8110 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8111 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8112 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8113 return false; | |
8114 //result *= 9; | |
1432 | 8115 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8116 return false; |
8117 //++pPlayers; | |
8118 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8119 //return true; | |
8120 } | |
8121 return true; | |
8122 } | |
1432 | 8123 |
1297 | 8124 //----- (0043EE15) -------------------------------------------------------- |
8125 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8126 { | |
8127 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8128 { | |
8129 for ( uint i = 0; i < 126; ++i ) | |
8130 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8131 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8132 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8133 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8134 return true; |
8135 } | |
8136 } | |
8137 for ( uint i = 0; i < 16; ++i ) | |
8138 { | |
8139 if ( pPlayer->pEquipment.pIndices[i] ) | |
8140 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8141 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8142 return true; |
8143 } | |
8144 } | |
8145 } | |
8146 return false; | |
8147 } | |
8148 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8149 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8150 { |
8151 unsigned int pNum; // ebp@1 | |
8152 Player **pPlayer; // ebx@1 | |
8153 Player *pPlayer2; // esi@2 | |
8154 enum CHARACTER_RACE pRace; // edi@2 | |
8155 bool pSex; // eax@2 | |
8156 char v6; // zf@7 | |
8157 | |
8158 //pPlayer = &pPlayers[1]; | |
8159 /*pNum = a1; | |
8160 | |
8161 while ( 1 ) | |
8162 { | |
8163 pPlayer2 = *pPlayer; | |
8164 pRace = pPlayer2->GetRace(); | |
8165 pSex = pPlayer2->GetSexByVoice(); | |
8166 if ( !pRace ) | |
8167 break; | |
8168 if ( pRace == 1 || pRace == 2 ) | |
8169 break; | |
8170 if ( !pSex && pNum == 2 )// | |
8171 //goto LABEL_15; | |
8172 { | |
8173 pSex = 1; | |
8174 return pSex; | |
8175 } | |
8176 v6 = pNum == 3;// | |
8177 LABEL_11: | |
8178 if ( v6 ) | |
8179 //goto LABEL_15; | |
8180 { | |
8181 pSex = 1; | |
8182 return pSex; | |
8183 } | |
8184 ++pPlayer; | |
8185 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8186 { | |
8187 pSex = 0; | |
8188 return pSex; | |
8189 } | |
8190 } | |
8191 if ( pSex || pNum ) | |
8192 { | |
8193 v6 = pNum == 1; | |
8194 goto LABEL_11; | |
8195 } | |
8196 //LABEL_15: | |
8197 pSex = 1; | |
8198 return pSex;*/ | |
8199 for (uint i = 1; i <= 4; ++i) | |
8200 { | |
8201 pRace = pPlayers[i]->GetRace(); | |
8202 pSex = pPlayers[i]->GetSexByVoice(); | |
8203 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8204 return 1; | |
8205 } | |
8206 return 0; | |
8207 } | |
8208 //----- (0043ED6F) -------------------------------------------------------- | |
8209 bool _43ED6F_check_party_races(bool a1) | |
8210 { | |
8211 bool v6; // zf@5 | |
8212 | |
8213 for (uint i = 0; i < 4; ++i) | |
8214 { | |
8215 auto player = pParty->pPlayers + i; | |
8216 auto race = player->GetRace(); | |
8217 | |
8218 if (race != CHARACTER_RACE_HUMAN && | |
8219 race != CHARACTER_RACE_ELF && | |
8220 race != CHARACTER_RACE_GOBLIN) | |
8221 v6 = a1 == 1; | |
8222 else | |
8223 v6 = !a1; | |
8224 | |
8225 if (v6) | |
8226 return true; | |
8227 } | |
8228 return false; | |
8229 } | |
8230 //----- (00439FCB) -------------------------------------------------------- | |
8231 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8232 { | |
8233 signed int v4; // esi@1 | |
8234 unsigned int v5; // ecx@1 | |
8235 Player *v6; // ebx@3 | |
8236 Actor *v7; // esi@3 | |
8237 unsigned int v8; // eax@4 | |
8238 char *v9; // eax@5 | |
8239 signed int v10; // eax@6 | |
8240 int v11; // edx@8 | |
8241 int v12; // edx@9 | |
8242 int v13; // edx@10 | |
8243 int v14; // edx@16 | |
8244 int v15; // edx@17 | |
8245 int v16; // edx@18 | |
8246 enum SoundID v17; // eax@24 | |
8247 int v18; // eax@26 | |
8248 unsigned __int8 v19; // zf@26 | |
8249 unsigned __int8 v20; // sf@26 | |
8250 unsigned __int16 v21; // ax@29 | |
8251 signed int v22; // edi@36 | |
8252 int v23; // eax@38 | |
8253 signed int v24; // eax@44 | |
8254 unsigned __int16 v25; // cx@47 | |
8255 signed int v26; // eax@49 | |
8256 int v27; // eax@54 | |
8257 float v28; // ST18_4@58 | |
8258 double v29; // st7@58 | |
8259 float v30; // ST08_4@58 | |
8260 double v31; // st7@58 | |
8261 float v32; // ST04_4@58 | |
8262 float v33; // ST00_4@58 | |
8263 int v34; // edi@61 | |
8264 int v35; // eax@70 | |
8265 double v36; // st7@70 | |
8266 SpriteObject *v37; // ebx@77 | |
8267 int v38; // edi@77 | |
8268 int v39; // esi@77 | |
8269 int v40; // eax@77 | |
8270 int v41; // eax@77 | |
8271 int v42; // eax@78 | |
8272 Player *v43; // eax@81 | |
8273 Actor *v44; // esi@82 | |
8274 Player *v45; // edi@84 | |
8275 unsigned __int16 v46; // ax@84 | |
8276 int v47; // ebx@105 | |
8277 int v48; // eax@107 | |
8278 unsigned __int16 v49; // ax@116 | |
8279 int v50; // ebx@123 | |
8280 unsigned __int16 v51; // ax@124 | |
8281 char v52; // bl@124 | |
8282 int v53; // eax@128 | |
8283 signed int v54; // eax@134 | |
8284 unsigned __int16 v55; // cx@137 | |
8285 signed int v56; // eax@139 | |
8286 int v57; // eax@144 | |
8287 float v58; // ST18_4@148 | |
8288 double v59; // st7@148 | |
8289 float v60; // ST08_4@148 | |
8290 double v61; // st7@148 | |
8291 float v62; // ST04_4@148 | |
8292 float v63; // ST00_4@148 | |
8293 int v64; // ebx@151 | |
8294 int v65; // eax@161 | |
8295 double v66; // st7@161 | |
8296 signed int v67; // ecx@164 | |
8297 signed int v68; // eax@170 | |
8298 int v69; // ecx@170 | |
8299 int v70; // eax@171 | |
8300 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8301 int v72; // [sp+30h] [bp-24h]@164 | |
8302 double v73; // [sp+40h] [bp-14h]@72 | |
8303 signed int v74; // [sp+44h] [bp-10h]@1 | |
8304 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8305 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8306 int v77; // [sp+50h] [bp-4h]@26 | |
8307 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8308 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8309 | |
8310 v4 = PID_ID(uObjID); | |
8311 v5 = PID_TYPE(uObjID) - 2; | |
8312 v74 = a2; | |
8313 uActorID = v4; | |
8314 if ( v5 ) | |
8315 { | |
8316 if ( v5 != 1 | |
8317 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8318 v75 = v6->sHealth, | |
8319 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8320 return; | |
8321 v8 = v6->pEquipment.uArmor; | |
8322 if ( !v8 | |
8323 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8324 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8325 || v10 > 11 ) | |
8326 { | |
8327 v14 = rand() % 4; | |
8328 if ( !v14 ) | |
8329 { | |
8330 v71 = (SoundID)108; | |
8331 goto LABEL_24; | |
8332 } | |
8333 v15 = v14 - 1; | |
8334 if ( !v15 ) | |
8335 { | |
8336 v71 = (SoundID)109; | |
8337 goto LABEL_24; | |
8338 } | |
8339 v16 = v15 - 1; | |
8340 if ( !v16 ) | |
8341 { | |
8342 v71 = (SoundID)110; | |
8343 goto LABEL_24; | |
8344 } | |
8345 if ( v16 == 1 ) | |
8346 { | |
8347 v71 = (SoundID)44; | |
8348 goto LABEL_24; | |
8349 } | |
8350 } | |
8351 else | |
8352 { | |
8353 v11 = rand() % 4; | |
8354 if ( !v11 ) | |
8355 { | |
8356 v71 = (SoundID)105; | |
8357 goto LABEL_24; | |
8358 } | |
8359 v12 = v11 - 1; | |
8360 if ( !v12 ) | |
8361 { | |
8362 v71 = (SoundID)106; | |
8363 goto LABEL_24; | |
8364 } | |
8365 v13 = v12 - 1; | |
8366 if ( !v13 ) | |
8367 { | |
8368 v71 = (SoundID)107; | |
8369 goto LABEL_24; | |
8370 } | |
8371 if ( v13 == 1 ) | |
8372 { | |
8373 v71 = (SoundID)45; | |
8374 LABEL_24: | |
8375 v17 = v71; | |
8376 goto LABEL_26; | |
8377 } | |
8378 } | |
8379 v17 = (SoundID)a4; | |
8380 LABEL_26: | |
8381 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8382 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8383 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8384 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8385 v77 = v18; | |
8386 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8387 { | |
8388 v21 = v7->pActorBuffs[3].uPower; | |
8389 if ( v21 ) | |
8390 v77 /= (signed int)v21; | |
8391 } | |
8392 if ( v74 ) | |
8393 { | |
8394 if ( v74 == 1 ) | |
8395 { | |
8396 v22 = v7->pMonsterInfo.uAttack2Type; | |
8397 } | |
8398 else | |
8399 { | |
8400 if ( v74 == 2 ) | |
8401 { | |
8402 v23 = v7->pMonsterInfo.uSpell1ID; | |
8403 } | |
8404 else | |
8405 { | |
8406 if ( v74 != 3 ) | |
8407 { | |
8408 if ( v74 == 4 ) | |
8409 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8410 else | |
8411 v22 = 4; | |
8412 goto LABEL_43; | |
8413 } | |
8414 v23 = v7->pMonsterInfo.uSpell2ID; | |
8415 } | |
8416 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8417 } | |
8418 } | |
8419 else | |
8420 { | |
8421 v22 = v7->pMonsterInfo.uAttack1Type; | |
8422 } | |
8423 LABEL_43: | |
8424 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8425 { | |
8426 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8427 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8428 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8429 { | |
8430 v25 = v7->uAIState; | |
8431 if ( v25 != 5 ) | |
8432 { | |
8433 if ( v25 != 4 ) | |
8434 { | |
8435 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8436 v7->sCurrentHP -= v26; | |
8437 if ( v26 ) | |
8438 { | |
8439 if ( v7->sCurrentHP >= 1 ) | |
8440 { | |
8441 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8442 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8443 } | |
8444 else | |
8445 { | |
8446 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8447 { | |
8448 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8449 v74 = v27; | |
8450 if ( pRenderer->pRenderD3D ) | |
8451 { | |
8452 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8453 { | |
8454 v28 = (double)v74; | |
8455 v74 = v7->vPosition.z; | |
8456 v29 = (double)v74; | |
8457 v74 = v7->vPosition.y; | |
8458 v30 = v29; | |
8459 v31 = (double)v74; | |
8460 v74 = v7->vPosition.x; | |
8461 v32 = v31; | |
8462 v33 = (double)v74; | |
8463 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8464 } | |
8465 } | |
8466 } | |
8467 Actor::Die(uActorID); | |
8468 Actor::ApplyFineForKillingPeasant(uActorID); | |
8469 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8470 if ( v7->pMonsterInfo.uExp ) | |
8471 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8472 v34 = SPEECH_51; | |
8473 if ( rand() % 100 < 20 ) | |
8474 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8475 v6->PlaySound((PlayerSpeech)v34, 0); | |
8476 } | |
8477 } | |
8478 } | |
8479 } | |
8480 } | |
8481 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8482 && v7->pMonsterInfo.uSpecialAttack | |
8483 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8484 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8485 } | |
8486 if ( !pParty->bTurnBasedModeOn ) | |
8487 { | |
8488 v35 = v6->GetActualEndurance(); | |
8489 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8490 v6->SetRecoveryTime((signed __int64)v36); | |
8491 } | |
8492 if ( v77 ) | |
8493 { | |
8494 v73 = (double)(signed int)v75; | |
8495 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8496 { | |
8497 if ( v6->sHealth > 0 ) | |
8498 { | |
8499 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8500 v6->PlaySound(SPEECH_48, 0); | |
8501 } | |
8502 } | |
8503 } | |
8504 viewparams->bRedrawGameUI = 1; | |
8505 return; | |
8506 } | |
8507 v37 = &pSpriteObjects[uActorID]; | |
8508 v38 = PID_TYPE(v37->spell_caster_pid); | |
8509 v39 = PID_ID(v37->spell_caster_pid); | |
8510 v40 = PID_TYPE(v37->spell_caster_pid); | |
8511 uActorID = PID_ID(v37->spell_caster_pid); | |
8512 v41 = v40 - 2; | |
8513 if ( !v41 ) | |
8514 goto LABEL_80; | |
8515 v42 = v41 - 1; | |
8516 if ( !v42 ) | |
8517 { | |
8518 v44 = &pActors[v39]; | |
8519 if ( a4 == -1 ) | |
8520 a4 = stru_50C198.which_player_would_attack(v44); | |
8521 v45 = &pParty->pPlayers[a4]; | |
8522 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8523 v46 = v37->uType; | |
8524 if ( v37->uType == 545 ) | |
8525 { | |
8526 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8527 v52 = v51; | |
8528 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8529 { | |
8530 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8531 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8532 v45->PlaySound(SPEECH_6, 0); | |
8533 return; | |
8534 } | |
8535 } | |
8536 else | |
8537 { | |
8538 if ( v46 != 555 | |
8539 && v46 != 510 | |
8540 && v46 != 500 | |
8541 && v46 != 515 | |
8542 && v46 != 505 | |
8543 && v46 != 530 | |
8544 && v46 != 525 | |
8545 && v46 != 520 | |
8546 && v46 != 535 | |
8547 && v46 != 540 ) | |
8548 goto LABEL_115; | |
8549 } | |
8550 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8551 return; | |
8552 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8553 v77 >>= 1; | |
8554 if ( v45->HasEnchantedItemEquipped(36) ) | |
8555 v77 >>= 1; | |
8556 if ( v45->HasEnchantedItemEquipped(69) ) | |
8557 v77 >>= 1; | |
8558 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8559 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8560 v77 >>= 1; |
8561 v75 = 0; | |
8562 v47 = (int)&v45->pEquipment; | |
8563 do | |
8564 { | |
8565 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8566 { | |
8567 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8568 if ( v48 == 520 ) | |
8569 v77 >>= 1; | |
8570 if ( v48 == 531 ) | |
8571 v77 >>= 1; | |
8572 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8573 v77 >>= 1; | |
8574 } | |
8575 ++v75; | |
8576 v47 += 4; | |
8577 } | |
8578 while ( (signed int)v75 <= 1 ); | |
8579 LABEL_115: | |
8580 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8581 { | |
8582 v49 = v44->pActorBuffs[3].uPower; | |
8583 if ( v49 ) | |
8584 v77 /= (signed int)v49; | |
8585 } | |
8586 if ( !v74 ) | |
8587 { | |
8588 v50 = v44->pMonsterInfo.uAttack1Type; | |
8589 goto LABEL_133; | |
8590 } | |
8591 if ( v74 == 1 ) | |
8592 { | |
8593 v50 = v44->pMonsterInfo.uAttack2Type; | |
8594 goto LABEL_133; | |
8595 } | |
8596 if ( v74 == 2 ) | |
8597 { | |
8598 v53 = v44->pMonsterInfo.uSpell1ID; | |
8599 } | |
8600 else | |
8601 { | |
8602 if ( v74 != 3 ) | |
8603 { | |
8604 if ( v74 == 4 ) | |
8605 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8606 else | |
8607 v50 = 4; | |
8608 LABEL_133: | |
8609 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8610 { | |
8611 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8612 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8613 { | |
8614 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8615 { | |
8616 v55 = v44->uAIState; | |
8617 if ( v55 != 5 ) | |
8618 { | |
8619 if ( v55 != 4 ) | |
8620 { | |
8621 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8622 v44->sCurrentHP -= v56; | |
8623 if ( v56 ) | |
8624 { | |
8625 if ( v44->sCurrentHP >= 1 ) | |
8626 { | |
8627 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8628 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8629 } | |
8630 else | |
8631 { | |
8632 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8633 { | |
8634 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8635 v75 = v57; | |
8636 if ( pRenderer->pRenderD3D ) | |
8637 { | |
8638 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8639 { | |
8640 v58 = (double)(signed int)v75; | |
8641 v75 = v44->vPosition.z; | |
8642 v59 = (double)(signed int)v75; | |
8643 v75 = v44->vPosition.y; | |
8644 v60 = v59; | |
8645 v61 = (double)(signed int)v75; | |
8646 v75 = v44->vPosition.x; | |
8647 v62 = v61; | |
8648 v63 = (double)(signed int)v75; | |
8649 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8650 } | |
8651 } | |
8652 } | |
8653 Actor::Die(uActorID); | |
8654 Actor::ApplyFineForKillingPeasant(uActorID); | |
8655 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8656 if ( v44->pMonsterInfo.uExp ) | |
8657 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8658 v64 = SPEECH_51; | |
8659 if ( rand() % 100 < 20 ) | |
8660 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8661 v45->PlaySound((PlayerSpeech)v64, 0); | |
8662 } | |
8663 } | |
8664 } | |
8665 } | |
8666 } | |
8667 } | |
8668 } | |
8669 if ( !v74 | |
8670 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8671 && v44->pMonsterInfo.uSpecialAttack | |
8672 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8673 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8674 if ( !pParty->bTurnBasedModeOn ) | |
8675 { | |
8676 v65 = v45->GetActualEndurance(); | |
8677 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8678 * flt_6BE3A4_debug_recmod1 | |
8679 * 2.133333333333333; | |
8680 v45->SetRecoveryTime((signed __int64)v66); | |
8681 } | |
8682 return; | |
8683 } | |
8684 v53 = v44->pMonsterInfo.uSpell2ID; | |
8685 } | |
8686 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8687 goto LABEL_133; | |
8688 } | |
8689 if ( v42 != 1 ) | |
8690 return; | |
8691 LABEL_80: | |
8692 if ( a4 != -1 ) | |
8693 { | |
8694 v43 = &pParty->pPlayers[a4]; | |
8695 LABEL_168: | |
8696 a4b = v43; | |
8697 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8698 { | |
8699 v70 = v43->GetMaxHealth(); | |
8700 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8701 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8702 } | |
8703 else | |
8704 { | |
8705 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8706 v69 = 0; | |
8707 } | |
8708 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8709 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8710 { | |
8711 qword_A750D8 = 256i64; | |
1406 | 8712 PlayerSpeechID = SPEECH_44; |
1407 | 8713 uSpeakingCharacter = uActorID + 1; |
1297 | 8714 } |
8715 return; | |
8716 } | |
8717 v74 = 0; | |
8718 a4a = 1; | |
8719 do | |
8720 { | |
8721 if ( pPlayers[a4a]->CanAct() ) | |
8722 { | |
8723 v67 = v74++; | |
8724 *(&v72 + v67) = a4a; | |
8725 } | |
8726 ++a4a; | |
8727 } | |
8728 while ( a4a <= 4 ); | |
8729 if ( v74 ) | |
8730 { | |
8731 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8732 goto LABEL_168; | |
8733 } | |
8734 } | |
8735 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8736 void OnInventoryLeftClick() |
1297 | 8737 { |
8738 Player *v0; // ebx@1 | |
8739 signed int v1; // eax@2 | |
8740 signed int v2; // ecx@2 | |
8741 int v3; // eax@2 | |
8742 char v4; // sf@2 | |
8743 int v5; // eax@2 | |
8744 unsigned int v6; // eax@7 | |
8745 unsigned int v7; // esi@12 | |
8746 unsigned int v8; // eax@12 | |
8747 unsigned int v9; // eax@16 | |
8748 unsigned int v10; // eax@18 | |
8749 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8750 POINT a2; // [sp+30h] [bp-18h]@4 | |
8751 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8752 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8753 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8754 int a4; // [sp+44h] [bp-4h]@2 | |
8755 | |
8756 v0 = pPlayers[uActiveCharacter]; | |
8757 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8758 { | |
8759 pMouse->GetClickPos(&pX, &pY); | |
8760 pY = pY - 17; | |
8761 v2 =pX - 14; | |
8762 pX = v2; | |
8763 v3 = 14 * (pY >> 5); | |
8764 v2 >>= 5; | |
8765 v4 = v2 + v3 < 0; | |
8766 v5 = v2 + v3; | |
8767 a4 = v5; | |
8768 if ( !v4 ) | |
8769 { | |
8770 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8771 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8772 { | |
8773 if ( unk_50C9A0 ) | |
8774 { | |
8775 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8776 if ( v6 ) | |
8777 { | |
8778 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8779 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8780 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8781 *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8782 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8783 unk_50C9A0 = 0; |
8784 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8785 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8786 pMouse->SetCursorBitmap("MICON1"); | |
8787 dword_50C9D0 = 113; | |
8788 dword_50C9D4 = 0; | |
8789 dword_50C9D8 = 256; | |
8790 } | |
8791 return; | |
8792 } | |
8793 if ( ptr_50C9A4 ) | |
8794 return; | |
8795 v7 = pParty->pPickedItem.uItemID; | |
8796 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8797 if ( !v7 ) | |
8798 { | |
8799 if ( !v8 ) | |
8800 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8801 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8802 v0->RemoveItemAtInventoryIndex(a4); |
8803 v9 = pParty->pPickedItem.uItemID; | |
8804 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8805 return; | |
8806 } | |
8807 v13 = v8; | |
8808 if ( v8 ) | |
8809 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8810 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8811 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8812 v0->RemoveItemAtInventoryIndex(a4); | |
8813 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8814 if ( !pX ) | |
8815 { | |
8816 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8817 if ( !pX ) | |
8818 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8819 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8820 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8821 return; | |
8822 } | |
8823 } | |
8824 v9 = this_.uItemID; | |
8825 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8826 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8827 return; | |
8828 } | |
8829 v10 = v0->AddItem(a4, v7); | |
8830 pX = v10; | |
8831 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8832 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8833 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8834 pMouse->RemoveHoldingItem(); |
8835 } | |
8836 } | |
8837 } | |
8838 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8839 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8840 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8841 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8842 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8843 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8844 return pConditions[Condition_Weak] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8845 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8846 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8847 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8848 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8849 return pConditions[Condition_Dead] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8850 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8851 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8852 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8853 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8854 return pConditions[Condition_Eradicated] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8855 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8856 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8857 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8858 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8859 return pConditions[Condition_Zombie] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8860 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8861 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8862 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8863 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8864 return pConditions[Condition_Cursed] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8865 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8866 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8867 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8868 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8869 return pConditions[Condition_Pertified] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8870 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8871 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8872 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8873 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8874 return pConditions[Condition_Unconcious] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8875 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8876 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8877 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8878 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8879 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8880 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8881 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8882 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8883 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8884 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8885 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8886 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8887 void Player::SetCursed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8888 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8889 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8890 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8891 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8892 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8893 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8894 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8895 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8896 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8897 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8898 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8899 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8900 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8901 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8902 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8903 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8904 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8905 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8906 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8907 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8908 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8909 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8910 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8911 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8912 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8913 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8914 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8915 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8916 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8917 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8918 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8919 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8920 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8921 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8922 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8923 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8924 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8925 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8926 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8927 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8928 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8929 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8930 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8931 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8932 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8933 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8934 pConditions[Condition_Disease2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8935 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8936 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8937 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8938 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8939 pConditions[Condition_Poison3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8940 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8941 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8942 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8943 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8944 pConditions[Condition_Disease3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8945 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8946 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8947 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8948 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8949 pConditions[Condition_Paralyzed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8950 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8951 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8952 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8953 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8954 pConditions[Condition_Unconcious] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8955 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8956 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8957 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8958 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8959 pConditions[Condition_Dead] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8960 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8961 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8962 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8963 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8964 pConditions[Condition_Pertified] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8965 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8966 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8967 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8968 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8969 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8970 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8971 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8972 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8973 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8974 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8975 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8976 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8977 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8978 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8979 SetCondition(Condition_Weak, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8980 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8981 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8982 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8983 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8984 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8985 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8986 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8987 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8988 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8989 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8990 } |