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