Mercurial > mm7
annotate Player.cpp @ 1564:461c2eca401b
fixing compilation error
author | Grumpy7 |
---|---|
date | Sun, 08 Sep 2013 03:27:10 +0200 |
parents | 0311debb684c |
children | 58420268d87d |
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 { | |
1036 | 1798 signed int itemid; // eax@1 |
1799 int min_damage; // edi@3 | |
1800 int max_damage; // eax@3 | |
0 | 1801 |
1802 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1803 | |
1036 | 1804 if ( pEquipment.uMainHand) |
1805 { | |
1806 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1807 if ( itemid < ITEM_BLASTER || itemid > ITEM_LASER_RIFLE ) //blasters |
1036 | 1808 { |
1809 min_damage = GetMeleeDamageMinimal(); | |
1810 max_damage = GetMeleeDamageMaximal(); | |
1811 } | |
1812 else | |
1813 { //for blasters | |
1814 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
1815 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
1816 } | |
1817 if ( max_damage ) | |
1818 { | |
1819 if ( min_damage == max_damage ) | |
1820 { | |
1821 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
1822 } | |
1823 else | |
1824 { | |
1825 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
1826 } | |
1827 } | |
1828 else | |
1829 { | |
1830 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
1831 } | |
1832 | |
1833 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
1834 { | |
1835 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
1836 } | |
1837 } | |
0 | 1838 else |
1036 | 1839 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
1840 return player__getmeleedamagestring_static_buff; | |
0 | 1841 } |
1842 | |
1843 //----- (0048D396) -------------------------------------------------------- | |
1844 char *Player::GetRangedDamageString() | |
1036 | 1845 { |
1846 signed int itemid; // eax@1 | |
1847 int min_damage; // edi@3 | |
1848 int max_damage; // eax@3 | |
1849 | |
1850 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1851 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1852 if (pEquipment.uMainHand >= 0) |
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 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
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 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1857 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1858 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1859 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1860 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1861 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1862 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
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 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1865 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1866 } |
0 | 1867 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1868 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1869 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1870 max_damage = GetRangedDamageMax(); |
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 if ( max_damage > 0) |
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 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1875 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1876 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1877 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1878 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1879 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1880 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1881 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1882 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1883 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1884 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1885 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1886 } |
1036 | 1887 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1888 } |
0 | 1889 |
1890 //----- (0048D45A) -------------------------------------------------------- | |
1891 bool Player::CanTrainToNextLevel() | |
1892 { | |
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
|
1893 int lvl = this->uLevel; |
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 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); |
1564 | 1895 return this->uExperience >= neededExp; |
0 | 1896 } |
1897 | |
1898 //----- (0048D498) -------------------------------------------------------- | |
1899 unsigned int Player::GetExperienceDisplayColor() | |
1900 { | |
1901 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
|
1902 return ui_character_bonus_text_color; |
0 | 1903 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
|
1904 return ui_character_default_text_color; |
0 | 1905 } |
1906 | |
1907 //----- (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
|
1908 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg ) |
1561 | 1909 { |
1036 | 1910 int resist_value; // edi@8 |
1911 int player_luck; // eax@21 | |
1912 signed int res_rand_divider; // ebx@2 | |
1913 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
|
1914 |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1915 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
|
1916 return 0; |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
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 resist_value = 0; |
1036 | 1919 switch(dmg_type) |
1920 { | |
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
|
1921 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
|
1922 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
|
1923 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
|
1924 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break; |
1036 | 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 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
|
1927 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
|
1928 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break; |
1036 | 1929 } |
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
|
1930 |
1036 | 1931 player_luck = GetActualLuck(); |
1932 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
1933 | |
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
|
1934 if ( GetParameterBonus(player_luck) + resist_value > 0 ) |
1036 | 1935 { |
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
|
1936 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
|
1937 { |
1036 | 1938 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
|
1939 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
|
1940 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
|
1941 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
|
1942 } |
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
|
1943 } |
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 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
|
1945 { |
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
|
1946 if (!pOwnItems[pEquipment.uArmor - 1].Broken()) |
0 | 1947 { |
1036 | 1948 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
1949 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 1950 { |
1036 | 1951 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
|
1952 return dmg / 2; |
0 | 1953 } |
1036 | 1954 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 1955 { |
1036 | 1956 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
|
1957 return dmg * 2 / 3; |
0 | 1958 } |
1959 } | |
1036 | 1960 } |
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
|
1961 return dmg; |
0 | 1962 } |
1963 | |
1964 //----- (0048D62C) -------------------------------------------------------- | |
816 | 1965 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
1966 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1967 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 1968 } |
1969 | |
1970 //----- (0048D651) -------------------------------------------------------- | |
816 | 1971 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
1972 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1973 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 1974 } |
1975 | |
1976 //----- (0048D676) -------------------------------------------------------- | |
1977 bool Player::IsUnarmed() | |
1978 { | |
1561 | 1979 return !HasItemEquipped(EQUIP_MAIN_HAND) && |
1980 (!HasItemEquipped(EQUIP_OFF_HAND) || GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD); | |
0 | 1981 } |
1982 | |
1983 //----- (0048D6AA) -------------------------------------------------------- | |
1984 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
1985 { | |
1986 auto i = pEquipment.pIndices[uEquipIndex]; | |
1987 if (i) | |
1080 | 1988 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 1989 else |
1990 return false; | |
0 | 1991 } |
1992 | |
1993 //----- (0048D6D0) -------------------------------------------------------- | |
1994 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
1995 { | |
1996 for (uint i = 0; i < 16; ++i) | |
1997 { | |
1998 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 1999 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 2000 return true; |
2001 } | |
2002 return false; | |
2003 } | |
2004 | |
2005 //----- (0048D709) -------------------------------------------------------- | |
1080 | 2006 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
1563 | 2007 { |
2008 return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); | |
2009 } | |
2010 | |
2011 bool Player::WearsItemAnyWhere(int item_id) | |
2012 { | |
2013 for (int i = 0; i < 16; i++) | |
2014 { | |
2015 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i)) | |
2016 { | |
2017 return true; | |
2018 } | |
2019 } | |
2020 return false; | |
0 | 2021 } |
2022 | |
2023 //----- (0048D76C) -------------------------------------------------------- | |
2024 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
2025 { | |
2026 unsigned __int16 v6; // cx@8 | |
2027 int v7; // edi@8 | |
2028 unsigned int v8; // ebx@8 | |
2029 unsigned int v9; // esi@8 | |
2030 int v10; // eax@8 | |
2031 int v11; // edi@12 | |
2032 bool result; // eax@13 | |
2033 | |
2034 if ( !a2 | |
2035 || this->pConditions[16] | |
2036 || this->pConditions[14] | |
2037 || this->pConditions[15] | |
2038 || this->pConditions[4] | |
2039 || this->pConditions[13] | |
2040 || this->pConditions[2] ) | |
2041 { | |
2042 result = 0; | |
2043 } | |
2044 else | |
2045 { | |
2046 v6 = this->pActiveSkills[34]; | |
2047 v7 = v6 & 0x3F; | |
2048 v8 = SkillToMastery(v6); | |
2049 v9 = a2->GetValue(); | |
2050 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
2051 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
2052 v9 *= 3; | |
2053 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
2054 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
2055 if ( rand() % 100 >= 5 ) | |
2056 { | |
2057 if ( *a6 > v11 ) | |
2058 result = *a6 - v11 < 500; | |
2059 else | |
2060 result = 2; | |
2061 } | |
2062 else | |
2063 { | |
2064 result = 0; | |
2065 } | |
2066 } | |
2067 return result; | |
2068 } | |
2069 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2070 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2071 | |
2072 //----- (0048D88B) -------------------------------------------------------- | |
2073 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2074 { | |
2075 Player *v4; // esi@1 | |
2076 Actor *v5; // edi@1 | |
2077 unsigned __int16 v6; // cx@10 | |
2078 int v7; // ebx@10 | |
2079 unsigned int v8; // esi@10 | |
2080 int v9; // eax@10 | |
2081 int v10; // esi@10 | |
2082 int v11; // eax@13 | |
2083 signed int v12; // ebx@15 | |
2084 signed int v13; // edx@15 | |
2085 int v14; // ecx@15 | |
2086 unsigned __int16 v15; // si@21 | |
2087 unsigned int v16; // ebx@24 | |
2088 int v17; // esi@24 | |
2089 const void *v18; // eax@29 | |
2090 unsigned int v19; // esi@31 | |
2091 int v20; // eax@34 | |
2092 char v21; // zf@36 | |
2093 unsigned int v22; // ST0C_4@39 | |
2094 char *v23; // esi@39 | |
2095 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2096 int v26; // [sp-8h] [bp-44h]@40 | |
2097 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2098 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2099 int v29; // [sp+30h] [bp-Ch]@10 | |
2100 int v30; // [sp+34h] [bp-8h]@10 | |
2101 Player *v31; // [sp+38h] [bp-4h]@1 | |
2102 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2103 | |
2104 v4 = this; | |
2105 v5 = &pActors[uActorID]; | |
2106 v31 = this; | |
2107 if ( &pActors[uActorID] | |
2108 && !this->pConditions[16] | |
2109 && !this->pConditions[14] | |
2110 && !this->pConditions[15] | |
2111 && !this->pConditions[4] | |
2112 && !this->pConditions[13] | |
2113 && !this->pConditions[2] ) | |
2114 { | |
2115 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2116 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2117 v6 = v4->pActiveSkills[34]; | |
2118 v7 = v6 & 0x3F; | |
2119 v8 = SkillToMastery(v6); | |
2120 v9 = rand(); | |
2121 v28 = 4 * v8; | |
2122 v30 = dword_4EDEA0[v8]; | |
2123 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2124 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2125 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2126 { | |
322 | 2127 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2128 _steal_perma = 0; |
2129 v26 = (int)v31->pName; | |
2130 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2131 } | |
2132 else | |
2133 { | |
2134 v11 = rand(); | |
2135 if ( v11 % 100 >= 40 ) | |
2136 { | |
2137 if ( v11 % 100 >= 70 ) | |
2138 { | |
2139 v19 = 0; | |
2140 if ( v7 > 0 ) | |
2141 { | |
2142 do | |
2143 { | |
2144 --v7; | |
2145 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2146 } | |
2147 while ( v7 ); | |
2148 } | |
2149 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2150 return _steal_perma; | |
377 | 2151 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2152 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2153 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2154 v21 = *(int *)v20 == v19; |
2155 *(int *)v20 -= v19; | |
2156 if ( v21 ) | |
2157 v5->array_000234[3].uItemID = 0; | |
2158 if ( v19 ) | |
2159 { | |
2160 party_finds_gold(v19, 2); | |
2161 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2162 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2163 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2164 LABEL_43: |
2165 ShowStatusBarString(v23, 2u); | |
2166 return _steal_perma; | |
2167 } | |
2168 } | |
2169 else | |
2170 { | |
2171 v27.Reset(); | |
2172 v12 = 0; | |
2173 v13 = 0; | |
2174 v14 = (int)v5->array_000234; | |
2175 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2176 { | |
2177 ++v13; | |
2178 v14 += 36; | |
2179 if ( v13 >= 4 ) | |
2180 goto LABEL_21; | |
2181 } | |
2182 v12 = 1; | |
2183 LABEL_21: | |
2184 v15 = v5->uCarriedItemID; | |
2185 if ( v15 || v12 ) | |
2186 { | |
2187 v27.Reset(); | |
2188 if ( v15 ) | |
2189 { | |
2190 v16 = (signed __int16)v15; | |
2191 v5->uCarriedItemID = 0; | |
2192 v27.uItemID = (signed __int16)v15; | |
2193 v17 = (signed __int16)v15; | |
2194 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2195 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2196 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2197 { | |
2198 if ( v16 != 220 ) | |
570 | 2199 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2200 } |
2201 } | |
2202 else | |
2203 { | |
2204 v18 = &v5->array_000234[rand() % 4]; | |
2205 memcpy(&v27, v18, sizeof(v27)); | |
2206 ((ItemGen *)v18)->Reset(); | |
2207 v16 = v27.uItemID; | |
2208 } | |
2209 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2210 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2211 pTmpBuf2.data(), |
0 | 2212 pGlobalTXT_LocalizationStrings[304], |
2213 v31->pName, | |
2214 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2215 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2216 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2217 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2218 pMouse->SetCursorBitmapFromItemID(v16); | |
2219 return _steal_perma; | |
2220 } | |
2221 } | |
2222 } | |
2223 v26 = (int)v31->pName; | |
2224 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2225 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2226 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2227 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2228 goto LABEL_43; |
2229 } | |
2230 return 0; | |
2231 } | |
2232 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2233 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2234 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2235 | |
2236 //----- (0048DBB9) -------------------------------------------------------- | |
2237 void Player::Heal(int amount) | |
2238 { | |
1010 | 2239 signed int max_health; // eax@3 |
2240 | |
2241 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
2242 { | |
2243 max_health = GetMaxHealth(); | |
2244 if ( pConditions[Condition_Zombie] ) | |
2245 max_health /= 2; | |
2246 sHealth += amount; | |
2247 if ( sHealth > max_health ) | |
2248 sHealth = max_health; | |
2249 if ( pConditions[Condition_Unconcious] ) | |
2250 { | |
2251 if ( sHealth > 0 ) | |
2252 { | |
2253 pConditions[Condition_Unconcious] = 0i64; | |
0 | 2254 } |
2255 } | |
2256 } | |
2257 } | |
2258 | |
2259 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2260 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2261 { | |
2262 signed int recieved_dmg; // eax@1 | |
2263 unsigned int armor_indx; // eax@8 | |
2264 bool broke_armor; | |
2265 | |
2266 pConditions[Condition_Sleep] = 0i64; | |
2267 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
2268 sHealth -= recieved_dmg; | |
2269 broke_armor = sHealth <= -10; | |
2270 if ( sHealth < 1 ) // | |
2271 { | |
2272 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
2273 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 2274 { |
1019 | 2275 SetCondition(Condition_Unconcious, 0); |
0 | 2276 } |
2277 else | |
2278 { | |
1019 | 2279 SetCondition(Condition_Dead, 0); |
1036 | 2280 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
2281 if ( sHealth > 0 ) | |
2282 sHealth = 0; | |
2283 } | |
2284 if (broke_armor ) | |
2285 { | |
2286 armor_indx = pEquipment.uArmor; | |
2287 if ( armor_indx ) | |
0 | 2288 { |
1036 | 2289 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 2290 { |
1036 | 2291 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 2292 } |
2293 } | |
2294 } | |
2295 } | |
1036 | 2296 if ( recieved_dmg && CanAct() ) |
187 | 2297 PlaySound(SPEECH_24, 0); |
1036 | 2298 return recieved_dmg; |
0 | 2299 } |
2300 | |
2301 //----- (0048DCF6) -------------------------------------------------------- | |
2302 int Player::_48DCF6(int a2, Actor *pActor) | |
2303 { | |
2304 signed int v3; // edi@1 | |
2305 signed int v4; // ebx@1 | |
2306 Player *v5; // esi@1 | |
2307 int v6; // eax@2 | |
2308 int v7; // eax@5 | |
2309 int v8; // eax@8 | |
2310 int v9; // ebx@8 | |
2311 int v10; // eax@8 | |
2312 int v11; // ebx@8 | |
2313 signed int v12; // edx@9 | |
2314 ItemGen *v13; // eax@9 | |
2315 int v14; // edx@16 | |
2316 unsigned int v15; // edx@17 | |
2317 int v16; // edx@26 | |
2318 unsigned int v17; // edx@27 | |
2319 signed int v19; // edx@38 | |
2320 int *v20; // ecx@38 | |
2321 signed int v21; // eax@40 | |
2322 int v22; // eax@49 | |
2323 signed int v23; // ebx@49 | |
2324 unsigned int v24; // eax@60 | |
2325 int v25; // ecx@61 | |
2326 int v26; // ebx@74 | |
2327 void *v27; // ecx@76 | |
2328 unsigned int v28; // ebx@78 | |
2329 signed int result; // eax@86 | |
2330 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2331 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2332 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2333 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2334 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2335 int v35; // [sp-Ch] [bp-ACh]@56 | |
2336 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2337 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2338 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2339 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2340 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2341 int v41; // [sp-4h] [bp-A4h]@51 | |
2342 int v42; // [sp-4h] [bp-A4h]@56 | |
2343 int v43; // [sp-4h] [bp-A4h]@57 | |
2344 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2345 int v45; // [sp-4h] [bp-A4h]@68 | |
2346 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2347 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2348 int v48; // [sp+9Ch] [bp-4h]@1 | |
2349 | |
2350 v3 = 0; | |
2351 v4 = 0; | |
2352 v5 = this; | |
2353 v47 = 0; | |
2354 v48 = 0; | |
2355 switch ( a2 ) | |
2356 { | |
2357 case 1: | |
2358 v6 = GetActualWillpower(); | |
2359 goto LABEL_46; | |
2360 case 2: | |
2361 case 3: | |
2362 case 4: | |
2363 case 9: | |
2364 case 10: | |
2365 case 11: | |
2366 case 13: | |
2367 case 21: | |
2368 v6 = GetActualEndurance(); | |
2369 goto LABEL_46; | |
2370 case 5: | |
2371 case 12: | |
2372 case 23: | |
2373 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2374 goto LABEL_5; | |
2375 case 15: | |
2376 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2377 goto LABEL_5; | |
2378 case 6: | |
2379 case 7: | |
2380 case 8: | |
2381 case 14: | |
2382 case 16: | |
2383 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2384 LABEL_5: | |
2385 v7 = GetActualResistance(v40); | |
2386 goto LABEL_47; | |
2387 case 22: | |
2388 v8 = GetActualWillpower(); | |
1036 | 2389 v9 = GetParameterBonus(v8); |
0 | 2390 v10 = GetActualIntelligence(); |
1036 | 2391 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2392 break; |
2393 case 17: | |
2394 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2395 v13 = this->pInventoryItemList; |
0 | 2396 do |
2397 { | |
315 | 2398 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 2399 v46[v4++] = v12; |
2400 ++v12; | |
2401 ++v13; | |
2402 } | |
2403 while ( v12 < 138 ); | |
2404 goto LABEL_36; | |
2405 case 18: | |
2406 v14 = 0; | |
2407 do | |
2408 { | |
2409 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2410 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2411 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2412 if ( v15 == EQUIP_ARMOUR ) |
898 | 2413 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2414 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2415 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2416 } |
2417 v14 = v15 + 1; | |
2418 } | |
2419 while ( v14 < 16 ); | |
2420 goto LABEL_36; | |
2421 case 19: | |
2422 v16 = 0; | |
2423 do | |
2424 { | |
2425 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2426 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2427 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2428 if ( v17 == 2 ) |
2429 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2430 if ( (!v17 || v17 == 1) | |
816 | 2431 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2432 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2433 } |
2434 v16 = v17 + 1; | |
2435 } | |
2436 while ( v16 < 16 ); | |
2437 LABEL_36: | |
2438 if ( !v4 ) | |
2439 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2440 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2441 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2442 break; | |
2443 case 20: | |
2444 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2445 v20 = this->pInventoryMatrix; |
0 | 2446 do |
2447 { | |
2448 if ( *v20 > 0 ) | |
2449 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2450 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2451 if ( v21 > 0 ) |
2452 { | |
2453 if ( v21 <= 134 ) | |
2454 v46[v4++] = v19; | |
2455 } | |
2456 } | |
2457 ++v19; | |
2458 ++v20; | |
2459 } | |
2460 while ( v19 < 126 ); | |
2461 if ( !v4 ) | |
2462 goto LABEL_87; | |
2463 v47 = (unsigned __int8)v46[rand() % v4]; | |
2464 v6 = GetActualAccuracy(); | |
2465 LABEL_46: | |
1036 | 2466 v7 = GetParameterBonus(v6); |
0 | 2467 LABEL_47: |
2468 v11 = v7; | |
2469 break; | |
2470 default: | |
2471 v11 = 0; | |
2472 break; | |
2473 } | |
2474 v22 = GetActualLuck(); | |
1036 | 2475 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2476 if ( rand() % v23 >= 30 ) |
2477 { | |
2478 LABEL_87: | |
2479 result = 0; | |
2480 } | |
2481 else | |
2482 { | |
2483 switch ( a2 ) | |
2484 { | |
2485 case 1: | |
2486 v41 = 1; | |
2487 v36 = 0; | |
2488 goto LABEL_56; | |
2489 case 2: | |
2490 v41 = 1; | |
2491 v36 = 1; | |
2492 goto LABEL_56; | |
2493 case 3: | |
2494 v41 = 1; | |
2495 v36 = 2; | |
2496 goto LABEL_56; | |
2497 case 23: | |
2498 v41 = 1; | |
2499 v36 = 3; | |
2500 goto LABEL_56; | |
2501 case 4: | |
2502 v41 = 1; | |
2503 v36 = 4; | |
2504 LABEL_56: | |
2505 SetCondition(v36, v41); | |
2506 v42 = 0; | |
2507 v37 = 0; | |
2508 v35 = 0; | |
2509 v34 = 0; | |
2510 v33 = -1; | |
2511 v32 = 0; | |
2512 v31 = 0; | |
2513 v30 = (SoundID)221; | |
2514 goto LABEL_83; | |
2515 case 5: | |
2516 v43 = 1; | |
2517 v38 = 5; | |
2518 goto LABEL_70; | |
2519 case 6: | |
2520 case 7: | |
2521 case 8: | |
2522 if ( a2 == 6 ) | |
2523 { | |
2524 v44 = 6; | |
2525 goto LABEL_60; | |
2526 } | |
2527 v25 = 2 * (a2 != 8) + 8; | |
2528 goto LABEL_65; | |
2529 case 9: | |
2530 if ( a2 == 6 ) | |
2531 { | |
2532 v44 = 7; | |
2533 LABEL_60: | |
2534 v24 = v44; | |
2535 } | |
2536 else | |
2537 { | |
2538 v25 = 2 * (a2 != 8) + 9; | |
2539 LABEL_65: | |
2540 v24 = v25; | |
2541 } | |
2542 SetCondition(v24, 1); | |
2543 v42 = 0; | |
2544 v37 = 0; | |
2545 v35 = 0; | |
2546 v34 = 0; | |
2547 v33 = -1; | |
2548 v32 = 0; | |
2549 v31 = 0; | |
2550 v30 = (SoundID)222; | |
2551 LABEL_83: | |
2552 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2553 do | |
2554 { | |
2555 LABEL_84: | |
2556 if ( v5 == pPlayers[v3 + 1] ) | |
2557 break; | |
2558 ++v3; | |
2559 } | |
2560 while ( v3 < 4 ); | |
2561 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2562 result = 1; | |
2563 break; | |
2564 case 12: | |
2565 v43 = 1; | |
2566 v38 = 12; | |
2567 goto LABEL_70; | |
2568 case 15: | |
2569 v45 = 1; | |
2570 v39 = 15; | |
2571 goto LABEL_73; | |
2572 case 13: | |
2573 v43 = 1; | |
2574 v38 = 13; | |
2575 LABEL_70: | |
2576 SetCondition(v38, v43); | |
2577 v42 = 0; | |
2578 v37 = 0; | |
2579 v35 = 0; | |
2580 v34 = 0; | |
2581 v33 = -1; | |
2582 v32 = 0; | |
2583 v31 = 0; | |
2584 v30 = (SoundID)224; | |
2585 goto LABEL_83; | |
2586 case 14: | |
2587 v45 = 1; | |
2588 v39 = 14; | |
2589 goto LABEL_73; | |
2590 case 16: | |
2591 v45 = 1; | |
2592 v39 = 16; | |
2593 LABEL_73: | |
2594 SetCondition(v39, v45); | |
2595 v42 = 0; | |
2596 v37 = 0; | |
2597 v35 = 0; | |
2598 v34 = 0; | |
2599 v33 = -1; | |
2600 v32 = 0; | |
2601 v31 = 0; | |
2602 v30 = (SoundID)225; | |
2603 goto LABEL_83; | |
2604 case 17: | |
2605 case 18: | |
2606 case 19: | |
2607 v26 = v48; | |
2608 if ( *(char *)(v48 + 21) & 2 ) | |
2609 goto LABEL_84; | |
187 | 2610 PlaySound(SPEECH_40, 0); |
0 | 2611 *(int *)(v26 + 20) |= 2u; |
2612 goto LABEL_79; | |
2613 case 20: | |
187 | 2614 PlaySound(SPEECH_40, 0); |
0 | 2615 v27 = pActor->array_000234; |
2616 if ( pActor->array_000234[0].uItemID ) | |
2617 { | |
2618 v27 = &pActor->array_000234[1]; | |
2619 if ( pActor->array_000234[1].uItemID ) | |
2620 goto LABEL_84; | |
2621 } | |
2622 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2623 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2624 RemoveItemAtInventoryIndex(v28); |
2625 LABEL_79: | |
2626 v42 = 0; | |
2627 v37 = 0; | |
2628 v35 = 0; | |
2629 v34 = 0; | |
2630 v33 = -1; | |
2631 v32 = 0; | |
2632 v31 = 0; | |
2633 v30 = (SoundID)47; | |
2634 goto LABEL_83; | |
2635 case 21: | |
187 | 2636 PlaySound(SPEECH_42, 0); |
0 | 2637 ++v5->sAgeModifier; |
2638 goto LABEL_82; | |
2639 case 22: | |
187 | 2640 PlaySound(SPEECH_41, 0); |
0 | 2641 v5->sMana = 0; |
2642 LABEL_82: | |
2643 v42 = 0; | |
2644 v37 = 0; | |
2645 v35 = 0; | |
2646 v34 = 0; | |
2647 v33 = -1; | |
2648 v32 = 0; | |
2649 v31 = 0; | |
2650 v30 = (SoundID)226; | |
2651 goto LABEL_83; | |
2652 default: | |
2653 goto LABEL_87; | |
2654 } | |
2655 } | |
2656 return result; | |
2657 } | |
324 | 2658 |
0 | 2659 // 48DCF6: using guessed type char var_94[140]; |
2660 | |
2661 //----- (0048E1A3) -------------------------------------------------------- | |
2662 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2663 { | |
1091 | 2664 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2665 } |
2666 | |
2667 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2668 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2669 { | |
2670 ItemGen *weapon = nullptr; | |
2671 ItemDesc *weapon_desc = nullptr; | |
2672 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2673 if (bRangedAttack) | |
0 | 2674 { |
2675 if ( !HasItemEquipped(EQUIP_BOW) ) | |
2676 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2677 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 2678 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2679 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
2680 goto LABEL_17; | |
2681 } | |
2682 else if ( IsUnarmed() == 1 ) | |
2683 { | |
2684 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
2685 { | |
2686 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 2687 goto LABEL_17; |
2688 } | |
2689 } | |
816 | 2690 |
2691 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
2692 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2693 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2694 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2695 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2696 { | |
2697 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2698 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2699 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2700 } | |
0 | 2701 else |
816 | 2702 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2703 } | |
1010 | 2704 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2705 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2706 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2707 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2708 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2709 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2710 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2711 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2712 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2713 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2714 } | |
2715 } | |
2716 | |
0 | 2717 LABEL_17: |
816 | 2718 uint armour_recovery = 0; |
0 | 2719 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2720 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2721 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2722 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
2723 | |
2724 float armour_recovery_multipliers[4]; | |
2725 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
2726 { | |
2727 armour_recovery_multipliers[0] = 1.0f; | |
2728 armour_recovery_multipliers[1] = 0; | |
2729 armour_recovery_multipliers[2] = 0; | |
2730 armour_recovery_multipliers[3] = 0; | |
2731 } | |
2732 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2733 { | |
2734 armour_recovery_multipliers[0] = 1.0f; | |
2735 armour_recovery_multipliers[1] = 0.5f; | |
2736 armour_recovery_multipliers[2] = 0; | |
2737 armour_recovery_multipliers[3] = 0; | |
2738 } | |
2739 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2740 { | |
2741 armour_recovery_multipliers[0] = 1.0f; | |
2742 armour_recovery_multipliers[1] = 0.5f; | |
2743 armour_recovery_multipliers[2] = 0.5f; | |
2744 armour_recovery_multipliers[3] = 0; | |
0 | 2745 } |
2746 else | |
2747 { | |
1545 | 2748 Error("Unknown armour type"); // what kind of armour is that? |
816 | 2749 armour_recovery_multipliers[0] = 1.0f; |
2750 armour_recovery_multipliers[1] = 1.0f; | |
2751 armour_recovery_multipliers[2] = 1.0f; | |
2752 armour_recovery_multipliers[3] = 1.0f; | |
2753 } | |
2754 | |
2755 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
2756 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
2757 } | |
2758 | |
2759 uint shield_recovery = 0; | |
2760 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2761 { | |
2762 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
2763 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2764 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2765 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2766 | |
2767 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
2768 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
2769 } | |
2770 | |
1036 | 2771 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2772 sword_axe_bow_recovery_reduction = 0; |
2773 bool shooting_laser = false; | |
2774 if (weapon_desc) | |
2775 { | |
2776 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2777 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2778 { | |
2779 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2780 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2781 } | |
2782 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2783 shooting_laser = true; | |
2784 } | |
2785 | |
2786 uint armsmaster_recovery_reduction = 0; | |
2787 if (!bRangedAttack && !shooting_laser) | |
2788 { | |
2789 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2790 { | |
2791 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2792 if (SkillToMastery(armsmaster_level) >= 4) | |
2793 armsmaster_recovery_reduction *= 2; | |
2794 } | |
2795 } | |
2796 | |
2797 uint v41 = 0; | |
2798 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 2799 v41 = 25; |
816 | 2800 |
2801 uint weapon_enchantment_recovery_reduction = 0; | |
2802 if ( weapon ) | |
2803 { | |
2804 if (weapon->uSpecEnchantmentType == 59 || | |
2805 weapon->uSpecEnchantmentType == 41 || | |
2806 weapon->uSpecEnchantmentType == 500) | |
2807 weapon_enchantment_recovery_reduction = 20; | |
2808 } | |
2809 | |
2810 | |
2811 int recovery = weapon_recovery + | |
2812 armour_recovery + | |
2813 shield_recovery | |
2814 - armsmaster_recovery_reduction | |
2815 - weapon_enchantment_recovery_reduction | |
2816 - v41 | |
2817 - sword_axe_bow_recovery_reduction | |
2818 - player_speed_recovery_reduction; | |
2819 | |
2820 if (recovery < 0) | |
2821 recovery = 0; | |
2822 return recovery; | |
0 | 2823 } |
2824 | |
2825 //----- (0048E4F8) -------------------------------------------------------- | |
2826 int Player::GetMaxHealth() | |
2827 { | |
2828 int v3; // esi@1 | |
2829 int v4; // esi@1 | |
2830 int v6; // esi@1 | |
2831 | |
1036 | 2832 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2833 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2834 v6 = uFullHealthBonus |
135 | 2835 + pBaseHealthByClass[classType / 4] |
0 | 2836 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2837 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2838 if (v6 <= 0) | |
2839 return 1; | |
2840 return v6; | |
2841 } | |
2842 | |
2843 //----- (0048E565) -------------------------------------------------------- | |
2844 int Player::GetMaxMana() | |
2845 { | |
2846 int v2; // eax@2 | |
2847 int v3; // esi@4 | |
2848 int v4; // eax@5 | |
2849 int v5; // esi@5 | |
2850 int v6; // eax@5 | |
2851 int v7; // esi@6 | |
2852 int v8; // esi@6 | |
2853 int v9; // esi@6 | |
2854 int result; // eax@7 | |
1116 | 2855 |
135 | 2856 switch (classType) |
0 | 2857 { |
1116 | 2858 case PLAYER_CLASS_ROGUE: |
2859 case PLAYER_CLASS_SPY: | |
2860 case PLAYER_CLASS_ASSASSIN: | |
2861 case PLAYER_CLASS_ARCHER: | |
2862 case PLAYER_CLASS_WARRIOR_MAGE: | |
2863 case PLAYER_CLASS_MASTER_ARCHER: | |
2864 case PLAYER_CLASS_SNIPER: | |
2865 case PLAYER_CLASS_SORCERER: | |
2866 case PLAYER_CLASS_WIZARD: | |
2867 case PLAYER_CLASS_ARCHMAGE: | |
2868 case PLAYER_CLASS_LICH: | |
0 | 2869 v2 = GetActualIntelligence(); |
1036 | 2870 v3 = GetParameterBonus(v2); |
1116 | 2871 break; |
2872 case PLAYER_CLASS_INITIATE: | |
2873 case PLAYER_CLASS_MASTER: | |
2874 case PLAYER_CLASS_NINJA: | |
2875 case PLAYER_CLASS_PALADIN: | |
2876 case PLAYER_CLASS_CRUSADER: | |
2877 case PLAYER_CLASS_HERO: | |
2878 case PLAYER_CLASS_VILLIAN: | |
2879 case PLAYER_CLASS_CLERIC: | |
2880 case PLAYER_CLASS_PRIEST: | |
2881 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2882 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2883 v2 = GetActualWillpower(); |
1036 | 2884 v3 = GetParameterBonus(v2); |
1116 | 2885 break; |
2886 case PLAYER_CLASS_HUNTER: | |
2887 case PLAYER_CLASS_RANGER_LORD: | |
2888 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2889 case PLAYER_CLASS_DRUID: | |
2890 case PLAYER_CLASS_GREAT_DRUID: | |
2891 case PLAYER_CLASS_ARCH_DRUID: | |
2892 case PLAYER_CLASS_WARLOCK: | |
0 | 2893 v4 = GetActualWillpower(); |
1036 | 2894 v5 = GetParameterBonus(v4); |
0 | 2895 v6 = GetActualIntelligence(); |
1036 | 2896 v3 = GetParameterBonus(v6) + v5; |
0 | 2897 break; |
2898 default: | |
1116 | 2899 return 0; |
0 | 2900 break; |
2901 } | |
1116 | 2902 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2903 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2904 v9 = uFullManaBonus | |
2905 + pBaseManaByClass[classType / 4] | |
2906 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2907 + v8; | |
2908 return max(0,v9); | |
0 | 2909 } |
2910 | |
2911 //----- (0048E656) -------------------------------------------------------- | |
2912 int Player::GetBaseAC() | |
2913 { | |
2914 Player *v1; // edi@1 | |
2915 int v2; // eax@1 | |
2916 int v3; // esi@1 | |
2917 int v4; // esi@1 | |
2918 int v5; // esi@1 | |
2919 int result; // eax@2 | |
2920 | |
2921 v1 = this; | |
2922 v2 = GetActualSpeed(); | |
1036 | 2923 v3 = GetParameterBonus(v2); |
0 | 2924 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2925 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2926 if ( v5 >= 1 ) | |
2927 result = v5; | |
2928 else | |
2929 result = 0; | |
2930 return result; | |
2931 } | |
2932 | |
2933 //----- (0048E68F) -------------------------------------------------------- | |
2934 int Player::GetActualAC() | |
2935 { | |
2936 Player *v1; // edi@1 | |
2937 int v2; // eax@1 | |
2938 int v3; // esi@1 | |
2939 int v4; // esi@1 | |
2940 int v5; // esi@1 | |
2941 int v6; // esi@1 | |
2942 int result; // eax@2 | |
2943 | |
2944 v1 = this; | |
2945 v2 = GetActualSpeed(); | |
1036 | 2946 v3 = GetParameterBonus(v2); |
0 | 2947 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2948 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2949 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
2950 if ( v6 >= 1 ) | |
2951 result = v6; | |
2952 else | |
2953 result = 0; | |
2954 return result; | |
2955 } | |
2956 | |
2957 //----- (0048E6DC) -------------------------------------------------------- | |
2958 unsigned int Player::GetBaseAge() | |
2959 { | |
352 | 2960 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 2961 } |
2962 | |
2963 //----- (0048E72C) -------------------------------------------------------- | |
2964 unsigned int Player::GetActualAge() | |
2965 { | |
2966 return this->sAgeModifier + GetBaseAge(); | |
2967 } | |
2968 | |
2969 //----- (0048E73F) -------------------------------------------------------- | |
2970 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
2971 { | |
2972 Player *v2; // ebx@1 | |
2973 signed int v3; // esi@1 | |
2974 enum CHARACTER_RACE v4; // eax@1 | |
2975 signed int v5; // edi@8 | |
2976 char v6; // zf@9 | |
2977 int v7; // esi@20 | |
2978 int result; // eax@21 | |
2979 signed int v9; // [sp-4h] [bp-10h]@11 | |
2980 | |
2981 v2 = this; | |
2982 v3 = 0; | |
2983 v4 = GetRace(); | |
2984 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
2985 { | |
2986 v5 = 0; | |
2987 goto LABEL_16; | |
2988 } | |
2989 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
2990 { | |
2991 v5 = 1; | |
2992 LABEL_16: | |
2993 v6 = v4 == 2; | |
2994 goto LABEL_17; | |
2995 } | |
2996 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
2997 { | |
2998 v6 = v4 == 3; | |
2999 v5 = 2; | |
3000 goto LABEL_17; | |
3001 } | |
3002 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3003 { | |
3004 v5 = 3; | |
3005 v6 = v4 == 3; | |
3006 goto LABEL_17; | |
3007 } | |
3008 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3009 { | |
3010 v5 = 7; | |
3011 if ( v4 != 1 ) | |
3012 goto LABEL_20; | |
3013 v9 = 10; | |
3014 LABEL_19: | |
3015 v3 = v9; | |
3016 goto LABEL_20; | |
3017 } | |
3018 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3019 { | |
3020 v5 = 8; | |
3021 v6 = v4 == 0; | |
3022 LABEL_17: | |
3023 if ( !v6 ) | |
3024 goto LABEL_20; | |
3025 v9 = 5; | |
3026 goto LABEL_19; | |
3027 } | |
3028 v5 = 0; | |
3029 LABEL_20: | |
3030 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3031 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3032 result = v7 + *(&v2->sResFireBase + v5); |
3033 return result; | |
3034 } | |
3035 | |
3036 //----- (0048E7D0) -------------------------------------------------------- | |
3037 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3038 { | |
3039 signed int v2; // edi@1 | |
3040 Player *v3; // esi@1 | |
3041 enum CHARACTER_RACE v4; // ebx@1 | |
3042 char v6; // zf@18 | |
3043 int v7; // ebx@28 | |
3044 int result; // eax@28 | |
3045 signed int v9; // [sp+10h] [bp-8h]@1 | |
3046 signed int v10; // [sp+14h] [bp-4h]@1 | |
3047 | |
3048 v2 = 0; | |
3049 v3 = this; | |
3050 v10 = 0; | |
3051 v9 = 0; | |
3052 v4 = GetRace(); | |
652 | 3053 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3054 v10 = 20; |
3055 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3056 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3057 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3058 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3059 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3060 && HasItemEquipped(EQUIP_ARMOUR) | |
3061 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3062 v10 += v3->pActiveSkills[9] & 0x3F; | |
3063 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3064 goto LABEL_25; | |
3065 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3066 { | |
3067 v2 = 1; | |
3068 LABEL_25: | |
3069 v6 = v4 == 2; | |
3070 LABEL_26: | |
3071 if ( v6 ) | |
3072 v9 = 5; | |
3073 goto LABEL_28; | |
3074 } | |
3075 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3076 { | |
3077 v6 = v4 == 3; | |
3078 v2 = 2; | |
3079 goto LABEL_26; | |
3080 } | |
3081 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3082 { | |
3083 v2 = 3; | |
3084 if ( v4 == 3 ) | |
3085 v10 += 5; | |
3086 } | |
3087 else | |
3088 { | |
3089 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3090 { | |
3091 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3092 goto LABEL_28; | |
3093 v2 = 8; | |
3094 v6 = v4 == 0; | |
3095 goto LABEL_26; | |
3096 } | |
3097 v2 = 7; | |
3098 if ( v4 == 1 ) | |
3099 v9 = 10; | |
3100 } | |
3101 LABEL_28: | |
3102 v7 = GetItemsBonus(a2, 0); | |
3103 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3104 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3105 { |
3106 if ( result > 200 ) | |
3107 result = 200; | |
3108 } | |
3109 return result; | |
3110 } | |
3111 | |
3112 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3113 bool Player::Recover(int dt) |
3114 { | |
3115 //Player *v2; // esi@1 | |
0 | 3116 signed __int64 v3; // qax@1 |
816 | 3117 //bool result; // eax@4 |
3118 | |
3119 //v2 = this; | |
3120 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3121 | |
3122 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3123 | |
3124 if (uTimeToRecovery > v3) | |
3125 { | |
3126 uTimeToRecovery -= v3; | |
3127 return true; | |
0 | 3128 } |
3129 else | |
3130 { | |
816 | 3131 uTimeToRecovery = 0; |
3132 viewparams->bRedrawGameUI = true; | |
3133 if (!uActiveCharacter) | |
0 | 3134 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3135 return false; |
3136 } | |
0 | 3137 } |
3138 | |
3139 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3140 void Player::SetRecoveryTime(signed int rec) |
3141 { | |
1545 | 3142 Assert(rec >= 0); |
816 | 3143 |
3144 if (rec > uTimeToRecovery) | |
3145 uTimeToRecovery = rec; | |
3146 | |
3147 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3148 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3149 |
3150 viewparams->bRedrawGameUI = true; | |
0 | 3151 } |
3152 // 50C0C4: using guessed type int some_active_character; | |
3153 | |
3154 //----- (0048E9B7) -------------------------------------------------------- | |
3155 void Player::RandomizeName() | |
3156 { | |
3157 if (!uExpressionTimePassed) | |
3158 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3159 } | |
3160 | |
3161 //----- (0048E9F4) -------------------------------------------------------- | |
3162 unsigned int Player::GetMajorConditionIdx() | |
3163 { | |
3164 for (uint i = 0; i < 18; ++i) | |
3165 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3166 return pConditionImportancyTable[i]; | |
3167 | |
3168 return 18; | |
3169 } | |
3170 | |
3171 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3172 int Player::GetParameterBonus( int player_parameter ) |
3173 { | |
3174 int i; // eax@1 | |
3175 i = 0; | |
3176 while (param_to_bonus_table[i]) | |
3177 { | |
3178 if (player_parameter >= param_to_bonus_table[i]) | |
3179 break; | |
3180 ++i; | |
3181 } | |
3182 return parameter_to_bonus_value[i]; | |
0 | 3183 } |
3184 | |
3185 //----- (0048EA46) -------------------------------------------------------- | |
3186 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3187 { | |
1032 | 3188 int inv_indx; // eax@3 |
3189 | |
3190 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3191 { | |
3192 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3193 continue; | |
3194 inv_indx = pEquipment.pIndices[i] - 1; | |
3195 if (a2==17) | |
3196 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3197 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3198 return 50; |
3199 } | |
3200 if (a2==24) | |
3201 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3202 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3203 return 5; |
3204 } | |
3205 } | |
3206 return 0; | |
0 | 3207 } |
3208 | |
3209 //----- (0048EAAE) -------------------------------------------------------- | |
3210 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3211 { | |
3212 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3213 // signed int v4; // eax@1 |
0 | 3214 int v5; // edi@1 |
3215 Player *v6; // ebx@1 | |
3216 Player *v8; // ecx@48 | |
3217 int v9; // eax@49 | |
3218 int v10; // edx@49 | |
3219 Player *v11; // ecx@55 | |
3220 int v12; // eax@56 | |
3221 int v13; // edx@56 | |
3222 int v14; // ecx@58 | |
3223 int v15; // eax@58 | |
3224 Player *v16; // ecx@61 | |
3225 int v17; // eax@62 | |
3226 Player *v18; // ecx@66 | |
3227 int v19; // eax@67 | |
3228 int v20; // eax@69 | |
3229 Player *v21; // ecx@75 | |
3230 int v22; // eax@76 | |
3231 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3232 //int v24; // eax@79 |
0 | 3233 int v25; // ecx@80 |
3234 int v26; // edi@80 | |
3235 Player *v27; // ecx@84 | |
3236 int v28; // eax@85 | |
3237 int v29; // edx@85 | |
3238 Player *v30; // ecx@96 | |
3239 int v31; // ebp@97 | |
3240 int v32; // eax@98 | |
3241 unsigned int v33; // eax@100 | |
3242 int v34; // eax@103 | |
3243 char v35; // zf@104 | |
3244 char v36; // zf@107 | |
3245 unsigned __int8 v37; // zf@119 | |
3246 char v38; // sf@119 | |
3247 unsigned __int8 v39; // of@119 | |
3248 char v40; // zf@122 | |
3249 char v41; // zf@145 | |
3250 char v42; // zf@164 | |
3251 char v43; // zf@173 | |
3252 char v44; // zf@189 | |
3253 char v45; // zf@198 | |
3254 char v46; // zf@239 | |
3255 int v47; // eax@268 | |
3256 int v48; // eax@269 | |
3257 int v49; // eax@291 | |
3258 char v50; // zf@295 | |
3259 int v51; // eax@306 | |
3260 int v52; // eax@307 | |
3261 char v53; // zf@312 | |
3262 char v54; // zf@336 | |
3263 char v55; // zf@348 | |
3264 int v56; // eax@365 | |
3265 int v57; // ebx@368 | |
3266 signed int v58; // [sp-4h] [bp-20h]@10 | |
3267 signed int v59; // [sp-4h] [bp-20h]@71 | |
3268 signed int v60; // [sp-4h] [bp-20h]@347 | |
3269 int v61; // [sp+10h] [bp-Ch]@1 | |
3270 int v62; // [sp+14h] [bp-8h]@1 | |
3271 int v63; // [sp+18h] [bp-4h]@101 | |
3272 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3273 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3274 bool no_skills; |
0 | 3275 |
3276 v3 = attr; | |
3277 v5 = 0; | |
3278 v6 = this; | |
3279 v62 = 0; | |
3280 v61 = 0; | |
3281 | |
1040 | 3282 |
3283 no_skills=false; | |
0 | 3284 switch (attr) |
3285 { | |
1040 | 3286 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3287 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3288 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3289 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3290 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3291 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3292 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3293 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3294 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3295 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3296 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3297 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3298 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3299 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3300 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3301 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3302 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3303 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3304 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3305 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3306 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3307 default: | |
3308 no_skills=true; | |
0 | 3309 } |
1040 | 3310 if (!no_skills) |
0 | 3311 { |
1040 | 3312 if ( !this->pActiveSkills[v58] ) |
3313 return 0; | |
0 | 3314 } |
1040 | 3315 |
0 | 3316 if ( (signed int)attr > 28 ) |
3317 { | |
3318 if ( (signed int)attr < 29 ) | |
3319 return v5 + v62 + v61; | |
1040 | 3320 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3321 { |
3322 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3323 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3324 return v5 + v62 + v61; |
3325 } | |
1040 | 3326 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3327 { |
3328 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3329 return v5 + v62 + v61; | |
1040 | 3330 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3331 v5 = pItemsTable->pItems[v57].uDamageMod; |
3332 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3333 v5 += v56; |
3334 return v5 + v62 + v61; | |
3335 } | |
3336 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3337 { |
3338 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3339 return v5 + v62 + v61; | |
1040 | 3340 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3341 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3342 LABEL_365: | |
3343 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3344 LABEL_366: | |
3345 v5 += v56; | |
3346 return v5 + v62 + v61; | |
3347 } | |
3348 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3349 return v5 + v62 + v61; | |
3350 LABEL_95: | |
3351 v65 = 0; | |
3352 while ( 1 ) | |
3353 { | |
3354 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3355 goto LABEL_361; | |
898 | 3356 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3357 if ( v3 == 9 ) |
3358 { | |
816 | 3359 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3360 if ( v32 >= 3 ) |
3361 { | |
3362 if ( v32 <= 11 ) | |
3363 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3364 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3365 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3366 } | |
3367 } | |
3368 } | |
3369 v63 = (int)((char *)v6 + 36 * v31); | |
3370 attra = (ItemGen *)(v63 + 532); | |
377 | 3371 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3372 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3373 { |
3374 v34 = attra->uItemID; | |
3375 switch ( attra->uItemID ) | |
3376 { | |
3377 case 0x1F4u: | |
3378 v35 = v3 == 5; | |
3379 goto LABEL_105; | |
3380 case 0x1F5u: | |
3381 v36 = v3 == 0; | |
3382 goto LABEL_108; | |
3383 case 0x1F6u: | |
3384 if ( v3 == 21 ) | |
3385 v61 += 10; | |
3386 v36 = v3 == 2; | |
3387 goto LABEL_108; | |
3388 case 0x1F7u: | |
3389 if ( v3 == 17 ) | |
3390 v61 += 5; | |
3391 if ( v3 == 18 ) | |
3392 v61 += 5; | |
3393 v36 = v3 == 6; | |
3394 goto LABEL_108; | |
3395 case 0x1F8u: | |
3396 goto LABEL_118; | |
3397 case 0x1F9u: | |
3398 v40 = v3 == 3; | |
3399 goto LABEL_123; | |
3400 case 0x1FAu: | |
3401 v35 = v3 == 10; | |
3402 goto LABEL_105; | |
3403 case 0x1FEu: | |
3404 v35 = v3 == 4; | |
3405 goto LABEL_105; | |
3406 case 0x1FFu: | |
3407 if ( v3 == 23 ) | |
3408 v61 += 10; | |
3409 if ( v3 == 22 ) | |
3410 v61 += 10; | |
3411 goto LABEL_361; | |
3412 case 0x200u: | |
3413 if ( v3 == 36 ) | |
3414 { | |
3415 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3416 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3417 } | |
3418 v36 = v3 == 5; | |
3419 LABEL_108: | |
3420 if ( v36 ) | |
3421 v5 += 40; | |
3422 goto LABEL_361; | |
3423 case 0x201u: | |
3424 if ( v3 == 39 ) | |
3425 { | |
3426 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3427 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3428 v62 = v34; | |
3429 } | |
3430 goto LABEL_136; | |
3431 case 0x202u: | |
3432 if ( !v3 ) | |
3433 v5 += 150; | |
3434 if ( v3 == 1 ) | |
3435 v5 -= 40; | |
3436 if ( v3 == 2 ) | |
3437 v5 -= 40; | |
3438 goto LABEL_145; | |
3439 case 0x203u: | |
3440 if ( v3 == 42 ) | |
3441 { | |
3442 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3443 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3444 } | |
3445 if ( v3 == 43 ) | |
3446 v61 += 15; | |
3447 goto LABEL_361; | |
3448 case 0x204u: | |
3449 if ( v3 == 17 ) | |
3450 v61 += 5; | |
3451 if ( v3 == 18 ) | |
3452 v61 += 5; | |
3453 if ( v3 == 6 ) | |
3454 v5 += 50; | |
3455 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3456 goto LABEL_166; | |
3457 v42 = v3 == 15; | |
3458 goto LABEL_165; | |
3459 case 0x205u: | |
3460 if ( v3 == 18 ) | |
3461 v61 += 5; | |
3462 goto LABEL_361; | |
3463 case 0x206u: | |
3464 if ( !v3 ) | |
3465 v5 += 100; | |
3466 if ( v3 == 3 ) | |
3467 v5 += 100; | |
3468 v43 = v3 == 9; | |
3469 goto LABEL_174; | |
3470 case 0x207u: | |
3471 if ( v3 == 45 ) | |
3472 v61 += 5; | |
3473 if ( v3 == 15 ) | |
3474 v5 -= 10; | |
3475 v42 = v3 == 14; | |
3476 LABEL_165: | |
3477 if ( v42 ) | |
3478 LABEL_166: | |
3479 v5 -= 10; | |
3480 goto LABEL_361; | |
3481 case 0x208u: | |
3482 v35 = v3 == 3; | |
3483 goto LABEL_105; | |
3484 case 0x209u: | |
3485 if ( v3 == 2 ) | |
3486 v5 += 15; | |
3487 if ( !v3 ) | |
3488 v5 += 15; | |
3489 v41 = v3 == 6; | |
3490 goto LABEL_146; | |
3491 case 0x20Au: | |
3492 if ( v3 == 46 ) | |
3493 v61 += 15; | |
3494 v44 = v3 == 3; | |
3495 goto LABEL_190; | |
3496 case 0x20Bu: | |
3497 if ( v3 == 34 ) | |
3498 { | |
3499 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3500 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3501 } | |
3502 if ( v3 == 12 ) | |
3503 v5 += 50; | |
3504 if ( v3 == 2 ) | |
3505 v5 += 30; | |
3506 v45 = v3 == 9; | |
3507 goto LABEL_199; | |
3508 case 0x20Cu: | |
3509 if ( !v3 ) | |
3510 v5 += 75; | |
3511 goto LABEL_145; | |
3512 case 0x20Du: | |
3513 if ( v3 == 5 ) | |
3514 v5 += 50; | |
3515 if ( v3 == 6 ) | |
3516 v5 += 50; | |
3517 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3518 goto LABEL_374; | |
3519 v43 = v3 == 15; | |
3520 LABEL_174: | |
3521 if ( v43 ) | |
3522 LABEL_374: | |
3523 v5 -= 15; | |
3524 goto LABEL_361; | |
3525 case 0x20Eu: | |
3526 if ( v3 == 4 ) | |
3527 v5 += 150; | |
3528 if ( v3 == 44 ) | |
3529 v61 += 5; | |
3530 if ( v3 == 9 ) | |
3531 v5 -= 25; | |
3532 goto LABEL_361; | |
3533 case 0x20Fu: | |
3534 if ( v3 == 39 ) | |
3535 { | |
3536 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3537 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3538 v62 = v34; | |
3539 } | |
3540 if ( v3 == 40 ) | |
3541 { | |
3542 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3543 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3544 } | |
3545 LABEL_145: | |
3546 v41 = v3 == 5; | |
3547 LABEL_146: | |
3548 if ( v41 ) | |
3549 v5 -= 40; | |
3550 goto LABEL_361; | |
3551 case 0x210u: | |
3552 if ( v3 == 38 ) | |
3553 { | |
3554 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3555 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3556 } | |
3557 if ( !v3 ) | |
3558 v5 += 75; | |
3559 v44 = v3 == 11; | |
3560 LABEL_190: | |
3561 if ( v44 ) | |
3562 v5 -= 50; | |
3563 goto LABEL_361; | |
3564 case 0x211u: | |
3565 if ( v3 == 5 ) | |
3566 v5 += 100; | |
3567 if ( v3 == 4 ) | |
3568 v5 += 50; | |
3569 v35 = v3 == 11; | |
3570 LABEL_105: | |
3571 if ( v35 ) | |
3572 v5 += 50; | |
3573 goto LABEL_361; | |
3574 case 0x212u: | |
3575 if ( v3 == 1 ) | |
3576 v5 -= 20; | |
3577 v45 = v3 == 2; | |
3578 LABEL_199: | |
3579 if ( v45 ) | |
3580 v5 -= 20; | |
3581 goto LABEL_361; | |
3582 case 0x214u: | |
3583 if ( v3 == 1 ) | |
3584 v5 += 15; | |
3585 v46 = v3 == 2; | |
3586 goto LABEL_240; | |
3587 case 0x215u: | |
3588 if ( v3 == 5 ) | |
3589 v5 += 15; | |
3590 v46 = v3 == 4; | |
3591 goto LABEL_240; | |
3592 case 0x216u: | |
3593 if ( v3 == 10 ) | |
3594 v5 += 30; | |
3595 if ( !v3 ) | |
3596 v5 += 15; | |
3597 goto LABEL_315; | |
3598 case 0x217u: | |
3599 if ( v3 == 21 ) | |
3600 v61 += 5; | |
3601 if ( !v3 ) | |
3602 v5 += 15; | |
3603 goto LABEL_253; | |
3604 case 0x218u: | |
3605 goto LABEL_253; | |
3606 default: | |
3607 goto LABEL_361; | |
3608 } | |
3609 goto LABEL_361; | |
3610 } | |
3611 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3612 { | |
3613 if ( (signed int)v3 >= 0 ) | |
3614 { | |
3615 if ( (signed int)v3 <= 15 ) | |
3616 { | |
3617 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3618 } | |
3619 else | |
3620 { | |
3621 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3622 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3623 } | |
3624 } | |
3625 goto LABEL_361; | |
3626 } | |
3627 v34 = *(int *)(v63 + 544); | |
3628 if ( v34 > 48 ) | |
3629 { | |
3630 switch ( v34 ) | |
3631 { | |
3632 case 54: | |
3633 goto LABEL_315; | |
3634 case 49: | |
3635 if ( v3 == 6 ) | |
3636 goto LABEL_121; | |
3637 v50 = v3 == 1; | |
3638 goto LABEL_296; | |
3639 case 51: | |
3640 if ( v3 != 5 && v3 != 1 ) | |
3641 goto LABEL_309; | |
3642 goto LABEL_121; | |
3643 case 52: | |
3644 if ( v3 == 3 ) | |
3645 goto LABEL_121; | |
3646 v50 = v3 == 4; | |
3647 goto LABEL_296; | |
3648 case 53: | |
3649 if ( !v3 ) | |
3650 goto LABEL_121; | |
3651 v50 = v3 == 2; | |
3652 goto LABEL_296; | |
3653 case 55: | |
3654 v46 = v3 == 6; | |
3655 goto LABEL_240; | |
3656 case 56: | |
3657 if ( !v3 ) | |
3658 goto LABEL_351; | |
3659 v53 = v3 == 3; | |
3660 goto LABEL_350; | |
3661 case 57: | |
3662 if ( v3 == 1 ) | |
3663 goto LABEL_351; | |
3664 v53 = v3 == 2; | |
3665 goto LABEL_350; | |
3666 case 50: | |
3667 if ( v3 == 10 ) | |
3668 v5 += 30; | |
3669 goto LABEL_361; | |
3670 case 60: | |
3671 if ( v3 != 23 ) | |
3672 goto LABEL_336; | |
3673 if ( v5 >= 3 ) | |
3674 goto LABEL_361; | |
3675 v5 = 3; | |
3676 LABEL_336: | |
3677 v54 = v3 == 22; | |
3678 goto LABEL_345; | |
3679 case 61: | |
3680 if ( v3 != 17 ) | |
3681 goto LABEL_340; | |
3682 if ( v5 >= 3 ) | |
3683 goto LABEL_361; | |
3684 v5 = 3; | |
3685 LABEL_340: | |
3686 v54 = v3 == 18; | |
3687 goto LABEL_345; | |
3688 case 62: | |
3689 if ( v3 != 19 ) | |
3690 goto LABEL_344; | |
3691 if ( v5 >= 3 ) | |
3692 goto LABEL_361; | |
3693 v5 = 3; | |
3694 LABEL_344: | |
3695 v54 = v3 == 20; | |
3696 LABEL_345: | |
3697 if ( !v54 ) | |
3698 goto LABEL_361; | |
3699 if ( v5 >= 3 ) | |
3700 goto LABEL_361; | |
3701 v60 = 3; | |
3702 goto LABEL_360; | |
3703 case 67: | |
3704 v55 = v3 == 18; | |
3705 goto LABEL_357; | |
3706 case 68: | |
3707 v53 = v3 == 9; | |
3708 goto LABEL_350; | |
3709 case 69: | |
3710 if ( v3 == 11 ) | |
3711 v5 += 20; | |
3712 break; | |
3713 case 70: | |
3714 if ( v3 == 12 ) | |
3715 v5 += 10; | |
3716 v55 = v3 == 16; | |
3717 LABEL_357: | |
3718 if ( v55 && v5 < 2 ) | |
3719 { | |
3720 v60 = 2; | |
3721 LABEL_360: | |
3722 v5 = v60; | |
3723 } | |
3724 break; | |
3725 default: | |
3726 goto LABEL_361; | |
3727 } | |
3728 goto LABEL_361; | |
3729 } | |
3730 if ( v34 == 48 ) | |
3731 { | |
3732 if ( v3 == 9 ) | |
3733 v5 += 5; | |
3734 LABEL_315: | |
3735 v46 = v3 == 3; | |
3736 LABEL_240: | |
3737 if ( v46 ) | |
3738 v5 += 15; | |
3739 goto LABEL_361; | |
3740 } | |
3741 if ( v34 > 32 ) | |
3742 { | |
3743 if ( v34 > 44 ) | |
3744 { | |
3745 v51 = v34 - 45; | |
3746 if ( !v51 ) | |
3747 { | |
3748 if ( v3 == 5 ) | |
3749 goto LABEL_351; | |
3750 v53 = v3 == 4; | |
3751 LABEL_350: | |
3752 if ( v53 ) | |
3753 LABEL_351: | |
3754 v5 += 5; | |
3755 goto LABEL_361; | |
3756 } | |
3757 v52 = v51 - 1; | |
3758 if ( !v52 ) | |
3759 { | |
3760 v40 = v3 == 0; | |
3761 LABEL_123: | |
3762 if ( v40 ) | |
3763 v5 += 25; | |
3764 goto LABEL_361; | |
3765 } | |
3766 if ( v52 == 1 ) | |
3767 { | |
3768 LABEL_309: | |
3769 v50 = v3 == 8; | |
3770 goto LABEL_296; | |
3771 } | |
3772 } | |
3773 else | |
3774 { | |
3775 if ( v34 == 44 ) | |
3776 { | |
3777 v50 = v3 == 7; | |
3778 goto LABEL_296; | |
3779 } | |
3780 v34 -= 33; | |
3781 if ( !v34 ) | |
3782 { | |
3783 if ( v3 != 38 ) | |
3784 goto LABEL_361; | |
3785 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3786 goto LABEL_138; | |
3787 } | |
3788 --v34; | |
3789 if ( !v34 ) | |
3790 { | |
3791 if ( v3 != 36 ) | |
3792 goto LABEL_361; | |
3793 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3794 goto LABEL_138; | |
3795 } | |
3796 v49 = v34 - 8; | |
3797 if ( !v49 ) | |
3798 { | |
3799 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3800 ++v5; | |
3801 goto LABEL_361; | |
3802 } | |
3803 if ( v49 == 1 ) | |
3804 { | |
3805 if ( v3 != 3 && v3 != 7 ) | |
3806 { | |
3807 v50 = v3 == 9; | |
3808 LABEL_296: | |
3809 if ( !v50 ) | |
3810 goto LABEL_361; | |
3811 } | |
3812 LABEL_121: | |
3813 v5 += 10; | |
3814 goto LABEL_361; | |
3815 } | |
3816 } | |
3817 } | |
3818 else | |
3819 { | |
3820 if ( v34 == 32 ) | |
3821 { | |
3822 if ( v3 != 39 ) | |
3823 goto LABEL_361; | |
3824 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3825 goto LABEL_138; | |
3826 } | |
3827 if ( v34 > 28 ) | |
3828 { | |
3829 v34 -= 29; | |
3830 if ( v34 ) | |
3831 { | |
3832 --v34; | |
3833 if ( v34 ) | |
3834 { | |
3835 --v34; | |
3836 if ( v34 || v3 != 41 ) | |
3837 goto LABEL_361; | |
3838 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3839 } | |
3840 else | |
3841 { | |
3842 if ( v3 != 34 ) | |
3843 goto LABEL_361; | |
3844 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3845 } | |
3846 } | |
3847 else | |
3848 { | |
3849 if ( v3 != 37 ) | |
3850 goto LABEL_361; | |
3851 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3852 } | |
3853 goto LABEL_138; | |
3854 } | |
3855 if ( v34 == 28 ) | |
3856 { | |
3857 LABEL_136: | |
3858 if ( v3 == 42 ) | |
3859 { | |
3860 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3861 LABEL_138: | |
3862 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3863 goto LABEL_361; | |
3864 } | |
3865 } | |
3866 else | |
3867 { | |
3868 v47 = v34 - 1; | |
3869 if ( v47 ) | |
3870 { | |
3871 v48 = v47 - 1; | |
3872 if ( v48 ) | |
3873 { | |
3874 v34 = v48 - 24; | |
3875 if ( v34 ) | |
3876 { | |
3877 --v34; | |
3878 if ( v34 || v3 != 40 ) | |
3879 goto LABEL_361; | |
3880 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3881 } | |
3882 else | |
3883 { | |
3884 if ( v3 != 35 ) | |
3885 goto LABEL_361; | |
3886 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3887 } | |
3888 goto LABEL_138; | |
3889 } | |
3890 LABEL_118: | |
3891 if ( (signed int)v3 < 0 ) | |
3892 goto LABEL_361; | |
3893 v39 = __OFSUB__((int)v3, 6); | |
3894 v37 = v3 == 6; | |
3895 v38 = v3 - 6 < 0; | |
3896 } | |
3897 else | |
3898 { | |
3899 LABEL_253: | |
3900 if ( (signed int)v3 < 10 ) | |
3901 goto LABEL_361; | |
3902 v39 = __OFSUB__((int)v3, 15); | |
3903 v37 = v3 == 15; | |
3904 v38 = v3 - 15 < 0; | |
3905 } | |
3906 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3907 goto LABEL_121; | |
3908 } | |
3909 } | |
3910 LABEL_361: | |
3911 ++v65; | |
3912 if ( (signed int)v65 >= 16 ) | |
3913 return v5 + v62 + v61; | |
3914 } | |
3915 } | |
1040 | 3916 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 3917 { |
3918 if ( IsUnarmed() != 1 ) | |
3919 { | |
816 | 3920 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3921 { | |
3922 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3923 if ( v22 >= 0 ) |
3924 { | |
3925 if ( v22 <= 2 ) | |
3926 { | |
1040 | 3927 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 3928 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 3929 { |
3930 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
3931 v25 = pItemsTable->pItems[v23].uDamageDice; | |
3932 } | |
3933 else | |
3934 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3935 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3936 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 3937 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3938 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 3939 } |
3940 } | |
3941 } | |
1040 | 3942 |
3943 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
3944 { | |
3945 | |
3946 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
3947 if ((v28 < 0) || v28 > 2 ) | |
3948 return v5 + v62 + v61; | |
3949 } | |
1062 | 3950 v15 = pItemsTable->pItems[v23].uDamageMod; |
3951 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 3952 v5 += v15 + v14; |
1049 | 3953 return v5 + v62 + v61; |
0 | 3954 } |
3955 v59 = 3; | |
3956 LABEL_74: | |
3957 v5 = v59; | |
3958 return v5 + v62 + v61; | |
3959 } | |
3960 if ( (signed int)attr < 0 ) | |
3961 return v5 + v62 + v61; | |
1040 | 3962 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 3963 goto LABEL_95; |
1040 | 3964 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
3965 { | |
3966 if ( !Player::HasEnchantedItemEquipped(25) ) | |
3967 return v5 + v62 + v61; | |
3968 v5 = 5; | |
3969 return v5 + v62 + v61; | |
3970 } | |
3971 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 3972 return v5 + v62 + v61; |
1040 | 3973 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 3974 { |
3975 if ( IsUnarmed() == 1 ) | |
3976 { | |
3977 v5 = 0; | |
3978 return v5 + v62 + v61; | |
3979 } | |
816 | 3980 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3981 { | |
3982 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3983 if ( v17 >= 0 ) |
3984 { | |
3985 if ( v17 <= 2 ) | |
1040 | 3986 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 3987 } |
3988 } | |
865 | 3989 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 3990 return v5 + v62 + v61; |
1040 | 3991 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
3992 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3993 v5 += v56; | |
3994 return v5 + v62 + v61; | |
3995 } | |
3996 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 3997 { |
3998 if ( IsUnarmed() == 1 ) | |
3999 { | |
4000 v5 = 1; | |
4001 return v5 + v62 + v61; | |
4002 } | |
816 | 4003 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4004 { | |
4005 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4006 if ( v9 >= 0 ) |
4007 { | |
4008 if ( v9 <= 2 ) | |
4009 { | |
1040 | 4010 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4011 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4012 if ( !v6->pEquipment.uShield ) |
0 | 4013 { |
1040 | 4014 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4015 ++v5; |
4016 } | |
4017 } | |
4018 } | |
4019 } | |
1040 | 4020 |
4021 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4022 { | |
4023 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4024 if ((v12 < 0) || v12 > 2 ) | |
4025 return v5 + v62 + v61; | |
4026 } | |
4027 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4028 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4029 LABEL_88: |
4030 v5 += v15 + v14; | |
4031 } | |
4032 return v5 + v62 + v61; | |
4033 } | |
4034 | |
4035 //----- (0048F73C) -------------------------------------------------------- | |
4036 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4037 { | |
4038 int result; // eax@1 | |
4039 int v3; // eax@4 | |
4040 int v4; // ecx@5 | |
4041 | |
4042 switch (a2) | |
4043 { | |
4044 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4045 } | |
4046 | |
4047 result = 0; | |
4048 if ( (signed int)a2 > 10 ) | |
4049 { | |
4050 if ( (signed int)a2 <= 15 ) | |
4051 { | |
4052 switch ( a2 ) | |
4053 { | |
4054 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4055 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4056 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4057 break; |
4058 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4059 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4060 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4061 break; |
4062 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4063 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4064 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4065 break; |
4066 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4067 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4068 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4069 break; |
4070 default: | |
4071 if ( a2 != 14 ) | |
4072 return result; | |
4073 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4074 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4075 break; |
4076 } | |
4077 return v4 + v3; | |
4078 } | |
4079 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4080 { | |
4081 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4082 { | |
4083 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4084 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4085 return v4 + v3; |
4086 } | |
4087 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4088 return result; | |
4089 } | |
4090 return this->pPlayerBuffs[1].uPower; | |
4091 } | |
4092 if ( a2 == 10 ) | |
4093 { | |
4094 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4095 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4096 return v4 + v3; |
4097 } | |
4098 switch ( a2 ) | |
4099 { | |
4100 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4101 v3 = pPlayerBuffs[19].uPower; | |
4102 goto LABEL_5; | |
4103 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4104 v3 = pPlayerBuffs[17].uPower; | |
4105 goto LABEL_5; | |
4106 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4107 v3 = pPlayerBuffs[20].uPower; | |
4108 goto LABEL_5; | |
4109 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4110 v3 = pPlayerBuffs[16].uPower; | |
4111 goto LABEL_5; | |
4112 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4113 v3 = pPlayerBuffs[15].uPower; | |
4114 goto LABEL_5; | |
4115 case CHARACTER_ATTRIBUTE_SPEED: | |
4116 v3 = pPlayerBuffs[21].uPower; | |
4117 goto LABEL_5; | |
4118 case CHARACTER_ATTRIBUTE_LUCK: | |
4119 v3 = pPlayerBuffs[18].uPower; | |
4120 LABEL_5: | |
1167 | 4121 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4122 return v4 + v3; |
4123 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4124 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4125 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4126 return v4 + v3; |
4127 default: | |
4128 return result; | |
4129 } | |
4130 return result; | |
4131 } | |
4132 | |
4133 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4134 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4135 { | |
1064 | 4136 signed int bonus_value; // esi@1 |
4137 unsigned __int16 skill_value; // ax@126 | |
4138 int result; // al@127 | |
353 | 4139 |
1064 | 4140 bonus_value = 0; |
353 | 4141 switch (uSkillType) |
4142 { | |
4143 case PLAYER_SKILL_MONSTER_ID: | |
4144 { | |
652 | 4145 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4146 bonus_value = 6; |
652 | 4147 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4148 bonus_value += 6; |
4149 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4150 } |
4151 break; | |
4152 | |
4153 case PLAYER_SKILL_ARMSMASTER: | |
4154 { | |
652 | 4155 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4156 bonus_value = 2; |
652 | 4157 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4158 bonus_value += 3; |
4159 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4160 } |
4161 break; | |
4162 | |
4163 case PLAYER_SKILL_STEALING: | |
4164 { | |
652 | 4165 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4166 bonus_value = 8; |
4167 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4168 } |
4169 break; | |
4170 | |
4171 | |
4172 case PLAYER_SKILL_ALCHEMY: | |
4173 { | |
652 | 4174 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4175 bonus_value = 4; |
652 | 4176 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4177 bonus_value += 8; |
4178 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4179 } |
4180 break; | |
4181 | |
4182 case PLAYER_SKILL_LEARNING: | |
4183 { | |
652 | 4184 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4185 bonus_value = 10; |
652 | 4186 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4187 bonus_value += 15; |
652 | 4188 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4189 bonus_value += 5; |
4190 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4191 } |
4192 break; | |
4193 | |
4194 case PLAYER_SKILL_UNARMED: | |
4195 { | |
652 | 4196 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4197 bonus_value = 2; |
4198 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4199 } |
4200 break; | |
4201 | |
4202 case PLAYER_SKILL_DODGE: | |
4203 { | |
652 | 4204 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4205 bonus_value = 2; |
4206 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4207 } |
4208 break; | |
4209 | |
4210 case PLAYER_SKILL_BOW: | |
1064 | 4211 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4212 break; |
4213 case PLAYER_SKILL_SHIELD: | |
1064 | 4214 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4215 break; |
4216 | |
4217 case PLAYER_SKILL_EARTH: | |
652 | 4218 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4219 bonus_value = 2; |
652 | 4220 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4221 bonus_value += 3; |
652 | 4222 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4223 bonus_value += 4; |
353 | 4224 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4225 bonus_value += 3; |
4226 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4227 break; |
4228 case PLAYER_SKILL_FIRE: | |
652 | 4229 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4230 bonus_value = 2; |
652 | 4231 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4232 bonus_value += 3; |
652 | 4233 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4234 bonus_value += 4; |
353 | 4235 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4236 bonus_value += 3; |
4237 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4238 break; |
4239 case PLAYER_SKILL_AIR: | |
652 | 4240 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4241 bonus_value = 2; |
652 | 4242 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4243 bonus_value += 3; |
652 | 4244 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4245 bonus_value += 4; |
353 | 4246 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4247 bonus_value += 3; |
4248 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4249 break; |
4250 case PLAYER_SKILL_WATER: | |
652 | 4251 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4252 bonus_value = 2; |
652 | 4253 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4254 bonus_value += 3; |
652 | 4255 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4256 bonus_value += 4; |
353 | 4257 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4258 bonus_value += 3; |
4259 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4260 break; |
4261 case PLAYER_SKILL_SPIRIT: | |
652 | 4262 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4263 bonus_value = 2; |
652 | 4264 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4265 bonus_value += 3; |
652 | 4266 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4267 bonus_value += 4; |
4268 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4269 break; |
4270 case PLAYER_SKILL_MIND: | |
652 | 4271 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4272 bonus_value = 2; |
652 | 4273 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4274 bonus_value += 3; |
652 | 4275 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4276 bonus_value += 4; |
4277 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4278 break; |
4279 case PLAYER_SKILL_BODY: | |
652 | 4280 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4281 bonus_value = 2; |
652 | 4282 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4283 bonus_value += 3; |
652 | 4284 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4285 bonus_value += 4; |
4286 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4287 break; |
4288 case PLAYER_SKILL_LIGHT: | |
1064 | 4289 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4290 break; |
4291 case PLAYER_SKILL_DARK: | |
4292 { | |
1064 | 4293 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4294 } |
4295 break; | |
4296 | |
4297 case PLAYER_SKILL_MERCHANT: | |
4298 { | |
652 | 4299 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4300 bonus_value = 4; |
652 | 4301 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4302 bonus_value += 6; |
652 | 4303 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4304 bonus_value += 3; |
652 | 4305 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4306 bonus_value += 8; |
353 | 4307 } |
4308 break; | |
4309 | |
4310 case PLAYER_SKILL_PERCEPTION: | |
4311 { | |
652 | 4312 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4313 bonus_value = 6; |
652 | 4314 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4315 bonus_value += 5; |
353 | 4316 } |
4317 break; | |
4318 | |
0 | 4319 case PLAYER_SKILL_ITEM_ID: |
1064 | 4320 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4321 break; |
4322 case PLAYER_SKILL_MEDITATION: | |
1064 | 4323 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4324 break; |
0 | 4325 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4326 { |
652 | 4327 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4328 bonus_value = 4; |
652 | 4329 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4330 bonus_value += 6; |
652 | 4331 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4332 bonus_value += 8; |
4333 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4334 } |
4335 break; | |
4336 } | |
4337 | |
1064 | 4338 skill_value = pActiveSkills[uSkillType]; |
4339 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4340 result = bonus_value + skill_value; | |
0 | 4341 else |
1064 | 4342 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4343 return result; |
4344 } | |
4345 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4346 |
0 | 4347 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4348 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
|
4349 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4350 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4351 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4352 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4353 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
|
4354 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
|
4355 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4356 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4357 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
|
4358 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4359 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
|
4360 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4361 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
|
4362 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4363 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4364 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4365 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
|
4366 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4367 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4368 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4369 { |
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
|
4370 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
|
4371 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
|
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 bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4374 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
|
4375 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
|
4376 } |
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
|
4377 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
|
4378 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4379 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
|
4380 { |
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 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
|
4382 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
|
4383 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
|
4384 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4385 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4386 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
|
4387 { |
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 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
|
4389 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
|
4390 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
|
4391 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4392 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4393 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
|
4394 { |
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
|
4395 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
|
4396 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
|
4397 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
|
4398 |
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 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
|
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 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) |
1538 | 4402 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4403 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
|
4404 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
|
4405 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
|
4406 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
|
4407 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
|
4408 { |
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 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4410 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
|
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_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
|
4413 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4414 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
|
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_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
|
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, 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
|
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_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
|
4421 wearingLeather = 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, 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
|
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 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
|
4425 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4426 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
|
4427 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
|
4428 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
|
4429 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4430 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
|
4431 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
|
4432 } |
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 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4434 } |
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
|
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 |
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 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
|
4438 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4439 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
|
4440 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
|
4441 { |
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
|
4442 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
|
4443 } |
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
|
4444 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
|
4445 } |
1538 | 4446 break; |
4447 case CHARACTER_ATTRIBUTE_ATTACK: | |
4448 if ( this->IsUnarmed() ) | |
4449 { | |
4450 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4451 if (!unarmedSkill) | |
4452 { | |
4453 return 0; | |
4454 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4455 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4456 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4457 } | |
4458 for (int i = 0; i < 16; ++i) | |
4459 { | |
4460 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4461 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4462 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4463 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4464 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4465 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4466 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4467 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4468 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4469 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4470 return multiplier * (currentItemSkillLevel & 0x3F); |
4471 } | |
4472 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4473 { | |
4474 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
|
4475 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4476 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4477 } | |
4478 else | |
4479 { | |
4480 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4481 } | |
4482 } | |
4483 } | |
4484 } | |
4485 return 0; | |
4486 break; | |
4487 | |
4488 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4489 for (int i = 0; i < 16; i++) | |
4490 { | |
4491 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4492 { | |
4493 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4494 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4495 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4496 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4497 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4498 return multiplier * (currentItemSkillLevel & 0x3F); |
4499 } | |
4500 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4501 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4502 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4503 return multiplier * (currentItemSkillLevel & 0x3F); |
4504 } | |
4505 } | |
4506 } | |
4507 return 0; | |
4508 break; | |
4509 | |
4510 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4511 if ( this->IsUnarmed() ) | |
4512 { | |
4513 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4514 if ( !unarmedSkillLevel ) | |
4515 { | |
4516 return 0; | |
4517 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4518 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4519 return multiplier * (unarmedSkillLevel & 0x3F); |
4520 } | |
4521 for (int i = 0; i < 16; i++) | |
4522 { | |
4523 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4524 { | |
4525 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4526 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4527 { | |
4528 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4529 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4530 int baseSkillBonus; | |
4531 int multiplier; | |
4532 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4533 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4534 case PLAYER_SKILL_STAFF: |
1538 | 4535 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
|
4536 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4537 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
|
4538 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4539 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
|
4540 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4541 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4542 { |
1538 | 4543 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4544 } |
1538 | 4545 break; |
4546 | |
4547 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4548 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4549 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4550 return armsMasterBonus + baseSkillBonus; | |
4551 break; | |
4552 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4553 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4554 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4555 return armsMasterBonus + baseSkillBonus; | |
4556 break; | |
4557 case PLAYER_SKILL_MACE: | |
4558 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4559 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4560 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4561 return armsMasterBonus + baseSkillBonus; | |
4562 break; | |
4563 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4564 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4565 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4566 return armsMasterBonus + baseSkillBonus; | |
4567 break; | |
1535 | 4568 } |
1533 | 4569 } |
1535 | 4570 } |
1538 | 4571 } |
4572 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4573 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4574 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4575 return 0; |
1533 | 4576 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4577 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4578 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4579 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
|
4580 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4581 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
|
4582 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4583 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4584 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
|
4585 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
|
4586 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
|
4587 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
|
4588 } |
1545 | 4589 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
|
4590 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4591 } |
0 | 4592 //----- (00490109) -------------------------------------------------------- |
4593 // faces are: 0 1 2 3 human males | |
4594 // 4 5 6 7 human females | |
4595 // 8 9 elf males | |
4596 // 10 11 elf females | |
4597 // 12 13 dwarf males | |
4598 // 14 15 dwarf females | |
4599 // 16 17 goblin males | |
4600 // 18 19 goblin females | |
4601 // 20 lich male | |
4602 // 21 lich female | |
4603 // 22 underwater suits (unused) | |
4604 // 23 zombie male | |
4605 // 24 zombie female | |
4606 enum CHARACTER_RACE Player::GetRace() | |
4607 { | |
1014 | 4608 if ( uCurrentFace > 15 ) |
4609 { | |
4610 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4611 return CHARACTER_RACE_GOBLIN; |
4612 } | |
4613 else | |
4614 { | |
1014 | 4615 if ( uCurrentFace >= 12 ) |
0 | 4616 { |
4617 return CHARACTER_RACE_DWARF; | |
4618 } | |
4619 else | |
4620 { | |
1014 | 4621 |
4622 if ( uCurrentFace <= 7 ) | |
0 | 4623 { |
4624 return CHARACTER_RACE_HUMAN; | |
4625 } | |
4626 else | |
4627 { | |
1014 | 4628 if ( uCurrentFace <= 11 ) |
0 | 4629 return CHARACTER_RACE_ELF; |
4630 } | |
4631 } | |
4632 } | |
4633 return CHARACTER_RACE_HUMAN; | |
4634 } | |
4635 | |
4636 //----- (00490141) -------------------------------------------------------- | |
187 | 4637 PLAYER_SEX Player::GetSexByVoice() |
0 | 4638 { |
4639 signed int result; // eax@1 | |
4640 | |
4641 result = 0; | |
4642 switch ( this->uVoiceID ) | |
4643 { | |
4644 case 0u: | |
4645 case 1u: | |
4646 case 2u: | |
4647 case 3u: | |
4648 case 8u: | |
4649 case 9u: | |
4650 case 0xCu: | |
4651 case 0xDu: | |
4652 case 0x10u: | |
4653 case 0x11u: | |
4654 case 0x14u: | |
4655 case 0x17u: | |
187 | 4656 return SEX_MALE; |
4657 | |
0 | 4658 case 4u: |
4659 case 5u: | |
4660 case 6u: | |
4661 case 7u: | |
4662 case 0xAu: | |
4663 case 0xBu: | |
4664 case 0xEu: | |
4665 case 0xFu: | |
4666 case 0x12u: | |
4667 case 0x13u: | |
4668 case 0x15u: | |
4669 case 0x18u: | |
187 | 4670 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4671 } |
1545 | 4672 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4673 return SEX_MALE; |
0 | 4674 } |
4675 | |
4676 //----- (00490188) -------------------------------------------------------- | |
4677 void Player::SetInitialStats() | |
4678 { | |
4679 auto v1 = GetRace(); | |
290 | 4680 uMight = StatTable[v1][0].uBaseValue; |
4681 uIntelligence = StatTable[v1][1].uBaseValue; | |
4682 uWillpower = StatTable[v1][2].uBaseValue; | |
4683 uEndurance = StatTable[v1][3].uBaseValue; | |
4684 uAccuracy = StatTable[v1][4].uBaseValue; | |
4685 uSpeed = StatTable[v1][5].uBaseValue; | |
4686 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4687 } |
4688 | |
4689 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4690 void Player::SetSexByVoice() |
4691 { | |
4692 switch ( this->uVoiceID) | |
0 | 4693 { |
4694 case 0: | |
4695 case 1: | |
4696 case 2: | |
4697 case 3: | |
4698 case 8: | |
4699 case 9: | |
4700 case 0xC: | |
4701 case 0xD: | |
4702 case 0x10: | |
4703 case 0x11: | |
4704 case 0x14: | |
4705 case 0x17: | |
1021 | 4706 this->uSex = SEX_MALE; |
0 | 4707 break; |
4708 case 4: | |
4709 case 5: | |
4710 case 6: | |
4711 case 7: | |
4712 case 0xA: | |
4713 case 0xB: | |
4714 case 0xE: | |
4715 case 0xF: | |
4716 case 0x12: | |
4717 case 0x13: | |
4718 case 0x15: | |
4719 case 0x18: | |
1021 | 4720 this->uSex = SEX_FEMALE; |
0 | 4721 break; |
4722 default: | |
4723 break; | |
4724 } | |
1021 | 4725 |
0 | 4726 } |
4727 | |
4728 //----- (0049024A) -------------------------------------------------------- | |
135 | 4729 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4730 { |
4731 sLevelModifier = 0; | |
4732 sAgeModifier = 0; | |
4733 | |
135 | 4734 classType = cls; |
0 | 4735 uLuckBonus = 0; |
4736 uSpeedBonus = 0; | |
4737 uAccuracyBonus = 0; | |
4738 uEnduranceBonus = 0; | |
4739 uWillpowerBonus = 0; | |
4740 uIntelligenceBonus = 0; | |
4741 uMightBonus = 0; | |
4742 uLevel = 1; | |
4743 uExperience = 251 + rand() % 100; | |
4744 uBirthYear = 1147 - rand() % 6; | |
4745 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4746 memset(_achieved_awards_bits, 0, 64); |
0 | 4747 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4748 | |
4749 for (uint i = 0; i < 37; ++i) | |
4750 { | |
135 | 4751 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4752 continue; |
4753 | |
4754 pActiveSkills[i] = 1; | |
4755 | |
4756 switch (i) | |
4757 { | |
886 | 4758 case PLAYER_SKILL_FIRE: |
4759 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4760 |
4761 extern bool all_magic; | |
4762 if ( all_magic == true ) | |
4763 { | |
4764 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4765 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4766 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4767 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4768 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4769 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4770 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4771 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4772 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4773 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4774 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4775 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4776 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4777 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4778 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4779 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4780 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4781 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4782 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4783 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4784 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4785 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4786 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4787 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4788 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4789 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4790 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4791 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4792 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4793 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4794 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4795 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4796 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4797 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4798 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4799 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4800 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4801 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4802 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4803 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4804 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4805 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4806 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4807 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4808 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4809 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4810 } | |
486 | 4811 break; |
886 | 4812 case PLAYER_SKILL_AIR: |
4813 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4814 break; | |
4815 case PLAYER_SKILL_WATER: | |
4816 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4817 break; | |
4818 case PLAYER_SKILL_EARTH: | |
4819 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4820 break; | |
4821 case PLAYER_SKILL_SPIRIT: | |
4822 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4823 break; | |
4824 case PLAYER_SKILL_MIND: | |
4825 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4826 break; | |
4827 case PLAYER_SKILL_BODY: | |
4828 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4829 |
4830 if ( all_magic == true ) | |
4831 { | |
4832 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4833 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4834 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4835 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4836 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4837 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4838 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4839 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4840 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4841 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4842 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4843 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4844 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4845 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4846 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4847 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4848 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4849 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4850 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4851 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4852 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4853 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4854 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4855 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4856 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4857 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4858 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4859 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4860 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4861 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4862 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4863 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4864 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4865 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4866 } | |
569 | 4867 break; |
886 | 4868 case PLAYER_SKILL_LIGHT: |
4869 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4870 break; | |
4871 case PLAYER_SKILL_DARK: | |
4872 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4873 break; | |
0 | 4874 } |
4875 } | |
4876 | |
4877 sHealth = GetMaxHealth(); | |
4878 sMana = GetMaxMana(); | |
4879 } | |
4880 | |
4881 //----- (004903C9) -------------------------------------------------------- | |
821 | 4882 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4883 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4884 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4885 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4886 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4887 signed int offset; |
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 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4890 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4891 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4892 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4893 offset = 0; |
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 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4896 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4897 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4898 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4899 offset = 2; |
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 else if ( order <= 12 ) |
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 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4904 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4905 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4906 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4907 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4908 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4909 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4910 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4911 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4912 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4913 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4914 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4915 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4916 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4917 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4918 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4919 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4920 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4921 |
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
|
4922 return (PLAYER_SKILL_TYPE)37; |
0 | 4923 } |
4924 | |
4925 | |
4926 | |
4927 //----- (0049048D) -------------------------------------------------------- | |
4928 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
4929 void Player::DecreaseAttribute(int eAttribute) | |
4930 { | |
4931 int v2; // eax@1 | |
4932 int pBaseValue; // ecx@1 | |
4933 int pDroppedStep; // ebx@1 | |
4934 int pStep; // esi@1 | |
4935 unsigned __int16 result; // ax@7 | |
4936 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
4937 | |
4938 v2 = eAttribute + 7 * GetRace(); | |
290 | 4939 pBaseValue = StatTable[0][v2].uBaseValue; |
4940 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 4941 uMinValue = pBaseValue - 2; |
290 | 4942 pStep = StatTable[0][v2].uBaseStep; |
1272 | 4943 unsigned short* AttrToChange = nullptr; |
4944 switch ( eAttribute ) | |
4945 { | |
4946 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4947 AttrToChange = &this->uMight; | |
4948 break; | |
4949 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4950 AttrToChange = &this->uIntelligence; | |
4951 break; | |
4952 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4953 AttrToChange = &this->uWillpower; | |
4954 break; | |
4955 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4956 AttrToChange = &this->uEndurance; | |
4957 break; | |
4958 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4959 AttrToChange = &this->uAccuracy; | |
4960 break; | |
4961 case CHARACTER_ATTRIBUTE_SPEED: | |
4962 AttrToChange = &this->uSpeed; | |
4963 break; | |
4964 case CHARACTER_ATTRIBUTE_LUCK: | |
4965 AttrToChange = &this->uLuck; | |
4966 break; | |
4967 } | |
4968 if ( *AttrToChange <= pBaseValue ) | |
4969 pStep = pDroppedStep; | |
4970 if ( *AttrToChange - pStep >= uMinValue ) | |
4971 *AttrToChange -= pStep; | |
0 | 4972 } |
4973 | |
4974 //----- (004905F5) -------------------------------------------------------- | |
1458 | 4975 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 4976 void Player::IncreaseAttribute( int eAttribute ) |
4977 { | |
4978 int raceId; // eax@1 | |
4979 int maxValue; // ebx@1 | |
4980 signed int baseStep; // edi@1 | |
4981 signed int tmp; // eax@17 | |
0 | 4982 signed int result; // eax@18 |
1273 | 4983 int baseValue; // [sp+Ch] [bp-8h]@1 |
4984 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
4985 unsigned short* statToChange; | |
4986 | |
4987 raceId = GetRace(); | |
4988 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
4989 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
4990 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
4991 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
4992 PlayerCreation_GetUnspentAttributePointCount(); | |
4993 switch ( eAttribute ) | |
4994 { | |
4995 case 0: | |
4996 statToChange = &this->uMight; | |
4997 break; | |
4998 case 1: | |
4999 statToChange = &this->uIntelligence; | |
5000 break; | |
5001 case 2: | |
5002 statToChange = &this->uWillpower; | |
5003 break; | |
5004 case 3: | |
5005 statToChange = &this->uEndurance; | |
5006 break; | |
5007 case 4: | |
5008 statToChange = &this->uAccuracy; | |
5009 break; | |
5010 case 5: | |
5011 statToChange = &this->uSpeed; | |
5012 break; | |
5013 case 6: | |
5014 statToChange = &this->uLuck; | |
5015 default: | |
1545 | 5016 Error("(%u)", eAttribute); |
1273 | 5017 } |
5018 if ( *statToChange < baseValue ) | |
5019 { | |
5020 tmp = baseStep; | |
5021 baseStep = droppedStep; | |
5022 droppedStep = tmp; | |
5023 } | |
5024 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5025 if ( result >= droppedStep ) | |
5026 { | |
5027 if ( baseStep + *statToChange <= maxValue ) | |
5028 *statToChange += baseStep; | |
5029 } | |
0 | 5030 } |
5031 | |
5032 //----- (0049070F) -------------------------------------------------------- | |
5033 void Player::Zero() | |
5034 { | |
5035 this->sLevelModifier = 0; | |
5036 this->sACModifier = 0; | |
5037 this->uLuckBonus = 0; | |
5038 this->uAccuracyBonus = 0; | |
5039 this->uSpeedBonus = 0; | |
5040 this->uEnduranceBonus = 0; | |
5041 this->uWillpowerBonus = 0; | |
5042 this->uIntelligenceBonus = 0; | |
5043 this->uMightBonus = 0; | |
5044 this->field_100 = 0; | |
5045 this->field_FC = 0; | |
5046 this->field_F8 = 0; | |
5047 this->field_F4 = 0; | |
5048 this->field_F0 = 0; | |
5049 this->field_EC = 0; | |
5050 this->field_E8 = 0; | |
5051 this->field_E4 = 0; | |
5052 this->field_E0 = 0; | |
766 | 5053 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5054 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5055 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5056 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5057 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5058 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5059 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5060 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5061 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5062 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5063 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5064 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5065 this->uFullHealthBonus = 0; |
0 | 5066 } |
5067 | |
5068 //----- (004907E7) -------------------------------------------------------- | |
299 | 5069 unsigned int Player::GetStatColor(int uStat) |
0 | 5070 { |
290 | 5071 int attribute_value; // edx@1 |
1393 | 5072 |
5073 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5074 switch (uStat) |
5075 { | |
5076 case 0: attribute_value = uMight; break; | |
5077 case 1: attribute_value = uIntelligence; break; | |
5078 case 2: attribute_value = uWillpower; break; | |
5079 case 3: attribute_value = uEndurance; break; | |
290 | 5080 case 4: attribute_value = uAccuracy; break; |
5081 case 5: attribute_value = uSpeed; break; | |
0 | 5082 case 6: attribute_value = uLuck; break; |
5083 }; | |
5084 | |
1393 | 5085 if (attribute_value == base_attribute_value) |
5086 return ui_character_stat_default_color; | |
5087 else if (attribute_value > base_attribute_value) | |
5088 return ui_character_stat_buffed_color; | |
0 | 5089 else |
1393 | 5090 return ui_character_stat_debuffed_color; |
0 | 5091 } |
5092 | |
5093 //----- (004908A8) -------------------------------------------------------- | |
5094 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5095 { | |
1014 | 5096 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5097 { | |
1393 | 5098 pConditions[uCondition] = 0i64; |
1014 | 5099 return true; |
0 | 5100 } |
5101 else | |
1014 | 5102 return false; |
0 | 5103 } |
5104 | |
5105 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5106 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5107 { |
5108 Player *v3; // esi@1 | |
5109 signed int v5; // eax@17 | |
5110 int v8; // edx@39 | |
5111 char *v13; // eax@45 | |
5112 signed int v15; // edi@68 | |
5113 int v16; // edx@73 | |
5114 unsigned __int16 v17; // edi@73 | |
5115 unsigned int v18; // eax@73 | |
5116 const char *v22; // eax@84 | |
5117 int scroll_id; // esi@96 | |
5118 int v25; // eax@109 | |
5119 int v26; // eax@113 | |
5120 int new_mana_val; // edi@114 | |
5121 signed __int64 v28; // qax@120 | |
5122 __int64 v30; // edi@137 | |
5123 __int64 v32; // ST3C_4@137 | |
5124 __int64 v34; // ST34_4@137 | |
5125 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5126 const char *v66; // [sp-4h] [bp-30h]@69 | |
5127 signed int v67; // [sp-4h] [bp-30h]@77 | |
5128 const char *v68; // [sp-4h] [bp-30h]@89 | |
5129 char v72; // [sp+20h] [bp-Ch]@68 | |
5130 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5131 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5132 Player *thisb; // [sp+28h] [bp-4h]@1 |
5133 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5134 | |
5135 thisb = this; | |
5136 v3 = &pParty->pPlayers[player_num-1]; | |
5137 v73 = 1; | |
1340 | 5138 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5139 return; |
5140 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5141 { |
1021 | 5142 if ( pParty->pPickedItem.uItemID == 160 ) |
5143 { | |
5144 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5145 } | |
5146 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5147 { |
1021 | 5148 new_mana_val = v3->sMana; |
5149 new_mana_val += 2; | |
5150 if ( new_mana_val > v3->GetMaxMana() ) | |
5151 new_mana_val = v3->GetMaxMana(); | |
5152 v3->PlaySound(SPEECH_36, 0); | |
5153 } | |
5154 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5155 { | |
5156 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5157 v3->PlaySound(SPEECH_36, 0); |
1021 | 5158 |
5159 } | |
5160 else | |
5161 { | |
5162 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5163 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
|
5164 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5165 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5166 return; | |
1019 | 5167 } |
1032 | 5168 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5169 | |
5170 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5171 { | |
5172 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5173 } | |
5174 if ( v73 ) | |
5175 { | |
5176 if ( pParty->bTurnBasedModeOn ) | |
5177 { | |
5178 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5179 thisb->SetRecoveryTime(100); | |
1448 | 5180 pTurnEngine->ApplyPlayerAction(); |
1032 | 5181 } |
5182 else | |
5183 { | |
5184 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5185 } | |
5186 } | |
5187 pMouse->RemoveHoldingItem(); | |
5188 return; | |
5189 | |
1021 | 5190 |
5191 } | |
5192 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5193 { |
1021 | 5194 switch ( pParty->pPickedItem.uItemID ) |
5195 { | |
5196 case 221: //Catalyst | |
5197 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5198 break; | |
5199 case 222: //Cure Wounds | |
5200 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5201 pParty->pPlayers[player_num-1].Heal(v25); | |
5202 v3->PlaySound(SPEECH_36, 0); | |
5203 break; | |
5204 case 223: //Magic Potion | |
5205 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5206 new_mana_val = v3->sMana; | |
5207 new_mana_val += v26; | |
5208 if ( new_mana_val > v3->GetMaxMana() ) | |
5209 new_mana_val = v3->GetMaxMana(); | |
5210 v3->PlaySound(SPEECH_36, 0); | |
5211 break; | |
5212 case 224: //Cure Weakness | |
5213 v3->pConditions[Condition_Weak] = 0i64; | |
5214 v3->PlaySound(SPEECH_36, 0); | |
5215 break; | |
5216 case 225: //Cure Disease | |
5217 v3->pConditions[Condition_Disease3] = 0i64; | |
5218 v3->pConditions[Condition_Disease2] = 0i64; | |
5219 v3->pConditions[Condition_Disease1] = 0i64; | |
5220 v3->PlaySound(SPEECH_36, 0); | |
5221 break; | |
5222 case 226: //Cure Poison | |
5223 v3->pConditions[Condition_Poison3] = 0i64; | |
5224 v3->pConditions[Condition_Poison2] = 0i64; | |
5225 v3->pConditions[Condition_Poison1] = 0i64; | |
5226 v3->PlaySound(SPEECH_36, 0); | |
5227 break; | |
5228 case 227: //Awaken | |
5229 v3->pConditions[Condition_Sleep] = 0i64; | |
5230 v3->PlaySound(SPEECH_36, 0); | |
5231 break; | |
5232 case 228: //Haste | |
5233 if ( !v3->pConditions[Condition_Weak] ) | |
5234 { | |
5235 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5236 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5237 v3->PlaySound(SPEECH_36, 0); | |
5238 } | |
5239 break; | |
5240 case 229: //Heroism | |
5241 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5242 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5243 v3->PlaySound(SPEECH_36, 0); | |
5244 break; | |
5245 case 230: //Bless | |
5246 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5247 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5248 v3->PlaySound(SPEECH_36, 0); | |
5249 break; | |
5250 case 231: //Preservation | |
1032 | 5251 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5252 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5253 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5254 v3->PlaySound(SPEECH_36, 0); | |
5255 break; | |
5256 case 232: //Shield | |
1032 | 5257 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5258 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5259 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5260 v3->PlaySound(SPEECH_36, 0); | |
5261 break; | |
5262 case 234: //Stoneskin | |
5263 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5264 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5265 v3->PlaySound(SPEECH_36, 0); | |
5266 break; | |
5267 case 235: //Water Breathing | |
5268 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5269 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5270 break; | |
5271 case 237: //Remove Fear | |
5272 v3->pConditions[Condition_Fear] = 0i64; | |
5273 v3->PlaySound(SPEECH_36, 0); | |
5274 break; | |
5275 case 238: //Remove Curse | |
5276 v3->pConditions[Condition_Cursed] = 0i64; | |
5277 v3->PlaySound(SPEECH_36, 0); | |
5278 break; | |
5279 case 239: //Cure Insanity | |
5280 v3->pConditions[Condition_Insane] = 0i64; | |
5281 v3->PlaySound(SPEECH_36, 0); | |
5282 break; | |
5283 case 240: //Might Boost | |
1032 | 5284 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5285 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5286 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5287 v3->PlaySound(SPEECH_36, 0); | |
5288 break; | |
5289 case 241: //Intellect Boost | |
1032 | 5290 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5291 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5292 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5293 v3->PlaySound(SPEECH_36, 0); | |
5294 break; | |
5295 case 242: //Personality Boost | |
1032 | 5296 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5297 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5298 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5299 v3->PlaySound(SPEECH_36, 0); | |
5300 break; | |
5301 case 243://Endurance Boost | |
1032 | 5302 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5303 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5304 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5305 v3->PlaySound(SPEECH_36, 0); | |
5306 break; | |
5307 case 244: //Speed Boost | |
1032 | 5308 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5309 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5310 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5311 v3->PlaySound(SPEECH_36, 0); | |
5312 break; | |
5313 case 245: //Accuracy Boost | |
1032 | 5314 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5315 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5316 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5317 v3->PlaySound(SPEECH_36, 0); | |
5318 break; | |
5319 case 251: //Cure Paralysis | |
5320 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5321 v3->PlaySound(SPEECH_36, 0); | |
5322 break; | |
5323 case 252://Divine Restoration | |
5324 v30 = v3->pConditions[Condition_Dead]; | |
5325 v32 = v3->pConditions[Condition_Pertified]; | |
5326 v34 = v3->pConditions[Condition_Eradicated]; | |
5327 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5328 v3->pConditions[Condition_Dead] = v30; | |
5329 v3->pConditions[Condition_Pertified] = v32; | |
5330 v3->pConditions[Condition_Eradicated] = v34; | |
5331 v3->PlaySound(SPEECH_36, 0); | |
5332 break; | |
5333 case 253: //Divine Cure | |
5334 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5335 pParty->pPlayers[player_num-1].Heal(v25); | |
5336 v3->PlaySound(SPEECH_36, 0); | |
5337 break; | |
5338 case 254: //Divine Power | |
5339 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5340 new_mana_val = v3->sMana; | |
5341 new_mana_val += v26; | |
5342 if ( new_mana_val > v3->GetMaxMana() ) | |
5343 new_mana_val = v3->GetMaxMana(); | |
5344 v3->PlaySound(SPEECH_36, 0); | |
5345 break; | |
5346 case 255: //Luck Boost | |
1032 | 5347 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5348 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5349 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5350 v3->PlaySound(SPEECH_36, 0); | |
5351 break; | |
5352 case 256: //Fire Resistance | |
1032 | 5353 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5354 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5355 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5356 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5357 break; |
1021 | 5358 case 257: //Air Resistance |
1032 | 5359 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5360 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5361 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5362 v3->PlaySound(SPEECH_36, 0); | |
5363 break; | |
5364 case 258: //Water Resistance | |
1032 | 5365 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5366 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5367 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5368 v3->PlaySound(SPEECH_36, 0); | |
5369 break; | |
5370 case 259: //Earth Resistance | |
1032 | 5371 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5372 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5373 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5374 v3->PlaySound(SPEECH_36, 0); | |
5375 break; | |
5376 case 260: //Mind Resistance | |
1032 | 5377 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5378 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5379 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5380 v3->PlaySound(SPEECH_36, 0); | |
5381 break; | |
5382 case 261: //Body Resistance | |
1032 | 5383 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5384 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5385 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5386 v3->PlaySound(SPEECH_36, 0); | |
5387 break; | |
5388 case 262: //Stone to Flesh | |
5389 v3->pConditions[Condition_Pertified] = 0i64; | |
5390 v3->PlaySound(SPEECH_36, 0); | |
5391 break; | |
5392 case 264: //Pure Luck | |
5393 if ( !v3->pure_luck_used ) | |
5394 { | |
5395 v3->uLuck += 50; | |
5396 v3->pure_luck_used = 1; | |
5397 } | |
5398 v3->PlaySound(SPEECH_36, 0); | |
5399 break; | |
5400 case 265: //Pure Speed | |
5401 if ( !v3->pure_speed_used ) | |
5402 { | |
5403 v3->uSpeed += 50; | |
5404 v3->pure_speed_used = 1; | |
5405 } | |
5406 v3->PlaySound(SPEECH_36, 0); | |
5407 break; | |
5408 case 266: //Pure Intellect | |
5409 if ( !v3->pure_intellect_used ) | |
5410 { | |
5411 v3->uIntelligence += 50; | |
5412 v3->pure_intellect_used = 1; | |
5413 } | |
5414 v3->PlaySound(SPEECH_36, 0); | |
5415 break; | |
5416 case 267: //Pure Endurance | |
5417 if ( !v3->pure_endurance_used ) | |
5418 { | |
5419 v3->uEndurance += 50; | |
5420 v3->pure_endurance_used = 1; | |
5421 } | |
5422 v3->PlaySound(SPEECH_36, 0); | |
5423 break; | |
5424 case 268: //Pure Personality | |
5425 if ( !v3->pure_willpower_used ) | |
5426 { | |
5427 v3->uWillpower += 50; | |
5428 v3->pure_willpower_used = 1; | |
5429 } | |
5430 v3->PlaySound(SPEECH_36, 0); | |
5431 break; | |
5432 case 269: //Pure Accuracy | |
5433 if ( !v3->pure_accuracy_used ) | |
5434 { | |
5435 v3->uAccuracy += 50; | |
5436 v3->pure_accuracy_used = 1; | |
5437 } | |
5438 v3->PlaySound(SPEECH_36, 0); | |
5439 break; | |
5440 case 270: //Pure Might | |
5441 if ( !v3->pure_might_used ) | |
5442 { | |
5443 v3->uMight += 50; | |
5444 v3->pure_might_used = 1; | |
5445 } | |
5446 v3->PlaySound(SPEECH_36, 0); | |
5447 break; | |
5448 case 271: //Rejuvenation | |
5449 v3->sAgeModifier = 0; | |
5450 v3->PlaySound(SPEECH_36, 0); | |
5451 break; | |
5452 | |
5453 default: | |
5454 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5455 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
|
5456 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5457 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5458 return; | |
1032 | 5459 } |
5460 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5461 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5462 { | |
5463 if ( !v73 ) | |
5464 { | |
5465 pMouse->RemoveHoldingItem(); | |
5466 return; | |
5467 } | |
5468 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5469 } |
1032 | 5470 if ( v73 ) |
5471 { | |
5472 if ( pParty->bTurnBasedModeOn ) | |
5473 { | |
5474 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5475 thisb->SetRecoveryTime(100); | |
1448 | 5476 pTurnEngine->ApplyPlayerAction(); |
1032 | 5477 } |
5478 else | |
5479 { | |
5480 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5481 } | |
5482 } | |
5483 pMouse->RemoveHoldingItem(); | |
5484 return; | |
5485 | |
1021 | 5486 } |
5487 | |
5488 | |
5489 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5490 { | |
5491 | |
5492 | |
5493 if ( pCurrentScreen == SCREEN_CASTING ) | |
5494 return; | |
5495 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5496 { | |
5497 | |
5498 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5499 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5500 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5501 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5502 return; |
5503 } | |
5504 if ( bUnderwater == 1 ) | |
5505 { | |
1032 | 5506 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5507 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5508 return; |
5509 } | |
5510 dword_50C9AC = 1; | |
5511 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5512 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5513 { | |
5514 pMouse->RemoveHoldingItem(); | |
5515 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5516 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5517 pCurrentScreen = SCREEN_GAME; |
5518 viewparams->bRedrawGameUI = 1; | |
5519 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5520 } | |
5521 else | |
5522 { | |
5523 _720984_unused = pParty->pPickedItem.uItemID; | |
5524 pMouse->RemoveHoldingItem(); | |
5525 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5526 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5527 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5528 { | |
5529 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5530 } | |
5531 } | |
5532 return; | |
5533 } | |
5534 | |
5535 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5536 | |
5537 { | |
5538 v15 = pParty->pPickedItem.uItemID - 400; | |
5539 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5540 if ( v72 ) | |
5541 { | |
5542 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5543 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
|
5544 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5545 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5546 return; |
5547 } | |
5548 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5549 { | |
5550 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5551 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
|
5552 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5553 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5554 return; |
5555 } | |
5556 v16 = v15 % 11 + 1; | |
5557 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5558 v18 = SkillToMastery(v17) - 1; | |
1032 | 5559 switch (v18) |
5560 { | |
5561 case 0: v67 = 4; break; | |
5562 case 1: v67 = 7; break; | |
5563 case 2: v67 = 10; break; | |
5564 case 3: v67 = 11; break; | |
5565 default: | |
5566 v67 = player_num; | |
5567 } | |
5568 | |
5569 if ( v16 > v67 || !v17 ) | |
1021 | 5570 { |
1032 | 5571 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5572 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
|
5573 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5574 v3->PlaySound((PlayerSpeech)20, 0); |
5575 return; | |
5576 } | |
5577 // v72 = 1; | |
5578 v3->PlaySound(SPEECH_21, 0); | |
5579 v73 = 0; | |
5580 | |
5581 | |
5582 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5583 { | |
5584 if ( !v73 ) | |
1021 | 5585 { |
1032 | 5586 pMouse->RemoveHoldingItem(); |
5587 return; | |
5588 } | |
5589 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5590 } | |
5591 if ( v73 ) | |
5592 { | |
5593 if ( pParty->bTurnBasedModeOn ) | |
5594 { | |
5595 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5596 thisb->SetRecoveryTime(100); | |
1448 | 5597 pTurnEngine->ApplyPlayerAction(); |
1021 | 5598 } |
5599 else | |
5600 { | |
1032 | 5601 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5602 } |
5603 } | |
1032 | 5604 pMouse->RemoveHoldingItem(); |
5605 return; | |
5606 | |
1021 | 5607 } |
5608 | |
5609 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5610 | |
5611 { | |
5612 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5613 { | |
5614 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5615 v3->PlaySound(SPEECH_37, 0); |
1021 | 5616 return; |
5617 } | |
5618 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5619 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5620 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5621 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5622 return; |
5623 } | |
5624 else | |
1459 | 5625 { |
5626 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5627 { | |
1021 | 5628 thisa = pParty->uCurrentMonthWeek + 1; |
5629 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5630 v74 = NULL; |
1021 | 5631 else |
5632 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5633 switch ( pParty->uCurrentMonth ) | |
5634 { | |
1019 | 5635 case 0: |
1021 | 5636 v3->uMight += 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 1: |
1021 | 5640 v3->uIntelligence += 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 2: |
1021 | 5644 v3->uWillpower += 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 3: |
1021 | 5648 v3->uEndurance += 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 4: |
1021 | 5652 v3->uAccuracy += 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 5: |
1021 | 5656 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5657 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5658 break; |
1019 | 5659 case 6: |
1021 | 5660 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5661 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5662 break; |
1019 | 5663 case 7: |
1021 | 5664 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5665 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5666 break; |
1019 | 5667 case 8: |
1021 | 5668 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5669 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5670 break; |
0 | 5671 case 9u: |
1021 | 5672 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5673 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5674 break; |
1019 | 5675 case 10: |
1021 | 5676 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5677 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5678 break; |
1019 | 5679 case 11: |
1021 | 5680 v8 = rand() % 6; |
5681 switch (v8) | |
5682 { | |
5683 case 0: | |
5684 v3->sResFireBase += thisa; | |
5685 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5686 break; | |
5687 case 1: | |
5688 v3->sResAirBase += thisa; | |
5689 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5690 break; | |
5691 case 2: | |
5692 v3->sResWaterBase += thisa; | |
5693 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5694 break; | |
5695 case 3: | |
5696 v3->sResEarthBase += thisa; | |
5697 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5698 break; | |
5699 case 4: | |
5700 v3->sResMindBase += thisa; | |
5701 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5702 break; | |
5703 case 5: | |
5704 v3->sResBodyBase += thisa; | |
5705 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5706 break; |
1021 | 5707 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5708 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5709 break; |
5710 | |
5711 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5712 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5713 pMouse->RemoveHoldingItem(); |
1459 | 5714 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5715 v3->PlaySound(SPEECH_93, 0); |
1032 | 5716 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5717 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5718 { |
1021 | 5719 v3->SetCondition(Condition_Eradicated, 0); |
5720 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5721 } |
1021 | 5722 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5723 { | |
5724 v3->SetCondition(Condition_Dead, 0); | |
5725 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5726 } | |
5727 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5728 { | |
5729 v3->SetCondition(Condition_Pertified, 0); | |
5730 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5731 } | |
1019 | 5732 return; |
1021 | 5733 } |
5734 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5735 { |
1021 | 5736 Party::GiveFood(1u); |
1459 | 5737 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5738 } | |
1021 | 5739 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5740 { | |
1459 | 5741 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5742 return; |
5743 } | |
5744 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5745 { | |
1459 | 5746 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5747 return; |
5748 } | |
5749 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5750 { | |
1459 | 5751 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5752 return; |
5753 } | |
1032 | 5754 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5755 { |
5756 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5757 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5758 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5759 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5760 } | |
5761 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5762 { | |
1459 | 5763 TeleportToNWCDungeon(); |
1021 | 5764 return; |
5765 } | |
0 | 5766 else |
1021 | 5767 { |
5768 | |
5769 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5770 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
|
5771 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5772 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5773 return; |
5774 } | |
1032 | 5775 |
0 | 5776 pMouse->RemoveHoldingItem(); |
5777 return; | |
5778 } | |
1021 | 5779 |
5780 } | |
0 | 5781 |
5782 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5783 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5784 { |
0 | 5785 Player *v3; // esi@1 |
5786 signed int v4; // edi@1 | |
5787 unsigned int v5; // eax@8 | |
5788 int v6; // eax@9 | |
5789 enum CHARACTER_RACE v7; // eax@11 | |
5790 signed int v8; // eax@17 | |
5791 unsigned __int8 v9; // sf@17 | |
5792 unsigned __int8 v10; // of@17 | |
5793 int v11; // eax@19 | |
5794 unsigned int v12; // eax@20 | |
484 | 5795 unsigned int test_bit_value; // eax@25 |
5796 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5797 signed int v15; // ecx@28 |
5798 ItemGen *v16; // eax@28 | |
5799 char v17; // zf@31 | |
5800 int v18; // edi@90 | |
5801 DDM_DLV_Header *v19; // eax@122 | |
5802 char v20; // cl@124 | |
5803 DDM_DLV_Header *v21; // eax@126 | |
5804 unsigned int v22; // edi@129 | |
100 | 5805 Player *v23; // esi@134 |
0 | 5806 ItemGen *v24; // ecx@135 |
5807 signed int v25; // edx@135 | |
5808 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5809 char *v27; // edi@155 | |
5810 int v28; // ebx@161 | |
5811 int v29; // eax@161 | |
5812 | |
469 | 5813 v6 = 0; |
0 | 5814 v3 = this; |
5815 v4 = -1; | |
469 | 5816 if ( VarNum > VAR_AutoNotes ) |
5817 { | |
5818 switch ( VarNum ) | |
0 | 5819 { |
5820 case VAR_Invisible: | |
1167 | 5821 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5822 return true; |
484 | 5823 return false; |
0 | 5824 case VAR_NumDeaths: |
5825 v4 = pParty->uNumDeaths; | |
469 | 5826 return v4 >= pValue; |
0 | 5827 case VAR_NumBounties: |
5828 v4 = pParty->uNumBountiesCollected; | |
469 | 5829 return v4 >= pValue; |
0 | 5830 case VAR_PrisonTerms: |
5831 v4 = pParty->uNumPrisonTerms; | |
469 | 5832 return v4 >= pValue; |
0 | 5833 case VAR_ArenaWinsPage: |
5834 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5835 return v4 >= pValue; |
0 | 5836 case VAR_ArenaWinsSquire: |
5837 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5838 return v4 >= pValue; |
0 | 5839 case VAR_ArenaWinsKnight: |
5840 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5841 return v4 >= pValue; |
0 | 5842 case VAR_ArenaWinsLord: |
5843 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5844 return v4 >= pValue; |
0 | 5845 case VAR_ReputationInCurrentLocation: |
5846 v19 = &pOutdoor->ddm; | |
5847 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5848 v19 = &pIndoor->dlv; | |
469 | 5849 v6 = v19->uReputation >= pValue; |
5850 return v6; | |
0 | 5851 case VAR_History_28|VAR_Sex: |
5852 v21 = &pOutdoor->ddm; | |
5853 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5854 v21 = &pIndoor->dlv; | |
469 | 5855 v6 = v21->field_C_alert == pValue; |
0 | 5856 return v6; |
5857 case VAR_MonthEquals2|VAR_Sex: | |
5858 case VAR_MonthEquals2|VAR_Class: | |
5859 case VAR_Counter1: | |
5860 case VAR_Counter2: | |
5861 case VAR_Counter3: | |
5862 case VAR_Counter4: | |
5863 case VAR_Counter5: | |
5864 case VAR_Counter6: | |
5865 case VAR_Counter7: | |
5866 case VAR_Counter8: | |
469 | 5867 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5868 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5869 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5870 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5871 return true; | |
5872 return false; | |
0 | 5873 case VAR_NumSkillPoints: |
5874 v4 = this->uSkillPoints; | |
469 | 5875 return v4 >= pValue; |
0 | 5876 case VAR_CircusPrises: |
5877 v4 = 0; | |
100 | 5878 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5879 do |
5880 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5881 v24 = v23->pInventoryItemList; |
0 | 5882 v25 = 138; |
5883 do | |
5884 { | |
5885 switch ( v24->uItemID ) | |
5886 { | |
5887 case 0x1D6u: | |
5888 ++v4; | |
5889 break; | |
5890 case 0x1D7u: | |
5891 v4 += 3; | |
5892 break; | |
5893 case 0x1DDu: | |
5894 v4 += 5; | |
5895 break; | |
5896 } | |
5897 ++v24; | |
5898 --v25; | |
5899 } | |
5900 while ( v25 ); | |
100 | 5901 ++v23; |
0 | 5902 } |
100 | 5903 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5904 return v4 >= pValue; |
0 | 5905 case VAR_MonthEquals2: |
469 | 5906 v6 = pParty->uCurrentMonth == pValue; |
5907 return v6; | |
0 | 5908 case VAR_IsFlying: |
5909 if ( pParty->bFlying | |
1167 | 5910 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5911 return true; |
5912 return false; | |
0 | 5913 case VAR_HiredNPCHasSpeciality: |
469 | 5914 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 5915 return v6; |
5916 case VAR_NPCs2: | |
469 | 5917 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 5918 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 5919 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5920 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 5921 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 5922 return v4 >= pValue; |
5923 v4 = pValue; | |
5924 return v4 >= pValue; | |
0 | 5925 case VAR_ItemEquipped: |
5926 v26 = (ITEM_EQUIP_TYPE)0; | |
5927 v27 = (char *)&this->pEquipment; | |
5928 break; | |
5929 case VAR_GoldInBank: | |
5930 v4 = pParty->uNumGoldInBank; | |
469 | 5931 return v4 >= pValue; |
0 | 5932 case VAR_ThieverySkill|0x80: |
5933 v28 = GetActualMight(); | |
5934 v29 = v3->GetBaseStrength(); | |
5935 goto LABEL_168; | |
5936 case VAR_DisarmTrapSkill|0x80: | |
5937 v28 = GetActualIntelligence(); | |
5938 v29 = v3->GetBaseIntelligence(); | |
5939 goto LABEL_168; | |
5940 case VAR_MonthEquals: | |
5941 v28 = GetActualWillpower(); | |
5942 v29 = v3->GetBaseWillpower(); | |
5943 goto LABEL_168; | |
5944 case VAR_MonthEquals|VAR_Sex: | |
5945 v28 = GetActualEndurance(); | |
5946 v29 = v3->GetBaseEndurance(); | |
5947 goto LABEL_168; | |
5948 case VAR_IdentifyMonsterSkill|0x80: | |
5949 v28 = GetActualSpeed(); | |
5950 v29 = v3->GetBaseSpeed(); | |
5951 goto LABEL_168; | |
5952 case VAR_ArmsmasterSkill|0x80: | |
5953 v28 = GetActualAccuracy(); | |
5954 v29 = v3->GetBaseAccuracy(); | |
5955 goto LABEL_168; | |
5956 case VAR_MonthEquals|VAR_MaxHP: | |
5957 v28 = GetActualLuck(); | |
5958 v29 = v3->GetBaseLuck(); | |
5959 LABEL_168: | |
5960 v10 = __OFSUB__(v28, v29); | |
5961 v9 = v28 - v29 < 0; | |
5962 LABEL_169: | |
5963 if ( v9 ^ v10 ) | |
469 | 5964 return v4 >= pValue; |
5965 return true; | |
0 | 5966 default: |
469 | 5967 return v4 >= pValue; |
0 | 5968 } |
5969 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5970 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 5971 { |
5972 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
5973 v27 += 4; | |
5974 if ( (signed int)v26 >= 16 ) | |
469 | 5975 return false; |
5976 } | |
5977 return true; | |
5978 } | |
5979 if ( VarNum == VAR_AutoNotes ) | |
0 | 5980 { |
1033 | 5981 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
5982 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 5983 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
5984 return false; | |
5985 return true; | |
469 | 5986 } |
5987 if ( VarNum <= VAR_BaseLuck ) | |
5988 { | |
5989 if ( VarNum != VAR_BaseLuck ) | |
5990 { | |
5991 switch ( VarNum ) | |
0 | 5992 { |
5993 case VAR_Hour: | |
469 | 5994 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
5995 return true; | |
5996 return false; | |
0 | 5997 case VAR_DayOfYear: |
469 | 5998 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
5999 v6 = v5 == pValue; | |
6000 return v6; | |
0 | 6001 case VAR_DayOfWeek: |
469 | 6002 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
6003 v6 = v5 == pValue; | |
0 | 6004 return v6; |
6005 case VAR_Sex: | |
469 | 6006 if ( pValue == (CHARACTER_RACE)this->uSex ) |
6007 return true; | |
6008 return v4 >= pValue; | |
0 | 6009 case VAR_Class: |
135 | 6010 v7 = (CHARACTER_RACE)this->classType; |
469 | 6011 if ( pValue == v7 ) |
6012 return true; | |
6013 return v4 >= pValue; | |
0 | 6014 case VAR_Race: |
6015 v7 = GetRace(); | |
469 | 6016 if ( pValue == v7 ) |
6017 return true; | |
6018 return v4 >= pValue; | |
0 | 6019 case VAR_CurrentHP: |
6020 v4 = this->sHealth; | |
469 | 6021 return v4 >= pValue; |
0 | 6022 case VAR_MaxHP: |
6023 v8 = GetMaxHealth(); | |
6024 v10 = __OFSUB__(v3->sHealth, v8); | |
6025 v9 = v3->sHealth - v8 < 0; | |
6026 goto LABEL_169; | |
6027 case VAR_CurrentSP: | |
6028 v4 = this->sMana; | |
469 | 6029 return v4 >= pValue; |
0 | 6030 case VAR_MaxSP: |
6031 v11 = GetMaxMana(); | |
6032 v10 = __OFSUB__(v3->sMana, v11); | |
6033 v9 = v3->sMana - v11 < 0; | |
6034 goto LABEL_169; | |
6035 case VAR_ActualAC: | |
6036 v12 = GetActualAC(); | |
6037 goto _j_cmp_against_arg; | |
6038 case VAR_ACModifier: | |
6039 v4 = this->sACModifier; | |
469 | 6040 return v4 >= pValue; |
0 | 6041 case VAR_BaseLevel: |
6042 v4 = this->uLevel; | |
469 | 6043 return v4 >= pValue; |
0 | 6044 case VAR_LevelModifier: |
6045 v4 = this->sLevelModifier; | |
469 | 6046 return v4 >= pValue; |
0 | 6047 case VAR_Age: |
6048 v12 = GetActualAge(); | |
6049 goto _j_cmp_against_arg; | |
6050 case VAR_Award: | |
1033 | 6051 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6052 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6053 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6054 return true; | |
6055 return false; | |
0 | 6056 case VAR_Experience: |
6057 v4 = LODWORD(this->uExperience); | |
469 | 6058 return v4 >= pValue; |
0 | 6059 case VAR_QBits_QuestsDone: |
484 | 6060 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6061 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6062 if ( test_bit_value & our_bit_value ) | |
478 | 6063 return true; |
6064 return false; | |
0 | 6065 case VAR_PlayerItemInHands: |
6066 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6067 v16 = v3->pInventoryItemList; |
0 | 6068 break; |
6069 case VAR_FixedGold: | |
6070 v4 = pParty->uNumGold; | |
469 | 6071 return v4 >= pValue; |
0 | 6072 case VAR_MightBonus: |
6073 v4 = this->uMightBonus; | |
469 | 6074 return v4 >= pValue; |
0 | 6075 case VAR_IntellectBonus: |
6076 v4 = this->uIntelligenceBonus; | |
469 | 6077 return v4 >= pValue; |
0 | 6078 case VAR_PersonalityBonus: |
6079 v4 = this->uWillpowerBonus; | |
469 | 6080 return v4 >= pValue; |
0 | 6081 case VAR_EnduranceBonus: |
6082 v4 = this->uEnduranceBonus; | |
469 | 6083 return v4 >= pValue; |
0 | 6084 case VAR_SpeedBonus: |
6085 v4 = this->uSpeedBonus; | |
469 | 6086 return v4 >= pValue; |
0 | 6087 case VAR_AccuracyBonus: |
6088 v4 = this->uAccuracyBonus; | |
469 | 6089 return v4 >= pValue; |
0 | 6090 case VAR_LuckBonus: |
6091 v4 = this->uLuckBonus; | |
469 | 6092 return v4 >= pValue; |
0 | 6093 case VAR_BaseMight: |
6094 v4 = this->uMight; | |
469 | 6095 return v4 >= pValue; |
0 | 6096 case VAR_BaseIntellect: |
6097 v4 = this->uIntelligence; | |
469 | 6098 return v4 >= pValue; |
0 | 6099 case VAR_BasePersonality: |
6100 v4 = this->uWillpower; | |
469 | 6101 return v4 >= pValue; |
0 | 6102 case VAR_BaseEndurance: |
6103 v4 = this->uEndurance; | |
469 | 6104 return v4 >= pValue; |
0 | 6105 case VAR_BaseSpeed: |
6106 v4 = this->uSpeed; | |
469 | 6107 return v4 >= pValue; |
0 | 6108 case VAR_BaseAccuracy: |
6109 v4 = this->uAccuracy; | |
469 | 6110 return v4 >= pValue; |
0 | 6111 case VAR_FixedFood: |
6112 v4 = pParty->uNumFoodRations; | |
469 | 6113 return v4 >= pValue; |
0 | 6114 default: |
469 | 6115 return v4 >= pValue; |
6116 } | |
6117 while ( v16->uItemID != pValue ) | |
0 | 6118 { |
6119 ++v15; | |
6120 ++v16; | |
6121 if ( v15 >= 138 ) | |
6122 { | |
469 | 6123 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6124 return v6; |
6125 } | |
6126 } | |
469 | 6127 return true; |
0 | 6128 } |
6129 v4 = this->uLuck; | |
469 | 6130 return v4 >= pValue; |
6131 } | |
6132 if ( VarNum <= VAR_MagicResistance ) | |
6133 { | |
6134 if ( VarNum == VAR_MagicResistance ) | |
0 | 6135 { |
6136 v4 = this->sResMagicBase; | |
6137 } | |
6138 else | |
6139 { | |
469 | 6140 switch ( VarNum ) |
0 | 6141 { |
6142 case VAR_FireResistance: | |
6143 v4 = this->sResFireBase; | |
469 | 6144 return v4 >= pValue; |
0 | 6145 case VAR_AirResistance: |
6146 v4 = this->sResAirBase; | |
469 | 6147 return v4 >= pValue; |
0 | 6148 case VAR_WaterResistance: |
6149 v4 = this->sResWaterBase; | |
469 | 6150 return v4 >= pValue; |
0 | 6151 case VAR_EarthResistance: |
6152 v4 = this->sResEarthBase; | |
469 | 6153 return v4 >= pValue; |
0 | 6154 case VAR_SpiritResistance: |
6155 v4 = this->sResSpiritBase; | |
469 | 6156 return v4 >= pValue; |
0 | 6157 case VAR_MindResistance: |
6158 v4 = this->sResMindBase; | |
469 | 6159 return v4 >= pValue; |
0 | 6160 case VAR_BodyResistance: |
6161 v4 = this->sResBodyBase; | |
469 | 6162 return v4 >= pValue; |
0 | 6163 case VAR_LightResistance: |
6164 v4 = this->sResLightBase; | |
469 | 6165 return v4 >= pValue; |
0 | 6166 case VAR_DarkResistance: |
6167 v4 = this->sResDarkBase; | |
469 | 6168 return v4 >= pValue; |
0 | 6169 case VAR_ActualMight: |
6170 v12 = GetActualMight(); | |
6171 goto _j_cmp_against_arg; | |
6172 case VAR_ActualIntellect: | |
6173 v12 = GetActualIntelligence(); | |
6174 goto _j_cmp_against_arg; | |
6175 case VAR_ActualPersonality: | |
6176 v12 = GetActualWillpower(); | |
6177 goto _j_cmp_against_arg; | |
6178 case VAR_ActualEndurance: | |
6179 v12 = GetActualEndurance(); | |
6180 goto _j_cmp_against_arg; | |
6181 case VAR_ActualSpeed: | |
6182 v12 = GetActualSpeed(); | |
6183 goto _j_cmp_against_arg; | |
6184 case VAR_ActualAccuracy: | |
6185 v12 = GetActualAccuracy(); | |
6186 goto _j_cmp_against_arg; | |
6187 case VAR_ActualLuck: | |
6188 v12 = GetActualLuck(); | |
6189 _j_cmp_against_arg: | |
6190 v4 = v12; | |
6191 break; | |
6192 default: | |
469 | 6193 return v4 >= pValue; |
6194 } | |
6195 } | |
6196 return v4 >= pValue; | |
6197 } | |
6198 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6199 { | |
6200 if ( VarNum != VAR_DisarmTrapSkill ) | |
6201 { | |
6202 if ( VarNum <= VAR_MindResistanceBonus ) | |
6203 { | |
6204 switch ( VarNum ) | |
0 | 6205 { |
6206 case VAR_MindResistanceBonus: | |
6207 v4 = this->sResMindBonus; | |
6208 break; | |
6209 case VAR_FireResistanceBonus: | |
6210 v4 = this->sResFireBonus; | |
6211 break; | |
6212 case VAR_AirResistanceBonus: | |
6213 v4 = this->sResAirBonus; | |
6214 break; | |
6215 case VAR_WaterResistanceBonus: | |
6216 v4 = this->sResWaterBonus; | |
6217 break; | |
6218 case VAR_EarthResistanceBonus: | |
6219 v4 = this->sResEarthBonus; | |
6220 break; | |
6221 case VAR_SpiritResistanceBonus: | |
6222 v4 = this->sResSpiritBonus; | |
6223 break; | |
6224 } | |
469 | 6225 return v4 >= pValue; |
6226 } | |
6227 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6228 { |
6229 v4 = this->sResBodyBonus; | |
469 | 6230 return v4 >= pValue; |
6231 } | |
6232 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6233 { |
6234 v4 = this->sResLightBonus; | |
469 | 6235 return v4 >= pValue; |
6236 } | |
6237 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6238 { |
6239 v4 = this->sResDarkBonus; | |
469 | 6240 return v4 >= pValue; |
6241 } | |
6242 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6243 { |
6244 v4 = this->sResMagicBonus; | |
469 | 6245 return v4 >= pValue; |
6246 } | |
6247 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6248 return v4 >= pValue; | |
0 | 6249 } |
6250 LABEL_90: | |
469 | 6251 v18 = *((short *)&this->pConditions[16] + VarNum); |
6252 if ( pValue <= 63 ) | |
0 | 6253 v4 = v18 & 0x3F; |
6254 else | |
469 | 6255 v4 = pValue & v18; |
6256 return v4 >= pValue; | |
6257 } | |
6258 if ( VarNum == 104 ) | |
0 | 6259 goto LABEL_90; |
469 | 6260 if ( (signed int)VarNum <= 104 ) |
6261 return v4 >= pValue; | |
6262 if ( (signed int)VarNum > 0x79 ) | |
6263 { | |
6264 if ( VarNum != 122 ) | |
6265 { | |
6266 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6267 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6268 return v4 >= pValue; | |
0 | 6269 } |
6270 v4 = GetMajorConditionIdx(); | |
6271 if ( v4 != 18 ) | |
6272 { | |
469 | 6273 return v4 >= pValue; |
6274 } | |
6275 v4 = pValue; | |
6276 return v4 >= pValue; | |
6277 } | |
1072 | 6278 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6279 } |
6280 | |
6281 | |
6282 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6283 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6284 { | |
6285 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
|
6286 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
|
6287 unsigned int v5_unused; // edi@1 |
0 | 6288 unsigned int v6; // esi@13 |
6289 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
|
6290 signed int v8_unused; // eax@17 |
0 | 6291 ItemGen *v9; // ecx@17 |
6292 int v10; // eax@21 | |
6293 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
|
6294 Player *unused12; // ecx@44 |
0 | 6295 char *v13; // ecx@45 |
6296 Player *v14; // ecx@49 | |
6297 int v15; // ecx@86 | |
6298 int v16; // esi@106 | |
6299 char v17; // al@106 | |
6300 int v18; // eax@107 | |
6301 Player *v19; // ecx@112 | |
6302 Player *v20; // ecx@127 | |
6303 int v21; // eax@127 | |
6304 int v22; // eax@145 | |
6305 char v23; // zf@146 | |
6306 DDM_DLV_Header *v24; // ecx@148 | |
6307 signed int v25; // eax@172 | |
6308 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
|
6309 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
|
6310 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6311 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
|
6312 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
|
6313 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
|
6314 |
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
|
6315 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
|
6316 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
|
6317 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6318 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
|
6319 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6320 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
|
6321 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
|
6322 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6323 } |
1545 | 6324 |
6325 Assert(currPlayerId != -1); | |
492 | 6326 if ( var_type > VAR_AutoNotes ) |
6327 { | |
6328 if ( var_type <= VAR_GoldInBank ) | |
6329 { | |
6330 if ( var_type == VAR_GoldInBank ) | |
6331 { | |
6332 pParty->uNumGoldInBank = var_value; | |
0 | 6333 return; |
6334 } | |
492 | 6335 if ( var_type <= VAR_Counter8 ) |
6336 { | |
6337 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6338 { |
492 | 6339 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6340 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6341 } |
6342 else | |
6343 { | |
492 | 6344 switch ( var_type ) |
0 | 6345 { |
6346 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6347 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6348 break; |
6349 case VAR_NPCs2: | |
6350 pParty->field_709 = 0; | |
492 | 6351 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6352 pParty->CountHirelings(); |
6353 viewparams->bRedrawGameUI = true; | |
0 | 6354 break; |
6355 case VAR_NumSkillPoints: | |
492 | 6356 this->uSkillPoints = var_value; |
0 | 6357 break; |
6358 } | |
6359 } | |
6360 return; | |
6361 } | |
492 | 6362 if ( var_type < VAR_Counter9 ) |
0 | 6363 return; |
492 | 6364 if ( (signed int)var_type <= 0x112 ) |
6365 { | |
6366 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6367 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6368 } |
6369 else | |
6370 { | |
492 | 6371 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6372 { |
6373 v24 = &pOutdoor->ddm; | |
6374 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6375 v24 = &pIndoor->dlv; | |
492 | 6376 v24->uReputation = var_value; |
6377 if ( var_value > 10000 ) | |
0 | 6378 v24->uReputation = 10000; |
6379 return; | |
6380 } | |
492 | 6381 if ( var_type <= VAR_ReputationInCurrentLocation |
6382 || var_type > VAR_History_28 | |
6383 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6384 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6385 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6386 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6387 v23) ) |
6388 return; | |
6389 bFlashHistoryBook = 1; | |
6390 } | |
492 | 6391 v25 = 8 * currPlayerId + 400; |
862 | 6392 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
|
6393 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6394 return; |
6395 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6396 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6397 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6398 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6399 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
|
6400 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6401 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6402 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6403 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6404 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6405 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6406 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6407 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6408 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6409 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6410 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6411 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6412 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6413 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6414 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6415 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6416 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6417 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6418 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6419 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6420 return; |
0 | 6421 } |
492 | 6422 if ( var_type == VAR_AutoNotes ) |
6423 { | |
6424 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
|
6425 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6426 && pAutonoteTxt[var_value].pText ) |
492 | 6427 { |
6428 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6429 v20->PlaySound(SPEECH_96, 0); |
1453 | 6430 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6431 bFlashAutonotesBook = 1; |
1453 | 6432 _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
|
6433 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6434 } |
1453 | 6435 _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
|
6436 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6437 return; |
0 | 6438 } |
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
|
6439 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
|
6440 { |
7ef8ae7ce42a
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 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
|
6442 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6443 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
|
6444 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
|
6445 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
|
6446 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
|
6447 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
|
6448 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
|
6449 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6450 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6451 for (int i = 0; i < 138; i++) |
0 | 6452 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6453 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6454 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
|
6455 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
|
6456 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6457 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
|
6458 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6459 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
|
6460 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6461 *(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
|
6462 } |
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
|
6463 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
|
6464 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
|
6465 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
|
6466 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
|
6467 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
|
6468 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
|
6469 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
|
6470 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
|
6471 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
|
6472 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
|
6473 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
|
6474 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
|
6475 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
|
6476 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
|
6477 { |
7ef8ae7ce42a
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 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
|
6479 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
|
6480 } |
7ef8ae7ce42a
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 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
|
6482 { |
7ef8ae7ce42a
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 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
|
6484 this->uVoiceID = 20; |
0 | 6485 } |
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
|
6486 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
|
6487 } |
7ef8ae7ce42a
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 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
|
6489 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
|
6490 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
|
6491 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
|
6492 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
|
6493 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
|
6494 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
|
6495 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
|
6496 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
|
6497 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
|
6498 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
|
6499 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
|
6500 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
|
6501 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
|
6502 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
|
6503 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
|
6504 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
|
6505 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
|
6506 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
|
6507 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
|
6508 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
|
6509 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
|
6510 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
|
6511 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
|
6512 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
|
6513 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
|
6514 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
|
6515 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
|
6516 //&& 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
|
6517 && 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
|
6518 { |
7ef8ae7ce42a
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 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
|
6520 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6521 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
|
6522 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6523 _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
|
6524 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
|
6525 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
|
6526 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
|
6527 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
|
6528 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
|
6529 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
|
6530 // && (&dword_722F10)[4 * a3] ) |
1310 | 6531 && pQuestTable[var_value] ) |
0 | 6532 { |
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
|
6533 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
|
6534 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
|
6535 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
|
6536 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6537 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
|
6538 } |
7ef8ae7ce42a
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 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
|
6540 _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
|
6541 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
|
6542 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
|
6543 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
|
6544 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
|
6545 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
|
6546 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
|
6547 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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 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
|
6559 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
|
6560 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
|
6561 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
|
6562 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
|
6563 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
|
6564 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
|
6565 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
|
6566 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
|
6567 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
|
6568 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
|
6569 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
|
6570 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
|
6571 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
|
6572 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
|
6573 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
|
6574 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
|
6575 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
|
6576 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
|
6577 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
|
6578 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
|
6579 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
|
6580 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
|
6581 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
|
6582 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
|
6583 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
|
6584 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
|
6585 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
|
6586 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
|
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_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
|
6590 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
|
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_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
|
6594 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
|
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_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
|
6598 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
|
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_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
|
6602 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
|
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 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
|
6606 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
|
6607 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6608 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
|
6609 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
|
6610 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
|
6611 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6612 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
|
6613 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
|
6614 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
|
6615 } |
0 | 6616 LABEL_111: |
187 | 6617 v26 = SPEECH_91; |
0 | 6618 LABEL_112: |
492 | 6619 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6620 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
|
6621 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6622 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6623 return; |
0 | 6624 } |
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
|
6625 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
|
6626 { |
492 | 6627 switch ( var_type ) |
0 | 6628 { |
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
|
6629 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
|
6630 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
|
6631 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
|
6632 goto LABEL_111; |
0 | 6633 case VAR_ActualIntellect: |
6634 LABEL_68: | |
492 | 6635 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6636 goto LABEL_111; |
6637 case VAR_ActualPersonality: | |
6638 LABEL_69: | |
492 | 6639 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6640 goto LABEL_111; |
6641 case VAR_ActualEndurance: | |
6642 LABEL_70: | |
492 | 6643 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6644 goto LABEL_111; |
6645 case VAR_ActualSpeed: | |
6646 LABEL_71: | |
492 | 6647 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6648 goto LABEL_111; |
6649 case VAR_ActualAccuracy: | |
6650 LABEL_72: | |
492 | 6651 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6652 goto LABEL_111; |
6653 case VAR_ActualLuck: | |
6654 LABEL_73: | |
492 | 6655 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6656 goto LABEL_111; |
6657 case VAR_FireResistance: | |
492 | 6658 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
|
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_AirResistance: |
492 | 6662 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
|
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_WaterResistance: |
492 | 6666 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
|
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_EarthResistance: |
492 | 6670 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
|
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_SpiritResistance: |
492 | 6674 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
|
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_MindResistance: |
492 | 6678 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
|
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_BodyResistance: |
492 | 6682 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
|
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_LightResistance: |
492 | 6686 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
|
6687 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6688 goto LABEL_112; |
0 | 6689 case VAR_DarkResistance: |
492 | 6690 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
|
6691 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6692 goto LABEL_112; |
0 | 6693 case VAR_MagicResistance: |
492 | 6694 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6695 v26 = 92; |
6696 goto LABEL_112; | |
6697 default: | |
6698 return; | |
6699 } | |
6700 return; | |
6701 } | |
6702 HIWORD(v15) = 0; | |
492 | 6703 if ( var_type > VAR_DisarmTrapSkill ) |
6704 { | |
6705 if ( var_type != VAR_LearningSkill ) | |
6706 { | |
6707 if ( var_type <= VAR_LearningSkill ) | |
0 | 6708 return; |
492 | 6709 if ( var_type <= VAR_Eradicated ) |
6710 { | |
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
|
6711 this->SetCondition(var_type - 105, 1); |
0 | 6712 } |
6713 else | |
6714 { | |
492 | 6715 if ( var_type != VAR_MajorCondition ) |
0 | 6716 { |
492 | 6717 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6718 byte_5E4C15[var_type] = var_value; | |
0 | 6719 return; |
6720 } | |
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
|
6721 memset(this, 0, 0xA0u); |
0 | 6722 } |
6723 } | |
6724 else | |
6725 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6726 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
|
6727 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6728 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6729 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6730 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6731 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6732 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6733 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6734 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6735 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
|
6736 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6737 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6738 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6739 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6740 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6741 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6742 return; |
0 | 6743 } |
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 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6745 { |
6746 switch ( var_type ) | |
0 | 6747 { |
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
|
6748 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
|
6749 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6750 break; |
6751 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
|
6752 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6753 break; |
6754 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
|
6755 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6756 break; |
6757 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
|
6758 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6759 break; |
6760 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
|
6761 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
|
6762 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
|
6763 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
|
6764 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
|
6765 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
|
6766 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
|
6767 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
|
6768 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
|
6769 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
|
6770 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
|
6771 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
|
6772 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
|
6773 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
|
6774 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
|
6775 case VAR_PhysicalResistanceBonus: |
1545 | 6776 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
|
6777 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
|
6778 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
|
6779 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
|
6780 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6781 break; |
6782 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
|
6783 Error("Unexpected var_type: %u", var_type); |
0 | 6784 return; |
6785 break; | |
6786 } | |
6787 goto LABEL_111; | |
6788 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6789 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
|
6790 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6791 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6792 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6793 } |
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::PlaySoundBasedOnCondition(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 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
|
6800 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
|
6801 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
|
6802 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6803 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6804 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6805 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
|
6806 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6807 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
|
6808 } |
0 | 6809 |
6810 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6811 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6812 { |
6813 char v3; // bl@1 | |
6814 Player *v4; // esi@1 | |
6815 signed int uPlayerIdx; // edi@1 | |
6816 int v6; // eax@15 | |
6817 unsigned int v7; // esi@18 | |
6818 int *v8; // ebx@21 | |
6819 int v9; // eax@22 | |
6820 signed int v10; // eax@24 | |
6821 int v11; // eax@27 | |
6822 __int16 *v12; // esi@28 | |
6823 Player *v13; // ecx@34 | |
6824 Player *v14; // ecx@36 | |
6825 char *v15; // ecx@37 | |
6826 unsigned __int8 v16; // cf@38 | |
6827 Player *v17; // ecx@42 | |
6828 __int16 *v18; // esi@53 | |
6829 __int16 *v19; // esi@62 | |
6830 char *v20; // esi@107 | |
6831 __int16 v21; // dx@107 | |
6832 int v22; // ecx@107 | |
6833 Player *v23; // ecx@132 | |
6834 int v24; // eax@132 | |
6835 int v25; // eax@150 | |
6836 char v26; // zf@151 | |
6837 DDM_DLV_Header *v27; // eax@153 | |
6838 signed int v28; // eax@176 | |
6839 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6840 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6841 int v31; // [sp-4h] [bp-3Ch]@84 |
6842 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6843 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6844 char v34; // [sp+37h] [bp-1h]@1 | |
6845 | |
6846 auto Dst = this; | |
6847 v3 = 0; | |
6848 v34 = 0; | |
6849 v4 = Dst; | |
6850 uPlayerIdx = 0; | |
6851 if ( Dst == pPlayers[2] ) | |
6852 uPlayerIdx = 1; | |
310 | 6853 else if ( Dst == pPlayers[3] ) |
6854 uPlayerIdx = 2; | |
6855 else if ( Dst == pPlayers[4] ) | |
6856 uPlayerIdx = 3; | |
6857 | |
6858 if ( var_type <= VAR_AutoNotes ) | |
6859 { | |
6860 if ( var_type != VAR_AutoNotes ) | |
6861 { | |
6862 if ( var_type <= VAR_ActualMight ) | |
6863 { | |
6864 if ( var_type != VAR_ActualMight ) | |
0 | 6865 { |
310 | 6866 switch ( var_type ) |
0 | 6867 { |
6868 case VAR_RandomGold: | |
6869 if ( !val ) | |
6870 val = 1; | |
6871 v6 = rand(); | |
6872 party_finds_gold(v6 % val + 1, 1); | |
6873 GameUI_DrawFoodAndGold(); | |
6874 return; | |
6875 case VAR_RandomFood: | |
6876 if ( !val ) | |
6877 val = 1; | |
6878 v7 = rand() % val + 1; | |
6879 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6880 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
|
6881 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6882 GameUI_DrawFoodAndGold(); |
6883 goto _play_sound; | |
6884 case VAR_Sex: | |
6885 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6886 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6887 goto _play_sound; | |
0 | 6888 case VAR_Class: |
135 | 6889 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6890 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6891 goto _play_sound; | |
0 | 6892 case VAR_CurrentHP: |
6893 v8 = &Dst->sHealth; | |
6894 *v8 += val; | |
6895 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6896 { |
6897 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6898 goto _play_sound; | |
6899 } | |
0 | 6900 v9 = v4->GetMaxHealth(); |
6901 goto LABEL_23; | |
6902 case VAR_MaxHP: | |
6903 v10 = Dst->GetMaxHealth(); | |
6904 v4->_health_related = 0; | |
6905 v4->uFullHealthBonus = 0; | |
6906 v4->sHealth = v10; | |
6907 return; | |
6908 case VAR_CurrentSP: | |
6909 v8 = &Dst->sMana; | |
6910 *v8 += val; | |
6911 if ( Dst->sMana > GetMaxMana() ) | |
6912 { | |
6913 v9 = v4->GetMaxMana(); | |
6914 LABEL_23: | |
6915 *v8 = v9; | |
6916 } | |
1507 | 6917 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6918 goto _play_sound; | |
0 | 6919 case VAR_MaxSP: |
6920 v11 = GetMaxMana(); | |
6921 v4->_mana_related = 0; | |
6922 v4->uFullManaBonus = 0; | |
6923 v4->sMana = v11; | |
6924 return; | |
6925 case VAR_ACModifier: | |
6926 v12 = &Dst->sACModifier; | |
6927 goto LABEL_29; | |
6928 case VAR_BaseLevel: | |
6929 v12 = (__int16 *)&Dst->uLevel; | |
6930 goto LABEL_29; | |
6931 case VAR_LevelModifier: | |
6932 v12 = &Dst->sLevelModifier; | |
6933 LABEL_29: | |
6934 *v12 += val; | |
6935 if ( *v12 > 255 ) | |
6936 *v12 = 255; | |
1507 | 6937 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6938 goto _play_sound; | |
0 | 6939 case VAR_Age: |
6940 Dst->sAgeModifier += val; | |
6941 return; | |
6942 case VAR_Award: | |
6943 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6944 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 6945 |
492 | 6946 && pAwards[val].pText ) |
0 | 6947 { |
6948 v14 = pPlayers[uPlayerIdx + 1]; | |
6949 v34 = 1; | |
6950 v3 = 1; | |
187 | 6951 v14->PlaySound(SPEECH_96, 0); |
0 | 6952 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6953 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 6954 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6955 if ( v34 != 1 ) | |
6956 { | |
6957 if ( v3 != 1 ) | |
6958 return; | |
6959 goto _play_sound; | |
6960 } | |
6961 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6962 if ( v3 != 1 ) | |
6963 return; | |
6964 goto _play_sound; | |
0 | 6965 case VAR_Experience: |
6966 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
6967 LODWORD(Dst->uExperience) += val; | |
6968 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
6969 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
6970 Dst->uExperience = 4000000000i64; | |
1507 | 6971 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6972 goto _play_sound; | |
0 | 6973 case VAR_QBits_QuestsDone: |
484 | 6974 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
|
6975 //&& (&dword_722F10)[4 * val] ) |
1310 | 6976 && pQuestTable[val] ) |
0 | 6977 { |
501 | 6978 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 6979 bFlashQuestBook = 1; |
6980 v34 = 1; | |
6981 v3 = 1; | |
501 | 6982 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 6983 } |
484 | 6984 v15 = (char *)pParty->_quest_bits; |
1507 | 6985 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6986 if ( v34 != 1 ) | |
6987 { | |
6988 if ( v3 != 1 ) | |
6989 return; | |
6990 goto _play_sound; | |
6991 } | |
6992 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6993 if ( v3 != 1 ) | |
6994 return; | |
6995 goto _play_sound; | |
0 | 6996 case VAR_PlayerItemInHands: |
6997 item.Reset(); | |
6998 item.Reset(); | |
6999 item.uAttributes = 1; | |
7000 item.uItemID = val; | |
7001 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 7002 pParty->pIsArtifactFound[val-500] = 1; |
0 | 7003 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
7004 { | |
7005 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
7006 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
7007 } | |
7008 pParty->SetHoldingItem(&item); | |
7009 return; | |
7010 case VAR_FixedGold: | |
7011 party_finds_gold(val, 1); | |
7012 return; | |
7013 case VAR_BaseMight: | |
7014 v18 = (__int16 *)&Dst->uMight; | |
7015 goto LABEL_82; | |
7016 case VAR_BaseIntellect: | |
7017 v18 = (__int16 *)&Dst->uIntelligence; | |
7018 goto LABEL_82; | |
7019 case VAR_BasePersonality: | |
7020 v18 = (__int16 *)&Dst->uWillpower; | |
7021 goto LABEL_82; | |
7022 case VAR_BaseEndurance: | |
7023 v18 = (__int16 *)&Dst->uEndurance; | |
7024 goto LABEL_82; | |
7025 case VAR_BaseSpeed: | |
7026 v18 = (__int16 *)&Dst->uSpeed; | |
7027 goto LABEL_82; | |
7028 case VAR_BaseAccuracy: | |
7029 v18 = (__int16 *)&Dst->uAccuracy; | |
7030 goto LABEL_82; | |
7031 case VAR_BaseLuck: | |
7032 v18 = (__int16 *)&Dst->uLuck; | |
7033 goto LABEL_82; | |
7034 case VAR_FixedFood: | |
7035 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7036 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7037 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7038 if ( pParty->uNumFoodRations > 0xFFFF ) |
7039 Party::SetFood(0xFFFFu); | |
7040 goto _play_sound; | |
7041 case VAR_MightBonus: | |
7042 goto LABEL_62; | |
7043 case VAR_IntellectBonus: | |
7044 goto LABEL_66; | |
7045 case VAR_PersonalityBonus: | |
7046 goto LABEL_67; | |
7047 case VAR_EnduranceBonus: | |
7048 goto LABEL_68; | |
7049 case VAR_SpeedBonus: | |
7050 goto LABEL_69; | |
7051 case VAR_AccuracyBonus: | |
7052 goto LABEL_70; | |
7053 case VAR_LuckBonus: | |
7054 goto LABEL_71; | |
7055 default: | |
7056 return; | |
7057 } | |
7058 return; | |
7059 } | |
7060 LABEL_62: | |
7061 v19 = (__int16 *)&Dst->uMightBonus; | |
7062 goto LABEL_113; | |
7063 } | |
310 | 7064 if ( var_type <= VAR_FireResistanceBonus ) |
7065 { | |
7066 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7067 { |
310 | 7068 switch ( var_type ) |
0 | 7069 { |
7070 case VAR_ActualIntellect: | |
7071 LABEL_66: | |
7072 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7073 goto LABEL_113; | |
7074 case VAR_ActualPersonality: | |
7075 LABEL_67: | |
7076 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7077 goto LABEL_113; | |
7078 case VAR_ActualEndurance: | |
7079 LABEL_68: | |
7080 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7081 goto LABEL_113; | |
7082 case VAR_ActualSpeed: | |
7083 LABEL_69: | |
7084 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7085 goto LABEL_113; | |
7086 case VAR_ActualAccuracy: | |
7087 LABEL_70: | |
7088 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7089 goto LABEL_113; | |
7090 case VAR_ActualLuck: | |
7091 LABEL_71: | |
7092 v19 = (__int16 *)&Dst->uLuckBonus; | |
7093 goto LABEL_113; | |
7094 case VAR_FireResistance: | |
7095 v18 = &Dst->sResFireBase; | |
7096 goto LABEL_82; | |
7097 case VAR_AirResistance: | |
7098 v18 = &Dst->sResAirBase; | |
7099 goto LABEL_82; | |
7100 case VAR_WaterResistance: | |
7101 v18 = &Dst->sResWaterBase; | |
7102 goto LABEL_82; | |
7103 case VAR_EarthResistance: | |
7104 v18 = &Dst->sResEarthBase; | |
7105 goto LABEL_82; | |
7106 case VAR_SpiritResistance: | |
7107 v18 = &Dst->sResSpiritBase; | |
7108 goto LABEL_82; | |
7109 case VAR_MindResistance: | |
7110 v18 = &Dst->sResMindBase; | |
7111 goto LABEL_82; | |
7112 case VAR_BodyResistance: | |
7113 v18 = &Dst->sResBodyBase; | |
7114 goto LABEL_82; | |
7115 case VAR_LightResistance: | |
7116 v18 = &Dst->sResLightBase; | |
7117 goto LABEL_82; | |
7118 case VAR_DarkResistance: | |
7119 v18 = &Dst->sResDarkBase; | |
7120 goto LABEL_82; | |
7121 case VAR_MagicResistance: | |
7122 v18 = &Dst->sResMagicBase; | |
7123 LABEL_82: | |
7124 *v18 += val; | |
7125 if ( *v18 > 255 ) | |
7126 *v18 = 255; | |
1507 | 7127 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7128 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7129 goto _play_sound; | |
0 | 7130 default: |
7131 return; | |
7132 } | |
7133 return; | |
7134 } | |
7135 v19 = &Dst->sResFireBonus; | |
7136 LABEL_113: | |
7137 *v19 += val; | |
7138 if ( *v19 > 255 ) | |
7139 *v19 = 255; | |
7140 v31 = 0; | |
187 | 7141 v29 = SPEECH_91; |
7142 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7143 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7144 goto _play_sound; | |
0 | 7145 } |
310 | 7146 if ( var_type <= VAR_DisarmTrapSkill ) |
7147 { | |
7148 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7149 { |
310 | 7150 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7151 { |
310 | 7152 switch ( var_type ) |
0 | 7153 { |
7154 case VAR_BodyResistanceBonus: | |
7155 v19 = &Dst->sResBodyBonus; | |
7156 break; | |
7157 case VAR_AirResistanceBonus: | |
7158 v19 = &Dst->sResAirBonus; | |
7159 break; | |
7160 case VAR_WaterResistanceBonus: | |
7161 v19 = &Dst->sResWaterBonus; | |
7162 break; | |
7163 case VAR_EarthResistanceBonus: | |
7164 v19 = &Dst->sResEarthBonus; | |
7165 break; | |
7166 case VAR_SpiritResistanceBonus: | |
7167 v19 = &Dst->sResSpiritBonus; | |
7168 break; | |
7169 default: | |
310 | 7170 if ( var_type != 62 ) |
0 | 7171 return; |
7172 v19 = &Dst->sResMindBonus; | |
7173 break; | |
7174 } | |
7175 goto LABEL_113; | |
7176 } | |
310 | 7177 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7178 { |
7179 v19 = &Dst->sResLightBonus; | |
7180 goto LABEL_113; | |
7181 } | |
310 | 7182 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7183 { |
7184 v19 = &Dst->sResDarkBonus; | |
7185 goto LABEL_113; | |
7186 } | |
310 | 7187 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7188 { |
7189 v19 = &Dst->sResMagicBonus; | |
7190 goto LABEL_113; | |
7191 } | |
310 | 7192 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7193 return; |
7194 } | |
7195 goto LABEL_106; | |
7196 } | |
310 | 7197 if ( var_type == VAR_LearningSkill ) |
0 | 7198 { |
7199 LABEL_106: | |
7200 if ( val <= VAR_BodyResistanceBonus ) | |
7201 { | |
310 | 7202 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7203 } |
7204 else | |
7205 { | |
310 | 7206 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7207 v21 = *(short *)v20; |
7208 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7209 if ( v22 > 60 ) | |
7210 LOWORD(v22) = 60; | |
7211 LOBYTE(v21) = v21 & 0xC0; | |
7212 *(short *)v20 = v22 | v21; | |
7213 } | |
1507 | 7214 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7215 goto _play_sound; | |
0 | 7216 } |
310 | 7217 if ( var_type <= VAR_LearningSkill ) |
0 | 7218 return; |
310 | 7219 if ( var_type <= VAR_Eradicated ) |
7220 { | |
7221 Dst->SetCondition(var_type - 105, 0); | |
0 | 7222 } |
7223 else | |
7224 { | |
310 | 7225 if ( var_type != VAR_MajorCondition ) |
0 | 7226 { |
310 | 7227 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7228 { |
310 | 7229 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7230 byte_5E4C15[var_type] += val; | |
0 | 7231 else |
310 | 7232 byte_5E4C15[var_type] = -1; |
0 | 7233 } |
7234 return; | |
7235 } | |
7236 memset(Dst, 0, 0xA0u); | |
7237 } | |
7238 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7239 goto _play_sound; | |
7240 } | |
7241 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
|
7242 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7243 && pAutonoteTxt[val].pText ) |
0 | 7244 { |
7245 v23 = pPlayers[uPlayerIdx + 1]; | |
7246 v34 = 1; | |
187 | 7247 v23->PlaySound(SPEECH_96, 0); |
1453 | 7248 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7249 bFlashAutonotesBook = 1; |
1453 | 7250 _506568_autonote_type = pAutonoteTxt[val].eType; |
7251 } | |
7252 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7253 v3 = 1; |
7254 if ( v34 != 1 ) | |
1507 | 7255 { |
7256 if ( v3 != 1 ) | |
7257 return; | |
7258 goto _play_sound; | |
7259 } | |
7260 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7261 if ( v3 != 1 ) | |
7262 return; | |
7263 goto _play_sound; | |
0 | 7264 } |
310 | 7265 if ( var_type > VAR_GoldInBank ) |
7266 { | |
7267 if ( var_type == 307 ) | |
0 | 7268 { |
7269 pParty->uNumDeaths += val; | |
1507 | 7270 if ( v34 != 1 ) |
7271 { | |
7272 if ( v3 != 1 ) | |
7273 return; | |
7274 goto _play_sound; | |
7275 } | |
7276 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7277 if ( v3 != 1 ) | |
7278 return; | |
7279 goto _play_sound; | |
0 | 7280 } |
310 | 7281 switch ( var_type ) |
0 | 7282 { |
7283 case 308: | |
7284 pParty->uNumBountiesCollected += val; | |
7285 break; | |
7286 case 309: | |
7287 pParty->uNumPrisonTerms += val; | |
7288 break; | |
7289 case 310: | |
7290 pParty->uNumArenaPageWins += val; | |
7291 break; | |
7292 case 311: | |
7293 pParty->uNumArenaSquireWins += val; | |
7294 break; | |
7295 case 312: | |
7296 pParty->uNumArenaKnightWins += val; | |
7297 break; | |
7298 case 313: | |
7299 pParty->uNumArenaLordWins += val; | |
7300 break; | |
7301 } | |
7302 } | |
7303 else | |
7304 { | |
310 | 7305 if ( var_type == VAR_GoldInBank ) |
0 | 7306 { |
7307 pParty->uNumGoldInBank += val; | |
7308 return; | |
7309 } | |
310 | 7310 if ( var_type <= VAR_Counter8 ) |
7311 { | |
7312 if ( (signed int)var_type >= 245 ) | |
7313 { | |
7314 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7315 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7316 } |
7317 else | |
7318 { | |
310 | 7319 switch ( var_type ) |
0 | 7320 { |
7321 case VAR_MonthEquals|VAR_CurrentSP: | |
7322 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7323 break; | |
7324 case VAR_NPCs2: | |
7325 pParty->field_709 = 0; | |
7326 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7327 pParty->CountHirelings(); |
7328 viewparams->bRedrawGameUI = true; | |
0 | 7329 break; |
7330 case VAR_NumSkillPoints: | |
7331 Dst->uSkillPoints += val; | |
7332 break; | |
7333 } | |
7334 } | |
7335 return; | |
7336 } | |
310 | 7337 if ( var_type < VAR_Counter9 ) |
0 | 7338 return; |
310 | 7339 if ( (signed int)var_type <= 274 ) |
7340 { | |
7341 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7342 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7343 goto _play_sound; |
7344 } | |
310 | 7345 if ( var_type != VAR_ReputationInCurrentLocation ) |
7346 { | |
7347 if ( var_type <= VAR_ReputationInCurrentLocation | |
7348 || var_type > VAR_History_28 | |
7349 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7350 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7351 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7352 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7353 v26) ) |
7354 return; | |
7355 bFlashHistoryBook = 1; | |
7356 _play_sound: | |
7357 v28 = 8 * uPlayerIdx + 400; | |
862 | 7358 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7359 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7360 return; | |
7361 } | |
7362 v27 = &pOutdoor->ddm; | |
7363 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7364 v27 = &pIndoor->dlv; | |
7365 v27->uReputation += val; | |
7366 if ( v27->uReputation > 10000 ) | |
7367 v27->uReputation = 10000; | |
7368 } | |
7369 } | |
7370 | |
7371 | |
7372 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7373 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7374 { |
7375 unsigned int v3; // ebx@1 | |
7376 signed int v4; // esi@1 | |
501 | 7377 bool result; // eax@8 |
0 | 7378 int v6; // esi@11 |
7379 int v7; // edi@14 | |
7380 signed int v8; // eax@17 | |
7381 char *v9; // eax@20 | |
7382 char v10; // sf@20 | |
7383 char *v11; // ecx@26 | |
7384 char *v12; // ecx@27 | |
7385 __int64 v13; // qax@27 | |
7386 unsigned __int8 v14; // cf@27 | |
501 | 7387 int *v15; // edx@29 |
0 | 7388 char *v16; // eax@90 |
7389 char *v17; // ecx@94 | |
501 | 7390 int v18; // esi@97 |
0 | 7391 signed int v19; // edx@97 |
7392 char *v20; // ecx@98 | |
7393 int v21; // eax@100 | |
7394 __int16 v22; // dx@112 | |
7395 int v23; // [sp-8h] [bp-14h]@45 | |
7396 signed int v24; // [sp-4h] [bp-10h]@4 | |
7397 int v25; // [sp-4h] [bp-10h]@45 | |
7398 | |
7399 v3 = 0; | |
605 | 7400 v4 = uActiveCharacter - 1; |
501 | 7401 result = false; |
7402 if ( (signed int)VarNum > 222 ) | |
7403 { | |
7404 if ( (signed int)VarNum <= 307 ) | |
7405 { | |
7406 if ( VarNum == 307 ) | |
7407 { | |
7408 pParty->uNumDeaths -= (unsigned int)pValue; | |
7409 return pValue; | |
7410 } | |
7411 if ( VarNum == 223 ) | |
0 | 7412 { |
7413 v11 = (char *)pParty->_autonote_bits; | |
501 | 7414 v22 = (short)pValue - 1; |
0 | 7415 } |
7416 else | |
7417 { | |
501 | 7418 if ( VarNum != 231 ) |
0 | 7419 { |
501 | 7420 switch ( VarNum ) |
0 | 7421 { |
7422 case 232: | |
501 | 7423 VarNum = (VariableType)0; |
1094 | 7424 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7425 result = (bool) pValue; |
7426 dword_5B65CC = 0; | |
7427 if ( (int)VarNum == pValue ) | |
0 | 7428 { |
501 | 7429 dword_5B65CC = (int)pValue; |
0 | 7430 } |
7431 else | |
7432 { | |
7433 pParty->field_709 = 0; | |
501 | 7434 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7435 pParty->CountHirelings(); |
7436 viewparams->bRedrawGameUI = true; | |
0 | 7437 } |
7438 break; | |
7439 case 241: | |
7440 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7441 { | |
7442 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7443 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7444 { |
605 | 7445 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7446 { |
7447 v21 = *(int *)v20; | |
7448 if ( (char)*(int *)v20 < 0 ) | |
7449 { | |
7450 LOBYTE(v21) = v21 & 0x7F; | |
7451 *(int *)v20 = v21; | |
7452 } | |
7453 } | |
7454 v20 += 76; | |
7455 } | |
7456 } | |
605 | 7457 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7458 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7459 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7460 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7461 pParty->field_709 = 0; | |
1035 | 7462 pParty->CountHirelings(); |
0 | 7463 break; |
7464 case 243: | |
7465 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7466 result = *v17 != NULL; |
501 | 7467 if ( (unsigned int)pValue <= *(int *)v17 ) |
7468 { | |
7469 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7470 result = (v17 != NULL); |
501 | 7471 } |
0 | 7472 else |
7473 *(int *)v17 = 0; | |
7474 break; | |
7475 case 275: | |
7476 v16 = (char *)&pOutdoor->ddm; | |
7477 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7478 v16 = (char *)&pIndoor->dlv; | |
501 | 7479 *((int *)v16 + 2) -= (int)pValue; |
0 | 7480 if ( *((int *)v16 + 2) < -10000 ) |
7481 *((int *)v16 + 2) = -10000; | |
7482 break; | |
7483 case 306: | |
501 | 7484 result = VarNum - 306; |
7485 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7486 { | |
7487 result = (bool)pValue; | |
7488 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7489 } |
0 | 7490 else |
7491 LABEL_88: | |
7492 dword_5B65C4 = 1; | |
7493 break; | |
7494 } | |
501 | 7495 return result; |
0 | 7496 } |
7497 v11 = this->field_1A50; | |
501 | 7498 v22 = (signed __int16)pValue; |
0 | 7499 } |
7500 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7501 return result; |
7502 } | |
7503 switch ( VarNum ) | |
0 | 7504 { |
7505 case 308: | |
501 | 7506 result = (bool)pValue; |
7507 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7508 break; |
7509 case 309: | |
501 | 7510 result = (bool)pValue; |
7511 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7512 break; |
7513 case 310: | |
501 | 7514 result = (bool)pValue; |
7515 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7516 break; |
7517 case 311: | |
501 | 7518 result = (bool)pValue; |
7519 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7520 break; |
7521 case 312: | |
501 | 7522 result = (bool)pValue; |
7523 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7524 break; |
7525 case 313: | |
501 | 7526 result = (bool)pValue; |
7527 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7528 break; |
7529 } | |
1545 | 7530 Error("Function not returning any value! (%u)", VarNum); |
0 | 7531 } |
7532 else | |
7533 { | |
501 | 7534 if ( (signed int)VarNum >= 123 ) |
7535 { | |
7536 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7537 } |
7538 else | |
7539 { | |
501 | 7540 switch ( VarNum ) |
0 | 7541 { |
7542 case VAR_RandomGold: | |
501 | 7543 v6 = rand() % (signed int)pValue + 1; |
0 | 7544 if ( v6 > pParty->uNumGold ) |
7545 v6 = pParty->uNumGold; | |
7546 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7547 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7548 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7549 GameUI_DrawFoodAndGold(); |
501 | 7550 return result; |
0 | 7551 case VAR_RandomFood: |
501 | 7552 v7 = rand() % (signed int)pValue + 1; |
0 | 7553 if ( v7 > pParty->uNumFoodRations ) |
7554 v7 = pParty->uNumFoodRations; | |
7555 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7556 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7557 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7558 GameUI_DrawFoodAndGold(); |
605 | 7559 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7560 v8 = 8 * v4 + 400; | |
862 | 7561 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7562 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7563 return result; |
0 | 7564 case VAR_CurrentHP: |
1036 | 7565 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7566 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7567 v8 = 8 * v4 + 400; | |
862 | 7568 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7569 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7570 return result; | |
0 | 7571 case VAR_CurrentSP: |
7572 v9 = (char *)&this->sMana; | |
501 | 7573 v10 = this->sMana - (signed int)pValue < 0; |
7574 *(int *)v9 -= (int)pValue; | |
0 | 7575 if ( v10 ) |
7576 *(int *)v9 = 0; | |
605 | 7577 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7578 v8 = 8 * v4 + 400; | |
862 | 7579 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7580 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7581 return result; | |
0 | 7582 case VAR_ACModifier: |
501 | 7583 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7584 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7585 v8 = 8 * v4 + 400; | |
862 | 7586 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7587 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7588 return result; | |
0 | 7589 case VAR_BaseLevel: |
501 | 7590 this->uLevel -= (unsigned __int8)pValue; |
605 | 7591 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7592 v8 = 8 * v4 + 400; | |
862 | 7593 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7594 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7595 return result; | |
0 | 7596 case VAR_LevelModifier: |
501 | 7597 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7598 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7599 v8 = 8 * v4 + 400; | |
862 | 7600 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7601 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7602 return result; | |
0 | 7603 case VAR_Age: |
501 | 7604 this->sAgeModifier -= (signed __int16)pValue; |
7605 return result; | |
0 | 7606 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7607 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7608 return result; |
0 | 7609 case VAR_Experience: |
7610 v12 = (char *)&this->uExperience; | |
501 | 7611 v13 = (signed int)pValue; |
7612 v14 = *(int *)v12 < (unsigned int)pValue; | |
7613 *(int *)v12 -= (int)pValue; | |
0 | 7614 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7615 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7616 v8 = 8 * v4 + 400; | |
862 | 7617 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7618 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7619 return result; | |
0 | 7620 case VAR_QBits_QuestsDone: |
501 | 7621 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7622 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7623 return true; |
0 | 7624 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7625 v15 = this->pInventoryMatrix; |
0 | 7626 break; |
7627 case VAR_FixedGold: | |
501 | 7628 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7629 goto LABEL_88; |
501 | 7630 Party::TakeGold((unsigned int)pValue); |
7631 return result; | |
0 | 7632 case VAR_MightBonus: |
7633 case VAR_ActualMight: | |
501 | 7634 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7635 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7636 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7637 v8 = 8 * v4 + 400; | |
862 | 7638 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7639 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7640 return result; | |
0 | 7641 case VAR_IntellectBonus: |
7642 case VAR_ActualIntellect: | |
501 | 7643 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7644 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7645 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7646 v8 = 8 * v4 + 400; | |
862 | 7647 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7648 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7649 return result; | |
0 | 7650 case VAR_PersonalityBonus: |
7651 case VAR_ActualPersonality: | |
501 | 7652 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7653 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7654 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7655 v8 = 8 * v4 + 400; | |
862 | 7656 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7657 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7658 return result; | |
0 | 7659 case VAR_EnduranceBonus: |
7660 case VAR_ActualEndurance: | |
501 | 7661 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7662 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7663 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7664 v8 = 8 * v4 + 400; | |
862 | 7665 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7666 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7667 return result; | |
0 | 7668 case VAR_SpeedBonus: |
7669 case VAR_ActualSpeed: | |
501 | 7670 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7671 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7672 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7673 v8 = 8 * v4 + 400; | |
862 | 7674 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7675 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7676 return result; | |
0 | 7677 case VAR_AccuracyBonus: |
7678 case VAR_ActualAccuracy: | |
501 | 7679 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7680 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7681 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7682 v8 = 8 * v4 + 400; | |
862 | 7683 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7684 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7685 return result; | |
0 | 7686 case VAR_LuckBonus: |
7687 case VAR_ActualLuck: | |
501 | 7688 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7689 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 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_BaseMight: |
501 | 7696 this->uMight -= (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_BaseIntellect: |
501 | 7704 this->uIntelligence -= (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_BasePersonality: |
501 | 7712 this->uWillpower -= (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_BaseEndurance: |
501 | 7720 this->uEndurance -= (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_BaseSpeed: |
501 | 7728 this->uSpeed -= (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_BaseAccuracy: |
501 | 7736 this->uAccuracy -= (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_BaseLuck: |
501 | 7744 this->uLuck -= (unsigned __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_FireResistance: |
501 | 7752 this->sResFireBase -= (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_AirResistance: |
501 | 7760 this->sResAirBase -= (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_WaterResistance: |
501 | 7768 this->sResWaterBase -= (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_EarthResistance: |
501 | 7776 this->sResEarthBase -= (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_SpiritResistance: |
501 | 7784 this->sResSpiritBase -= (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_MindResistance: |
501 | 7792 this->sResMindBase -= (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_BodyResistance: |
501 | 7800 this->sResBodyBase -= (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_LightResistance: |
501 | 7808 this->sResLightBase -= (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_DarkResistance: |
501 | 7816 this->sResDarkBase -= (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_MagicResistance: |
501 | 7824 this->sResMagicBase -= (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_FireResistanceBonus: |
501 | 7832 this->sResFireBonus -= (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_AirResistanceBonus: |
501 | 7840 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7841 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_WaterResistanceBonus: |
501 | 7848 this->sResWaterBonus -= (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_EarthResistanceBonus: |
501 | 7856 this->sResEarthBonus -= (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_SpiritResistanceBonus: |
501 | 7864 this->sResSpiritBonus -= (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_MindResistanceBonus: |
501 | 7872 this->sResMindBonus -= (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_BodyResistanceBonus: |
501 | 7880 this->sResBodyBonus -= (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_LightResistanceBonus: |
501 | 7888 this->sResLightBonus -= (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_DarkResistanceBonus: |
501 | 7896 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7897 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7898 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7899 v8 = 8 * v4 + 400; | |
862 | 7900 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7901 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7902 return result; | |
0 | 7903 case VAR_MagicResistanceBonus: |
501 | 7904 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7905 v25 = 0; |
187 | 7906 v23 = SPEECH_91; |
7907 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7908 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7909 v8 = 8 * v4 + 400; | |
862 | 7910 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7911 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7912 return result; | |
0 | 7913 case VAR_FixedFood: |
501 | 7914 Party::TakeFood((unsigned int)pValue); |
605 | 7915 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7916 v8 = 8 * v4 + 400; | |
862 | 7917 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7918 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7919 return result; | |
0 | 7920 case VAR_StaffSkill: |
7921 case VAR_SwordSkill: | |
7922 case VAR_DaggerSkill: | |
7923 case VAR_AxeSkill: | |
7924 case VAR_SpearSkill: | |
7925 case VAR_BowSkill: | |
7926 case VAR_MaceSkill: | |
7927 case VAR_BlasterSkill: | |
7928 case VAR_ShieldSkill: | |
7929 case VAR_LeatherSkill: | |
7930 case VAR_SkillChain: | |
7931 case VAR_PlateSkill: | |
7932 case VAR_FireSkill: | |
7933 case VAR_AirSkill: | |
7934 case VAR_WaterSkill: | |
7935 case VAR_EarthSkill: | |
7936 case VAR_SpiritSkill: | |
7937 case VAR_MindSkill: | |
7938 case VAR_BodySkill: | |
7939 case VAR_LightSkill: | |
7940 case VAR_DarkSkill: | |
7941 case VAR_IdentifyItemSkill: | |
7942 case VAR_MerchantSkill: | |
7943 case VAR_RepairSkill: | |
7944 case VAR_BodybuildingSkill: | |
7945 case VAR_MeditationSkill: | |
7946 case VAR_PerceptionSkill: | |
7947 case VAR_DiplomacySkill: | |
7948 case VAR_DisarmTrapSkill: | |
7949 case VAR_LearningSkill: | |
501 | 7950 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 7951 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7952 v8 = 8 * v4 + 400; | |
862 | 7953 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7954 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7955 return result; | |
0 | 7956 case VAR_Cursed: |
7957 case VAR_Weak: | |
7958 case VAR_Asleep: | |
7959 case VAR_Afraid: | |
7960 case VAR_Drunk: | |
7961 case VAR_Insane: | |
7962 case VAR_PoisonedGreen: | |
7963 case VAR_DiseasedGreen: | |
7964 case VAR_PoisonedYellow: | |
7965 case VAR_DiseasedYellow: | |
7966 case VAR_PoisonedRed: | |
7967 case VAR_DiseasedRed: | |
7968 case VAR_Paralyzed: | |
7969 case VAR_Unconsious: | |
7970 case VAR_Dead: | |
7971 case VAR_Stoned: | |
7972 case VAR_Eradicated: | |
1071 | 7973 //*((int *)this + 2 * VarNum - 210) = 0; |
7974 //*((int *)this + 2 * result - 209) = 0; | |
7975 this->pConditions[VarNum] = 0; | |
0 | 7976 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7977 v8 = 8 * v4 + 400; | |
862 | 7978 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 7979 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7980 return result; |
605 | 7981 default: |
7982 return result; | |
7983 } | |
7984 for (v3 = 1; v3 < 126; v3++) | |
7985 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7986 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 7987 { |
605 | 7988 RemoveItemAtInventoryIndex(v3); |
501 | 7989 return true; |
0 | 7990 } |
605 | 7991 } |
501 | 7992 if ( pParty->pPickedItem.uItemID == pValue ) |
7993 { | |
605 | 7994 pMouse->RemoveHoldingItem(); |
7995 return true; | |
7996 } | |
7997 return false; | |
0 | 7998 } |
7999 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8000 |
1430 | 8001 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8002 return false; |
0 | 8003 } |
8004 // 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
|
8005 // 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
|
8006 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8007 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8008 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8009 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
|
8010 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8011 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8012 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8013 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8014 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8015 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8016 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8017 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8018 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
|
8019 //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
|
8020 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
|
8021 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
|
8022 |
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 _this.Reset(); |
1374 | 8025 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8026 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8027 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8028 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8029 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8030 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8031 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8032 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8033 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
|
8034 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8035 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8036 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8037 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8038 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8039 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8040 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8041 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8042 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8043 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8044 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8045 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8046 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8047 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
|
8048 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8049 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8050 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8051 } |
1295 | 8052 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8053 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8054 |
1295 | 8055 //----- (0049387A) -------------------------------------------------------- |
1459 | 8056 int CycleCharacter(bool backwards) |
1295 | 8057 { |
8058 signed int result; // eax@1 | |
8059 signed int v2; // ecx@2 | |
8060 signed int v3; // ecx@8 | |
8061 | |
8062 result = uActiveCharacter; | |
1459 | 8063 if ( backwards ) |
1295 | 8064 { |
8065 v2 = 0; | |
8066 while ( 1 ) | |
8067 { | |
8068 --result; | |
8069 if ( result < 1 ) | |
8070 result = 4; | |
8071 if ( !pPlayers[result]->uTimeToRecovery ) | |
8072 break; | |
8073 ++v2; | |
8074 if ( v2 >= 4 ) | |
8075 return uActiveCharacter; | |
8076 } | |
8077 } | |
8078 else | |
8079 { | |
8080 v3 = 0; | |
8081 while ( 1 ) | |
8082 { | |
8083 ++result; | |
8084 if ( result > 4 ) | |
8085 result = 1; | |
8086 if ( !pPlayers[result]->uTimeToRecovery ) | |
8087 break; | |
8088 ++v3; | |
8089 if ( v3 >= 4 ) | |
8090 return uActiveCharacter; | |
8091 } | |
8092 } | |
8093 return result; | |
1297 | 8094 } |
8095 //----- (0043EE77) -------------------------------------------------------- | |
8096 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8097 { | |
8098 bool result; // eax@0 | |
8099 Player *v2; // edx@3 | |
8100 int v3; // ecx@3 | |
8101 Player **pPlayers; // esi@8 | |
1424 | 8102 //bool item_flag; |
1297 | 8103 Player *v6; // edx@9 |
8104 | |
1424 | 8105 //if ( a1 < 1 || a1 > 4 ) |
8106 //{ | |
8107 //if ( !a1 ) | |
8108 //{ | |
8109 //pPlayers = &::pPlayers[1]; | |
8110 //v5 = 604; | |
8111 //while ( 1 ) | |
1545 | 8112 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8113 for ( uint i = 1; i < 5; ++i ) |
1424 | 8114 { |
8115 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8116 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8117 return false; | |
8118 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8119 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8120 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8121 return false; | |
8122 //result *= 9; | |
1432 | 8123 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8124 return false; |
8125 //++pPlayers; | |
8126 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8127 //return true; | |
8128 } | |
8129 return true; | |
8130 } | |
1432 | 8131 |
1297 | 8132 //----- (0043EE15) -------------------------------------------------------- |
8133 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8134 { | |
8135 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8136 { | |
8137 for ( uint i = 0; i < 126; ++i ) | |
8138 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8139 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8140 { |
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->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8142 return true; |
8143 } | |
8144 } | |
8145 for ( uint i = 0; i < 16; ++i ) | |
8146 { | |
8147 if ( pPlayer->pEquipment.pIndices[i] ) | |
8148 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8149 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8150 return true; |
8151 } | |
8152 } | |
8153 } | |
8154 return false; | |
8155 } | |
8156 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8157 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8158 { |
8159 unsigned int pNum; // ebp@1 | |
8160 Player **pPlayer; // ebx@1 | |
8161 Player *pPlayer2; // esi@2 | |
8162 enum CHARACTER_RACE pRace; // edi@2 | |
8163 bool pSex; // eax@2 | |
8164 char v6; // zf@7 | |
8165 | |
8166 //pPlayer = &pPlayers[1]; | |
8167 /*pNum = a1; | |
8168 | |
8169 while ( 1 ) | |
8170 { | |
8171 pPlayer2 = *pPlayer; | |
8172 pRace = pPlayer2->GetRace(); | |
8173 pSex = pPlayer2->GetSexByVoice(); | |
8174 if ( !pRace ) | |
8175 break; | |
8176 if ( pRace == 1 || pRace == 2 ) | |
8177 break; | |
8178 if ( !pSex && pNum == 2 )// | |
8179 //goto LABEL_15; | |
8180 { | |
8181 pSex = 1; | |
8182 return pSex; | |
8183 } | |
8184 v6 = pNum == 3;// | |
8185 LABEL_11: | |
8186 if ( v6 ) | |
8187 //goto LABEL_15; | |
8188 { | |
8189 pSex = 1; | |
8190 return pSex; | |
8191 } | |
8192 ++pPlayer; | |
8193 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8194 { | |
8195 pSex = 0; | |
8196 return pSex; | |
8197 } | |
8198 } | |
8199 if ( pSex || pNum ) | |
8200 { | |
8201 v6 = pNum == 1; | |
8202 goto LABEL_11; | |
8203 } | |
8204 //LABEL_15: | |
8205 pSex = 1; | |
8206 return pSex;*/ | |
8207 for (uint i = 1; i <= 4; ++i) | |
8208 { | |
8209 pRace = pPlayers[i]->GetRace(); | |
8210 pSex = pPlayers[i]->GetSexByVoice(); | |
8211 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8212 return 1; | |
8213 } | |
8214 return 0; | |
8215 } | |
8216 //----- (0043ED6F) -------------------------------------------------------- | |
8217 bool _43ED6F_check_party_races(bool a1) | |
8218 { | |
8219 bool v6; // zf@5 | |
8220 | |
8221 for (uint i = 0; i < 4; ++i) | |
8222 { | |
8223 auto player = pParty->pPlayers + i; | |
8224 auto race = player->GetRace(); | |
8225 | |
8226 if (race != CHARACTER_RACE_HUMAN && | |
8227 race != CHARACTER_RACE_ELF && | |
8228 race != CHARACTER_RACE_GOBLIN) | |
8229 v6 = a1 == 1; | |
8230 else | |
8231 v6 = !a1; | |
8232 | |
8233 if (v6) | |
8234 return true; | |
8235 } | |
8236 return false; | |
8237 } | |
8238 //----- (00439FCB) -------------------------------------------------------- | |
8239 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8240 { | |
8241 signed int v4; // esi@1 | |
8242 unsigned int v5; // ecx@1 | |
8243 Player *v6; // ebx@3 | |
8244 Actor *v7; // esi@3 | |
8245 unsigned int v8; // eax@4 | |
8246 char *v9; // eax@5 | |
8247 signed int v10; // eax@6 | |
8248 int v11; // edx@8 | |
8249 int v12; // edx@9 | |
8250 int v13; // edx@10 | |
8251 int v14; // edx@16 | |
8252 int v15; // edx@17 | |
8253 int v16; // edx@18 | |
8254 enum SoundID v17; // eax@24 | |
8255 int v18; // eax@26 | |
8256 unsigned __int8 v19; // zf@26 | |
8257 unsigned __int8 v20; // sf@26 | |
8258 unsigned __int16 v21; // ax@29 | |
8259 signed int v22; // edi@36 | |
8260 int v23; // eax@38 | |
8261 signed int v24; // eax@44 | |
8262 unsigned __int16 v25; // cx@47 | |
8263 signed int v26; // eax@49 | |
8264 int v27; // eax@54 | |
8265 float v28; // ST18_4@58 | |
8266 double v29; // st7@58 | |
8267 float v30; // ST08_4@58 | |
8268 double v31; // st7@58 | |
8269 float v32; // ST04_4@58 | |
8270 float v33; // ST00_4@58 | |
8271 int v34; // edi@61 | |
8272 int v35; // eax@70 | |
8273 double v36; // st7@70 | |
8274 SpriteObject *v37; // ebx@77 | |
8275 int v38; // edi@77 | |
8276 int v39; // esi@77 | |
8277 int v40; // eax@77 | |
8278 int v41; // eax@77 | |
8279 int v42; // eax@78 | |
8280 Player *v43; // eax@81 | |
8281 Actor *v44; // esi@82 | |
8282 Player *v45; // edi@84 | |
8283 unsigned __int16 v46; // ax@84 | |
8284 int v47; // ebx@105 | |
8285 int v48; // eax@107 | |
8286 unsigned __int16 v49; // ax@116 | |
8287 int v50; // ebx@123 | |
8288 unsigned __int16 v51; // ax@124 | |
8289 char v52; // bl@124 | |
8290 int v53; // eax@128 | |
8291 signed int v54; // eax@134 | |
8292 unsigned __int16 v55; // cx@137 | |
8293 signed int v56; // eax@139 | |
8294 int v57; // eax@144 | |
8295 float v58; // ST18_4@148 | |
8296 double v59; // st7@148 | |
8297 float v60; // ST08_4@148 | |
8298 double v61; // st7@148 | |
8299 float v62; // ST04_4@148 | |
8300 float v63; // ST00_4@148 | |
8301 int v64; // ebx@151 | |
8302 int v65; // eax@161 | |
8303 double v66; // st7@161 | |
8304 signed int v67; // ecx@164 | |
8305 signed int v68; // eax@170 | |
8306 int v69; // ecx@170 | |
8307 int v70; // eax@171 | |
8308 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8309 int v72; // [sp+30h] [bp-24h]@164 | |
8310 double v73; // [sp+40h] [bp-14h]@72 | |
8311 signed int v74; // [sp+44h] [bp-10h]@1 | |
8312 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8313 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8314 int v77; // [sp+50h] [bp-4h]@26 | |
8315 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8316 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8317 | |
8318 v4 = PID_ID(uObjID); | |
8319 v5 = PID_TYPE(uObjID) - 2; | |
8320 v74 = a2; | |
8321 uActorID = v4; | |
8322 if ( v5 ) | |
8323 { | |
8324 if ( v5 != 1 | |
8325 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8326 v75 = v6->sHealth, | |
8327 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8328 return; | |
8329 v8 = v6->pEquipment.uArmor; | |
8330 if ( !v8 | |
8331 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8332 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8333 || v10 > 11 ) | |
8334 { | |
8335 v14 = rand() % 4; | |
8336 if ( !v14 ) | |
8337 { | |
8338 v71 = (SoundID)108; | |
8339 goto LABEL_24; | |
8340 } | |
8341 v15 = v14 - 1; | |
8342 if ( !v15 ) | |
8343 { | |
8344 v71 = (SoundID)109; | |
8345 goto LABEL_24; | |
8346 } | |
8347 v16 = v15 - 1; | |
8348 if ( !v16 ) | |
8349 { | |
8350 v71 = (SoundID)110; | |
8351 goto LABEL_24; | |
8352 } | |
8353 if ( v16 == 1 ) | |
8354 { | |
8355 v71 = (SoundID)44; | |
8356 goto LABEL_24; | |
8357 } | |
8358 } | |
8359 else | |
8360 { | |
8361 v11 = rand() % 4; | |
8362 if ( !v11 ) | |
8363 { | |
8364 v71 = (SoundID)105; | |
8365 goto LABEL_24; | |
8366 } | |
8367 v12 = v11 - 1; | |
8368 if ( !v12 ) | |
8369 { | |
8370 v71 = (SoundID)106; | |
8371 goto LABEL_24; | |
8372 } | |
8373 v13 = v12 - 1; | |
8374 if ( !v13 ) | |
8375 { | |
8376 v71 = (SoundID)107; | |
8377 goto LABEL_24; | |
8378 } | |
8379 if ( v13 == 1 ) | |
8380 { | |
8381 v71 = (SoundID)45; | |
8382 LABEL_24: | |
8383 v17 = v71; | |
8384 goto LABEL_26; | |
8385 } | |
8386 } | |
8387 v17 = (SoundID)a4; | |
8388 LABEL_26: | |
8389 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8390 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8391 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8392 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8393 v77 = v18; | |
8394 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8395 { | |
8396 v21 = v7->pActorBuffs[3].uPower; | |
8397 if ( v21 ) | |
8398 v77 /= (signed int)v21; | |
8399 } | |
8400 if ( v74 ) | |
8401 { | |
8402 if ( v74 == 1 ) | |
8403 { | |
8404 v22 = v7->pMonsterInfo.uAttack2Type; | |
8405 } | |
8406 else | |
8407 { | |
8408 if ( v74 == 2 ) | |
8409 { | |
8410 v23 = v7->pMonsterInfo.uSpell1ID; | |
8411 } | |
8412 else | |
8413 { | |
8414 if ( v74 != 3 ) | |
8415 { | |
8416 if ( v74 == 4 ) | |
8417 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8418 else | |
8419 v22 = 4; | |
8420 goto LABEL_43; | |
8421 } | |
8422 v23 = v7->pMonsterInfo.uSpell2ID; | |
8423 } | |
8424 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8425 } | |
8426 } | |
8427 else | |
8428 { | |
8429 v22 = v7->pMonsterInfo.uAttack1Type; | |
8430 } | |
8431 LABEL_43: | |
8432 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8433 { | |
8434 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8435 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8436 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8437 { | |
8438 v25 = v7->uAIState; | |
8439 if ( v25 != 5 ) | |
8440 { | |
8441 if ( v25 != 4 ) | |
8442 { | |
8443 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8444 v7->sCurrentHP -= v26; | |
8445 if ( v26 ) | |
8446 { | |
8447 if ( v7->sCurrentHP >= 1 ) | |
8448 { | |
8449 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8450 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8451 } | |
8452 else | |
8453 { | |
8454 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8455 { | |
8456 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8457 v74 = v27; | |
8458 if ( pRenderer->pRenderD3D ) | |
8459 { | |
8460 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8461 { | |
8462 v28 = (double)v74; | |
8463 v74 = v7->vPosition.z; | |
8464 v29 = (double)v74; | |
8465 v74 = v7->vPosition.y; | |
8466 v30 = v29; | |
8467 v31 = (double)v74; | |
8468 v74 = v7->vPosition.x; | |
8469 v32 = v31; | |
8470 v33 = (double)v74; | |
8471 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8472 } | |
8473 } | |
8474 } | |
8475 Actor::Die(uActorID); | |
8476 Actor::ApplyFineForKillingPeasant(uActorID); | |
8477 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8478 if ( v7->pMonsterInfo.uExp ) | |
8479 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8480 v34 = SPEECH_51; | |
8481 if ( rand() % 100 < 20 ) | |
8482 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8483 v6->PlaySound((PlayerSpeech)v34, 0); | |
8484 } | |
8485 } | |
8486 } | |
8487 } | |
8488 } | |
8489 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8490 && v7->pMonsterInfo.uSpecialAttack | |
8491 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8492 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8493 } | |
8494 if ( !pParty->bTurnBasedModeOn ) | |
8495 { | |
8496 v35 = v6->GetActualEndurance(); | |
8497 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8498 v6->SetRecoveryTime((signed __int64)v36); | |
8499 } | |
8500 if ( v77 ) | |
8501 { | |
8502 v73 = (double)(signed int)v75; | |
8503 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8504 { | |
8505 if ( v6->sHealth > 0 ) | |
8506 { | |
8507 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8508 v6->PlaySound(SPEECH_48, 0); | |
8509 } | |
8510 } | |
8511 } | |
8512 viewparams->bRedrawGameUI = 1; | |
8513 return; | |
8514 } | |
8515 v37 = &pSpriteObjects[uActorID]; | |
8516 v38 = PID_TYPE(v37->spell_caster_pid); | |
8517 v39 = PID_ID(v37->spell_caster_pid); | |
8518 v40 = PID_TYPE(v37->spell_caster_pid); | |
8519 uActorID = PID_ID(v37->spell_caster_pid); | |
8520 v41 = v40 - 2; | |
8521 if ( !v41 ) | |
8522 goto LABEL_80; | |
8523 v42 = v41 - 1; | |
8524 if ( !v42 ) | |
8525 { | |
8526 v44 = &pActors[v39]; | |
8527 if ( a4 == -1 ) | |
8528 a4 = stru_50C198.which_player_would_attack(v44); | |
8529 v45 = &pParty->pPlayers[a4]; | |
8530 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8531 v46 = v37->uType; | |
8532 if ( v37->uType == 545 ) | |
8533 { | |
8534 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8535 v52 = v51; | |
8536 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8537 { | |
8538 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8539 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8540 v45->PlaySound(SPEECH_6, 0); | |
8541 return; | |
8542 } | |
8543 } | |
8544 else | |
8545 { | |
8546 if ( v46 != 555 | |
8547 && v46 != 510 | |
8548 && v46 != 500 | |
8549 && v46 != 515 | |
8550 && v46 != 505 | |
8551 && v46 != 530 | |
8552 && v46 != 525 | |
8553 && v46 != 520 | |
8554 && v46 != 535 | |
8555 && v46 != 540 ) | |
8556 goto LABEL_115; | |
8557 } | |
8558 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8559 return; | |
8560 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8561 v77 >>= 1; | |
8562 if ( v45->HasEnchantedItemEquipped(36) ) | |
8563 v77 >>= 1; | |
8564 if ( v45->HasEnchantedItemEquipped(69) ) | |
8565 v77 >>= 1; | |
8566 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8567 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8568 v77 >>= 1; |
8569 v75 = 0; | |
8570 v47 = (int)&v45->pEquipment; | |
8571 do | |
8572 { | |
8573 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8574 { | |
8575 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8576 if ( v48 == 520 ) | |
8577 v77 >>= 1; | |
8578 if ( v48 == 531 ) | |
8579 v77 >>= 1; | |
8580 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8581 v77 >>= 1; | |
8582 } | |
8583 ++v75; | |
8584 v47 += 4; | |
8585 } | |
8586 while ( (signed int)v75 <= 1 ); | |
8587 LABEL_115: | |
8588 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8589 { | |
8590 v49 = v44->pActorBuffs[3].uPower; | |
8591 if ( v49 ) | |
8592 v77 /= (signed int)v49; | |
8593 } | |
8594 if ( !v74 ) | |
8595 { | |
8596 v50 = v44->pMonsterInfo.uAttack1Type; | |
8597 goto LABEL_133; | |
8598 } | |
8599 if ( v74 == 1 ) | |
8600 { | |
8601 v50 = v44->pMonsterInfo.uAttack2Type; | |
8602 goto LABEL_133; | |
8603 } | |
8604 if ( v74 == 2 ) | |
8605 { | |
8606 v53 = v44->pMonsterInfo.uSpell1ID; | |
8607 } | |
8608 else | |
8609 { | |
8610 if ( v74 != 3 ) | |
8611 { | |
8612 if ( v74 == 4 ) | |
8613 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8614 else | |
8615 v50 = 4; | |
8616 LABEL_133: | |
8617 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8618 { | |
8619 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8620 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8621 { | |
8622 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8623 { | |
8624 v55 = v44->uAIState; | |
8625 if ( v55 != 5 ) | |
8626 { | |
8627 if ( v55 != 4 ) | |
8628 { | |
8629 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8630 v44->sCurrentHP -= v56; | |
8631 if ( v56 ) | |
8632 { | |
8633 if ( v44->sCurrentHP >= 1 ) | |
8634 { | |
8635 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8636 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8637 } | |
8638 else | |
8639 { | |
8640 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8641 { | |
8642 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8643 v75 = v57; | |
8644 if ( pRenderer->pRenderD3D ) | |
8645 { | |
8646 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8647 { | |
8648 v58 = (double)(signed int)v75; | |
8649 v75 = v44->vPosition.z; | |
8650 v59 = (double)(signed int)v75; | |
8651 v75 = v44->vPosition.y; | |
8652 v60 = v59; | |
8653 v61 = (double)(signed int)v75; | |
8654 v75 = v44->vPosition.x; | |
8655 v62 = v61; | |
8656 v63 = (double)(signed int)v75; | |
8657 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8658 } | |
8659 } | |
8660 } | |
8661 Actor::Die(uActorID); | |
8662 Actor::ApplyFineForKillingPeasant(uActorID); | |
8663 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8664 if ( v44->pMonsterInfo.uExp ) | |
8665 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8666 v64 = SPEECH_51; | |
8667 if ( rand() % 100 < 20 ) | |
8668 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8669 v45->PlaySound((PlayerSpeech)v64, 0); | |
8670 } | |
8671 } | |
8672 } | |
8673 } | |
8674 } | |
8675 } | |
8676 } | |
8677 if ( !v74 | |
8678 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8679 && v44->pMonsterInfo.uSpecialAttack | |
8680 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8681 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8682 if ( !pParty->bTurnBasedModeOn ) | |
8683 { | |
8684 v65 = v45->GetActualEndurance(); | |
8685 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8686 * flt_6BE3A4_debug_recmod1 | |
8687 * 2.133333333333333; | |
8688 v45->SetRecoveryTime((signed __int64)v66); | |
8689 } | |
8690 return; | |
8691 } | |
8692 v53 = v44->pMonsterInfo.uSpell2ID; | |
8693 } | |
8694 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8695 goto LABEL_133; | |
8696 } | |
8697 if ( v42 != 1 ) | |
8698 return; | |
8699 LABEL_80: | |
8700 if ( a4 != -1 ) | |
8701 { | |
8702 v43 = &pParty->pPlayers[a4]; | |
8703 LABEL_168: | |
8704 a4b = v43; | |
8705 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8706 { | |
8707 v70 = v43->GetMaxHealth(); | |
8708 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8709 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8710 } | |
8711 else | |
8712 { | |
8713 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8714 v69 = 0; | |
8715 } | |
8716 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8717 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8718 { | |
8719 qword_A750D8 = 256i64; | |
1406 | 8720 PlayerSpeechID = SPEECH_44; |
1407 | 8721 uSpeakingCharacter = uActorID + 1; |
1297 | 8722 } |
8723 return; | |
8724 } | |
8725 v74 = 0; | |
8726 a4a = 1; | |
8727 do | |
8728 { | |
8729 if ( pPlayers[a4a]->CanAct() ) | |
8730 { | |
8731 v67 = v74++; | |
8732 *(&v72 + v67) = a4a; | |
8733 } | |
8734 ++a4a; | |
8735 } | |
8736 while ( a4a <= 4 ); | |
8737 if ( v74 ) | |
8738 { | |
8739 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8740 goto LABEL_168; | |
8741 } | |
8742 } | |
8743 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8744 void OnInventoryLeftClick() |
1297 | 8745 { |
8746 Player *v0; // ebx@1 | |
8747 signed int v1; // eax@2 | |
8748 signed int v2; // ecx@2 | |
8749 int v3; // eax@2 | |
8750 char v4; // sf@2 | |
8751 int v5; // eax@2 | |
8752 unsigned int v6; // eax@7 | |
8753 unsigned int v7; // esi@12 | |
8754 unsigned int v8; // eax@12 | |
8755 unsigned int v9; // eax@16 | |
8756 unsigned int v10; // eax@18 | |
8757 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8758 POINT a2; // [sp+30h] [bp-18h]@4 | |
8759 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8760 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8761 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8762 int a4; // [sp+44h] [bp-4h]@2 | |
8763 | |
8764 v0 = pPlayers[uActiveCharacter]; | |
8765 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8766 { | |
8767 pMouse->GetClickPos(&pX, &pY); | |
8768 pY = pY - 17; | |
8769 v2 =pX - 14; | |
8770 pX = v2; | |
8771 v3 = 14 * (pY >> 5); | |
8772 v2 >>= 5; | |
8773 v4 = v2 + v3 < 0; | |
8774 v5 = v2 + v3; | |
8775 a4 = v5; | |
8776 if ( !v4 ) | |
8777 { | |
8778 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8779 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8780 { | |
8781 if ( unk_50C9A0 ) | |
8782 { | |
8783 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8784 if ( v6 ) | |
8785 { | |
8786 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8787 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8788 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8789 *((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
|
8790 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8791 unk_50C9A0 = 0; |
8792 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8793 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8794 pMouse->SetCursorBitmap("MICON1"); | |
8795 dword_50C9D0 = 113; | |
8796 dword_50C9D4 = 0; | |
8797 dword_50C9D8 = 256; | |
8798 } | |
8799 return; | |
8800 } | |
8801 if ( ptr_50C9A4 ) | |
8802 return; | |
8803 v7 = pParty->pPickedItem.uItemID; | |
8804 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8805 if ( !v7 ) | |
8806 { | |
8807 if ( !v8 ) | |
8808 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8809 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8810 v0->RemoveItemAtInventoryIndex(a4); |
8811 v9 = pParty->pPickedItem.uItemID; | |
8812 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8813 return; | |
8814 } | |
8815 v13 = v8; | |
8816 if ( v8 ) | |
8817 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8818 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8819 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8820 v0->RemoveItemAtInventoryIndex(a4); | |
8821 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8822 if ( !pX ) | |
8823 { | |
8824 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8825 if ( !pX ) | |
8826 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8827 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8828 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8829 return; | |
8830 } | |
8831 } | |
8832 v9 = this_.uItemID; | |
8833 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8834 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8835 return; | |
8836 } | |
8837 v10 = v0->AddItem(a4, v7); | |
8838 pX = v10; | |
8839 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8840 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8841 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8842 pMouse->RemoveHoldingItem(); |
8843 } | |
8844 } | |
8845 } | |
8846 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8847 } |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8850 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8851 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8852 return pConditions[Condition_Weak] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8855 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8856 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8857 return pConditions[Condition_Dead] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8860 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8861 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8862 return pConditions[Condition_Eradicated] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8865 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8866 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8867 return pConditions[Condition_Zombie] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8870 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8871 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8872 return pConditions[Condition_Cursed] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8875 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8876 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8877 return pConditions[Condition_Pertified] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8878 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8879 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8880 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8881 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8882 return pConditions[Condition_Unconcious] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8883 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8884 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8885 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8886 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8887 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8888 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8889 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8890 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8891 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8892 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8893 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8894 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8895 void Player::SetCursed( bool state ) |
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 pConditions[Condition_Cursed] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8900 void Player::SetWeak( bool state ) |
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 pConditions[Condition_Weak] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8905 void Player::SetAsleep( bool state ) |
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 pConditions[Condition_Sleep] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8910 void Player::SetAfraid( bool state ) |
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 pConditions[Condition_Fear] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8915 void Player::SetDrunk( bool state ) |
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 pConditions[Condition_Drunk] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8920 void Player::SetInsane( bool state ) |
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 pConditions[Condition_Insane] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8925 void Player::SetPoison1( bool state ) |
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 pConditions[Condition_Poison1] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8930 void Player::SetDisease1( bool state ) |
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 pConditions[Condition_Disease1] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8935 void Player::SetPoison2( bool state ) |
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 pConditions[Condition_Poison2] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8940 void Player::SetDisease2( bool state ) |
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 pConditions[Condition_Disease2] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8945 void Player::SetPoison3( bool state ) |
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 pConditions[Condition_Poison3] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8950 void Player::SetDisease3( bool state ) |
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 pConditions[Condition_Disease3] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8955 void Player::SetParalyzed( bool state ) |
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 pConditions[Condition_Paralyzed] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8960 void Player::SetUnconcious( bool state ) |
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 pConditions[Condition_Unconcious] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8965 void Player::SetDead( bool state ) |
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 pConditions[Condition_Dead] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8970 void Player::SetPertified( bool state ) |
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 pConditions[Condition_Pertified] = 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8975 void Player::SetEradicated( bool state ) |
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 pConditions[Condition_Eradicated] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8980 void Player::SetZombie( bool state ) |
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 pConditions[Condition_Zombie] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8985 void Player::SetCondWeakWithBlockCheck( int blockable ) |
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 SetCondition(Condition_Weak, 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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8990 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8991 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8992 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8993 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8994 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8995 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8996 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8997 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8998 } |