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