Mercurial > mm7
annotate Player.cpp @ 1554:e303d8a9bcdc
Merge
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 21:14:48 +0200 |
parents | b98812ead5d9 c4ab816fcc5e |
children | 9c4cf5b07e98 |
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); |
1545 | 343 Assert (price > 0); |
749 | 344 |
345 if (price < uRealValue) | |
346 price = uRealValue; | |
347 return price; | |
0 | 348 } |
349 | |
350 //----- (004B8179) -------------------------------------------------------- | |
916 | 351 int Player::GetPriceIdentification(float a2) |
0 | 352 { |
353 signed int v2; // esi@1 | |
354 int v3; // ecx@1 | |
355 signed int result; // eax@3 | |
356 | |
1275 | 357 v2 = (signed int)(a2 * 50.0); |
0 | 358 v3 = v2 * (100 - GetMerchant()) / 100; |
359 if ( v3 < v2 / 3 ) | |
360 v3 = v2 / 3; | |
361 result = 1; | |
362 if ( v3 >= 1 ) | |
363 result = v3; | |
364 return result; | |
365 } | |
366 | |
367 //----- (004B81C3) -------------------------------------------------------- | |
916 | 368 int Player::GetPriceRepair(int a2, float a3) |
0 | 369 { |
370 signed int v3; // esi@1 | |
371 int v4; // ecx@1 | |
372 signed int result; // eax@3 | |
373 | |
1275 | 374 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 375 v4 = v3 * (100 - GetMerchant()) / 100; |
376 if ( v4 < v3 / 3 ) | |
377 v4 = v3 / 3; | |
378 result = 1; | |
379 if ( v4 >= 1 ) | |
380 result = v4; | |
381 return result; | |
382 } | |
383 | |
384 //----- (004B8213) -------------------------------------------------------- | |
1275 | 385 int Player::GetBaseSellingPrice(int a2, float a3) |
386 { | |
387 signed int v3; // qax@1 | |
388 | |
389 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
390 if ( v3 < 1 ) | |
391 v3 = 1; | |
0 | 392 return v3; |
393 } | |
394 | |
395 //----- (004B8233) -------------------------------------------------------- | |
1275 | 396 int Player::GetBaseBuyingPrice(int a2, float a3) |
397 { | |
398 signed int v3; // qax@1 | |
399 | |
400 v3 = (signed int)((double)a2 * a3); | |
401 if ( v3 < 1 ) | |
402 v3 = 1; | |
0 | 403 return v3; |
404 } | |
405 | |
406 //----- (004B824B) -------------------------------------------------------- | |
1275 | 407 int Player::GetBaseIdentifyPrice(float a2) |
408 { | |
409 signed int v2; // qax@1 | |
410 | |
411 v2 = (signed int)(a2 * 50.0); | |
412 if ( v2 < 1 ) | |
413 v2 = 1; | |
0 | 414 return v2; |
415 } | |
416 | |
417 //----- (004B8265) -------------------------------------------------------- | |
1275 | 418 int Player::GetBaseRepairPrice(int a2, float a3) |
419 { | |
420 signed int v3; // qax@1 | |
421 | |
422 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
423 if ( v3 < 1 ) | |
424 v3 = 1; | |
0 | 425 return v3; |
426 } | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 433 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
434 { |
0 | 435 signed int v2; // eax@1 |
336 | 436 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 437 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
438 { | |
439 return false; | |
440 } | |
441 else | |
442 { | |
443 if (GetMajorConditionIdx() == Condition_Zombie) | |
444 { | |
445 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
446 { | |
447 return false; | |
448 } | |
449 else | |
450 { | |
451 return true; | |
452 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
453 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
454 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
455 { |
1348 | 456 return true; |
457 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
458 } |
0 | 459 } |
460 | |
461 | |
462 | |
463 //----- (00421E75) -------------------------------------------------------- | |
1012 | 464 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
465 { | |
466 int item_idx; // eax@1 | |
467 int inv_index; // eax@3 | |
468 | |
1351 | 469 |
1012 | 470 item_idx = *pitem_index; |
471 if ( item_idx >125 || item_idx < 0 ) | |
472 { | |
473 return 0; | |
474 } | |
475 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
476 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 477 if ( inv_index < 0 ) |
478 { | |
479 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
480 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 481 } |
482 | |
483 return inv_index; | |
0 | 484 } |
485 | |
486 | |
487 | |
488 //----- (004160CA) -------------------------------------------------------- | |
1012 | 489 void Player::ItemsEnchant( int enchant_count ) |
490 { | |
491 int avalible_items; // ebx@1 | |
492 int i; // edx@8 | |
493 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
494 | |
495 avalible_items = 0; | |
496 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
497 | |
1349 | 498 for (i = 0; i < 138; ++i) |
499 { | |
500 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
501 item_index_tabl[avalible_items++] = i; | |
502 } | |
1012 | 503 |
504 if ( avalible_items ) | |
505 { | |
506 if ( enchant_count ) | |
507 { | |
1349 | 508 for ( i = 0; i < enchant_count; ++i ) |
509 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
510 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
|
511 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 512 } |
0 | 513 } |
514 else | |
515 { | |
1012 | 516 for ( i = 0; i < avalible_items; ++i ) |
517 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
518 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 519 } |
520 } | |
521 } | |
0 | 522 } |
523 | |
524 //----- (004948B1) -------------------------------------------------------- | |
187 | 525 void Player::PlaySound(PlayerSpeech speech, int a3) |
526 { | |
1351 | 527 signed int speechCount = 0; // esi@4 |
528 signed int expressionCount = 0; // esi@4 | |
529 int pickedVariant; // esi@10 | |
248 | 530 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 531 signed int pSoundID; // ecx@19 |
1351 | 532 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
533 int expressionVariantArray[5]; | |
534 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
535 unsigned int expressionDuration = 0; | |
187 | 536 |
1351 | 537 pickedSoundID = 0; |
203 | 538 if (uVoicesVolumeMultiplier) |
0 | 539 { |
1351 | 540 for (int i = 0; i < 2; i++) |
541 { | |
1406 | 542 if ( SoundSetAction[speech][i] ) |
543 { | |
544 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 545 speechCount++; |
546 } | |
547 } | |
548 if ( speechCount ) | |
549 { | |
550 pickedVariant = speechVariantArray[rand() % speechCount]; | |
551 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
552 if (numberOfSubvariants > 0) | |
553 { | |
554 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 555 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 556 } |
557 } | |
558 } | |
559 | |
560 for (int i = 0; i < 5; i++) | |
561 { | |
1406 | 562 if ( SoundSetAction[speech][i + 3] ) |
563 { | |
564 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 565 expressionCount++; |
566 } | |
567 } | |
568 if ( expressionCount ) | |
569 { | |
570 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
571 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
572 { | |
1406 | 573 pSoundID = 0; |
574 if ( pSoundList->sNumSounds ) | |
575 { | |
1351 | 576 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 577 { |
1406 | 578 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
579 pSoundID = i; | |
0 | 580 } |
581 } | |
1406 | 582 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 583 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
584 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
585 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
586 } |
0 | 587 } |
588 // 4948B1: using guessed type int var_1C[5]; | |
589 | |
590 //----- (00494A25) -------------------------------------------------------- | |
187 | 591 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
592 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
593 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
594 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
|
595 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
598 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
|
599 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
600 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
601 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
602 else |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
604 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
|
605 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
606 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
|
607 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
608 return; |
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 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
611 } |
0 | 612 this->uExpressionTimePassed = 0; |
613 if ( !a3 ) | |
614 { | |
187 | 615 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
616 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
617 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
618 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
619 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
620 } |
187 | 621 expression = new_expression; |
0 | 622 viewparams->bRedrawGameUI = 1; |
623 } | |
624 | |
625 //----- (0049327B) -------------------------------------------------------- | |
1355 | 626 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
|
627 { |
135 | 628 if ( this->classType == uClass ) |
0 | 629 { |
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
|
630 return true; |
0 | 631 } |
632 else | |
633 { | |
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
|
634 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
|
635 { |
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 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
|
637 } |
0 | 638 switch ( uClass ) |
639 { | |
640 case 0x1Au: | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
641 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); |
0 | 642 case 0x1Bu: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
643 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); |
0 | 644 case 0x22u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
645 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
0 | 646 case 0x23u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
647 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
0 | 648 break; |
649 default: | |
1545 | 650 Error("Should not be able to get here (%u)", uClass); |
0 | 651 break; |
652 } | |
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
|
653 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
|
654 } |
0 | 655 } |
656 | |
657 | |
658 //----- (00492C0B) -------------------------------------------------------- | |
659 bool Player::CanAct() | |
660 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
661 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
662 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
663 this->IsPertified() || this->IsEradicated() ) |
1355 | 664 return false; |
0 | 665 else |
1355 | 666 return true; |
0 | 667 } |
668 | |
669 //----- (00492C40) -------------------------------------------------------- | |
670 bool Player::CanSteal() | |
671 { | |
1355 | 672 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 673 } |
674 | |
675 //----- (00492C4E) -------------------------------------------------------- | |
676 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
677 { | |
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
|
678 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
|
679 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
680 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
681 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
|
682 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
|
683 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
|
684 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
|
685 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
|
686 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
693 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
694 } |
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
|
695 |
0 | 696 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
697 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
|
698 { |
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 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
|
700 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
|
701 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
|
702 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
|
703 |
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
|
704 if ( pConditions[uConditionIdx] ) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
705 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
706 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
707 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
708 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
709 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
710 } |
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
|
711 |
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 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
|
713 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
714 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
|
715 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
|
716 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 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
|
718 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
|
719 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 720 case Condition_Poison1: |
721 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
722 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 723 case Condition_Disease1: |
724 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 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
|
726 case Condition_Paralyzed: break; //nosound |
1014 | 727 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
|
728 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
|
729 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
|
730 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
|
731 break; |
1014 | 732 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
733 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
|
734 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
|
735 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
|
736 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
|
737 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
|
738 break; |
1014 | 739 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
740 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
|
741 break; |
1014 | 742 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
|
743 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
|
744 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
|
745 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
|
746 if ( sMana > 0 ) |
1014 | 747 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
|
748 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
|
749 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
750 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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 { |
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 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
|
761 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
|
762 } |
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 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
|
764 { |
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 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
|
766 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
|
767 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
768 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
|
769 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
|
770 } |
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
|
771 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
772 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
773 for (int i = 1; i < 5; ++i) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
774 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 ++players_before; |
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 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
780 |
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
|
781 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
|
782 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
|
783 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
|
784 { |
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 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
|
786 { |
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 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
|
788 ++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
|
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 } |
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 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
|
792 { |
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 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
|
794 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
795 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
|
796 } |
0 | 797 |
798 //----- (00492528) -------------------------------------------------------- | |
799 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
800 { | |
1363 | 801 Texture *texture; // esi@1 |
802 unsigned int slotWidth; // ebx@1 | |
803 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
804 | |
805 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
806 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
807 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 808 if ( !areWeLoadingTexture ) |
809 { | |
1363 | 810 texture->Release(); |
1006 | 811 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 812 } |
1545 | 813 |
1554 | 814 assert("Items should have nonzero dimensions"); |
1363 | 815 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
816 { | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
817 for (unsigned int x = 0; x < slotWidth; x++) |
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 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 820 { |
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
|
821 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
|
822 { |
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
|
823 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
|
824 } |
1363 | 825 } |
826 } | |
827 return true; | |
828 } | |
829 return false; | |
0 | 830 } |
831 // 506128: using guessed type int areWeLoadingTexture; | |
832 | |
833 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
834 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
835 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
836 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
837 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
838 if (pInventoryItemList[i].uItemID == 0) |
1365
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 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
841 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
842 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
843 return -1; |
0 | 844 } |
845 | |
846 //----- (00492600) -------------------------------------------------------- | |
847 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
848 { | |
849 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
850 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
852 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
853 if ( freeSlot == -1 ) |
0 | 854 { |
855 if ( uActiveCharacter ) | |
201 | 856 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
857 return 0; |
0 | 858 } |
859 else | |
860 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
861 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
862 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
863 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 864 } |
865 return result; | |
866 } | |
867 // 506128: using guessed type int areWeLoadingTexture; | |
868 | |
869 //----- (00492700) -------------------------------------------------------- | |
870 int Player::HasSkill(unsigned int uSkillType) | |
871 { | |
1374 | 872 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
873 { | |
874 return 1; | |
0 | 875 } |
876 else | |
877 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
878 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
879 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 880 return 0; |
881 } | |
0 | 882 } |
883 | |
884 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
885 void Player::WearItem( unsigned int uItemID ) |
0 | 886 { |
1010 | 887 int item_body_anch; // edi@6 |
888 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
889 item_indx = FindFreeInventoryListSlot(); |
1010 | 890 |
891 if ( item_indx != -1 ) | |
892 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
893 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 894 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
895 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
|
896 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 897 } |
898 } | |
899 | |
900 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
901 int Player::AddItem(int index, unsigned int uItemID) |
0 | 902 { |
1374 | 903 int xStartValue = 0; |
904 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
905 if ( index == -1 ) |
0 | 906 { |
1385 | 907 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
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 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
0 | 910 { |
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
|
911 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
|
912 { |
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
|
913 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
|
914 } |
0 | 915 } |
1385 | 916 } |
0 | 917 return 0; |
918 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
919 if ( !CanFitItem(index, uItemID) ) |
0 | 920 { |
921 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
922 return 0; | |
923 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
924 return CreateItemInInventory(index, uItemID); |
0 | 925 } |
926 | |
927 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
928 int Player::AddItem2(int index, ItemGen *Src) |
0 | 929 { |
930 pItemsTable->SetSpecialBonus(Src); | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
931 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
932 if ( index == -1 ) |
0 | 933 { |
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
|
934 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
|
935 { |
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 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
1385 | 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 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) ) |
0 | 939 { |
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
|
940 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src); |
0 | 941 } |
1385 | 942 } |
0 | 943 } |
944 return 0; | |
945 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
946 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 947 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
948 return CreateItemInInventory2(index, Src); |
0 | 949 } |
950 | |
951 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
952 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 953 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
954 signed int freeSlot; // ebx@1 |
0 | 955 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
956 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
957 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
958 if ( freeSlot == -1 ) |
0 | 959 { |
960 result = 0; | |
961 } | |
962 else | |
963 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
964 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
965 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
966 result = freeSlot + 1; |
0 | 967 } |
968 return result; | |
969 } | |
970 // 506128: using guessed type int areWeLoadingTexture; | |
971 | |
972 //----- (0049298B) -------------------------------------------------------- | |
1385 | 973 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
|
974 { |
1014 | 975 Texture *item_texture; // esi@1 |
976 int *pInvPos; // esi@4 | |
977 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
978 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
979 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
980 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 981 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
982 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 983 if ( !areWeLoadingTexture ) |
984 { | |
1014 | 985 item_texture->Release(); |
1006 | 986 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 987 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
988 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
989 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
990 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
991 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
992 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
993 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
|
994 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
995 } |
1014 | 996 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
997 pInventoryMatrix[index] = itemListPos + 1; |
0 | 998 } |
278 | 999 |
0 | 1000 // 506128: using guessed type int areWeLoadingTexture; |
1001 | |
1002 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1003 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1004 { |
1014 | 1005 ItemGen *item_in_slot; // ecx@1 |
1006 Texture *item_texture; // esi@1 | |
1007 unsigned int slot_height; // ebp@1 | |
1008 int *pInvPos; // edx@4 | |
1009 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1010 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1011 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1012 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1013 item_in_slot->Reset(); | |
1014 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1015 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1016 if ( !areWeLoadingTexture ) |
1017 { | |
1014 | 1018 item_texture->Release(); |
1006 | 1019 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1020 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1021 if ( slot_width > 0 ) |
1014 | 1022 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1023 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1024 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1025 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1026 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1027 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1028 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1029 } |
0 | 1030 } |
1031 // 506128: using guessed type int areWeLoadingTexture; | |
1032 | |
1033 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1034 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1035 { | |
1036 unsigned int idemId; // edx@1 | |
1037 signed int equipType; // esi@1 | |
1038 float multiplier; // ST04_4@26 | |
1039 int price; // edi@26 | |
1040 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1041 int itemValue; | |
1042 | |
1043 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1044 idemId = pItem->uItemID; | |
1045 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1046 itemValue = pItem->GetValue(); | |
1047 | |
1048 switch (building_type) | |
1049 { | |
1411 | 1050 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1051 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1052 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1053 if (equipType > EQUIP_BOW) |
1386 | 1054 return 4; |
1055 break; | |
1411 | 1056 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1057 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1058 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1059 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1060 return 4; |
1061 break; | |
1411 | 1062 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1063 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1064 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1065 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1066 return 4; |
1067 break; | |
1411 | 1068 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1069 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1070 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1071 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1072 return 4; |
1073 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1074 default: |
1545 | 1075 Error("(%u)", building_type); |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1076 break; |
1386 | 1077 } |
1078 if (pItem->Stolen()) | |
1079 return 6; | |
1080 | |
1081 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1082 switch (ShopMenuType) | |
1083 { | |
1084 case 2: | |
1085 price = GetBuyingPrice(itemValue, multiplier); | |
1086 break; | |
1087 case 3: | |
917 | 1088 if (pItem->Broken()) |
1386 | 1089 price = 1; |
917 | 1090 else |
1386 | 1091 price = this->GetPriceSell(itemValue, multiplier); |
1092 break; | |
1093 case 4: | |
1094 price = this->GetPriceIdentification(multiplier); | |
1095 break; | |
1096 case 5: | |
1097 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1098 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1099 default: |
1545 | 1100 Assert("(%u)", ShopMenuType); |
1386 | 1101 break; |
1102 } | |
1103 if ( merchantLevel ) | |
1104 { | |
1105 if (price == itemValue) | |
1106 { | |
1107 return 3; | |
1108 } | |
917 | 1109 else |
1386 | 1110 { |
1111 return 2; | |
1112 } | |
1113 } | |
0 | 1114 else |
1386 | 1115 { |
1116 return 1; | |
1117 } | |
0 | 1118 } |
1119 | |
1120 //----- (0049107D) -------------------------------------------------------- | |
1121 int Player::GetBodybuilding() | |
1122 { | |
1010 | 1123 int v1; // al@1 |
0 | 1124 |
1125 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1126 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
|
1127 return multiplier * (v1 & 0x3F); |
0 | 1128 } |
1129 | |
1130 //----- (004910A8) -------------------------------------------------------- | |
607 | 1131 int Player::GetMeditation() |
0 | 1132 { |
1010 | 1133 int v1; // al@1 |
0 | 1134 |
1135 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1136 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
|
1137 return multiplier * (v1 & 0x3F); |
0 | 1138 } |
1139 | |
1140 //----- (004910D3) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1141 bool Player::CanIdentify( ItemGen *pItem ) |
0 | 1142 { |
1143 unsigned __int16 v2; // ax@1 | |
1144 int v5; // edi@7 | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
1145 |
652 | 1146 if (CheckHiredNPCSpeciality(Scholar)) |
1147 return true; | |
0 | 1148 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1149 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1150 if ( (signed int)SkillToMastery(v2) >= 4 ) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1151 return true; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1152 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1153 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
|
1154 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1155 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St; |
0 | 1156 } |
1157 | |
1158 //----- (00491151) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1159 bool Player::CanRepair( ItemGen *pItem ) |
0 | 1160 { |
1161 unsigned __int16 v2; // ax@1 | |
1162 int v5; // edi@7 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1163 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1164 ItemDesc* v7 = &pItemsTable->pItems[pItem->uItemID]; |
652 | 1165 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || |
1166 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1167 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1168 return true; | |
1169 | |
1010 | 1170 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1171 if ( (signed int)SkillToMastery(v2) >= 4 ) |
0 | 1172 return true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1173 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1174 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
|
1175 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1176 return v5 >= v7->uItemID_Rep_St; |
0 | 1177 } |
1178 | |
1179 //----- (004911F3) -------------------------------------------------------- | |
1180 int Player::GetMerchant() | |
1181 { | |
1182 unsigned __int16 v2; // ax@1 | |
1183 int v5; // edi@1 | |
1184 int v7; // eax@3 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1185 |
607 | 1186 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1187 if ( SkillToMastery(v2) >= 4 ) |
0 | 1188 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1189 |
0 | 1190 v7 = GetPartyReputation(); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1191 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
|
1192 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1193 if (v5 == 0) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1194 { |
0 | 1195 return -v7; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1196 } |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1197 return v5 - v7 + 7; |
0 | 1198 } |
1199 | |
1200 //----- (0049125A) -------------------------------------------------------- | |
1201 int Player::GetPerception() | |
1202 { | |
1203 unsigned __int16 v2; // ax@1 | |
1204 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1205 |
1010 | 1206 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1207 if ( SkillToMastery(v2) >= 4 ) |
0 | 1208 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1209 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1210 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
|
1211 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1212 return v5; |
0 | 1213 } |
1214 | |
1215 //----- (004912B0) -------------------------------------------------------- | |
1216 int Player::GetDisarmTrap() | |
1217 { | |
1218 unsigned __int16 v2; // ax@1 | |
1219 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1220 |
1010 | 1221 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 1222 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1223 return 10000; | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1224 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1225 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
|
1226 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
|
1227 multiplier++; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1228 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1229 return v5; |
0 | 1230 } |
1231 | |
1232 //----- (00491317) -------------------------------------------------------- | |
1233 char Player::GetLearningPercent() | |
1234 { | |
1235 int v2; // eax@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1236 |
1010 | 1237 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1238 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
|
1239 return multiplier * v2 + 9; |
0 | 1240 } |
1241 | |
1242 //----- (0048C6AF) -------------------------------------------------------- | |
1243 Player::Player() | |
1244 { | |
1245 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1246 memset(pInventoryMatrix, 0, 126 * sizeof(int)); |
0 | 1247 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
|
1248 pInventoryItemList[i].Reset(); |
0 | 1249 for (uint i = 0; i < 12; ++i) |
1250 pEquippedItems[i].Reset(); | |
1251 | |
1252 | |
1253 for (uint i = 0; i < 24; ++i) | |
1254 { | |
1255 pPlayerBuffs[i].uSkill = 0; | |
1256 pPlayerBuffs[i].uSkill = 0; | |
1257 pPlayerBuffs[i].uPower = 0; | |
1258 pPlayerBuffs[i].uExpireTime = 0; | |
1259 pPlayerBuffs[i].uCaster = 0; | |
1260 pPlayerBuffs[i].uFlags = 0; | |
1261 } | |
1262 | |
1263 pName[0] = 0; | |
1014 | 1264 uCurrentFace = 0; |
0 | 1265 uVoiceID = 0; |
1266 memset(pConditions, 0, 20 * sizeof(__int64)); | |
1267 | |
1268 field_BB = 0; | |
1269 | |
1270 uMight = uMightBonus = 0; | |
1271 uIntelligence = uIntelligenceBonus = 0; | |
1272 uWillpower = uWillpowerBonus = 0; | |
1273 uEndurance = uEnduranceBonus = 0; | |
1274 uSpeed = uSpeedBonus = 0; | |
1275 uAccuracy = uAccuracyBonus = 0; | |
1276 uLuck = uLuckBonus = 0; | |
1277 uLevel = sLevelModifier = 0; | |
1278 sAgeModifier = 0; | |
1388
60d4885eb107
sACModifier zeroed in player constructor so AC is not always 0(or -some value) ingame
Grumpy7
parents:
1387
diff
changeset
|
1279 sACModifier = 0; |
0 | 1280 |
1019 | 1281 // memset(field_1F5, 0, 30); |
1282 pure_luck_used=0; | |
1283 pure_speed_used=0; | |
1284 pure_intellect_used=0; | |
1285 pure_endurance_used=0; | |
1286 pure_willpower_used=0; | |
1287 pure_accuracy_used=0; | |
1288 pure_might_used=0; | |
0 | 1289 |
1290 sResFireBase = sResFireBonus = 0; | |
1291 sResAirBase = sResAirBonus = 0; | |
1292 sResWaterBase = sResWaterBonus = 0; | |
1293 sResEarthBase = sResEarthBonus = 0; | |
1294 sResMagicBase = sResMagicBonus = 0; | |
1295 sResSpiritBase = sResSpiritBonus = 0; | |
1296 sResMindBase = sResMindBonus = 0; | |
1297 sResBodyBase = sResBodyBonus = 0; | |
1298 sResLightBase = sResLightBonus = 0; | |
1299 sResDarkBase = sResDarkBonus = 0; | |
1300 | |
1301 uTimeToRecovery = 0; | |
1302 | |
1303 uSkillPoints = 0; | |
1304 | |
1305 sHealth = 0; | |
1306 uFullHealthBonus = 0; | |
1307 _health_related = 0; | |
1308 | |
1309 sMana = 0; | |
1310 uFullManaBonus = 0; | |
1311 _mana_related = 0; | |
1312 | |
1313 uQuickSpell = 0; | |
1314 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
1315 | |
1316 _some_attack_bonus = 0; | |
1317 field_1A91 = 0; | |
1318 _melee_dmg_bonus = 0; | |
1319 field_1A93 = 0; | |
1320 _ranged_atk_bonus = 0; | |
1321 field_1A95 = 0; | |
1322 _ranged_dmg_bonus = 0; | |
1323 field_1A97 = 0; | |
1324 | |
130 | 1325 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 1326 uExpressionTimePassed = 0; |
1327 uExpressionTimeLength = 0; | |
1328 | |
1329 uNumDivineInterventionCastsThisDay = 0; | |
1330 uNumArmageddonCasts = 0; | |
1331 uNumFireSpikeCasts = 0; | |
1332 | |
1333 memset(field_1988, 0, 49 * sizeof(int)); | |
1334 memset(field_1A50, 0, 64 * sizeof(char)); | |
1335 | |
1336 field_E0 = 0; | |
1337 field_E4 = 0; | |
1338 field_E8 = 0; | |
1339 field_EC = 0; | |
1340 field_F0 = 0; | |
1341 field_F4 = 0; | |
1342 field_F8 = 0; | |
1343 field_FC = 0; | |
1344 field_100 = 0; | |
1345 field_104 = 0; | |
198 | 1346 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1347 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1348 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1349 |
198 | 1350 lastOpenedSpellbookPage = 0; |
0 | 1351 } |
1352 | |
1353 //----- (0048C6F6) -------------------------------------------------------- | |
1354 bool Party::AddItem(ItemGen *pItem) | |
1355 { | |
1356 unsigned int v2; // eax@1 | |
1357 unsigned int v3; // ecx@4 | |
1358 signed int v4; // edx@4 | |
1359 char *v5; // eax@8 | |
973 | 1360 //unsigned int v6; // eax@10 |
0 | 1361 Texture *v7; // ebx@10 |
1362 signed int v8; // esi@10 | |
1363 Player *v9; // edi@11 | |
1364 int v10; // eax@11 | |
1365 bool result; // eax@15 | |
1366 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 1367 |
1368 | |
188 | 1369 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
1370 //int v16; // [sp+10h] [bp-18h]@3 | |
1371 //int v17; // [sp+14h] [bp-14h]@3 | |
1372 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 1373 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
1374 Party *v20; // [sp+20h] [bp-8h]@1 | |
1375 int v21; // [sp+24h] [bp-4h]@10 | |
1376 | |
1377 auto thos = this; | |
1378 | |
1379 v20 = thos; | |
1380 v2 = pItem->uItemID; | |
222 | 1381 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1382 pItem->SetIdentified(); |
188 | 1383 ///v15 = 0; |
1384 //v16 = 1; | |
1385 //v18 = 3; | |
1386 //v17 = 2; | |
0 | 1387 if ( uActiveCharacter ) |
1388 { | |
1389 v3 = uActiveCharacter - 1; | |
1390 v4 = 0; | |
1391 do | |
1392 { | |
188 | 1393 v15[v4++] = v3++; |
0 | 1394 if ( (signed int)v3 >= 4 ) |
1395 v3 = 0; | |
1396 } | |
1397 while ( v4 < 4 ); | |
1398 } | |
1399 v5 = pItemsTable->pItems[v2].pIconName; | |
1400 if ( v5 ) | |
1401 { | |
973 | 1402 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1403 v21 = areWeLoadingTexture; |
1404 v8 = 0; | |
1405 while ( 1 ) | |
1406 { | |
188 | 1407 v9 = &v20->pPlayers[v15[v8]]; |
1408 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 1409 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 1410 if ( v10 ) |
1411 break; | |
1412 ++v8; | |
1413 if ( v8 >= 4 ) | |
1414 { | |
1415 if ( !v21 ) | |
1416 { | |
1417 v7->Release(); | |
1006 | 1418 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1419 } |
1420 goto LABEL_15; | |
1421 } | |
1422 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1423 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
0 | 1424 pItem->Reset(); |
1425 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 1426 v19->PlaySound(SPEECH_60, 0); |
0 | 1427 if ( !v21 ) |
1428 { | |
1429 v7->Release(); | |
1006 | 1430 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1431 } |
1432 result = 1; | |
1433 } | |
1434 else | |
1435 { | |
1436 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1437 LABEL_15: | |
1438 result = 0; | |
1439 } | |
1440 return result; | |
1441 } | |
1442 // 506128: using guessed type int areWeLoadingTexture; | |
1443 | |
1444 //----- (0048C855) -------------------------------------------------------- | |
1445 int Player::GetBaseStrength() | |
1446 { | |
1447 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1448 } | |
1449 | |
1450 //----- (0048C86C) -------------------------------------------------------- | |
1451 int Player::GetBaseIntelligence() | |
1452 { | |
1453 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1454 } | |
1455 | |
1456 //----- (0048C883) -------------------------------------------------------- | |
1457 int Player::GetBaseWillpower() | |
1458 { | |
1459 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1460 } | |
1461 | |
1462 //----- (0048C89A) -------------------------------------------------------- | |
1463 int Player::GetBaseEndurance() | |
1464 { | |
1465 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1466 } | |
1467 | |
1468 //----- (0048C8B1) -------------------------------------------------------- | |
1469 int Player::GetBaseAccuracy() | |
1470 { | |
1471 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1472 } | |
1473 | |
1474 //----- (0048C8C8) -------------------------------------------------------- | |
1475 int Player::GetBaseSpeed() | |
1476 { | |
1477 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1478 } | |
1479 | |
1480 //----- (0048C8DF) -------------------------------------------------------- | |
1481 int Player::GetBaseLuck() | |
1482 { | |
1483 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1484 } | |
1485 | |
1486 //----- (0048C8F6) -------------------------------------------------------- | |
1487 int Player::GetBaseLevel() | |
1488 { | |
1489 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1490 } | |
1491 | |
1492 //----- (0048C90D) -------------------------------------------------------- | |
1493 int Player::GetActualLevel() | |
1494 { | |
1495 return uLevel + sLevelModifier + | |
1496 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1497 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1498 } | |
1499 | |
1500 //----- (0048C93C) -------------------------------------------------------- | |
1501 int Player::GetActualMight() | |
1502 { | |
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
|
1503 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus); |
0 | 1504 } |
1505 | |
1506 //----- (0048C9C2) -------------------------------------------------------- | |
1507 int Player::GetActualIntelligence() | |
1508 { | |
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
|
1509 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus); |
0 | 1510 } |
1511 | |
1512 //----- (0048CA3F) -------------------------------------------------------- | |
1513 int Player::GetActualWillpower() | |
1514 { | |
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
|
1515 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus); |
0 | 1516 } |
1517 | |
1518 //----- (0048CABC) -------------------------------------------------------- | |
1519 int Player::GetActualEndurance() | |
1520 { | |
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
|
1521 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus); |
0 | 1522 } |
1523 | |
1524 //----- (0048CB39) -------------------------------------------------------- | |
1525 int Player::GetActualAccuracy() | |
1526 { | |
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
|
1527 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus); |
0 | 1528 } |
1529 | |
1530 //----- (0048CBB6) -------------------------------------------------------- | |
1531 int Player::GetActualSpeed() | |
1532 { | |
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 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus); |
0 | 1534 } |
1535 | |
1536 //----- (0048CC33) -------------------------------------------------------- | |
1537 int Player::GetActualLuck() | |
1538 { | |
1036 | 1539 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1540 | |
1541 npc_luck_bonus = 0; | |
652 | 1542 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1543 npc_luck_bonus = 5; |
652 | 1544 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1545 npc_luck_bonus += 20; |
652 | 1546 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1547 npc_luck_bonus += 10; |
1324 | 1548 |
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
|
1549 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus) |
1325 | 1550 + npc_luck_bonus; |
1551 } | |
1552 | |
1553 //----- (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
|
1554 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
|
1555 { |
1324 | 1556 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1557 uint uAgeingMultiplier = 100; | |
1558 for (uint i = 0; i < 4; ++i) | |
1325 | 1559 { |
1324 | 1560 if (uActualAge >= pAgeingTable[i]) |
1325 | 1561 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1562 else | |
1563 break; | |
1564 } | |
1565 | |
1566 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1567 int magicBonus = GetMagicalBonus(attrId); | |
1568 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
|
1569 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 |
1325 | 1570 + 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
|
1571 + 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
|
1572 + this->*attrBonus; |
0 | 1573 } |
1574 | |
1575 //----- (0048CCF5) -------------------------------------------------------- | |
1576 int Player::GetActualAttack(int a2) | |
1577 { | |
1578 Player *v2; // esi@1 | |
1579 int v3; // eax@1 | |
1580 int v4; // edi@1 | |
1581 int v5; // ebx@1 | |
1582 int v6; // ebp@1 | |
1583 | |
1584 v2 = this; | |
1585 v3 = GetActualAccuracy(); | |
1036 | 1586 v4 = GetParameterBonus(v3); |
0 | 1587 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1588 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1589 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
1590 } | |
1591 | |
1592 //----- (0048CD45) -------------------------------------------------------- | |
1593 int Player::GetMeleeDamageMinimal() | |
1594 { | |
1595 Player *v1; // edi@1 | |
1596 int v2; // eax@1 | |
1597 int v3; // esi@1 | |
1598 int v4; // esi@1 | |
1599 int v5; // esi@1 | |
1600 int v6; // esi@1 | |
1601 signed int result; // eax@1 | |
1602 | |
1036 | 1603 |
0 | 1604 v2 = GetActualMight(); |
1036 | 1605 v3 = GetParameterBonus(v2); |
0 | 1606 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1607 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1608 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1609 if ( result < 1 ) | |
1610 result = 1; | |
0 | 1611 return result; |
1612 } | |
1613 | |
1614 //----- (0048CD90) -------------------------------------------------------- | |
1615 int Player::GetMeleeDamageMaximal() | |
1616 { | |
1617 Player *v1; // edi@1 | |
1618 int v2; // eax@1 | |
1619 int v3; // esi@1 | |
1620 int v4; // esi@1 | |
1621 int v5; // esi@1 | |
1622 int v6; // esi@1 | |
1623 signed int result; // eax@1 | |
1624 | |
1625 v1 = this; | |
1626 v2 = GetActualMight(); | |
1036 | 1627 v3 = GetParameterBonus(v2); |
0 | 1628 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1629 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1630 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
1631 result = 1; | |
1632 if ( v6 >= 1 ) | |
1633 result = v6; | |
1634 return result; | |
1635 } | |
1636 | |
1637 //----- (0048CDDB) -------------------------------------------------------- | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1638 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
|
1639 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1640 int dmgSum; // esi@62 |
0 | 1641 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
|
1642 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
|
1643 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
|
1644 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1645 offHndWpnDmg = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1646 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
|
1647 if ( IsUnarmed() ) |
0 | 1648 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1649 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
|
1650 } |
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
|
1651 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
|
1652 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1653 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
|
1654 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1655 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
|
1656 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
|
1657 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
|
1658 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
|
1659 addOneDice = true; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1660 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
|
1661 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1662 if ( !ignoreOffhand ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1663 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1664 if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) |
0 | 1665 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1666 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
|
1667 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
|
1668 if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) |
0 | 1669 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1670 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); |
0 | 1671 } |
1672 } | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1673 } |
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 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
|
1676 if ( !ignoreSkillBonus ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1677 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1678 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
|
1679 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
|
1680 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
|
1681 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus; |
0 | 1682 } |
1683 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
|
1684 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
|
1685 result = dmgSum; |
0 | 1686 return result; |
1687 } | |
1688 | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1689 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1690 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
|
1691 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1692 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
|
1693 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
|
1694 if (addOneDice) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1695 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1696 diceCount++; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1697 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1698 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
|
1699 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
|
1700 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
|
1701 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1702 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
|
1703 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1704 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
|
1705 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
|
1706 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1707 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
|
1708 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
|
1709 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1710 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1711 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1712 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
|
1713 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1714 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1715 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1716 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
|
1717 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1718 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1719 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1720 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
|
1721 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1722 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1723 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1724 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1725 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
|
1726 && 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
|
1727 && 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
|
1728 totalDmg *= 3; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1729 return totalDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1730 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1731 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1732 |
0 | 1733 //----- (0048D0B9) -------------------------------------------------------- |
1734 int Player::GetRangedAttack() | |
1735 { | |
1736 Player *v1; // esi@1 | |
1737 int v2; // eax@1 | |
1738 int v3; // edi@3 | |
1739 int v4; // eax@4 | |
1740 int v5; // edi@4 | |
1741 int v6; // edi@4 | |
1742 int v7; // edi@4 | |
1743 | |
1744 v1 = this; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1745 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1746 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) |
0 | 1747 { |
1748 v4 = GetActualAccuracy(); | |
1036 | 1749 v5 = GetParameterBonus(v4); |
0 | 1750 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
1751 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
1752 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
1753 } | |
1754 else | |
1755 { | |
1756 v3 = GetActualAttack(1); | |
1757 } | |
1758 return v3; | |
1759 } | |
1760 | |
1761 //----- (0048D124) -------------------------------------------------------- | |
1762 int Player::GetRangedDamageMin() | |
1763 { | |
1764 Player *v1; // esi@1 | |
1765 int v2; // edi@1 | |
1766 int v3; // edi@1 | |
1767 int v4; // edi@1 | |
1768 unsigned __int16 v5; // ax@1 | |
1769 int result; // eax@6 | |
1770 | |
1771 v1 = this; | |
1040 | 1772 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
1773 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1774 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 1775 if ( v4 >= 1 ) |
1776 result = v4; | |
1777 else | |
1778 result = 0; | |
1779 return result; | |
1780 } | |
1781 | |
1782 //----- (0048D191) -------------------------------------------------------- | |
1783 int Player::GetRangedDamageMax() | |
1784 { | |
1785 Player *v1; // esi@1 | |
1786 int v2; // edi@1 | |
1787 int v3; // edi@1 | |
1788 int v4; // edi@1 | |
1789 unsigned __int16 v5; // ax@1 | |
1790 int result; // eax@6 | |
1791 | |
1792 v1 = this; | |
1040 | 1793 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
1794 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1795 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 1796 if ( v4 >= 1 ) |
1797 result = v4; | |
1798 else | |
1799 result = 0; | |
1800 return result; | |
1801 } | |
1802 | |
1803 //----- (0048D1FE) -------------------------------------------------------- | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1804 int Player::CalculateRangedDamageTo( int a2 ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1805 { |
0 | 1806 bool result; // eax@1 |
1807 ItemGen *v4; // ebx@2 | |
1808 unsigned int v5; // edi@2 | |
1809 int v7; // edx@4 | |
1810 char v8; // zf@4 | |
1811 int v9; // esi@5 | |
1812 int v10; // ebx@6 | |
1813 signed int v15; // [sp+8h] [bp-Ch]@2 | |
1814 int v17; // [sp+10h] [bp-4h]@1 | |
1815 | |
1816 v17 = 0; | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1817 if ( !HasItemEquipped(EQUIP_BOW) ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1818 return 0; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1819 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
0 | 1820 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
|
1821 v15 = pItemsTable->pItems[v5].uDamageRoll; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1822 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
|
1823 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1824 int v7 = rand() % v15; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1825 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
|
1826 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1827 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
0 | 1828 if ( a2 ) |
1829 { | |
377 | 1830 v10 = v4->uSpecEnchantmentType; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1831 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1832 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1833 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1834 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1835 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
|
1836 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1837 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1838 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1839 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
|
1840 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1841 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1842 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1843 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
|
1844 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1845 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1846 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1847 } |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1848 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
0 | 1849 } |
1850 | |
1851 //----- (0048D2EA) -------------------------------------------------------- | |
1852 char *Player::GetMeleeDamageString() | |
1853 { | |
1036 | 1854 signed int itemid; // eax@1 |
1855 int min_damage; // edi@3 | |
1856 int max_damage; // eax@3 | |
0 | 1857 |
1858 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1859 | |
1036 | 1860 if ( pEquipment.uMainHand) |
1861 { | |
1862 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1863 if ( itemid < ITEM_BLASTER || itemid > ITEM_LASER_RIFLE ) //blasters |
1036 | 1864 { |
1865 min_damage = GetMeleeDamageMinimal(); | |
1866 max_damage = GetMeleeDamageMaximal(); | |
1867 } | |
1868 else | |
1869 { //for blasters | |
1870 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
1871 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
1872 } | |
1873 if ( max_damage ) | |
1874 { | |
1875 if ( min_damage == max_damage ) | |
1876 { | |
1877 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
1878 } | |
1879 else | |
1880 { | |
1881 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
1882 } | |
1883 } | |
1884 else | |
1885 { | |
1886 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
1887 } | |
1888 | |
1889 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
1890 { | |
1891 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
1892 } | |
1893 } | |
0 | 1894 else |
1036 | 1895 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
1896 return player__getmeleedamagestring_static_buff; | |
0 | 1897 } |
1898 | |
1899 //----- (0048D396) -------------------------------------------------------- | |
1900 char *Player::GetRangedDamageString() | |
1036 | 1901 { |
1902 signed int itemid; // eax@1 | |
1903 int min_damage; // edi@3 | |
1904 int max_damage; // eax@3 | |
1905 | |
1906 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1907 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1908 if (pEquipment.uMainHand >= 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1909 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1910 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1911 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1912 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1913 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1914 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1915 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1916 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1917 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1918 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1919 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1920 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1921 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1922 } |
0 | 1923 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1924 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1925 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1926 max_damage = GetRangedDamageMax(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1927 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1928 if ( max_damage > 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1929 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1930 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1931 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1932 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1933 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1934 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1935 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1936 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1937 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1938 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1939 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1940 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1941 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1942 } |
1036 | 1943 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1944 } |
0 | 1945 |
1946 //----- (0048D45A) -------------------------------------------------------- | |
1947 bool Player::CanTrainToNextLevel() | |
1948 { | |
1949 int v1; // edx@1 | |
1950 int v2; // eax@1 | |
1951 int i; // esi@1 | |
1952 | |
1953 v1 = this->uLevel; | |
1954 v2 = 0; | |
1955 for ( i = 0; i < v1; ++i ) | |
1956 v2 += i + 1; | |
1957 return (signed __int64)this->uExperience >= 1000 * v2; | |
1958 } | |
1959 | |
1960 //----- (0048D498) -------------------------------------------------------- | |
1961 unsigned int Player::GetExperienceDisplayColor() | |
1962 { | |
1963 unsigned int result; // eax@2 | |
1964 | |
1965 if ( CanTrainToNextLevel() ) | |
995 | 1966 result = ui_character_bonus_text_color; |
0 | 1967 else |
995 | 1968 result = ui_character_default_text_color; |
0 | 1969 return result; |
1970 } | |
1971 | |
1972 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 1973 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
1974 { | |
1975 | |
1976 int resist_value; // edi@8 | |
1977 int player_luck; // eax@21 | |
1978 signed int res_rand_divider; // ebx@2 | |
1979 int armor_skill; // eax@29 | |
1980 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
1981 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
1982 | |
1983 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
1984 switch(dmg_type) | |
1985 { | |
1986 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
1987 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
1988 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
1989 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
1990 | |
1991 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
1992 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
1993 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
1994 } | |
1995 if (player_resist) | |
1996 resist_value = GetActualResistance(player_resist); | |
1997 else | |
1998 resist_value = 0; | |
1999 | |
2000 result_amount_dmg = amount; | |
2001 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 2002 return 0; |
1036 | 2003 player_luck = GetActualLuck(); |
2004 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
2005 | |
2006 if ( resist_value ) | |
2007 { | |
2008 if ( rand() % res_rand_divider >= 30 ) | |
2009 { | |
2010 result_amount_dmg = amount >> 1; | |
2011 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2012 { |
1036 | 2013 result_amount_dmg = amount >> 2; |
2014 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2015 { |
1036 | 2016 result_amount_dmg = amount >> 3; |
2017 if ( rand() % res_rand_divider >= 30 ) | |
2018 result_amount_dmg = amount >> 4; | |
0 | 2019 } |
2020 } | |
2021 } | |
2022 } | |
1036 | 2023 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
2024 { | |
2025 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 2026 { |
1036 | 2027 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
2028 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 2029 { |
1036 | 2030 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
2031 return (int)(double)result_amount_dmg * 0.5; | |
0 | 2032 } |
1036 | 2033 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 2034 { |
1036 | 2035 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
2036 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 2037 } |
2038 } | |
1036 | 2039 } |
2040 return result_amount_dmg; | |
0 | 2041 } |
2042 | |
2043 //----- (0048D62C) -------------------------------------------------------- | |
816 | 2044 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
2045 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2046 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 2047 } |
2048 | |
2049 //----- (0048D651) -------------------------------------------------------- | |
816 | 2050 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
2051 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2052 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 2053 } |
2054 | |
2055 //----- (0048D676) -------------------------------------------------------- | |
2056 bool Player::IsUnarmed() | |
2057 { | |
1091 | 2058 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
2059 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 2060 } |
2061 | |
2062 //----- (0048D6AA) -------------------------------------------------------- | |
2063 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
2064 { | |
2065 auto i = pEquipment.pIndices[uEquipIndex]; | |
2066 if (i) | |
1080 | 2067 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 2068 else |
2069 return false; | |
0 | 2070 } |
2071 | |
2072 //----- (0048D6D0) -------------------------------------------------------- | |
2073 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
2074 { | |
2075 for (uint i = 0; i < 16; ++i) | |
2076 { | |
2077 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 2078 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 2079 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
2080 return true; | |
2081 } | |
2082 return false; | |
2083 } | |
2084 | |
2085 //----- (0048D709) -------------------------------------------------------- | |
1080 | 2086 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
2087 { | |
1010 | 2088 |
0 | 2089 int v6; // esi@5 |
2090 | |
1080 | 2091 if ( equip_type >= 16 ) |
0 | 2092 { |
2093 v6 = 0; | |
2094 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2095 || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 2096 { |
2097 ++v6; | |
2098 if ( (signed int)v6 >= 16 ) | |
2099 return 0; | |
2100 } | |
2101 return 1; | |
2102 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2103 if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 2104 return 1; |
2105 return 0; | |
2106 } | |
2107 | |
2108 //----- (0048D76C) -------------------------------------------------------- | |
2109 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
2110 { | |
2111 unsigned __int16 v6; // cx@8 | |
2112 int v7; // edi@8 | |
2113 unsigned int v8; // ebx@8 | |
2114 unsigned int v9; // esi@8 | |
2115 int v10; // eax@8 | |
2116 int v11; // edi@12 | |
2117 bool result; // eax@13 | |
2118 | |
2119 if ( !a2 | |
2120 || this->pConditions[16] | |
2121 || this->pConditions[14] | |
2122 || this->pConditions[15] | |
2123 || this->pConditions[4] | |
2124 || this->pConditions[13] | |
2125 || this->pConditions[2] ) | |
2126 { | |
2127 result = 0; | |
2128 } | |
2129 else | |
2130 { | |
2131 v6 = this->pActiveSkills[34]; | |
2132 v7 = v6 & 0x3F; | |
2133 v8 = SkillToMastery(v6); | |
2134 v9 = a2->GetValue(); | |
2135 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
2136 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
2137 v9 *= 3; | |
2138 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
2139 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
2140 if ( rand() % 100 >= 5 ) | |
2141 { | |
2142 if ( *a6 > v11 ) | |
2143 result = *a6 - v11 < 500; | |
2144 else | |
2145 result = 2; | |
2146 } | |
2147 else | |
2148 { | |
2149 result = 0; | |
2150 } | |
2151 } | |
2152 return result; | |
2153 } | |
2154 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2155 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2156 | |
2157 //----- (0048D88B) -------------------------------------------------------- | |
2158 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2159 { | |
2160 Player *v4; // esi@1 | |
2161 Actor *v5; // edi@1 | |
2162 unsigned __int16 v6; // cx@10 | |
2163 int v7; // ebx@10 | |
2164 unsigned int v8; // esi@10 | |
2165 int v9; // eax@10 | |
2166 int v10; // esi@10 | |
2167 int v11; // eax@13 | |
2168 signed int v12; // ebx@15 | |
2169 signed int v13; // edx@15 | |
2170 int v14; // ecx@15 | |
2171 unsigned __int16 v15; // si@21 | |
2172 unsigned int v16; // ebx@24 | |
2173 int v17; // esi@24 | |
2174 const void *v18; // eax@29 | |
2175 unsigned int v19; // esi@31 | |
2176 int v20; // eax@34 | |
2177 char v21; // zf@36 | |
2178 unsigned int v22; // ST0C_4@39 | |
2179 char *v23; // esi@39 | |
2180 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2181 int v26; // [sp-8h] [bp-44h]@40 | |
2182 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2183 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2184 int v29; // [sp+30h] [bp-Ch]@10 | |
2185 int v30; // [sp+34h] [bp-8h]@10 | |
2186 Player *v31; // [sp+38h] [bp-4h]@1 | |
2187 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2188 | |
2189 v4 = this; | |
2190 v5 = &pActors[uActorID]; | |
2191 v31 = this; | |
2192 if ( &pActors[uActorID] | |
2193 && !this->pConditions[16] | |
2194 && !this->pConditions[14] | |
2195 && !this->pConditions[15] | |
2196 && !this->pConditions[4] | |
2197 && !this->pConditions[13] | |
2198 && !this->pConditions[2] ) | |
2199 { | |
2200 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2201 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2202 v6 = v4->pActiveSkills[34]; | |
2203 v7 = v6 & 0x3F; | |
2204 v8 = SkillToMastery(v6); | |
2205 v9 = rand(); | |
2206 v28 = 4 * v8; | |
2207 v30 = dword_4EDEA0[v8]; | |
2208 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2209 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2210 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2211 { | |
322 | 2212 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2213 _steal_perma = 0; |
2214 v26 = (int)v31->pName; | |
2215 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2216 } | |
2217 else | |
2218 { | |
2219 v11 = rand(); | |
2220 if ( v11 % 100 >= 40 ) | |
2221 { | |
2222 if ( v11 % 100 >= 70 ) | |
2223 { | |
2224 v19 = 0; | |
2225 if ( v7 > 0 ) | |
2226 { | |
2227 do | |
2228 { | |
2229 --v7; | |
2230 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2231 } | |
2232 while ( v7 ); | |
2233 } | |
2234 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2235 return _steal_perma; | |
377 | 2236 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2237 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2238 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2239 v21 = *(int *)v20 == v19; |
2240 *(int *)v20 -= v19; | |
2241 if ( v21 ) | |
2242 v5->array_000234[3].uItemID = 0; | |
2243 if ( v19 ) | |
2244 { | |
2245 party_finds_gold(v19, 2); | |
2246 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2247 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2248 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2249 LABEL_43: |
2250 ShowStatusBarString(v23, 2u); | |
2251 return _steal_perma; | |
2252 } | |
2253 } | |
2254 else | |
2255 { | |
2256 v27.Reset(); | |
2257 v12 = 0; | |
2258 v13 = 0; | |
2259 v14 = (int)v5->array_000234; | |
2260 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2261 { | |
2262 ++v13; | |
2263 v14 += 36; | |
2264 if ( v13 >= 4 ) | |
2265 goto LABEL_21; | |
2266 } | |
2267 v12 = 1; | |
2268 LABEL_21: | |
2269 v15 = v5->uCarriedItemID; | |
2270 if ( v15 || v12 ) | |
2271 { | |
2272 v27.Reset(); | |
2273 if ( v15 ) | |
2274 { | |
2275 v16 = (signed __int16)v15; | |
2276 v5->uCarriedItemID = 0; | |
2277 v27.uItemID = (signed __int16)v15; | |
2278 v17 = (signed __int16)v15; | |
2279 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2280 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2281 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2282 { | |
2283 if ( v16 != 220 ) | |
570 | 2284 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2285 } |
2286 } | |
2287 else | |
2288 { | |
2289 v18 = &v5->array_000234[rand() % 4]; | |
2290 memcpy(&v27, v18, sizeof(v27)); | |
2291 ((ItemGen *)v18)->Reset(); | |
2292 v16 = v27.uItemID; | |
2293 } | |
2294 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2295 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2296 pTmpBuf2.data(), |
0 | 2297 pGlobalTXT_LocalizationStrings[304], |
2298 v31->pName, | |
2299 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2300 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2301 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2302 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2303 pMouse->SetCursorBitmapFromItemID(v16); | |
2304 return _steal_perma; | |
2305 } | |
2306 } | |
2307 } | |
2308 v26 = (int)v31->pName; | |
2309 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2310 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2311 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2312 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2313 goto LABEL_43; |
2314 } | |
2315 return 0; | |
2316 } | |
2317 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2318 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2319 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2320 | |
2321 //----- (0048DBB9) -------------------------------------------------------- | |
2322 void Player::Heal(int amount) | |
2323 { | |
1010 | 2324 signed int max_health; // eax@3 |
2325 | |
2326 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
2327 { | |
2328 max_health = GetMaxHealth(); | |
2329 if ( pConditions[Condition_Zombie] ) | |
2330 max_health /= 2; | |
2331 sHealth += amount; | |
2332 if ( sHealth > max_health ) | |
2333 sHealth = max_health; | |
2334 if ( pConditions[Condition_Unconcious] ) | |
2335 { | |
2336 if ( sHealth > 0 ) | |
2337 { | |
2338 pConditions[Condition_Unconcious] = 0i64; | |
0 | 2339 } |
2340 } | |
2341 } | |
2342 } | |
2343 | |
2344 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2345 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2346 { | |
2347 signed int recieved_dmg; // eax@1 | |
2348 unsigned int armor_indx; // eax@8 | |
2349 bool broke_armor; | |
2350 | |
2351 pConditions[Condition_Sleep] = 0i64; | |
2352 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
2353 sHealth -= recieved_dmg; | |
2354 broke_armor = sHealth <= -10; | |
2355 if ( sHealth < 1 ) // | |
2356 { | |
2357 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
2358 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 2359 { |
1019 | 2360 SetCondition(Condition_Unconcious, 0); |
0 | 2361 } |
2362 else | |
2363 { | |
1019 | 2364 SetCondition(Condition_Dead, 0); |
1036 | 2365 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
2366 if ( sHealth > 0 ) | |
2367 sHealth = 0; | |
2368 } | |
2369 if (broke_armor ) | |
2370 { | |
2371 armor_indx = pEquipment.uArmor; | |
2372 if ( armor_indx ) | |
0 | 2373 { |
1036 | 2374 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 2375 { |
1036 | 2376 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 2377 } |
2378 } | |
2379 } | |
2380 } | |
1036 | 2381 if ( recieved_dmg && CanAct() ) |
187 | 2382 PlaySound(SPEECH_24, 0); |
1036 | 2383 return recieved_dmg; |
0 | 2384 } |
2385 | |
2386 //----- (0048DCF6) -------------------------------------------------------- | |
2387 int Player::_48DCF6(int a2, Actor *pActor) | |
2388 { | |
2389 signed int v3; // edi@1 | |
2390 signed int v4; // ebx@1 | |
2391 Player *v5; // esi@1 | |
2392 int v6; // eax@2 | |
2393 int v7; // eax@5 | |
2394 int v8; // eax@8 | |
2395 int v9; // ebx@8 | |
2396 int v10; // eax@8 | |
2397 int v11; // ebx@8 | |
2398 signed int v12; // edx@9 | |
2399 ItemGen *v13; // eax@9 | |
2400 int v14; // edx@16 | |
2401 unsigned int v15; // edx@17 | |
2402 int v16; // edx@26 | |
2403 unsigned int v17; // edx@27 | |
2404 signed int v19; // edx@38 | |
2405 int *v20; // ecx@38 | |
2406 signed int v21; // eax@40 | |
2407 int v22; // eax@49 | |
2408 signed int v23; // ebx@49 | |
2409 unsigned int v24; // eax@60 | |
2410 int v25; // ecx@61 | |
2411 int v26; // ebx@74 | |
2412 void *v27; // ecx@76 | |
2413 unsigned int v28; // ebx@78 | |
2414 signed int result; // eax@86 | |
2415 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2416 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2417 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2418 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2419 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2420 int v35; // [sp-Ch] [bp-ACh]@56 | |
2421 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2422 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2423 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2424 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2425 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2426 int v41; // [sp-4h] [bp-A4h]@51 | |
2427 int v42; // [sp-4h] [bp-A4h]@56 | |
2428 int v43; // [sp-4h] [bp-A4h]@57 | |
2429 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2430 int v45; // [sp-4h] [bp-A4h]@68 | |
2431 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2432 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2433 int v48; // [sp+9Ch] [bp-4h]@1 | |
2434 | |
2435 v3 = 0; | |
2436 v4 = 0; | |
2437 v5 = this; | |
2438 v47 = 0; | |
2439 v48 = 0; | |
2440 switch ( a2 ) | |
2441 { | |
2442 case 1: | |
2443 v6 = GetActualWillpower(); | |
2444 goto LABEL_46; | |
2445 case 2: | |
2446 case 3: | |
2447 case 4: | |
2448 case 9: | |
2449 case 10: | |
2450 case 11: | |
2451 case 13: | |
2452 case 21: | |
2453 v6 = GetActualEndurance(); | |
2454 goto LABEL_46; | |
2455 case 5: | |
2456 case 12: | |
2457 case 23: | |
2458 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2459 goto LABEL_5; | |
2460 case 15: | |
2461 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2462 goto LABEL_5; | |
2463 case 6: | |
2464 case 7: | |
2465 case 8: | |
2466 case 14: | |
2467 case 16: | |
2468 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2469 LABEL_5: | |
2470 v7 = GetActualResistance(v40); | |
2471 goto LABEL_47; | |
2472 case 22: | |
2473 v8 = GetActualWillpower(); | |
1036 | 2474 v9 = GetParameterBonus(v8); |
0 | 2475 v10 = GetActualIntelligence(); |
1036 | 2476 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2477 break; |
2478 case 17: | |
2479 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2480 v13 = this->pInventoryItemList; |
0 | 2481 do |
2482 { | |
315 | 2483 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 2484 v46[v4++] = v12; |
2485 ++v12; | |
2486 ++v13; | |
2487 } | |
2488 while ( v12 < 138 ); | |
2489 goto LABEL_36; | |
2490 case 18: | |
2491 v14 = 0; | |
2492 do | |
2493 { | |
2494 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2495 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2496 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2497 if ( v15 == EQUIP_ARMOUR ) |
898 | 2498 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2499 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2500 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2501 } |
2502 v14 = v15 + 1; | |
2503 } | |
2504 while ( v14 < 16 ); | |
2505 goto LABEL_36; | |
2506 case 19: | |
2507 v16 = 0; | |
2508 do | |
2509 { | |
2510 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2511 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2512 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2513 if ( v17 == 2 ) |
2514 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2515 if ( (!v17 || v17 == 1) | |
816 | 2516 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2517 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2518 } |
2519 v16 = v17 + 1; | |
2520 } | |
2521 while ( v16 < 16 ); | |
2522 LABEL_36: | |
2523 if ( !v4 ) | |
2524 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2525 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2526 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2527 break; | |
2528 case 20: | |
2529 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2530 v20 = this->pInventoryMatrix; |
0 | 2531 do |
2532 { | |
2533 if ( *v20 > 0 ) | |
2534 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2535 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2536 if ( v21 > 0 ) |
2537 { | |
2538 if ( v21 <= 134 ) | |
2539 v46[v4++] = v19; | |
2540 } | |
2541 } | |
2542 ++v19; | |
2543 ++v20; | |
2544 } | |
2545 while ( v19 < 126 ); | |
2546 if ( !v4 ) | |
2547 goto LABEL_87; | |
2548 v47 = (unsigned __int8)v46[rand() % v4]; | |
2549 v6 = GetActualAccuracy(); | |
2550 LABEL_46: | |
1036 | 2551 v7 = GetParameterBonus(v6); |
0 | 2552 LABEL_47: |
2553 v11 = v7; | |
2554 break; | |
2555 default: | |
2556 v11 = 0; | |
2557 break; | |
2558 } | |
2559 v22 = GetActualLuck(); | |
1036 | 2560 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2561 if ( rand() % v23 >= 30 ) |
2562 { | |
2563 LABEL_87: | |
2564 result = 0; | |
2565 } | |
2566 else | |
2567 { | |
2568 switch ( a2 ) | |
2569 { | |
2570 case 1: | |
2571 v41 = 1; | |
2572 v36 = 0; | |
2573 goto LABEL_56; | |
2574 case 2: | |
2575 v41 = 1; | |
2576 v36 = 1; | |
2577 goto LABEL_56; | |
2578 case 3: | |
2579 v41 = 1; | |
2580 v36 = 2; | |
2581 goto LABEL_56; | |
2582 case 23: | |
2583 v41 = 1; | |
2584 v36 = 3; | |
2585 goto LABEL_56; | |
2586 case 4: | |
2587 v41 = 1; | |
2588 v36 = 4; | |
2589 LABEL_56: | |
2590 SetCondition(v36, v41); | |
2591 v42 = 0; | |
2592 v37 = 0; | |
2593 v35 = 0; | |
2594 v34 = 0; | |
2595 v33 = -1; | |
2596 v32 = 0; | |
2597 v31 = 0; | |
2598 v30 = (SoundID)221; | |
2599 goto LABEL_83; | |
2600 case 5: | |
2601 v43 = 1; | |
2602 v38 = 5; | |
2603 goto LABEL_70; | |
2604 case 6: | |
2605 case 7: | |
2606 case 8: | |
2607 if ( a2 == 6 ) | |
2608 { | |
2609 v44 = 6; | |
2610 goto LABEL_60; | |
2611 } | |
2612 v25 = 2 * (a2 != 8) + 8; | |
2613 goto LABEL_65; | |
2614 case 9: | |
2615 if ( a2 == 6 ) | |
2616 { | |
2617 v44 = 7; | |
2618 LABEL_60: | |
2619 v24 = v44; | |
2620 } | |
2621 else | |
2622 { | |
2623 v25 = 2 * (a2 != 8) + 9; | |
2624 LABEL_65: | |
2625 v24 = v25; | |
2626 } | |
2627 SetCondition(v24, 1); | |
2628 v42 = 0; | |
2629 v37 = 0; | |
2630 v35 = 0; | |
2631 v34 = 0; | |
2632 v33 = -1; | |
2633 v32 = 0; | |
2634 v31 = 0; | |
2635 v30 = (SoundID)222; | |
2636 LABEL_83: | |
2637 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2638 do | |
2639 { | |
2640 LABEL_84: | |
2641 if ( v5 == pPlayers[v3 + 1] ) | |
2642 break; | |
2643 ++v3; | |
2644 } | |
2645 while ( v3 < 4 ); | |
2646 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2647 result = 1; | |
2648 break; | |
2649 case 12: | |
2650 v43 = 1; | |
2651 v38 = 12; | |
2652 goto LABEL_70; | |
2653 case 15: | |
2654 v45 = 1; | |
2655 v39 = 15; | |
2656 goto LABEL_73; | |
2657 case 13: | |
2658 v43 = 1; | |
2659 v38 = 13; | |
2660 LABEL_70: | |
2661 SetCondition(v38, v43); | |
2662 v42 = 0; | |
2663 v37 = 0; | |
2664 v35 = 0; | |
2665 v34 = 0; | |
2666 v33 = -1; | |
2667 v32 = 0; | |
2668 v31 = 0; | |
2669 v30 = (SoundID)224; | |
2670 goto LABEL_83; | |
2671 case 14: | |
2672 v45 = 1; | |
2673 v39 = 14; | |
2674 goto LABEL_73; | |
2675 case 16: | |
2676 v45 = 1; | |
2677 v39 = 16; | |
2678 LABEL_73: | |
2679 SetCondition(v39, v45); | |
2680 v42 = 0; | |
2681 v37 = 0; | |
2682 v35 = 0; | |
2683 v34 = 0; | |
2684 v33 = -1; | |
2685 v32 = 0; | |
2686 v31 = 0; | |
2687 v30 = (SoundID)225; | |
2688 goto LABEL_83; | |
2689 case 17: | |
2690 case 18: | |
2691 case 19: | |
2692 v26 = v48; | |
2693 if ( *(char *)(v48 + 21) & 2 ) | |
2694 goto LABEL_84; | |
187 | 2695 PlaySound(SPEECH_40, 0); |
0 | 2696 *(int *)(v26 + 20) |= 2u; |
2697 goto LABEL_79; | |
2698 case 20: | |
187 | 2699 PlaySound(SPEECH_40, 0); |
0 | 2700 v27 = pActor->array_000234; |
2701 if ( pActor->array_000234[0].uItemID ) | |
2702 { | |
2703 v27 = &pActor->array_000234[1]; | |
2704 if ( pActor->array_000234[1].uItemID ) | |
2705 goto LABEL_84; | |
2706 } | |
2707 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2708 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2709 RemoveItemAtInventoryIndex(v28); |
2710 LABEL_79: | |
2711 v42 = 0; | |
2712 v37 = 0; | |
2713 v35 = 0; | |
2714 v34 = 0; | |
2715 v33 = -1; | |
2716 v32 = 0; | |
2717 v31 = 0; | |
2718 v30 = (SoundID)47; | |
2719 goto LABEL_83; | |
2720 case 21: | |
187 | 2721 PlaySound(SPEECH_42, 0); |
0 | 2722 ++v5->sAgeModifier; |
2723 goto LABEL_82; | |
2724 case 22: | |
187 | 2725 PlaySound(SPEECH_41, 0); |
0 | 2726 v5->sMana = 0; |
2727 LABEL_82: | |
2728 v42 = 0; | |
2729 v37 = 0; | |
2730 v35 = 0; | |
2731 v34 = 0; | |
2732 v33 = -1; | |
2733 v32 = 0; | |
2734 v31 = 0; | |
2735 v30 = (SoundID)226; | |
2736 goto LABEL_83; | |
2737 default: | |
2738 goto LABEL_87; | |
2739 } | |
2740 } | |
2741 return result; | |
2742 } | |
324 | 2743 |
0 | 2744 // 48DCF6: using guessed type char var_94[140]; |
2745 | |
2746 //----- (0048E1A3) -------------------------------------------------------- | |
2747 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2748 { | |
1091 | 2749 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2750 } |
2751 | |
2752 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2753 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2754 { | |
2755 ItemGen *weapon = nullptr; | |
2756 ItemDesc *weapon_desc = nullptr; | |
2757 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2758 if (bRangedAttack) | |
0 | 2759 { |
2760 if ( !HasItemEquipped(EQUIP_BOW) ) | |
2761 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2762 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 2763 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2764 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
2765 goto LABEL_17; | |
2766 } | |
2767 else if ( IsUnarmed() == 1 ) | |
2768 { | |
2769 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
2770 { | |
2771 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 2772 goto LABEL_17; |
2773 } | |
2774 } | |
816 | 2775 |
2776 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
2777 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2778 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2779 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2780 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2781 { | |
2782 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2783 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2784 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2785 } | |
0 | 2786 else |
816 | 2787 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2788 } | |
1010 | 2789 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2790 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2791 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2792 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2793 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2794 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2795 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2796 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2797 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2798 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2799 } | |
2800 } | |
2801 | |
0 | 2802 LABEL_17: |
816 | 2803 uint armour_recovery = 0; |
0 | 2804 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2805 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2806 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2807 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
2808 | |
2809 float armour_recovery_multipliers[4]; | |
2810 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
2811 { | |
2812 armour_recovery_multipliers[0] = 1.0f; | |
2813 armour_recovery_multipliers[1] = 0; | |
2814 armour_recovery_multipliers[2] = 0; | |
2815 armour_recovery_multipliers[3] = 0; | |
2816 } | |
2817 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2818 { | |
2819 armour_recovery_multipliers[0] = 1.0f; | |
2820 armour_recovery_multipliers[1] = 0.5f; | |
2821 armour_recovery_multipliers[2] = 0; | |
2822 armour_recovery_multipliers[3] = 0; | |
2823 } | |
2824 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2825 { | |
2826 armour_recovery_multipliers[0] = 1.0f; | |
2827 armour_recovery_multipliers[1] = 0.5f; | |
2828 armour_recovery_multipliers[2] = 0.5f; | |
2829 armour_recovery_multipliers[3] = 0; | |
0 | 2830 } |
2831 else | |
2832 { | |
1545 | 2833 Error("Unknown armour type"); // what kind of armour is that? |
816 | 2834 armour_recovery_multipliers[0] = 1.0f; |
2835 armour_recovery_multipliers[1] = 1.0f; | |
2836 armour_recovery_multipliers[2] = 1.0f; | |
2837 armour_recovery_multipliers[3] = 1.0f; | |
2838 } | |
2839 | |
2840 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
2841 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
2842 } | |
2843 | |
2844 uint shield_recovery = 0; | |
2845 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2846 { | |
2847 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
2848 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2849 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2850 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2851 | |
2852 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
2853 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
2854 } | |
2855 | |
1036 | 2856 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2857 sword_axe_bow_recovery_reduction = 0; |
2858 bool shooting_laser = false; | |
2859 if (weapon_desc) | |
2860 { | |
2861 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2862 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2863 { | |
2864 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2865 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2866 } | |
2867 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2868 shooting_laser = true; | |
2869 } | |
2870 | |
2871 uint armsmaster_recovery_reduction = 0; | |
2872 if (!bRangedAttack && !shooting_laser) | |
2873 { | |
2874 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2875 { | |
2876 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2877 if (SkillToMastery(armsmaster_level) >= 4) | |
2878 armsmaster_recovery_reduction *= 2; | |
2879 } | |
2880 } | |
2881 | |
2882 uint v41 = 0; | |
2883 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 2884 v41 = 25; |
816 | 2885 |
2886 uint weapon_enchantment_recovery_reduction = 0; | |
2887 if ( weapon ) | |
2888 { | |
2889 if (weapon->uSpecEnchantmentType == 59 || | |
2890 weapon->uSpecEnchantmentType == 41 || | |
2891 weapon->uSpecEnchantmentType == 500) | |
2892 weapon_enchantment_recovery_reduction = 20; | |
2893 } | |
2894 | |
2895 | |
2896 int recovery = weapon_recovery + | |
2897 armour_recovery + | |
2898 shield_recovery | |
2899 - armsmaster_recovery_reduction | |
2900 - weapon_enchantment_recovery_reduction | |
2901 - v41 | |
2902 - sword_axe_bow_recovery_reduction | |
2903 - player_speed_recovery_reduction; | |
2904 | |
2905 if (recovery < 0) | |
2906 recovery = 0; | |
2907 return recovery; | |
0 | 2908 } |
2909 | |
2910 //----- (0048E4F8) -------------------------------------------------------- | |
2911 int Player::GetMaxHealth() | |
2912 { | |
2913 int v3; // esi@1 | |
2914 int v4; // esi@1 | |
2915 int v6; // esi@1 | |
2916 | |
1036 | 2917 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2918 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2919 v6 = uFullHealthBonus |
135 | 2920 + pBaseHealthByClass[classType / 4] |
0 | 2921 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2922 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2923 if (v6 <= 0) | |
2924 return 1; | |
2925 return v6; | |
2926 } | |
2927 | |
2928 //----- (0048E565) -------------------------------------------------------- | |
2929 int Player::GetMaxMana() | |
2930 { | |
2931 int v2; // eax@2 | |
2932 int v3; // esi@4 | |
2933 int v4; // eax@5 | |
2934 int v5; // esi@5 | |
2935 int v6; // eax@5 | |
2936 int v7; // esi@6 | |
2937 int v8; // esi@6 | |
2938 int v9; // esi@6 | |
2939 int result; // eax@7 | |
1116 | 2940 |
135 | 2941 switch (classType) |
0 | 2942 { |
1116 | 2943 case PLAYER_CLASS_ROGUE: |
2944 case PLAYER_CLASS_SPY: | |
2945 case PLAYER_CLASS_ASSASSIN: | |
2946 case PLAYER_CLASS_ARCHER: | |
2947 case PLAYER_CLASS_WARRIOR_MAGE: | |
2948 case PLAYER_CLASS_MASTER_ARCHER: | |
2949 case PLAYER_CLASS_SNIPER: | |
2950 case PLAYER_CLASS_SORCERER: | |
2951 case PLAYER_CLASS_WIZARD: | |
2952 case PLAYER_CLASS_ARCHMAGE: | |
2953 case PLAYER_CLASS_LICH: | |
0 | 2954 v2 = GetActualIntelligence(); |
1036 | 2955 v3 = GetParameterBonus(v2); |
1116 | 2956 break; |
2957 case PLAYER_CLASS_INITIATE: | |
2958 case PLAYER_CLASS_MASTER: | |
2959 case PLAYER_CLASS_NINJA: | |
2960 case PLAYER_CLASS_PALADIN: | |
2961 case PLAYER_CLASS_CRUSADER: | |
2962 case PLAYER_CLASS_HERO: | |
2963 case PLAYER_CLASS_VILLIAN: | |
2964 case PLAYER_CLASS_CLERIC: | |
2965 case PLAYER_CLASS_PRIEST: | |
2966 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2967 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2968 v2 = GetActualWillpower(); |
1036 | 2969 v3 = GetParameterBonus(v2); |
1116 | 2970 break; |
2971 case PLAYER_CLASS_HUNTER: | |
2972 case PLAYER_CLASS_RANGER_LORD: | |
2973 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2974 case PLAYER_CLASS_DRUID: | |
2975 case PLAYER_CLASS_GREAT_DRUID: | |
2976 case PLAYER_CLASS_ARCH_DRUID: | |
2977 case PLAYER_CLASS_WARLOCK: | |
0 | 2978 v4 = GetActualWillpower(); |
1036 | 2979 v5 = GetParameterBonus(v4); |
0 | 2980 v6 = GetActualIntelligence(); |
1036 | 2981 v3 = GetParameterBonus(v6) + v5; |
0 | 2982 break; |
2983 default: | |
1116 | 2984 return 0; |
0 | 2985 break; |
2986 } | |
1116 | 2987 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2988 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2989 v9 = uFullManaBonus | |
2990 + pBaseManaByClass[classType / 4] | |
2991 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2992 + v8; | |
2993 return max(0,v9); | |
0 | 2994 } |
2995 | |
2996 //----- (0048E656) -------------------------------------------------------- | |
2997 int Player::GetBaseAC() | |
2998 { | |
2999 Player *v1; // edi@1 | |
3000 int v2; // eax@1 | |
3001 int v3; // esi@1 | |
3002 int v4; // esi@1 | |
3003 int v5; // esi@1 | |
3004 int result; // eax@2 | |
3005 | |
3006 v1 = this; | |
3007 v2 = GetActualSpeed(); | |
1036 | 3008 v3 = GetParameterBonus(v2); |
0 | 3009 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3010 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3011 if ( v5 >= 1 ) | |
3012 result = v5; | |
3013 else | |
3014 result = 0; | |
3015 return result; | |
3016 } | |
3017 | |
3018 //----- (0048E68F) -------------------------------------------------------- | |
3019 int Player::GetActualAC() | |
3020 { | |
3021 Player *v1; // edi@1 | |
3022 int v2; // eax@1 | |
3023 int v3; // esi@1 | |
3024 int v4; // esi@1 | |
3025 int v5; // esi@1 | |
3026 int v6; // esi@1 | |
3027 int result; // eax@2 | |
3028 | |
3029 v1 = this; | |
3030 v2 = GetActualSpeed(); | |
1036 | 3031 v3 = GetParameterBonus(v2); |
0 | 3032 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3033 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3034 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
3035 if ( v6 >= 1 ) | |
3036 result = v6; | |
3037 else | |
3038 result = 0; | |
3039 return result; | |
3040 } | |
3041 | |
3042 //----- (0048E6DC) -------------------------------------------------------- | |
3043 unsigned int Player::GetBaseAge() | |
3044 { | |
352 | 3045 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 3046 } |
3047 | |
3048 //----- (0048E72C) -------------------------------------------------------- | |
3049 unsigned int Player::GetActualAge() | |
3050 { | |
3051 return this->sAgeModifier + GetBaseAge(); | |
3052 } | |
3053 | |
3054 //----- (0048E73F) -------------------------------------------------------- | |
3055 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3056 { | |
3057 Player *v2; // ebx@1 | |
3058 signed int v3; // esi@1 | |
3059 enum CHARACTER_RACE v4; // eax@1 | |
3060 signed int v5; // edi@8 | |
3061 char v6; // zf@9 | |
3062 int v7; // esi@20 | |
3063 int result; // eax@21 | |
3064 signed int v9; // [sp-4h] [bp-10h]@11 | |
3065 | |
3066 v2 = this; | |
3067 v3 = 0; | |
3068 v4 = GetRace(); | |
3069 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3070 { | |
3071 v5 = 0; | |
3072 goto LABEL_16; | |
3073 } | |
3074 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3075 { | |
3076 v5 = 1; | |
3077 LABEL_16: | |
3078 v6 = v4 == 2; | |
3079 goto LABEL_17; | |
3080 } | |
3081 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3082 { | |
3083 v6 = v4 == 3; | |
3084 v5 = 2; | |
3085 goto LABEL_17; | |
3086 } | |
3087 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3088 { | |
3089 v5 = 3; | |
3090 v6 = v4 == 3; | |
3091 goto LABEL_17; | |
3092 } | |
3093 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3094 { | |
3095 v5 = 7; | |
3096 if ( v4 != 1 ) | |
3097 goto LABEL_20; | |
3098 v9 = 10; | |
3099 LABEL_19: | |
3100 v3 = v9; | |
3101 goto LABEL_20; | |
3102 } | |
3103 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3104 { | |
3105 v5 = 8; | |
3106 v6 = v4 == 0; | |
3107 LABEL_17: | |
3108 if ( !v6 ) | |
3109 goto LABEL_20; | |
3110 v9 = 5; | |
3111 goto LABEL_19; | |
3112 } | |
3113 v5 = 0; | |
3114 LABEL_20: | |
3115 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3116 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3117 result = v7 + *(&v2->sResFireBase + v5); |
3118 return result; | |
3119 } | |
3120 | |
3121 //----- (0048E7D0) -------------------------------------------------------- | |
3122 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3123 { | |
3124 signed int v2; // edi@1 | |
3125 Player *v3; // esi@1 | |
3126 enum CHARACTER_RACE v4; // ebx@1 | |
3127 char v6; // zf@18 | |
3128 int v7; // ebx@28 | |
3129 int result; // eax@28 | |
3130 signed int v9; // [sp+10h] [bp-8h]@1 | |
3131 signed int v10; // [sp+14h] [bp-4h]@1 | |
3132 | |
3133 v2 = 0; | |
3134 v3 = this; | |
3135 v10 = 0; | |
3136 v9 = 0; | |
3137 v4 = GetRace(); | |
652 | 3138 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3139 v10 = 20; |
3140 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3141 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3142 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3143 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3144 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3145 && HasItemEquipped(EQUIP_ARMOUR) | |
3146 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3147 v10 += v3->pActiveSkills[9] & 0x3F; | |
3148 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3149 goto LABEL_25; | |
3150 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3151 { | |
3152 v2 = 1; | |
3153 LABEL_25: | |
3154 v6 = v4 == 2; | |
3155 LABEL_26: | |
3156 if ( v6 ) | |
3157 v9 = 5; | |
3158 goto LABEL_28; | |
3159 } | |
3160 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3161 { | |
3162 v6 = v4 == 3; | |
3163 v2 = 2; | |
3164 goto LABEL_26; | |
3165 } | |
3166 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3167 { | |
3168 v2 = 3; | |
3169 if ( v4 == 3 ) | |
3170 v10 += 5; | |
3171 } | |
3172 else | |
3173 { | |
3174 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3175 { | |
3176 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3177 goto LABEL_28; | |
3178 v2 = 8; | |
3179 v6 = v4 == 0; | |
3180 goto LABEL_26; | |
3181 } | |
3182 v2 = 7; | |
3183 if ( v4 == 1 ) | |
3184 v9 = 10; | |
3185 } | |
3186 LABEL_28: | |
3187 v7 = GetItemsBonus(a2, 0); | |
3188 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3189 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3190 { |
3191 if ( result > 200 ) | |
3192 result = 200; | |
3193 } | |
3194 return result; | |
3195 } | |
3196 | |
3197 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3198 bool Player::Recover(int dt) |
3199 { | |
3200 //Player *v2; // esi@1 | |
0 | 3201 signed __int64 v3; // qax@1 |
816 | 3202 //bool result; // eax@4 |
3203 | |
3204 //v2 = this; | |
3205 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3206 | |
3207 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3208 | |
3209 if (uTimeToRecovery > v3) | |
3210 { | |
3211 uTimeToRecovery -= v3; | |
3212 return true; | |
0 | 3213 } |
3214 else | |
3215 { | |
816 | 3216 uTimeToRecovery = 0; |
3217 viewparams->bRedrawGameUI = true; | |
3218 if (!uActiveCharacter) | |
0 | 3219 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3220 return false; |
3221 } | |
0 | 3222 } |
3223 | |
3224 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3225 void Player::SetRecoveryTime(signed int rec) |
3226 { | |
1545 | 3227 Assert(rec >= 0); |
816 | 3228 |
3229 if (rec > uTimeToRecovery) | |
3230 uTimeToRecovery = rec; | |
3231 | |
3232 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3233 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3234 |
3235 viewparams->bRedrawGameUI = true; | |
0 | 3236 } |
3237 // 50C0C4: using guessed type int some_active_character; | |
3238 | |
3239 //----- (0048E9B7) -------------------------------------------------------- | |
3240 void Player::RandomizeName() | |
3241 { | |
3242 if (!uExpressionTimePassed) | |
3243 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3244 } | |
3245 | |
3246 //----- (0048E9F4) -------------------------------------------------------- | |
3247 unsigned int Player::GetMajorConditionIdx() | |
3248 { | |
3249 for (uint i = 0; i < 18; ++i) | |
3250 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3251 return pConditionImportancyTable[i]; | |
3252 | |
3253 return 18; | |
3254 } | |
3255 | |
3256 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3257 int Player::GetParameterBonus( int player_parameter ) |
3258 { | |
3259 int i; // eax@1 | |
3260 i = 0; | |
3261 while (param_to_bonus_table[i]) | |
3262 { | |
3263 if (player_parameter >= param_to_bonus_table[i]) | |
3264 break; | |
3265 ++i; | |
3266 } | |
3267 return parameter_to_bonus_value[i]; | |
0 | 3268 } |
3269 | |
3270 //----- (0048EA46) -------------------------------------------------------- | |
3271 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3272 { | |
1032 | 3273 int inv_indx; // eax@3 |
3274 | |
3275 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3276 { | |
3277 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3278 continue; | |
3279 inv_indx = pEquipment.pIndices[i] - 1; | |
3280 if (a2==17) | |
3281 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3282 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3283 return 50; |
3284 } | |
3285 if (a2==24) | |
3286 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3287 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3288 return 5; |
3289 } | |
3290 } | |
3291 return 0; | |
0 | 3292 } |
3293 | |
3294 //----- (0048EAAE) -------------------------------------------------------- | |
3295 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3296 { | |
3297 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3298 // signed int v4; // eax@1 |
0 | 3299 int v5; // edi@1 |
3300 Player *v6; // ebx@1 | |
3301 Player *v8; // ecx@48 | |
3302 int v9; // eax@49 | |
3303 int v10; // edx@49 | |
3304 Player *v11; // ecx@55 | |
3305 int v12; // eax@56 | |
3306 int v13; // edx@56 | |
3307 int v14; // ecx@58 | |
3308 int v15; // eax@58 | |
3309 Player *v16; // ecx@61 | |
3310 int v17; // eax@62 | |
3311 Player *v18; // ecx@66 | |
3312 int v19; // eax@67 | |
3313 int v20; // eax@69 | |
3314 Player *v21; // ecx@75 | |
3315 int v22; // eax@76 | |
3316 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3317 //int v24; // eax@79 |
0 | 3318 int v25; // ecx@80 |
3319 int v26; // edi@80 | |
3320 Player *v27; // ecx@84 | |
3321 int v28; // eax@85 | |
3322 int v29; // edx@85 | |
3323 Player *v30; // ecx@96 | |
3324 int v31; // ebp@97 | |
3325 int v32; // eax@98 | |
3326 unsigned int v33; // eax@100 | |
3327 int v34; // eax@103 | |
3328 char v35; // zf@104 | |
3329 char v36; // zf@107 | |
3330 unsigned __int8 v37; // zf@119 | |
3331 char v38; // sf@119 | |
3332 unsigned __int8 v39; // of@119 | |
3333 char v40; // zf@122 | |
3334 char v41; // zf@145 | |
3335 char v42; // zf@164 | |
3336 char v43; // zf@173 | |
3337 char v44; // zf@189 | |
3338 char v45; // zf@198 | |
3339 char v46; // zf@239 | |
3340 int v47; // eax@268 | |
3341 int v48; // eax@269 | |
3342 int v49; // eax@291 | |
3343 char v50; // zf@295 | |
3344 int v51; // eax@306 | |
3345 int v52; // eax@307 | |
3346 char v53; // zf@312 | |
3347 char v54; // zf@336 | |
3348 char v55; // zf@348 | |
3349 int v56; // eax@365 | |
3350 int v57; // ebx@368 | |
3351 signed int v58; // [sp-4h] [bp-20h]@10 | |
3352 signed int v59; // [sp-4h] [bp-20h]@71 | |
3353 signed int v60; // [sp-4h] [bp-20h]@347 | |
3354 int v61; // [sp+10h] [bp-Ch]@1 | |
3355 int v62; // [sp+14h] [bp-8h]@1 | |
3356 int v63; // [sp+18h] [bp-4h]@101 | |
3357 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3358 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3359 bool no_skills; |
0 | 3360 |
3361 v3 = attr; | |
3362 v5 = 0; | |
3363 v6 = this; | |
3364 v62 = 0; | |
3365 v61 = 0; | |
3366 | |
1040 | 3367 |
3368 no_skills=false; | |
0 | 3369 switch (attr) |
3370 { | |
1040 | 3371 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3372 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3373 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3374 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3375 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3376 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3377 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3378 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3379 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3380 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3381 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3382 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3383 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3384 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3385 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3386 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3387 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3388 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3389 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3390 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3391 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3392 default: | |
3393 no_skills=true; | |
0 | 3394 } |
1040 | 3395 if (!no_skills) |
0 | 3396 { |
1040 | 3397 if ( !this->pActiveSkills[v58] ) |
3398 return 0; | |
0 | 3399 } |
1040 | 3400 |
0 | 3401 if ( (signed int)attr > 28 ) |
3402 { | |
3403 if ( (signed int)attr < 29 ) | |
3404 return v5 + v62 + v61; | |
1040 | 3405 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3406 { |
3407 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3408 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3409 return v5 + v62 + v61; |
3410 } | |
1040 | 3411 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3412 { |
3413 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3414 return v5 + v62 + v61; | |
1040 | 3415 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3416 v5 = pItemsTable->pItems[v57].uDamageMod; |
3417 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3418 v5 += v56; |
3419 return v5 + v62 + v61; | |
3420 } | |
3421 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3422 { |
3423 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3424 return v5 + v62 + v61; | |
1040 | 3425 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3426 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3427 LABEL_365: | |
3428 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3429 LABEL_366: | |
3430 v5 += v56; | |
3431 return v5 + v62 + v61; | |
3432 } | |
3433 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3434 return v5 + v62 + v61; | |
3435 LABEL_95: | |
3436 v65 = 0; | |
3437 while ( 1 ) | |
3438 { | |
3439 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3440 goto LABEL_361; | |
898 | 3441 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3442 if ( v3 == 9 ) |
3443 { | |
816 | 3444 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3445 if ( v32 >= 3 ) |
3446 { | |
3447 if ( v32 <= 11 ) | |
3448 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3449 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3450 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3451 } | |
3452 } | |
3453 } | |
3454 v63 = (int)((char *)v6 + 36 * v31); | |
3455 attra = (ItemGen *)(v63 + 532); | |
377 | 3456 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3457 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3458 { |
3459 v34 = attra->uItemID; | |
3460 switch ( attra->uItemID ) | |
3461 { | |
3462 case 0x1F4u: | |
3463 v35 = v3 == 5; | |
3464 goto LABEL_105; | |
3465 case 0x1F5u: | |
3466 v36 = v3 == 0; | |
3467 goto LABEL_108; | |
3468 case 0x1F6u: | |
3469 if ( v3 == 21 ) | |
3470 v61 += 10; | |
3471 v36 = v3 == 2; | |
3472 goto LABEL_108; | |
3473 case 0x1F7u: | |
3474 if ( v3 == 17 ) | |
3475 v61 += 5; | |
3476 if ( v3 == 18 ) | |
3477 v61 += 5; | |
3478 v36 = v3 == 6; | |
3479 goto LABEL_108; | |
3480 case 0x1F8u: | |
3481 goto LABEL_118; | |
3482 case 0x1F9u: | |
3483 v40 = v3 == 3; | |
3484 goto LABEL_123; | |
3485 case 0x1FAu: | |
3486 v35 = v3 == 10; | |
3487 goto LABEL_105; | |
3488 case 0x1FEu: | |
3489 v35 = v3 == 4; | |
3490 goto LABEL_105; | |
3491 case 0x1FFu: | |
3492 if ( v3 == 23 ) | |
3493 v61 += 10; | |
3494 if ( v3 == 22 ) | |
3495 v61 += 10; | |
3496 goto LABEL_361; | |
3497 case 0x200u: | |
3498 if ( v3 == 36 ) | |
3499 { | |
3500 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3501 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3502 } | |
3503 v36 = v3 == 5; | |
3504 LABEL_108: | |
3505 if ( v36 ) | |
3506 v5 += 40; | |
3507 goto LABEL_361; | |
3508 case 0x201u: | |
3509 if ( v3 == 39 ) | |
3510 { | |
3511 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3512 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3513 v62 = v34; | |
3514 } | |
3515 goto LABEL_136; | |
3516 case 0x202u: | |
3517 if ( !v3 ) | |
3518 v5 += 150; | |
3519 if ( v3 == 1 ) | |
3520 v5 -= 40; | |
3521 if ( v3 == 2 ) | |
3522 v5 -= 40; | |
3523 goto LABEL_145; | |
3524 case 0x203u: | |
3525 if ( v3 == 42 ) | |
3526 { | |
3527 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3528 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3529 } | |
3530 if ( v3 == 43 ) | |
3531 v61 += 15; | |
3532 goto LABEL_361; | |
3533 case 0x204u: | |
3534 if ( v3 == 17 ) | |
3535 v61 += 5; | |
3536 if ( v3 == 18 ) | |
3537 v61 += 5; | |
3538 if ( v3 == 6 ) | |
3539 v5 += 50; | |
3540 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3541 goto LABEL_166; | |
3542 v42 = v3 == 15; | |
3543 goto LABEL_165; | |
3544 case 0x205u: | |
3545 if ( v3 == 18 ) | |
3546 v61 += 5; | |
3547 goto LABEL_361; | |
3548 case 0x206u: | |
3549 if ( !v3 ) | |
3550 v5 += 100; | |
3551 if ( v3 == 3 ) | |
3552 v5 += 100; | |
3553 v43 = v3 == 9; | |
3554 goto LABEL_174; | |
3555 case 0x207u: | |
3556 if ( v3 == 45 ) | |
3557 v61 += 5; | |
3558 if ( v3 == 15 ) | |
3559 v5 -= 10; | |
3560 v42 = v3 == 14; | |
3561 LABEL_165: | |
3562 if ( v42 ) | |
3563 LABEL_166: | |
3564 v5 -= 10; | |
3565 goto LABEL_361; | |
3566 case 0x208u: | |
3567 v35 = v3 == 3; | |
3568 goto LABEL_105; | |
3569 case 0x209u: | |
3570 if ( v3 == 2 ) | |
3571 v5 += 15; | |
3572 if ( !v3 ) | |
3573 v5 += 15; | |
3574 v41 = v3 == 6; | |
3575 goto LABEL_146; | |
3576 case 0x20Au: | |
3577 if ( v3 == 46 ) | |
3578 v61 += 15; | |
3579 v44 = v3 == 3; | |
3580 goto LABEL_190; | |
3581 case 0x20Bu: | |
3582 if ( v3 == 34 ) | |
3583 { | |
3584 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3585 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3586 } | |
3587 if ( v3 == 12 ) | |
3588 v5 += 50; | |
3589 if ( v3 == 2 ) | |
3590 v5 += 30; | |
3591 v45 = v3 == 9; | |
3592 goto LABEL_199; | |
3593 case 0x20Cu: | |
3594 if ( !v3 ) | |
3595 v5 += 75; | |
3596 goto LABEL_145; | |
3597 case 0x20Du: | |
3598 if ( v3 == 5 ) | |
3599 v5 += 50; | |
3600 if ( v3 == 6 ) | |
3601 v5 += 50; | |
3602 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3603 goto LABEL_374; | |
3604 v43 = v3 == 15; | |
3605 LABEL_174: | |
3606 if ( v43 ) | |
3607 LABEL_374: | |
3608 v5 -= 15; | |
3609 goto LABEL_361; | |
3610 case 0x20Eu: | |
3611 if ( v3 == 4 ) | |
3612 v5 += 150; | |
3613 if ( v3 == 44 ) | |
3614 v61 += 5; | |
3615 if ( v3 == 9 ) | |
3616 v5 -= 25; | |
3617 goto LABEL_361; | |
3618 case 0x20Fu: | |
3619 if ( v3 == 39 ) | |
3620 { | |
3621 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3622 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3623 v62 = v34; | |
3624 } | |
3625 if ( v3 == 40 ) | |
3626 { | |
3627 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3628 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3629 } | |
3630 LABEL_145: | |
3631 v41 = v3 == 5; | |
3632 LABEL_146: | |
3633 if ( v41 ) | |
3634 v5 -= 40; | |
3635 goto LABEL_361; | |
3636 case 0x210u: | |
3637 if ( v3 == 38 ) | |
3638 { | |
3639 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3640 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3641 } | |
3642 if ( !v3 ) | |
3643 v5 += 75; | |
3644 v44 = v3 == 11; | |
3645 LABEL_190: | |
3646 if ( v44 ) | |
3647 v5 -= 50; | |
3648 goto LABEL_361; | |
3649 case 0x211u: | |
3650 if ( v3 == 5 ) | |
3651 v5 += 100; | |
3652 if ( v3 == 4 ) | |
3653 v5 += 50; | |
3654 v35 = v3 == 11; | |
3655 LABEL_105: | |
3656 if ( v35 ) | |
3657 v5 += 50; | |
3658 goto LABEL_361; | |
3659 case 0x212u: | |
3660 if ( v3 == 1 ) | |
3661 v5 -= 20; | |
3662 v45 = v3 == 2; | |
3663 LABEL_199: | |
3664 if ( v45 ) | |
3665 v5 -= 20; | |
3666 goto LABEL_361; | |
3667 case 0x214u: | |
3668 if ( v3 == 1 ) | |
3669 v5 += 15; | |
3670 v46 = v3 == 2; | |
3671 goto LABEL_240; | |
3672 case 0x215u: | |
3673 if ( v3 == 5 ) | |
3674 v5 += 15; | |
3675 v46 = v3 == 4; | |
3676 goto LABEL_240; | |
3677 case 0x216u: | |
3678 if ( v3 == 10 ) | |
3679 v5 += 30; | |
3680 if ( !v3 ) | |
3681 v5 += 15; | |
3682 goto LABEL_315; | |
3683 case 0x217u: | |
3684 if ( v3 == 21 ) | |
3685 v61 += 5; | |
3686 if ( !v3 ) | |
3687 v5 += 15; | |
3688 goto LABEL_253; | |
3689 case 0x218u: | |
3690 goto LABEL_253; | |
3691 default: | |
3692 goto LABEL_361; | |
3693 } | |
3694 goto LABEL_361; | |
3695 } | |
3696 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3697 { | |
3698 if ( (signed int)v3 >= 0 ) | |
3699 { | |
3700 if ( (signed int)v3 <= 15 ) | |
3701 { | |
3702 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3703 } | |
3704 else | |
3705 { | |
3706 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3707 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3708 } | |
3709 } | |
3710 goto LABEL_361; | |
3711 } | |
3712 v34 = *(int *)(v63 + 544); | |
3713 if ( v34 > 48 ) | |
3714 { | |
3715 switch ( v34 ) | |
3716 { | |
3717 case 54: | |
3718 goto LABEL_315; | |
3719 case 49: | |
3720 if ( v3 == 6 ) | |
3721 goto LABEL_121; | |
3722 v50 = v3 == 1; | |
3723 goto LABEL_296; | |
3724 case 51: | |
3725 if ( v3 != 5 && v3 != 1 ) | |
3726 goto LABEL_309; | |
3727 goto LABEL_121; | |
3728 case 52: | |
3729 if ( v3 == 3 ) | |
3730 goto LABEL_121; | |
3731 v50 = v3 == 4; | |
3732 goto LABEL_296; | |
3733 case 53: | |
3734 if ( !v3 ) | |
3735 goto LABEL_121; | |
3736 v50 = v3 == 2; | |
3737 goto LABEL_296; | |
3738 case 55: | |
3739 v46 = v3 == 6; | |
3740 goto LABEL_240; | |
3741 case 56: | |
3742 if ( !v3 ) | |
3743 goto LABEL_351; | |
3744 v53 = v3 == 3; | |
3745 goto LABEL_350; | |
3746 case 57: | |
3747 if ( v3 == 1 ) | |
3748 goto LABEL_351; | |
3749 v53 = v3 == 2; | |
3750 goto LABEL_350; | |
3751 case 50: | |
3752 if ( v3 == 10 ) | |
3753 v5 += 30; | |
3754 goto LABEL_361; | |
3755 case 60: | |
3756 if ( v3 != 23 ) | |
3757 goto LABEL_336; | |
3758 if ( v5 >= 3 ) | |
3759 goto LABEL_361; | |
3760 v5 = 3; | |
3761 LABEL_336: | |
3762 v54 = v3 == 22; | |
3763 goto LABEL_345; | |
3764 case 61: | |
3765 if ( v3 != 17 ) | |
3766 goto LABEL_340; | |
3767 if ( v5 >= 3 ) | |
3768 goto LABEL_361; | |
3769 v5 = 3; | |
3770 LABEL_340: | |
3771 v54 = v3 == 18; | |
3772 goto LABEL_345; | |
3773 case 62: | |
3774 if ( v3 != 19 ) | |
3775 goto LABEL_344; | |
3776 if ( v5 >= 3 ) | |
3777 goto LABEL_361; | |
3778 v5 = 3; | |
3779 LABEL_344: | |
3780 v54 = v3 == 20; | |
3781 LABEL_345: | |
3782 if ( !v54 ) | |
3783 goto LABEL_361; | |
3784 if ( v5 >= 3 ) | |
3785 goto LABEL_361; | |
3786 v60 = 3; | |
3787 goto LABEL_360; | |
3788 case 67: | |
3789 v55 = v3 == 18; | |
3790 goto LABEL_357; | |
3791 case 68: | |
3792 v53 = v3 == 9; | |
3793 goto LABEL_350; | |
3794 case 69: | |
3795 if ( v3 == 11 ) | |
3796 v5 += 20; | |
3797 break; | |
3798 case 70: | |
3799 if ( v3 == 12 ) | |
3800 v5 += 10; | |
3801 v55 = v3 == 16; | |
3802 LABEL_357: | |
3803 if ( v55 && v5 < 2 ) | |
3804 { | |
3805 v60 = 2; | |
3806 LABEL_360: | |
3807 v5 = v60; | |
3808 } | |
3809 break; | |
3810 default: | |
3811 goto LABEL_361; | |
3812 } | |
3813 goto LABEL_361; | |
3814 } | |
3815 if ( v34 == 48 ) | |
3816 { | |
3817 if ( v3 == 9 ) | |
3818 v5 += 5; | |
3819 LABEL_315: | |
3820 v46 = v3 == 3; | |
3821 LABEL_240: | |
3822 if ( v46 ) | |
3823 v5 += 15; | |
3824 goto LABEL_361; | |
3825 } | |
3826 if ( v34 > 32 ) | |
3827 { | |
3828 if ( v34 > 44 ) | |
3829 { | |
3830 v51 = v34 - 45; | |
3831 if ( !v51 ) | |
3832 { | |
3833 if ( v3 == 5 ) | |
3834 goto LABEL_351; | |
3835 v53 = v3 == 4; | |
3836 LABEL_350: | |
3837 if ( v53 ) | |
3838 LABEL_351: | |
3839 v5 += 5; | |
3840 goto LABEL_361; | |
3841 } | |
3842 v52 = v51 - 1; | |
3843 if ( !v52 ) | |
3844 { | |
3845 v40 = v3 == 0; | |
3846 LABEL_123: | |
3847 if ( v40 ) | |
3848 v5 += 25; | |
3849 goto LABEL_361; | |
3850 } | |
3851 if ( v52 == 1 ) | |
3852 { | |
3853 LABEL_309: | |
3854 v50 = v3 == 8; | |
3855 goto LABEL_296; | |
3856 } | |
3857 } | |
3858 else | |
3859 { | |
3860 if ( v34 == 44 ) | |
3861 { | |
3862 v50 = v3 == 7; | |
3863 goto LABEL_296; | |
3864 } | |
3865 v34 -= 33; | |
3866 if ( !v34 ) | |
3867 { | |
3868 if ( v3 != 38 ) | |
3869 goto LABEL_361; | |
3870 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3871 goto LABEL_138; | |
3872 } | |
3873 --v34; | |
3874 if ( !v34 ) | |
3875 { | |
3876 if ( v3 != 36 ) | |
3877 goto LABEL_361; | |
3878 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3879 goto LABEL_138; | |
3880 } | |
3881 v49 = v34 - 8; | |
3882 if ( !v49 ) | |
3883 { | |
3884 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3885 ++v5; | |
3886 goto LABEL_361; | |
3887 } | |
3888 if ( v49 == 1 ) | |
3889 { | |
3890 if ( v3 != 3 && v3 != 7 ) | |
3891 { | |
3892 v50 = v3 == 9; | |
3893 LABEL_296: | |
3894 if ( !v50 ) | |
3895 goto LABEL_361; | |
3896 } | |
3897 LABEL_121: | |
3898 v5 += 10; | |
3899 goto LABEL_361; | |
3900 } | |
3901 } | |
3902 } | |
3903 else | |
3904 { | |
3905 if ( v34 == 32 ) | |
3906 { | |
3907 if ( v3 != 39 ) | |
3908 goto LABEL_361; | |
3909 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3910 goto LABEL_138; | |
3911 } | |
3912 if ( v34 > 28 ) | |
3913 { | |
3914 v34 -= 29; | |
3915 if ( v34 ) | |
3916 { | |
3917 --v34; | |
3918 if ( v34 ) | |
3919 { | |
3920 --v34; | |
3921 if ( v34 || v3 != 41 ) | |
3922 goto LABEL_361; | |
3923 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3924 } | |
3925 else | |
3926 { | |
3927 if ( v3 != 34 ) | |
3928 goto LABEL_361; | |
3929 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3930 } | |
3931 } | |
3932 else | |
3933 { | |
3934 if ( v3 != 37 ) | |
3935 goto LABEL_361; | |
3936 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3937 } | |
3938 goto LABEL_138; | |
3939 } | |
3940 if ( v34 == 28 ) | |
3941 { | |
3942 LABEL_136: | |
3943 if ( v3 == 42 ) | |
3944 { | |
3945 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3946 LABEL_138: | |
3947 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3948 goto LABEL_361; | |
3949 } | |
3950 } | |
3951 else | |
3952 { | |
3953 v47 = v34 - 1; | |
3954 if ( v47 ) | |
3955 { | |
3956 v48 = v47 - 1; | |
3957 if ( v48 ) | |
3958 { | |
3959 v34 = v48 - 24; | |
3960 if ( v34 ) | |
3961 { | |
3962 --v34; | |
3963 if ( v34 || v3 != 40 ) | |
3964 goto LABEL_361; | |
3965 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3966 } | |
3967 else | |
3968 { | |
3969 if ( v3 != 35 ) | |
3970 goto LABEL_361; | |
3971 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3972 } | |
3973 goto LABEL_138; | |
3974 } | |
3975 LABEL_118: | |
3976 if ( (signed int)v3 < 0 ) | |
3977 goto LABEL_361; | |
3978 v39 = __OFSUB__((int)v3, 6); | |
3979 v37 = v3 == 6; | |
3980 v38 = v3 - 6 < 0; | |
3981 } | |
3982 else | |
3983 { | |
3984 LABEL_253: | |
3985 if ( (signed int)v3 < 10 ) | |
3986 goto LABEL_361; | |
3987 v39 = __OFSUB__((int)v3, 15); | |
3988 v37 = v3 == 15; | |
3989 v38 = v3 - 15 < 0; | |
3990 } | |
3991 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3992 goto LABEL_121; | |
3993 } | |
3994 } | |
3995 LABEL_361: | |
3996 ++v65; | |
3997 if ( (signed int)v65 >= 16 ) | |
3998 return v5 + v62 + v61; | |
3999 } | |
4000 } | |
1040 | 4001 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 4002 { |
4003 if ( IsUnarmed() != 1 ) | |
4004 { | |
816 | 4005 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4006 { | |
4007 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4008 if ( v22 >= 0 ) |
4009 { | |
4010 if ( v22 <= 2 ) | |
4011 { | |
1040 | 4012 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 4013 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 4014 { |
4015 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
4016 v25 = pItemsTable->pItems[v23].uDamageDice; | |
4017 } | |
4018 else | |
4019 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4020 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4021 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 4022 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4023 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 4024 } |
4025 } | |
4026 } | |
1040 | 4027 |
4028 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
4029 { | |
4030 | |
4031 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4032 if ((v28 < 0) || v28 > 2 ) | |
4033 return v5 + v62 + v61; | |
4034 } | |
1062 | 4035 v15 = pItemsTable->pItems[v23].uDamageMod; |
4036 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 4037 v5 += v15 + v14; |
1049 | 4038 return v5 + v62 + v61; |
0 | 4039 } |
4040 v59 = 3; | |
4041 LABEL_74: | |
4042 v5 = v59; | |
4043 return v5 + v62 + v61; | |
4044 } | |
4045 if ( (signed int)attr < 0 ) | |
4046 return v5 + v62 + v61; | |
1040 | 4047 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 4048 goto LABEL_95; |
1040 | 4049 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
4050 { | |
4051 if ( !Player::HasEnchantedItemEquipped(25) ) | |
4052 return v5 + v62 + v61; | |
4053 v5 = 5; | |
4054 return v5 + v62 + v61; | |
4055 } | |
4056 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 4057 return v5 + v62 + v61; |
1040 | 4058 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 4059 { |
4060 if ( IsUnarmed() == 1 ) | |
4061 { | |
4062 v5 = 0; | |
4063 return v5 + v62 + v61; | |
4064 } | |
816 | 4065 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4066 { | |
4067 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4068 if ( v17 >= 0 ) |
4069 { | |
4070 if ( v17 <= 2 ) | |
1040 | 4071 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 4072 } |
4073 } | |
865 | 4074 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 4075 return v5 + v62 + v61; |
1040 | 4076 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
4077 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4078 v5 += v56; | |
4079 return v5 + v62 + v61; | |
4080 } | |
4081 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 4082 { |
4083 if ( IsUnarmed() == 1 ) | |
4084 { | |
4085 v5 = 1; | |
4086 return v5 + v62 + v61; | |
4087 } | |
816 | 4088 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4089 { | |
4090 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4091 if ( v9 >= 0 ) |
4092 { | |
4093 if ( v9 <= 2 ) | |
4094 { | |
1040 | 4095 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4096 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4097 if ( !v6->pEquipment.uShield ) |
0 | 4098 { |
1040 | 4099 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4100 ++v5; |
4101 } | |
4102 } | |
4103 } | |
4104 } | |
1040 | 4105 |
4106 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4107 { | |
4108 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4109 if ((v12 < 0) || v12 > 2 ) | |
4110 return v5 + v62 + v61; | |
4111 } | |
4112 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4113 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4114 LABEL_88: |
4115 v5 += v15 + v14; | |
4116 } | |
4117 return v5 + v62 + v61; | |
4118 } | |
4119 | |
4120 //----- (0048F73C) -------------------------------------------------------- | |
4121 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4122 { | |
4123 int result; // eax@1 | |
4124 int v3; // eax@4 | |
4125 int v4; // ecx@5 | |
4126 | |
4127 switch (a2) | |
4128 { | |
4129 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4130 } | |
4131 | |
4132 result = 0; | |
4133 if ( (signed int)a2 > 10 ) | |
4134 { | |
4135 if ( (signed int)a2 <= 15 ) | |
4136 { | |
4137 switch ( a2 ) | |
4138 { | |
4139 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4140 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4141 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4142 break; |
4143 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4144 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4145 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4146 break; |
4147 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4148 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4149 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4150 break; |
4151 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4152 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4153 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4154 break; |
4155 default: | |
4156 if ( a2 != 14 ) | |
4157 return result; | |
4158 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4159 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4160 break; |
4161 } | |
4162 return v4 + v3; | |
4163 } | |
4164 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4165 { | |
4166 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4167 { | |
4168 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4169 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4170 return v4 + v3; |
4171 } | |
4172 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4173 return result; | |
4174 } | |
4175 return this->pPlayerBuffs[1].uPower; | |
4176 } | |
4177 if ( a2 == 10 ) | |
4178 { | |
4179 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4180 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4181 return v4 + v3; |
4182 } | |
4183 switch ( a2 ) | |
4184 { | |
4185 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4186 v3 = pPlayerBuffs[19].uPower; | |
4187 goto LABEL_5; | |
4188 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4189 v3 = pPlayerBuffs[17].uPower; | |
4190 goto LABEL_5; | |
4191 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4192 v3 = pPlayerBuffs[20].uPower; | |
4193 goto LABEL_5; | |
4194 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4195 v3 = pPlayerBuffs[16].uPower; | |
4196 goto LABEL_5; | |
4197 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4198 v3 = pPlayerBuffs[15].uPower; | |
4199 goto LABEL_5; | |
4200 case CHARACTER_ATTRIBUTE_SPEED: | |
4201 v3 = pPlayerBuffs[21].uPower; | |
4202 goto LABEL_5; | |
4203 case CHARACTER_ATTRIBUTE_LUCK: | |
4204 v3 = pPlayerBuffs[18].uPower; | |
4205 LABEL_5: | |
1167 | 4206 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4207 return v4 + v3; |
4208 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4209 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4210 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4211 return v4 + v3; |
4212 default: | |
4213 return result; | |
4214 } | |
4215 return result; | |
4216 } | |
4217 | |
4218 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4219 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4220 { | |
1064 | 4221 signed int bonus_value; // esi@1 |
4222 unsigned __int16 skill_value; // ax@126 | |
4223 int result; // al@127 | |
353 | 4224 |
1064 | 4225 bonus_value = 0; |
353 | 4226 switch (uSkillType) |
4227 { | |
4228 case PLAYER_SKILL_MONSTER_ID: | |
4229 { | |
652 | 4230 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4231 bonus_value = 6; |
652 | 4232 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4233 bonus_value += 6; |
4234 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4235 } |
4236 break; | |
4237 | |
4238 case PLAYER_SKILL_ARMSMASTER: | |
4239 { | |
652 | 4240 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4241 bonus_value = 2; |
652 | 4242 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4243 bonus_value += 3; |
4244 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4245 } |
4246 break; | |
4247 | |
4248 case PLAYER_SKILL_STEALING: | |
4249 { | |
652 | 4250 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4251 bonus_value = 8; |
4252 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4253 } |
4254 break; | |
4255 | |
4256 | |
4257 case PLAYER_SKILL_ALCHEMY: | |
4258 { | |
652 | 4259 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4260 bonus_value = 4; |
652 | 4261 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4262 bonus_value += 8; |
4263 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4264 } |
4265 break; | |
4266 | |
4267 case PLAYER_SKILL_LEARNING: | |
4268 { | |
652 | 4269 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4270 bonus_value = 10; |
652 | 4271 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4272 bonus_value += 15; |
652 | 4273 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4274 bonus_value += 5; |
4275 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4276 } |
4277 break; | |
4278 | |
4279 case PLAYER_SKILL_UNARMED: | |
4280 { | |
652 | 4281 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4282 bonus_value = 2; |
4283 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4284 } |
4285 break; | |
4286 | |
4287 case PLAYER_SKILL_DODGE: | |
4288 { | |
652 | 4289 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4290 bonus_value = 2; |
4291 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4292 } |
4293 break; | |
4294 | |
4295 case PLAYER_SKILL_BOW: | |
1064 | 4296 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4297 break; |
4298 case PLAYER_SKILL_SHIELD: | |
1064 | 4299 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4300 break; |
4301 | |
4302 case PLAYER_SKILL_EARTH: | |
652 | 4303 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4304 bonus_value = 2; |
652 | 4305 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4306 bonus_value += 3; |
652 | 4307 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4308 bonus_value += 4; |
353 | 4309 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4310 bonus_value += 3; |
4311 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4312 break; |
4313 case PLAYER_SKILL_FIRE: | |
652 | 4314 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4315 bonus_value = 2; |
652 | 4316 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4317 bonus_value += 3; |
652 | 4318 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4319 bonus_value += 4; |
353 | 4320 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4321 bonus_value += 3; |
4322 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4323 break; |
4324 case PLAYER_SKILL_AIR: | |
652 | 4325 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4326 bonus_value = 2; |
652 | 4327 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4328 bonus_value += 3; |
652 | 4329 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4330 bonus_value += 4; |
353 | 4331 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4332 bonus_value += 3; |
4333 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4334 break; |
4335 case PLAYER_SKILL_WATER: | |
652 | 4336 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4337 bonus_value = 2; |
652 | 4338 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4339 bonus_value += 3; |
652 | 4340 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4341 bonus_value += 4; |
353 | 4342 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4343 bonus_value += 3; |
4344 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4345 break; |
4346 case PLAYER_SKILL_SPIRIT: | |
652 | 4347 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4348 bonus_value = 2; |
652 | 4349 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4350 bonus_value += 3; |
652 | 4351 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4352 bonus_value += 4; |
4353 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4354 break; |
4355 case PLAYER_SKILL_MIND: | |
652 | 4356 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4357 bonus_value = 2; |
652 | 4358 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4359 bonus_value += 3; |
652 | 4360 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4361 bonus_value += 4; |
4362 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4363 break; |
4364 case PLAYER_SKILL_BODY: | |
652 | 4365 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4366 bonus_value = 2; |
652 | 4367 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4368 bonus_value += 3; |
652 | 4369 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4370 bonus_value += 4; |
4371 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4372 break; |
4373 case PLAYER_SKILL_LIGHT: | |
1064 | 4374 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4375 break; |
4376 case PLAYER_SKILL_DARK: | |
4377 { | |
1064 | 4378 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4379 } |
4380 break; | |
4381 | |
4382 case PLAYER_SKILL_MERCHANT: | |
4383 { | |
652 | 4384 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4385 bonus_value = 4; |
652 | 4386 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4387 bonus_value += 6; |
652 | 4388 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4389 bonus_value += 3; |
652 | 4390 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4391 bonus_value += 8; |
353 | 4392 } |
4393 break; | |
4394 | |
4395 case PLAYER_SKILL_PERCEPTION: | |
4396 { | |
652 | 4397 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4398 bonus_value = 6; |
652 | 4399 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4400 bonus_value += 5; |
353 | 4401 } |
4402 break; | |
4403 | |
0 | 4404 case PLAYER_SKILL_ITEM_ID: |
1064 | 4405 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4406 break; |
4407 case PLAYER_SKILL_MEDITATION: | |
1064 | 4408 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4409 break; |
0 | 4410 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4411 { |
652 | 4412 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4413 bonus_value = 4; |
652 | 4414 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4415 bonus_value += 6; |
652 | 4416 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4417 bonus_value += 8; |
4418 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4419 } |
4420 break; | |
4421 } | |
4422 | |
1064 | 4423 skill_value = pActiveSkills[uSkillType]; |
4424 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4425 result = bonus_value + skill_value; | |
0 | 4426 else |
1064 | 4427 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4428 return result; |
4429 } | |
4430 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4431 |
0 | 4432 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4433 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
|
4434 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4435 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4436 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4437 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4438 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
|
4439 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
|
4440 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4441 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4442 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
|
4443 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4444 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
|
4445 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4446 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
|
4447 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4448 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4449 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4450 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
|
4451 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4452 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4453 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4454 { |
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
|
4455 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
|
4456 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
|
4457 { |
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
|
4458 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4459 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
|
4460 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
|
4461 } |
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
|
4462 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
|
4463 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4464 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
|
4465 { |
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
|
4466 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
|
4467 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
|
4468 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
|
4469 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4470 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4471 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
|
4472 { |
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
|
4473 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
|
4474 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
|
4475 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
|
4476 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4477 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4478 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
|
4479 { |
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
|
4480 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
|
4481 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
|
4482 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
|
4483 |
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
|
4484 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
|
4485 { |
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
|
4486 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) |
1538 | 4487 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4488 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
|
4489 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
|
4490 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
|
4491 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
|
4492 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
|
4493 { |
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
|
4494 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4495 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
|
4496 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
|
4497 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
|
4498 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4499 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
|
4500 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
|
4501 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
|
4502 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4503 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
|
4504 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
|
4505 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
|
4506 wearingLeather = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4507 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
|
4508 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
|
4509 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
|
4510 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4511 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
|
4512 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
|
4513 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
|
4514 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4515 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
|
4516 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
|
4517 } |
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
|
4518 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4519 } |
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
|
4520 } |
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
|
4521 |
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
|
4522 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
|
4523 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4524 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
|
4525 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
|
4526 { |
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
|
4527 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
|
4528 } |
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
|
4529 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
|
4530 } |
1538 | 4531 break; |
4532 case CHARACTER_ATTRIBUTE_ATTACK: | |
4533 if ( this->IsUnarmed() ) | |
4534 { | |
4535 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4536 if (!unarmedSkill) | |
4537 { | |
4538 return 0; | |
4539 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4540 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4541 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4542 } | |
4543 for (int i = 0; i < 16; ++i) | |
4544 { | |
4545 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4546 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4547 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4548 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4549 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4550 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4551 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4552 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4553 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4554 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4555 return multiplier * (currentItemSkillLevel & 0x3F); |
4556 } | |
4557 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4558 { | |
4559 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
|
4560 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4561 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4562 } | |
4563 else | |
4564 { | |
4565 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4566 } | |
4567 } | |
4568 } | |
4569 } | |
4570 return 0; | |
4571 break; | |
4572 | |
4573 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4574 for (int i = 0; i < 16; i++) | |
4575 { | |
4576 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4577 { | |
4578 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4579 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4580 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4581 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4582 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4583 return multiplier * (currentItemSkillLevel & 0x3F); |
4584 } | |
4585 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4586 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4587 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4588 return multiplier * (currentItemSkillLevel & 0x3F); |
4589 } | |
4590 } | |
4591 } | |
4592 return 0; | |
4593 break; | |
4594 | |
4595 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4596 if ( this->IsUnarmed() ) | |
4597 { | |
4598 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4599 if ( !unarmedSkillLevel ) | |
4600 { | |
4601 return 0; | |
4602 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4603 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4604 return multiplier * (unarmedSkillLevel & 0x3F); |
4605 } | |
4606 for (int i = 0; i < 16; i++) | |
4607 { | |
4608 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4609 { | |
4610 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4611 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4612 { | |
4613 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4614 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4615 int baseSkillBonus; | |
4616 int multiplier; | |
4617 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4618 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4619 case PLAYER_SKILL_STAFF: |
1538 | 4620 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
|
4621 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4622 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
|
4623 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4624 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
|
4625 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4626 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4627 { |
1538 | 4628 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4629 } |
1538 | 4630 break; |
4631 | |
4632 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4633 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4634 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4635 return armsMasterBonus + baseSkillBonus; | |
4636 break; | |
4637 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4638 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4639 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4640 return armsMasterBonus + baseSkillBonus; | |
4641 break; | |
4642 case PLAYER_SKILL_MACE: | |
4643 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4644 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4645 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4646 return armsMasterBonus + baseSkillBonus; | |
4647 break; | |
4648 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4649 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4650 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4651 return armsMasterBonus + baseSkillBonus; | |
4652 break; | |
1535 | 4653 } |
1533 | 4654 } |
1535 | 4655 } |
1538 | 4656 } |
4657 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4658 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4659 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4660 return 0; |
1533 | 4661 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4662 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4663 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4664 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
|
4665 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4666 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
|
4667 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4668 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4669 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
|
4670 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
|
4671 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
|
4672 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
|
4673 } |
1545 | 4674 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
|
4675 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4676 } |
0 | 4677 //----- (00490109) -------------------------------------------------------- |
4678 // faces are: 0 1 2 3 human males | |
4679 // 4 5 6 7 human females | |
4680 // 8 9 elf males | |
4681 // 10 11 elf females | |
4682 // 12 13 dwarf males | |
4683 // 14 15 dwarf females | |
4684 // 16 17 goblin males | |
4685 // 18 19 goblin females | |
4686 // 20 lich male | |
4687 // 21 lich female | |
4688 // 22 underwater suits (unused) | |
4689 // 23 zombie male | |
4690 // 24 zombie female | |
4691 enum CHARACTER_RACE Player::GetRace() | |
4692 { | |
1014 | 4693 if ( uCurrentFace > 15 ) |
4694 { | |
4695 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4696 return CHARACTER_RACE_GOBLIN; |
4697 } | |
4698 else | |
4699 { | |
1014 | 4700 if ( uCurrentFace >= 12 ) |
0 | 4701 { |
4702 return CHARACTER_RACE_DWARF; | |
4703 } | |
4704 else | |
4705 { | |
1014 | 4706 |
4707 if ( uCurrentFace <= 7 ) | |
0 | 4708 { |
4709 return CHARACTER_RACE_HUMAN; | |
4710 } | |
4711 else | |
4712 { | |
1014 | 4713 if ( uCurrentFace <= 11 ) |
0 | 4714 return CHARACTER_RACE_ELF; |
4715 } | |
4716 } | |
4717 } | |
4718 return CHARACTER_RACE_HUMAN; | |
4719 } | |
4720 | |
4721 //----- (00490141) -------------------------------------------------------- | |
187 | 4722 PLAYER_SEX Player::GetSexByVoice() |
0 | 4723 { |
4724 signed int result; // eax@1 | |
4725 | |
4726 result = 0; | |
4727 switch ( this->uVoiceID ) | |
4728 { | |
4729 case 0u: | |
4730 case 1u: | |
4731 case 2u: | |
4732 case 3u: | |
4733 case 8u: | |
4734 case 9u: | |
4735 case 0xCu: | |
4736 case 0xDu: | |
4737 case 0x10u: | |
4738 case 0x11u: | |
4739 case 0x14u: | |
4740 case 0x17u: | |
187 | 4741 return SEX_MALE; |
4742 | |
0 | 4743 case 4u: |
4744 case 5u: | |
4745 case 6u: | |
4746 case 7u: | |
4747 case 0xAu: | |
4748 case 0xBu: | |
4749 case 0xEu: | |
4750 case 0xFu: | |
4751 case 0x12u: | |
4752 case 0x13u: | |
4753 case 0x15u: | |
4754 case 0x18u: | |
187 | 4755 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4756 } |
1545 | 4757 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4758 return SEX_MALE; |
0 | 4759 } |
4760 | |
4761 //----- (00490188) -------------------------------------------------------- | |
4762 void Player::SetInitialStats() | |
4763 { | |
4764 auto v1 = GetRace(); | |
290 | 4765 uMight = StatTable[v1][0].uBaseValue; |
4766 uIntelligence = StatTable[v1][1].uBaseValue; | |
4767 uWillpower = StatTable[v1][2].uBaseValue; | |
4768 uEndurance = StatTable[v1][3].uBaseValue; | |
4769 uAccuracy = StatTable[v1][4].uBaseValue; | |
4770 uSpeed = StatTable[v1][5].uBaseValue; | |
4771 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4772 } |
4773 | |
4774 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4775 void Player::SetSexByVoice() |
4776 { | |
4777 switch ( this->uVoiceID) | |
0 | 4778 { |
4779 case 0: | |
4780 case 1: | |
4781 case 2: | |
4782 case 3: | |
4783 case 8: | |
4784 case 9: | |
4785 case 0xC: | |
4786 case 0xD: | |
4787 case 0x10: | |
4788 case 0x11: | |
4789 case 0x14: | |
4790 case 0x17: | |
1021 | 4791 this->uSex = SEX_MALE; |
0 | 4792 break; |
4793 case 4: | |
4794 case 5: | |
4795 case 6: | |
4796 case 7: | |
4797 case 0xA: | |
4798 case 0xB: | |
4799 case 0xE: | |
4800 case 0xF: | |
4801 case 0x12: | |
4802 case 0x13: | |
4803 case 0x15: | |
4804 case 0x18: | |
1021 | 4805 this->uSex = SEX_FEMALE; |
0 | 4806 break; |
4807 default: | |
4808 break; | |
4809 } | |
1021 | 4810 |
0 | 4811 } |
4812 | |
4813 //----- (0049024A) -------------------------------------------------------- | |
135 | 4814 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4815 { |
4816 sLevelModifier = 0; | |
4817 sAgeModifier = 0; | |
4818 | |
135 | 4819 classType = cls; |
0 | 4820 uLuckBonus = 0; |
4821 uSpeedBonus = 0; | |
4822 uAccuracyBonus = 0; | |
4823 uEnduranceBonus = 0; | |
4824 uWillpowerBonus = 0; | |
4825 uIntelligenceBonus = 0; | |
4826 uMightBonus = 0; | |
4827 uLevel = 1; | |
4828 uExperience = 251 + rand() % 100; | |
4829 uBirthYear = 1147 - rand() % 6; | |
4830 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4831 memset(_achieved_awards_bits, 0, 64); |
0 | 4832 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4833 | |
4834 for (uint i = 0; i < 37; ++i) | |
4835 { | |
135 | 4836 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4837 continue; |
4838 | |
4839 pActiveSkills[i] = 1; | |
4840 | |
4841 switch (i) | |
4842 { | |
886 | 4843 case PLAYER_SKILL_FIRE: |
4844 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4845 |
4846 extern bool all_magic; | |
4847 if ( all_magic == true ) | |
4848 { | |
4849 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4850 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4851 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4852 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4853 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4854 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4855 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4856 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4857 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4858 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4859 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4860 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4861 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4862 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4863 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4864 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4865 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4866 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4867 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4868 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4869 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4870 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4871 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4872 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4873 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4874 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4875 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4876 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4877 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4878 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4879 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4880 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4881 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4882 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4883 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4884 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4885 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4886 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4887 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4888 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4889 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4890 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4891 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4892 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4893 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4894 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4895 } | |
486 | 4896 break; |
886 | 4897 case PLAYER_SKILL_AIR: |
4898 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4899 break; | |
4900 case PLAYER_SKILL_WATER: | |
4901 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4902 break; | |
4903 case PLAYER_SKILL_EARTH: | |
4904 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4905 break; | |
4906 case PLAYER_SKILL_SPIRIT: | |
4907 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4908 break; | |
4909 case PLAYER_SKILL_MIND: | |
4910 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4911 break; | |
4912 case PLAYER_SKILL_BODY: | |
4913 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4914 |
4915 if ( all_magic == true ) | |
4916 { | |
4917 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4918 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4919 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4920 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4921 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4922 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4923 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4924 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4925 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4926 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4927 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4928 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4929 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4930 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4931 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4932 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4933 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4934 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4935 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4936 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4937 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4938 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4939 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4940 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4941 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4942 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4943 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4944 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4945 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4946 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4947 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4948 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4949 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4950 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4951 } | |
569 | 4952 break; |
886 | 4953 case PLAYER_SKILL_LIGHT: |
4954 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4955 break; | |
4956 case PLAYER_SKILL_DARK: | |
4957 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4958 break; | |
0 | 4959 } |
4960 } | |
4961 | |
4962 sHealth = GetMaxHealth(); | |
4963 sMana = GetMaxMana(); | |
4964 } | |
4965 | |
4966 //----- (004903C9) -------------------------------------------------------- | |
821 | 4967 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4968 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4969 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4970 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4971 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4972 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4973 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4974 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4975 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4976 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4977 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4978 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4979 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4980 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4981 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4982 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4983 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4984 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4985 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4986 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4987 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4988 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4989 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4990 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4991 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4992 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4993 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4994 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4995 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4996 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4997 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4998 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4999 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5000 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5001 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5002 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5003 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5004 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5005 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5006 |
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
|
5007 return (PLAYER_SKILL_TYPE)37; |
0 | 5008 } |
5009 | |
5010 | |
5011 | |
5012 //----- (0049048D) -------------------------------------------------------- | |
5013 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
5014 void Player::DecreaseAttribute(int eAttribute) | |
5015 { | |
5016 int v2; // eax@1 | |
5017 int pBaseValue; // ecx@1 | |
5018 int pDroppedStep; // ebx@1 | |
5019 int pStep; // esi@1 | |
5020 unsigned __int16 result; // ax@7 | |
5021 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
5022 | |
5023 v2 = eAttribute + 7 * GetRace(); | |
290 | 5024 pBaseValue = StatTable[0][v2].uBaseValue; |
5025 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 5026 uMinValue = pBaseValue - 2; |
290 | 5027 pStep = StatTable[0][v2].uBaseStep; |
1272 | 5028 unsigned short* AttrToChange = nullptr; |
5029 switch ( eAttribute ) | |
5030 { | |
5031 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5032 AttrToChange = &this->uMight; | |
5033 break; | |
5034 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5035 AttrToChange = &this->uIntelligence; | |
5036 break; | |
5037 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5038 AttrToChange = &this->uWillpower; | |
5039 break; | |
5040 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5041 AttrToChange = &this->uEndurance; | |
5042 break; | |
5043 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5044 AttrToChange = &this->uAccuracy; | |
5045 break; | |
5046 case CHARACTER_ATTRIBUTE_SPEED: | |
5047 AttrToChange = &this->uSpeed; | |
5048 break; | |
5049 case CHARACTER_ATTRIBUTE_LUCK: | |
5050 AttrToChange = &this->uLuck; | |
5051 break; | |
5052 } | |
5053 if ( *AttrToChange <= pBaseValue ) | |
5054 pStep = pDroppedStep; | |
5055 if ( *AttrToChange - pStep >= uMinValue ) | |
5056 *AttrToChange -= pStep; | |
0 | 5057 } |
5058 | |
5059 //----- (004905F5) -------------------------------------------------------- | |
1458 | 5060 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 5061 void Player::IncreaseAttribute( int eAttribute ) |
5062 { | |
5063 int raceId; // eax@1 | |
5064 int maxValue; // ebx@1 | |
5065 signed int baseStep; // edi@1 | |
5066 signed int tmp; // eax@17 | |
0 | 5067 signed int result; // eax@18 |
1273 | 5068 int baseValue; // [sp+Ch] [bp-8h]@1 |
5069 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
5070 unsigned short* statToChange; | |
5071 | |
5072 raceId = GetRace(); | |
5073 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
5074 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
5075 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
5076 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
5077 PlayerCreation_GetUnspentAttributePointCount(); | |
5078 switch ( eAttribute ) | |
5079 { | |
5080 case 0: | |
5081 statToChange = &this->uMight; | |
5082 break; | |
5083 case 1: | |
5084 statToChange = &this->uIntelligence; | |
5085 break; | |
5086 case 2: | |
5087 statToChange = &this->uWillpower; | |
5088 break; | |
5089 case 3: | |
5090 statToChange = &this->uEndurance; | |
5091 break; | |
5092 case 4: | |
5093 statToChange = &this->uAccuracy; | |
5094 break; | |
5095 case 5: | |
5096 statToChange = &this->uSpeed; | |
5097 break; | |
5098 case 6: | |
5099 statToChange = &this->uLuck; | |
5100 default: | |
1545 | 5101 Error("(%u)", eAttribute); |
1273 | 5102 } |
5103 if ( *statToChange < baseValue ) | |
5104 { | |
5105 tmp = baseStep; | |
5106 baseStep = droppedStep; | |
5107 droppedStep = tmp; | |
5108 } | |
5109 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5110 if ( result >= droppedStep ) | |
5111 { | |
5112 if ( baseStep + *statToChange <= maxValue ) | |
5113 *statToChange += baseStep; | |
5114 } | |
0 | 5115 } |
5116 | |
5117 //----- (0049070F) -------------------------------------------------------- | |
5118 void Player::Zero() | |
5119 { | |
5120 this->sLevelModifier = 0; | |
5121 this->sACModifier = 0; | |
5122 this->uLuckBonus = 0; | |
5123 this->uAccuracyBonus = 0; | |
5124 this->uSpeedBonus = 0; | |
5125 this->uEnduranceBonus = 0; | |
5126 this->uWillpowerBonus = 0; | |
5127 this->uIntelligenceBonus = 0; | |
5128 this->uMightBonus = 0; | |
5129 this->field_100 = 0; | |
5130 this->field_FC = 0; | |
5131 this->field_F8 = 0; | |
5132 this->field_F4 = 0; | |
5133 this->field_F0 = 0; | |
5134 this->field_EC = 0; | |
5135 this->field_E8 = 0; | |
5136 this->field_E4 = 0; | |
5137 this->field_E0 = 0; | |
766 | 5138 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5139 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5140 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5141 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5142 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5143 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5144 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5145 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5146 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5147 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5148 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5149 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5150 this->uFullHealthBonus = 0; |
0 | 5151 } |
5152 | |
5153 //----- (004907E7) -------------------------------------------------------- | |
299 | 5154 unsigned int Player::GetStatColor(int uStat) |
0 | 5155 { |
290 | 5156 int attribute_value; // edx@1 |
1393 | 5157 |
5158 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5159 switch (uStat) |
5160 { | |
5161 case 0: attribute_value = uMight; break; | |
5162 case 1: attribute_value = uIntelligence; break; | |
5163 case 2: attribute_value = uWillpower; break; | |
5164 case 3: attribute_value = uEndurance; break; | |
290 | 5165 case 4: attribute_value = uAccuracy; break; |
5166 case 5: attribute_value = uSpeed; break; | |
0 | 5167 case 6: attribute_value = uLuck; break; |
5168 }; | |
5169 | |
1393 | 5170 if (attribute_value == base_attribute_value) |
5171 return ui_character_stat_default_color; | |
5172 else if (attribute_value > base_attribute_value) | |
5173 return ui_character_stat_buffed_color; | |
0 | 5174 else |
1393 | 5175 return ui_character_stat_debuffed_color; |
0 | 5176 } |
5177 | |
5178 //----- (004908A8) -------------------------------------------------------- | |
5179 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5180 { | |
1014 | 5181 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5182 { | |
1393 | 5183 pConditions[uCondition] = 0i64; |
1014 | 5184 return true; |
0 | 5185 } |
5186 else | |
1014 | 5187 return false; |
0 | 5188 } |
5189 | |
5190 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5191 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5192 { |
5193 Player *v3; // esi@1 | |
5194 signed int v5; // eax@17 | |
5195 int v8; // edx@39 | |
5196 char *v13; // eax@45 | |
5197 signed int v15; // edi@68 | |
5198 int v16; // edx@73 | |
5199 unsigned __int16 v17; // edi@73 | |
5200 unsigned int v18; // eax@73 | |
5201 const char *v22; // eax@84 | |
5202 int scroll_id; // esi@96 | |
5203 int v25; // eax@109 | |
5204 int v26; // eax@113 | |
5205 int new_mana_val; // edi@114 | |
5206 signed __int64 v28; // qax@120 | |
5207 __int64 v30; // edi@137 | |
5208 __int64 v32; // ST3C_4@137 | |
5209 __int64 v34; // ST34_4@137 | |
5210 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5211 const char *v66; // [sp-4h] [bp-30h]@69 | |
5212 signed int v67; // [sp-4h] [bp-30h]@77 | |
5213 const char *v68; // [sp-4h] [bp-30h]@89 | |
5214 char v72; // [sp+20h] [bp-Ch]@68 | |
5215 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5216 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5217 Player *thisb; // [sp+28h] [bp-4h]@1 |
5218 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5219 | |
5220 thisb = this; | |
5221 v3 = &pParty->pPlayers[player_num-1]; | |
5222 v73 = 1; | |
1340 | 5223 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5224 return; |
5225 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5226 { |
1021 | 5227 if ( pParty->pPickedItem.uItemID == 160 ) |
5228 { | |
5229 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5230 } | |
5231 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5232 { |
1021 | 5233 new_mana_val = v3->sMana; |
5234 new_mana_val += 2; | |
5235 if ( new_mana_val > v3->GetMaxMana() ) | |
5236 new_mana_val = v3->GetMaxMana(); | |
5237 v3->PlaySound(SPEECH_36, 0); | |
5238 } | |
5239 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5240 { | |
5241 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5242 v3->PlaySound(SPEECH_36, 0); |
1021 | 5243 |
5244 } | |
5245 else | |
5246 { | |
5247 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5248 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
|
5249 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5250 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5251 return; | |
1019 | 5252 } |
1032 | 5253 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5254 | |
5255 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5256 { | |
5257 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5258 } | |
5259 if ( v73 ) | |
5260 { | |
5261 if ( pParty->bTurnBasedModeOn ) | |
5262 { | |
5263 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5264 thisb->SetRecoveryTime(100); | |
1448 | 5265 pTurnEngine->ApplyPlayerAction(); |
1032 | 5266 } |
5267 else | |
5268 { | |
5269 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5270 } | |
5271 } | |
5272 pMouse->RemoveHoldingItem(); | |
5273 return; | |
5274 | |
1021 | 5275 |
5276 } | |
5277 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5278 { |
1021 | 5279 switch ( pParty->pPickedItem.uItemID ) |
5280 { | |
5281 case 221: //Catalyst | |
5282 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5283 break; | |
5284 case 222: //Cure Wounds | |
5285 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5286 pParty->pPlayers[player_num-1].Heal(v25); | |
5287 v3->PlaySound(SPEECH_36, 0); | |
5288 break; | |
5289 case 223: //Magic Potion | |
5290 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5291 new_mana_val = v3->sMana; | |
5292 new_mana_val += v26; | |
5293 if ( new_mana_val > v3->GetMaxMana() ) | |
5294 new_mana_val = v3->GetMaxMana(); | |
5295 v3->PlaySound(SPEECH_36, 0); | |
5296 break; | |
5297 case 224: //Cure Weakness | |
5298 v3->pConditions[Condition_Weak] = 0i64; | |
5299 v3->PlaySound(SPEECH_36, 0); | |
5300 break; | |
5301 case 225: //Cure Disease | |
5302 v3->pConditions[Condition_Disease3] = 0i64; | |
5303 v3->pConditions[Condition_Disease2] = 0i64; | |
5304 v3->pConditions[Condition_Disease1] = 0i64; | |
5305 v3->PlaySound(SPEECH_36, 0); | |
5306 break; | |
5307 case 226: //Cure Poison | |
5308 v3->pConditions[Condition_Poison3] = 0i64; | |
5309 v3->pConditions[Condition_Poison2] = 0i64; | |
5310 v3->pConditions[Condition_Poison1] = 0i64; | |
5311 v3->PlaySound(SPEECH_36, 0); | |
5312 break; | |
5313 case 227: //Awaken | |
5314 v3->pConditions[Condition_Sleep] = 0i64; | |
5315 v3->PlaySound(SPEECH_36, 0); | |
5316 break; | |
5317 case 228: //Haste | |
5318 if ( !v3->pConditions[Condition_Weak] ) | |
5319 { | |
5320 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5321 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5322 v3->PlaySound(SPEECH_36, 0); | |
5323 } | |
5324 break; | |
5325 case 229: //Heroism | |
5326 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5327 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5328 v3->PlaySound(SPEECH_36, 0); | |
5329 break; | |
5330 case 230: //Bless | |
5331 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5332 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5333 v3->PlaySound(SPEECH_36, 0); | |
5334 break; | |
5335 case 231: //Preservation | |
1032 | 5336 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5337 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5338 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5339 v3->PlaySound(SPEECH_36, 0); | |
5340 break; | |
5341 case 232: //Shield | |
1032 | 5342 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5343 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5344 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5345 v3->PlaySound(SPEECH_36, 0); | |
5346 break; | |
5347 case 234: //Stoneskin | |
5348 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5349 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5350 v3->PlaySound(SPEECH_36, 0); | |
5351 break; | |
5352 case 235: //Water Breathing | |
5353 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5354 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5355 break; | |
5356 case 237: //Remove Fear | |
5357 v3->pConditions[Condition_Fear] = 0i64; | |
5358 v3->PlaySound(SPEECH_36, 0); | |
5359 break; | |
5360 case 238: //Remove Curse | |
5361 v3->pConditions[Condition_Cursed] = 0i64; | |
5362 v3->PlaySound(SPEECH_36, 0); | |
5363 break; | |
5364 case 239: //Cure Insanity | |
5365 v3->pConditions[Condition_Insane] = 0i64; | |
5366 v3->PlaySound(SPEECH_36, 0); | |
5367 break; | |
5368 case 240: //Might Boost | |
1032 | 5369 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5370 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5371 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5372 v3->PlaySound(SPEECH_36, 0); | |
5373 break; | |
5374 case 241: //Intellect Boost | |
1032 | 5375 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5376 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5377 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5378 v3->PlaySound(SPEECH_36, 0); | |
5379 break; | |
5380 case 242: //Personality Boost | |
1032 | 5381 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5382 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5383 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5384 v3->PlaySound(SPEECH_36, 0); | |
5385 break; | |
5386 case 243://Endurance Boost | |
1032 | 5387 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5388 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5389 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5390 v3->PlaySound(SPEECH_36, 0); | |
5391 break; | |
5392 case 244: //Speed Boost | |
1032 | 5393 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5394 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5395 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5396 v3->PlaySound(SPEECH_36, 0); | |
5397 break; | |
5398 case 245: //Accuracy Boost | |
1032 | 5399 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5400 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5401 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5402 v3->PlaySound(SPEECH_36, 0); | |
5403 break; | |
5404 case 251: //Cure Paralysis | |
5405 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5406 v3->PlaySound(SPEECH_36, 0); | |
5407 break; | |
5408 case 252://Divine Restoration | |
5409 v30 = v3->pConditions[Condition_Dead]; | |
5410 v32 = v3->pConditions[Condition_Pertified]; | |
5411 v34 = v3->pConditions[Condition_Eradicated]; | |
5412 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5413 v3->pConditions[Condition_Dead] = v30; | |
5414 v3->pConditions[Condition_Pertified] = v32; | |
5415 v3->pConditions[Condition_Eradicated] = v34; | |
5416 v3->PlaySound(SPEECH_36, 0); | |
5417 break; | |
5418 case 253: //Divine Cure | |
5419 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5420 pParty->pPlayers[player_num-1].Heal(v25); | |
5421 v3->PlaySound(SPEECH_36, 0); | |
5422 break; | |
5423 case 254: //Divine Power | |
5424 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5425 new_mana_val = v3->sMana; | |
5426 new_mana_val += v26; | |
5427 if ( new_mana_val > v3->GetMaxMana() ) | |
5428 new_mana_val = v3->GetMaxMana(); | |
5429 v3->PlaySound(SPEECH_36, 0); | |
5430 break; | |
5431 case 255: //Luck Boost | |
1032 | 5432 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5433 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5434 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5435 v3->PlaySound(SPEECH_36, 0); | |
5436 break; | |
5437 case 256: //Fire Resistance | |
1032 | 5438 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5439 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5440 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5441 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5442 break; |
1021 | 5443 case 257: //Air Resistance |
1032 | 5444 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5445 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5446 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5447 v3->PlaySound(SPEECH_36, 0); | |
5448 break; | |
5449 case 258: //Water Resistance | |
1032 | 5450 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5451 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5452 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5453 v3->PlaySound(SPEECH_36, 0); | |
5454 break; | |
5455 case 259: //Earth Resistance | |
1032 | 5456 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5457 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5458 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5459 v3->PlaySound(SPEECH_36, 0); | |
5460 break; | |
5461 case 260: //Mind Resistance | |
1032 | 5462 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5463 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5464 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5465 v3->PlaySound(SPEECH_36, 0); | |
5466 break; | |
5467 case 261: //Body Resistance | |
1032 | 5468 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5469 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5470 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5471 v3->PlaySound(SPEECH_36, 0); | |
5472 break; | |
5473 case 262: //Stone to Flesh | |
5474 v3->pConditions[Condition_Pertified] = 0i64; | |
5475 v3->PlaySound(SPEECH_36, 0); | |
5476 break; | |
5477 case 264: //Pure Luck | |
5478 if ( !v3->pure_luck_used ) | |
5479 { | |
5480 v3->uLuck += 50; | |
5481 v3->pure_luck_used = 1; | |
5482 } | |
5483 v3->PlaySound(SPEECH_36, 0); | |
5484 break; | |
5485 case 265: //Pure Speed | |
5486 if ( !v3->pure_speed_used ) | |
5487 { | |
5488 v3->uSpeed += 50; | |
5489 v3->pure_speed_used = 1; | |
5490 } | |
5491 v3->PlaySound(SPEECH_36, 0); | |
5492 break; | |
5493 case 266: //Pure Intellect | |
5494 if ( !v3->pure_intellect_used ) | |
5495 { | |
5496 v3->uIntelligence += 50; | |
5497 v3->pure_intellect_used = 1; | |
5498 } | |
5499 v3->PlaySound(SPEECH_36, 0); | |
5500 break; | |
5501 case 267: //Pure Endurance | |
5502 if ( !v3->pure_endurance_used ) | |
5503 { | |
5504 v3->uEndurance += 50; | |
5505 v3->pure_endurance_used = 1; | |
5506 } | |
5507 v3->PlaySound(SPEECH_36, 0); | |
5508 break; | |
5509 case 268: //Pure Personality | |
5510 if ( !v3->pure_willpower_used ) | |
5511 { | |
5512 v3->uWillpower += 50; | |
5513 v3->pure_willpower_used = 1; | |
5514 } | |
5515 v3->PlaySound(SPEECH_36, 0); | |
5516 break; | |
5517 case 269: //Pure Accuracy | |
5518 if ( !v3->pure_accuracy_used ) | |
5519 { | |
5520 v3->uAccuracy += 50; | |
5521 v3->pure_accuracy_used = 1; | |
5522 } | |
5523 v3->PlaySound(SPEECH_36, 0); | |
5524 break; | |
5525 case 270: //Pure Might | |
5526 if ( !v3->pure_might_used ) | |
5527 { | |
5528 v3->uMight += 50; | |
5529 v3->pure_might_used = 1; | |
5530 } | |
5531 v3->PlaySound(SPEECH_36, 0); | |
5532 break; | |
5533 case 271: //Rejuvenation | |
5534 v3->sAgeModifier = 0; | |
5535 v3->PlaySound(SPEECH_36, 0); | |
5536 break; | |
5537 | |
5538 default: | |
5539 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5540 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
|
5541 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5542 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5543 return; | |
1032 | 5544 } |
5545 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5546 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5547 { | |
5548 if ( !v73 ) | |
5549 { | |
5550 pMouse->RemoveHoldingItem(); | |
5551 return; | |
5552 } | |
5553 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5554 } |
1032 | 5555 if ( v73 ) |
5556 { | |
5557 if ( pParty->bTurnBasedModeOn ) | |
5558 { | |
5559 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5560 thisb->SetRecoveryTime(100); | |
1448 | 5561 pTurnEngine->ApplyPlayerAction(); |
1032 | 5562 } |
5563 else | |
5564 { | |
5565 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5566 } | |
5567 } | |
5568 pMouse->RemoveHoldingItem(); | |
5569 return; | |
5570 | |
1021 | 5571 } |
5572 | |
5573 | |
5574 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5575 { | |
5576 | |
5577 | |
5578 if ( pCurrentScreen == SCREEN_CASTING ) | |
5579 return; | |
5580 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5581 { | |
5582 | |
5583 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5584 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5585 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5586 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5587 return; |
5588 } | |
5589 if ( bUnderwater == 1 ) | |
5590 { | |
1032 | 5591 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5592 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5593 return; |
5594 } | |
5595 dword_50C9AC = 1; | |
5596 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5597 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5598 { | |
5599 pMouse->RemoveHoldingItem(); | |
5600 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5601 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5602 pCurrentScreen = SCREEN_GAME; |
5603 viewparams->bRedrawGameUI = 1; | |
5604 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5605 } | |
5606 else | |
5607 { | |
5608 _720984_unused = pParty->pPickedItem.uItemID; | |
5609 pMouse->RemoveHoldingItem(); | |
5610 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5611 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5612 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5613 { | |
5614 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5615 } | |
5616 } | |
5617 return; | |
5618 } | |
5619 | |
5620 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5621 | |
5622 { | |
5623 v15 = pParty->pPickedItem.uItemID - 400; | |
5624 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5625 if ( v72 ) | |
5626 { | |
5627 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5628 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
|
5629 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5630 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5631 return; |
5632 } | |
5633 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5634 { | |
5635 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5636 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
|
5637 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5638 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5639 return; |
5640 } | |
5641 v16 = v15 % 11 + 1; | |
5642 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5643 v18 = SkillToMastery(v17) - 1; | |
1032 | 5644 switch (v18) |
5645 { | |
5646 case 0: v67 = 4; break; | |
5647 case 1: v67 = 7; break; | |
5648 case 2: v67 = 10; break; | |
5649 case 3: v67 = 11; break; | |
5650 default: | |
5651 v67 = player_num; | |
5652 } | |
5653 | |
5654 if ( v16 > v67 || !v17 ) | |
1021 | 5655 { |
1032 | 5656 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5657 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
|
5658 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5659 v3->PlaySound((PlayerSpeech)20, 0); |
5660 return; | |
5661 } | |
5662 // v72 = 1; | |
5663 v3->PlaySound(SPEECH_21, 0); | |
5664 v73 = 0; | |
5665 | |
5666 | |
5667 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5668 { | |
5669 if ( !v73 ) | |
1021 | 5670 { |
1032 | 5671 pMouse->RemoveHoldingItem(); |
5672 return; | |
5673 } | |
5674 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5675 } | |
5676 if ( v73 ) | |
5677 { | |
5678 if ( pParty->bTurnBasedModeOn ) | |
5679 { | |
5680 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5681 thisb->SetRecoveryTime(100); | |
1448 | 5682 pTurnEngine->ApplyPlayerAction(); |
1021 | 5683 } |
5684 else | |
5685 { | |
1032 | 5686 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5687 } |
5688 } | |
1032 | 5689 pMouse->RemoveHoldingItem(); |
5690 return; | |
5691 | |
1021 | 5692 } |
5693 | |
5694 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5695 | |
5696 { | |
5697 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5698 { | |
5699 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5700 v3->PlaySound(SPEECH_37, 0); |
1021 | 5701 return; |
5702 } | |
5703 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5704 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5705 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5706 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5707 return; |
5708 } | |
5709 else | |
1459 | 5710 { |
5711 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5712 { | |
1021 | 5713 thisa = pParty->uCurrentMonthWeek + 1; |
5714 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5715 v74 = NULL; |
1021 | 5716 else |
5717 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5718 switch ( pParty->uCurrentMonth ) | |
5719 { | |
1019 | 5720 case 0: |
1021 | 5721 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5722 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5723 break; |
1019 | 5724 case 1: |
1021 | 5725 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5726 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5727 break; |
1019 | 5728 case 2: |
1021 | 5729 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5730 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5731 break; |
1019 | 5732 case 3: |
1021 | 5733 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5734 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5735 break; |
1019 | 5736 case 4: |
1021 | 5737 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5738 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5739 break; |
1019 | 5740 case 5: |
1021 | 5741 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5742 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5743 break; |
1019 | 5744 case 6: |
1021 | 5745 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5746 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5747 break; |
1019 | 5748 case 7: |
1021 | 5749 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5750 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5751 break; |
1019 | 5752 case 8: |
1021 | 5753 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5754 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5755 break; |
0 | 5756 case 9u: |
1021 | 5757 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5758 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5759 break; |
1019 | 5760 case 10: |
1021 | 5761 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5762 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5763 break; |
1019 | 5764 case 11: |
1021 | 5765 v8 = rand() % 6; |
5766 switch (v8) | |
5767 { | |
5768 case 0: | |
5769 v3->sResFireBase += thisa; | |
5770 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5771 break; | |
5772 case 1: | |
5773 v3->sResAirBase += thisa; | |
5774 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5775 break; | |
5776 case 2: | |
5777 v3->sResWaterBase += thisa; | |
5778 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5779 break; | |
5780 case 3: | |
5781 v3->sResEarthBase += thisa; | |
5782 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5783 break; | |
5784 case 4: | |
5785 v3->sResMindBase += thisa; | |
5786 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5787 break; | |
5788 case 5: | |
5789 v3->sResBodyBase += thisa; | |
5790 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5791 break; |
1021 | 5792 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5793 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5794 break; |
5795 | |
5796 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5797 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5798 pMouse->RemoveHoldingItem(); |
1459 | 5799 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5800 v3->PlaySound(SPEECH_93, 0); |
1032 | 5801 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5802 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5803 { |
1021 | 5804 v3->SetCondition(Condition_Eradicated, 0); |
5805 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5806 } |
1021 | 5807 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5808 { | |
5809 v3->SetCondition(Condition_Dead, 0); | |
5810 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5811 } | |
5812 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5813 { | |
5814 v3->SetCondition(Condition_Pertified, 0); | |
5815 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5816 } | |
1019 | 5817 return; |
1021 | 5818 } |
5819 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5820 { |
1021 | 5821 Party::GiveFood(1u); |
1459 | 5822 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5823 } | |
1021 | 5824 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5825 { | |
1459 | 5826 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5827 return; |
5828 } | |
5829 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5830 { | |
1459 | 5831 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5832 return; |
5833 } | |
5834 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5835 { | |
1459 | 5836 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5837 return; |
5838 } | |
1032 | 5839 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5840 { |
5841 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5842 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5843 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5844 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5845 } | |
5846 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5847 { | |
1459 | 5848 TeleportToNWCDungeon(); |
1021 | 5849 return; |
5850 } | |
0 | 5851 else |
1021 | 5852 { |
5853 | |
5854 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5855 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
|
5856 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5857 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5858 return; |
5859 } | |
1032 | 5860 |
0 | 5861 pMouse->RemoveHoldingItem(); |
5862 return; | |
5863 } | |
1021 | 5864 |
5865 } | |
0 | 5866 |
5867 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5868 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5869 { |
0 | 5870 Player *v3; // esi@1 |
5871 signed int v4; // edi@1 | |
5872 unsigned int v5; // eax@8 | |
5873 int v6; // eax@9 | |
5874 enum CHARACTER_RACE v7; // eax@11 | |
5875 signed int v8; // eax@17 | |
5876 unsigned __int8 v9; // sf@17 | |
5877 unsigned __int8 v10; // of@17 | |
5878 int v11; // eax@19 | |
5879 unsigned int v12; // eax@20 | |
484 | 5880 unsigned int test_bit_value; // eax@25 |
5881 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5882 signed int v15; // ecx@28 |
5883 ItemGen *v16; // eax@28 | |
5884 char v17; // zf@31 | |
5885 int v18; // edi@90 | |
5886 DDM_DLV_Header *v19; // eax@122 | |
5887 char v20; // cl@124 | |
5888 DDM_DLV_Header *v21; // eax@126 | |
5889 unsigned int v22; // edi@129 | |
100 | 5890 Player *v23; // esi@134 |
0 | 5891 ItemGen *v24; // ecx@135 |
5892 signed int v25; // edx@135 | |
5893 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5894 char *v27; // edi@155 | |
5895 int v28; // ebx@161 | |
5896 int v29; // eax@161 | |
5897 | |
469 | 5898 v6 = 0; |
0 | 5899 v3 = this; |
5900 v4 = -1; | |
469 | 5901 if ( VarNum > VAR_AutoNotes ) |
5902 { | |
5903 switch ( VarNum ) | |
0 | 5904 { |
5905 case VAR_Invisible: | |
1167 | 5906 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5907 return true; |
484 | 5908 return false; |
0 | 5909 case VAR_NumDeaths: |
5910 v4 = pParty->uNumDeaths; | |
469 | 5911 return v4 >= pValue; |
0 | 5912 case VAR_NumBounties: |
5913 v4 = pParty->uNumBountiesCollected; | |
469 | 5914 return v4 >= pValue; |
0 | 5915 case VAR_PrisonTerms: |
5916 v4 = pParty->uNumPrisonTerms; | |
469 | 5917 return v4 >= pValue; |
0 | 5918 case VAR_ArenaWinsPage: |
5919 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5920 return v4 >= pValue; |
0 | 5921 case VAR_ArenaWinsSquire: |
5922 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5923 return v4 >= pValue; |
0 | 5924 case VAR_ArenaWinsKnight: |
5925 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5926 return v4 >= pValue; |
0 | 5927 case VAR_ArenaWinsLord: |
5928 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5929 return v4 >= pValue; |
0 | 5930 case VAR_ReputationInCurrentLocation: |
5931 v19 = &pOutdoor->ddm; | |
5932 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5933 v19 = &pIndoor->dlv; | |
469 | 5934 v6 = v19->uReputation >= pValue; |
5935 return v6; | |
0 | 5936 case VAR_History_28|VAR_Sex: |
5937 v21 = &pOutdoor->ddm; | |
5938 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5939 v21 = &pIndoor->dlv; | |
469 | 5940 v6 = v21->field_C_alert == pValue; |
0 | 5941 return v6; |
5942 case VAR_MonthEquals2|VAR_Sex: | |
5943 case VAR_MonthEquals2|VAR_Class: | |
5944 case VAR_Counter1: | |
5945 case VAR_Counter2: | |
5946 case VAR_Counter3: | |
5947 case VAR_Counter4: | |
5948 case VAR_Counter5: | |
5949 case VAR_Counter6: | |
5950 case VAR_Counter7: | |
5951 case VAR_Counter8: | |
469 | 5952 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5953 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5954 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5955 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5956 return true; | |
5957 return false; | |
0 | 5958 case VAR_NumSkillPoints: |
5959 v4 = this->uSkillPoints; | |
469 | 5960 return v4 >= pValue; |
0 | 5961 case VAR_CircusPrises: |
5962 v4 = 0; | |
100 | 5963 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5964 do |
5965 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5966 v24 = v23->pInventoryItemList; |
0 | 5967 v25 = 138; |
5968 do | |
5969 { | |
5970 switch ( v24->uItemID ) | |
5971 { | |
5972 case 0x1D6u: | |
5973 ++v4; | |
5974 break; | |
5975 case 0x1D7u: | |
5976 v4 += 3; | |
5977 break; | |
5978 case 0x1DDu: | |
5979 v4 += 5; | |
5980 break; | |
5981 } | |
5982 ++v24; | |
5983 --v25; | |
5984 } | |
5985 while ( v25 ); | |
100 | 5986 ++v23; |
0 | 5987 } |
100 | 5988 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5989 return v4 >= pValue; |
0 | 5990 case VAR_MonthEquals2: |
469 | 5991 v6 = pParty->uCurrentMonth == pValue; |
5992 return v6; | |
0 | 5993 case VAR_IsFlying: |
5994 if ( pParty->bFlying | |
1167 | 5995 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5996 return true; |
5997 return false; | |
0 | 5998 case VAR_HiredNPCHasSpeciality: |
469 | 5999 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 6000 return v6; |
6001 case VAR_NPCs2: | |
469 | 6002 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 6003 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 6004 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
6005 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 6006 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 6007 return v4 >= pValue; |
6008 v4 = pValue; | |
6009 return v4 >= pValue; | |
0 | 6010 case VAR_ItemEquipped: |
6011 v26 = (ITEM_EQUIP_TYPE)0; | |
6012 v27 = (char *)&this->pEquipment; | |
6013 break; | |
6014 case VAR_GoldInBank: | |
6015 v4 = pParty->uNumGoldInBank; | |
469 | 6016 return v4 >= pValue; |
0 | 6017 case VAR_ThieverySkill|0x80: |
6018 v28 = GetActualMight(); | |
6019 v29 = v3->GetBaseStrength(); | |
6020 goto LABEL_168; | |
6021 case VAR_DisarmTrapSkill|0x80: | |
6022 v28 = GetActualIntelligence(); | |
6023 v29 = v3->GetBaseIntelligence(); | |
6024 goto LABEL_168; | |
6025 case VAR_MonthEquals: | |
6026 v28 = GetActualWillpower(); | |
6027 v29 = v3->GetBaseWillpower(); | |
6028 goto LABEL_168; | |
6029 case VAR_MonthEquals|VAR_Sex: | |
6030 v28 = GetActualEndurance(); | |
6031 v29 = v3->GetBaseEndurance(); | |
6032 goto LABEL_168; | |
6033 case VAR_IdentifyMonsterSkill|0x80: | |
6034 v28 = GetActualSpeed(); | |
6035 v29 = v3->GetBaseSpeed(); | |
6036 goto LABEL_168; | |
6037 case VAR_ArmsmasterSkill|0x80: | |
6038 v28 = GetActualAccuracy(); | |
6039 v29 = v3->GetBaseAccuracy(); | |
6040 goto LABEL_168; | |
6041 case VAR_MonthEquals|VAR_MaxHP: | |
6042 v28 = GetActualLuck(); | |
6043 v29 = v3->GetBaseLuck(); | |
6044 LABEL_168: | |
6045 v10 = __OFSUB__(v28, v29); | |
6046 v9 = v28 - v29 < 0; | |
6047 LABEL_169: | |
6048 if ( v9 ^ v10 ) | |
469 | 6049 return v4 >= pValue; |
6050 return true; | |
0 | 6051 default: |
469 | 6052 return v4 >= pValue; |
0 | 6053 } |
6054 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6055 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 6056 { |
6057 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
6058 v27 += 4; | |
6059 if ( (signed int)v26 >= 16 ) | |
469 | 6060 return false; |
6061 } | |
6062 return true; | |
6063 } | |
6064 if ( VarNum == VAR_AutoNotes ) | |
0 | 6065 { |
1033 | 6066 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
6067 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 6068 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6069 return false; | |
6070 return true; | |
469 | 6071 } |
6072 if ( VarNum <= VAR_BaseLuck ) | |
6073 { | |
6074 if ( VarNum != VAR_BaseLuck ) | |
6075 { | |
6076 switch ( VarNum ) | |
0 | 6077 { |
6078 case VAR_Hour: | |
469 | 6079 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
6080 return true; | |
6081 return false; | |
0 | 6082 case VAR_DayOfYear: |
469 | 6083 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
6084 v6 = v5 == pValue; | |
6085 return v6; | |
0 | 6086 case VAR_DayOfWeek: |
469 | 6087 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
6088 v6 = v5 == pValue; | |
0 | 6089 return v6; |
6090 case VAR_Sex: | |
469 | 6091 if ( pValue == (CHARACTER_RACE)this->uSex ) |
6092 return true; | |
6093 return v4 >= pValue; | |
0 | 6094 case VAR_Class: |
135 | 6095 v7 = (CHARACTER_RACE)this->classType; |
469 | 6096 if ( pValue == v7 ) |
6097 return true; | |
6098 return v4 >= pValue; | |
0 | 6099 case VAR_Race: |
6100 v7 = GetRace(); | |
469 | 6101 if ( pValue == v7 ) |
6102 return true; | |
6103 return v4 >= pValue; | |
0 | 6104 case VAR_CurrentHP: |
6105 v4 = this->sHealth; | |
469 | 6106 return v4 >= pValue; |
0 | 6107 case VAR_MaxHP: |
6108 v8 = GetMaxHealth(); | |
6109 v10 = __OFSUB__(v3->sHealth, v8); | |
6110 v9 = v3->sHealth - v8 < 0; | |
6111 goto LABEL_169; | |
6112 case VAR_CurrentSP: | |
6113 v4 = this->sMana; | |
469 | 6114 return v4 >= pValue; |
0 | 6115 case VAR_MaxSP: |
6116 v11 = GetMaxMana(); | |
6117 v10 = __OFSUB__(v3->sMana, v11); | |
6118 v9 = v3->sMana - v11 < 0; | |
6119 goto LABEL_169; | |
6120 case VAR_ActualAC: | |
6121 v12 = GetActualAC(); | |
6122 goto _j_cmp_against_arg; | |
6123 case VAR_ACModifier: | |
6124 v4 = this->sACModifier; | |
469 | 6125 return v4 >= pValue; |
0 | 6126 case VAR_BaseLevel: |
6127 v4 = this->uLevel; | |
469 | 6128 return v4 >= pValue; |
0 | 6129 case VAR_LevelModifier: |
6130 v4 = this->sLevelModifier; | |
469 | 6131 return v4 >= pValue; |
0 | 6132 case VAR_Age: |
6133 v12 = GetActualAge(); | |
6134 goto _j_cmp_against_arg; | |
6135 case VAR_Award: | |
1033 | 6136 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6137 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6138 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6139 return true; | |
6140 return false; | |
0 | 6141 case VAR_Experience: |
6142 v4 = LODWORD(this->uExperience); | |
469 | 6143 return v4 >= pValue; |
0 | 6144 case VAR_QBits_QuestsDone: |
484 | 6145 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6146 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6147 if ( test_bit_value & our_bit_value ) | |
478 | 6148 return true; |
6149 return false; | |
0 | 6150 case VAR_PlayerItemInHands: |
6151 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6152 v16 = v3->pInventoryItemList; |
0 | 6153 break; |
6154 case VAR_FixedGold: | |
6155 v4 = pParty->uNumGold; | |
469 | 6156 return v4 >= pValue; |
0 | 6157 case VAR_MightBonus: |
6158 v4 = this->uMightBonus; | |
469 | 6159 return v4 >= pValue; |
0 | 6160 case VAR_IntellectBonus: |
6161 v4 = this->uIntelligenceBonus; | |
469 | 6162 return v4 >= pValue; |
0 | 6163 case VAR_PersonalityBonus: |
6164 v4 = this->uWillpowerBonus; | |
469 | 6165 return v4 >= pValue; |
0 | 6166 case VAR_EnduranceBonus: |
6167 v4 = this->uEnduranceBonus; | |
469 | 6168 return v4 >= pValue; |
0 | 6169 case VAR_SpeedBonus: |
6170 v4 = this->uSpeedBonus; | |
469 | 6171 return v4 >= pValue; |
0 | 6172 case VAR_AccuracyBonus: |
6173 v4 = this->uAccuracyBonus; | |
469 | 6174 return v4 >= pValue; |
0 | 6175 case VAR_LuckBonus: |
6176 v4 = this->uLuckBonus; | |
469 | 6177 return v4 >= pValue; |
0 | 6178 case VAR_BaseMight: |
6179 v4 = this->uMight; | |
469 | 6180 return v4 >= pValue; |
0 | 6181 case VAR_BaseIntellect: |
6182 v4 = this->uIntelligence; | |
469 | 6183 return v4 >= pValue; |
0 | 6184 case VAR_BasePersonality: |
6185 v4 = this->uWillpower; | |
469 | 6186 return v4 >= pValue; |
0 | 6187 case VAR_BaseEndurance: |
6188 v4 = this->uEndurance; | |
469 | 6189 return v4 >= pValue; |
0 | 6190 case VAR_BaseSpeed: |
6191 v4 = this->uSpeed; | |
469 | 6192 return v4 >= pValue; |
0 | 6193 case VAR_BaseAccuracy: |
6194 v4 = this->uAccuracy; | |
469 | 6195 return v4 >= pValue; |
0 | 6196 case VAR_FixedFood: |
6197 v4 = pParty->uNumFoodRations; | |
469 | 6198 return v4 >= pValue; |
0 | 6199 default: |
469 | 6200 return v4 >= pValue; |
6201 } | |
6202 while ( v16->uItemID != pValue ) | |
0 | 6203 { |
6204 ++v15; | |
6205 ++v16; | |
6206 if ( v15 >= 138 ) | |
6207 { | |
469 | 6208 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6209 return v6; |
6210 } | |
6211 } | |
469 | 6212 return true; |
0 | 6213 } |
6214 v4 = this->uLuck; | |
469 | 6215 return v4 >= pValue; |
6216 } | |
6217 if ( VarNum <= VAR_MagicResistance ) | |
6218 { | |
6219 if ( VarNum == VAR_MagicResistance ) | |
0 | 6220 { |
6221 v4 = this->sResMagicBase; | |
6222 } | |
6223 else | |
6224 { | |
469 | 6225 switch ( VarNum ) |
0 | 6226 { |
6227 case VAR_FireResistance: | |
6228 v4 = this->sResFireBase; | |
469 | 6229 return v4 >= pValue; |
0 | 6230 case VAR_AirResistance: |
6231 v4 = this->sResAirBase; | |
469 | 6232 return v4 >= pValue; |
0 | 6233 case VAR_WaterResistance: |
6234 v4 = this->sResWaterBase; | |
469 | 6235 return v4 >= pValue; |
0 | 6236 case VAR_EarthResistance: |
6237 v4 = this->sResEarthBase; | |
469 | 6238 return v4 >= pValue; |
0 | 6239 case VAR_SpiritResistance: |
6240 v4 = this->sResSpiritBase; | |
469 | 6241 return v4 >= pValue; |
0 | 6242 case VAR_MindResistance: |
6243 v4 = this->sResMindBase; | |
469 | 6244 return v4 >= pValue; |
0 | 6245 case VAR_BodyResistance: |
6246 v4 = this->sResBodyBase; | |
469 | 6247 return v4 >= pValue; |
0 | 6248 case VAR_LightResistance: |
6249 v4 = this->sResLightBase; | |
469 | 6250 return v4 >= pValue; |
0 | 6251 case VAR_DarkResistance: |
6252 v4 = this->sResDarkBase; | |
469 | 6253 return v4 >= pValue; |
0 | 6254 case VAR_ActualMight: |
6255 v12 = GetActualMight(); | |
6256 goto _j_cmp_against_arg; | |
6257 case VAR_ActualIntellect: | |
6258 v12 = GetActualIntelligence(); | |
6259 goto _j_cmp_against_arg; | |
6260 case VAR_ActualPersonality: | |
6261 v12 = GetActualWillpower(); | |
6262 goto _j_cmp_against_arg; | |
6263 case VAR_ActualEndurance: | |
6264 v12 = GetActualEndurance(); | |
6265 goto _j_cmp_against_arg; | |
6266 case VAR_ActualSpeed: | |
6267 v12 = GetActualSpeed(); | |
6268 goto _j_cmp_against_arg; | |
6269 case VAR_ActualAccuracy: | |
6270 v12 = GetActualAccuracy(); | |
6271 goto _j_cmp_against_arg; | |
6272 case VAR_ActualLuck: | |
6273 v12 = GetActualLuck(); | |
6274 _j_cmp_against_arg: | |
6275 v4 = v12; | |
6276 break; | |
6277 default: | |
469 | 6278 return v4 >= pValue; |
6279 } | |
6280 } | |
6281 return v4 >= pValue; | |
6282 } | |
6283 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6284 { | |
6285 if ( VarNum != VAR_DisarmTrapSkill ) | |
6286 { | |
6287 if ( VarNum <= VAR_MindResistanceBonus ) | |
6288 { | |
6289 switch ( VarNum ) | |
0 | 6290 { |
6291 case VAR_MindResistanceBonus: | |
6292 v4 = this->sResMindBonus; | |
6293 break; | |
6294 case VAR_FireResistanceBonus: | |
6295 v4 = this->sResFireBonus; | |
6296 break; | |
6297 case VAR_AirResistanceBonus: | |
6298 v4 = this->sResAirBonus; | |
6299 break; | |
6300 case VAR_WaterResistanceBonus: | |
6301 v4 = this->sResWaterBonus; | |
6302 break; | |
6303 case VAR_EarthResistanceBonus: | |
6304 v4 = this->sResEarthBonus; | |
6305 break; | |
6306 case VAR_SpiritResistanceBonus: | |
6307 v4 = this->sResSpiritBonus; | |
6308 break; | |
6309 } | |
469 | 6310 return v4 >= pValue; |
6311 } | |
6312 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6313 { |
6314 v4 = this->sResBodyBonus; | |
469 | 6315 return v4 >= pValue; |
6316 } | |
6317 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6318 { |
6319 v4 = this->sResLightBonus; | |
469 | 6320 return v4 >= pValue; |
6321 } | |
6322 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6323 { |
6324 v4 = this->sResDarkBonus; | |
469 | 6325 return v4 >= pValue; |
6326 } | |
6327 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6328 { |
6329 v4 = this->sResMagicBonus; | |
469 | 6330 return v4 >= pValue; |
6331 } | |
6332 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6333 return v4 >= pValue; | |
0 | 6334 } |
6335 LABEL_90: | |
469 | 6336 v18 = *((short *)&this->pConditions[16] + VarNum); |
6337 if ( pValue <= 63 ) | |
0 | 6338 v4 = v18 & 0x3F; |
6339 else | |
469 | 6340 v4 = pValue & v18; |
6341 return v4 >= pValue; | |
6342 } | |
6343 if ( VarNum == 104 ) | |
0 | 6344 goto LABEL_90; |
469 | 6345 if ( (signed int)VarNum <= 104 ) |
6346 return v4 >= pValue; | |
6347 if ( (signed int)VarNum > 0x79 ) | |
6348 { | |
6349 if ( VarNum != 122 ) | |
6350 { | |
6351 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6352 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6353 return v4 >= pValue; | |
0 | 6354 } |
6355 v4 = GetMajorConditionIdx(); | |
6356 if ( v4 != 18 ) | |
6357 { | |
469 | 6358 return v4 >= pValue; |
6359 } | |
6360 v4 = pValue; | |
6361 return v4 >= pValue; | |
6362 } | |
1072 | 6363 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6364 } |
6365 | |
6366 | |
6367 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6368 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6369 { | |
6370 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
|
6371 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
|
6372 unsigned int v5_unused; // edi@1 |
0 | 6373 unsigned int v6; // esi@13 |
6374 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
|
6375 signed int v8_unused; // eax@17 |
0 | 6376 ItemGen *v9; // ecx@17 |
6377 int v10; // eax@21 | |
6378 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
|
6379 Player *unused12; // ecx@44 |
0 | 6380 char *v13; // ecx@45 |
6381 Player *v14; // ecx@49 | |
6382 int v15; // ecx@86 | |
6383 int v16; // esi@106 | |
6384 char v17; // al@106 | |
6385 int v18; // eax@107 | |
6386 Player *v19; // ecx@112 | |
6387 Player *v20; // ecx@127 | |
6388 int v21; // eax@127 | |
6389 int v22; // eax@145 | |
6390 char v23; // zf@146 | |
6391 DDM_DLV_Header *v24; // ecx@148 | |
6392 signed int v25; // eax@172 | |
6393 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
|
6394 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
|
6395 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6396 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
|
6397 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
|
6398 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
|
6399 |
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
|
6400 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
|
6401 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
|
6402 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6403 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
|
6404 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6405 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
|
6406 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
|
6407 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6408 } |
1545 | 6409 |
6410 Assert(currPlayerId != -1); | |
492 | 6411 if ( var_type > VAR_AutoNotes ) |
6412 { | |
6413 if ( var_type <= VAR_GoldInBank ) | |
6414 { | |
6415 if ( var_type == VAR_GoldInBank ) | |
6416 { | |
6417 pParty->uNumGoldInBank = var_value; | |
0 | 6418 return; |
6419 } | |
492 | 6420 if ( var_type <= VAR_Counter8 ) |
6421 { | |
6422 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6423 { |
492 | 6424 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6425 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6426 } |
6427 else | |
6428 { | |
492 | 6429 switch ( var_type ) |
0 | 6430 { |
6431 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6432 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6433 break; |
6434 case VAR_NPCs2: | |
6435 pParty->field_709 = 0; | |
492 | 6436 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6437 pParty->CountHirelings(); |
6438 viewparams->bRedrawGameUI = true; | |
0 | 6439 break; |
6440 case VAR_NumSkillPoints: | |
492 | 6441 this->uSkillPoints = var_value; |
0 | 6442 break; |
6443 } | |
6444 } | |
6445 return; | |
6446 } | |
492 | 6447 if ( var_type < VAR_Counter9 ) |
0 | 6448 return; |
492 | 6449 if ( (signed int)var_type <= 0x112 ) |
6450 { | |
6451 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6452 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6453 } |
6454 else | |
6455 { | |
492 | 6456 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6457 { |
6458 v24 = &pOutdoor->ddm; | |
6459 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6460 v24 = &pIndoor->dlv; | |
492 | 6461 v24->uReputation = var_value; |
6462 if ( var_value > 10000 ) | |
0 | 6463 v24->uReputation = 10000; |
6464 return; | |
6465 } | |
492 | 6466 if ( var_type <= VAR_ReputationInCurrentLocation |
6467 || var_type > VAR_History_28 | |
6468 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6469 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6470 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6471 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6472 v23) ) |
6473 return; | |
6474 bFlashHistoryBook = 1; | |
6475 } | |
492 | 6476 v25 = 8 * currPlayerId + 400; |
862 | 6477 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
|
6478 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6479 return; |
6480 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6481 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6482 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6483 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6484 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
|
6485 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6486 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6487 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6488 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6489 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6490 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6491 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6492 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6493 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6494 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6495 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6496 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6497 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6498 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6499 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6500 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6501 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6502 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6503 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6504 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6505 return; |
0 | 6506 } |
492 | 6507 if ( var_type == VAR_AutoNotes ) |
6508 { | |
6509 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
|
6510 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6511 && pAutonoteTxt[var_value].pText ) |
492 | 6512 { |
6513 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6514 v20->PlaySound(SPEECH_96, 0); |
1453 | 6515 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6516 bFlashAutonotesBook = 1; |
1453 | 6517 _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
|
6518 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6519 } |
1453 | 6520 _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
|
6521 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6522 return; |
0 | 6523 } |
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 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
|
6525 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6526 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
|
6527 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6528 case VAR_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
|
6529 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
|
6530 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
|
6531 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
|
6532 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
|
6533 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
|
6534 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6535 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6536 for (int i = 0; i < 138; i++) |
0 | 6537 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6538 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6539 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
|
6540 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
|
6541 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6542 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
|
6543 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6544 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
|
6545 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6546 *(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
|
6547 } |
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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 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
|
6559 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
|
6560 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
|
6561 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
|
6562 { |
7ef8ae7ce42a
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 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
|
6564 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
|
6565 } |
7ef8ae7ce42a
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 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
|
6567 { |
7ef8ae7ce42a
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 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
|
6569 this->uVoiceID = 20; |
0 | 6570 } |
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
|
6571 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
|
6572 } |
7ef8ae7ce42a
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_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
|
6574 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
|
6575 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
|
6576 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
|
6577 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
|
6578 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
|
6579 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
|
6580 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
|
6581 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
|
6582 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
|
6583 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
|
6584 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
|
6585 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
|
6586 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
|
6587 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
|
6588 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
|
6589 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
|
6590 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
|
6591 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
|
6592 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
|
6593 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
|
6594 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
|
6595 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
|
6596 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
|
6597 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
|
6598 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
|
6599 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
|
6600 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
|
6601 //&& 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
|
6602 && 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
|
6603 { |
7ef8ae7ce42a
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 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
|
6605 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6606 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
|
6607 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6608 _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
|
6609 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
|
6610 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
|
6611 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
|
6612 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
|
6613 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
|
6614 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
|
6615 // && (&dword_722F10)[4 * a3] ) |
1310 | 6616 && pQuestTable[var_value] ) |
0 | 6617 { |
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
|
6618 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
|
6619 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
|
6620 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
|
6621 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6622 PlaySoundBasedOnCondition(currPlayerId); |
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
|
6623 } |
7ef8ae7ce42a
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 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
|
6625 _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
|
6626 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
|
6627 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
|
6628 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
|
6629 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
|
6630 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
|
6631 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
|
6632 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
|
6633 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
|
6634 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
|
6635 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
|
6636 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
|
6637 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
|
6638 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
|
6639 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
|
6640 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
|
6641 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
|
6642 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
|
6643 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
|
6644 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
|
6645 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
|
6646 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
|
6647 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
|
6648 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
|
6649 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
|
6650 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
|
6651 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
|
6652 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
|
6653 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
|
6654 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
|
6655 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
|
6656 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
|
6657 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
|
6658 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
|
6659 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
|
6660 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
|
6661 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
|
6662 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
|
6663 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
|
6664 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
|
6665 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
|
6666 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
|
6667 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
|
6668 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
|
6669 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
|
6670 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
|
6671 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
|
6672 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6673 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
|
6674 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
|
6675 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
|
6676 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6677 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
|
6678 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
|
6679 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
|
6680 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6681 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
|
6682 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
|
6683 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
|
6684 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6685 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
|
6686 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
|
6687 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
|
6688 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6689 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
|
6690 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
|
6691 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
|
6692 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6693 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
|
6694 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
|
6695 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
|
6696 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6697 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
|
6698 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
|
6699 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
|
6700 } |
0 | 6701 LABEL_111: |
187 | 6702 v26 = SPEECH_91; |
0 | 6703 LABEL_112: |
492 | 6704 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6705 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
|
6706 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6707 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6708 return; |
0 | 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 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
|
6711 { |
492 | 6712 switch ( var_type ) |
0 | 6713 { |
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
|
6714 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
|
6715 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
|
6716 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
|
6717 goto LABEL_111; |
0 | 6718 case VAR_ActualIntellect: |
6719 LABEL_68: | |
492 | 6720 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6721 goto LABEL_111; |
6722 case VAR_ActualPersonality: | |
6723 LABEL_69: | |
492 | 6724 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6725 goto LABEL_111; |
6726 case VAR_ActualEndurance: | |
6727 LABEL_70: | |
492 | 6728 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6729 goto LABEL_111; |
6730 case VAR_ActualSpeed: | |
6731 LABEL_71: | |
492 | 6732 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6733 goto LABEL_111; |
6734 case VAR_ActualAccuracy: | |
6735 LABEL_72: | |
492 | 6736 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6737 goto LABEL_111; |
6738 case VAR_ActualLuck: | |
6739 LABEL_73: | |
492 | 6740 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6741 goto LABEL_111; |
6742 case VAR_FireResistance: | |
492 | 6743 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
|
6744 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6745 goto LABEL_112; |
0 | 6746 case VAR_AirResistance: |
492 | 6747 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
|
6748 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6749 goto LABEL_112; |
0 | 6750 case VAR_WaterResistance: |
492 | 6751 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
|
6752 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6753 goto LABEL_112; |
0 | 6754 case VAR_EarthResistance: |
492 | 6755 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
|
6756 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6757 goto LABEL_112; |
0 | 6758 case VAR_SpiritResistance: |
492 | 6759 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
|
6760 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6761 goto LABEL_112; |
0 | 6762 case VAR_MindResistance: |
492 | 6763 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
|
6764 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6765 goto LABEL_112; |
0 | 6766 case VAR_BodyResistance: |
492 | 6767 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
|
6768 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6769 goto LABEL_112; |
0 | 6770 case VAR_LightResistance: |
492 | 6771 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
|
6772 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6773 goto LABEL_112; |
0 | 6774 case VAR_DarkResistance: |
492 | 6775 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
|
6776 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6777 goto LABEL_112; |
0 | 6778 case VAR_MagicResistance: |
492 | 6779 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6780 v26 = 92; |
6781 goto LABEL_112; | |
6782 default: | |
6783 return; | |
6784 } | |
6785 return; | |
6786 } | |
6787 HIWORD(v15) = 0; | |
492 | 6788 if ( var_type > VAR_DisarmTrapSkill ) |
6789 { | |
6790 if ( var_type != VAR_LearningSkill ) | |
6791 { | |
6792 if ( var_type <= VAR_LearningSkill ) | |
0 | 6793 return; |
492 | 6794 if ( var_type <= VAR_Eradicated ) |
6795 { | |
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
|
6796 this->SetCondition(var_type - 105, 1); |
0 | 6797 } |
6798 else | |
6799 { | |
492 | 6800 if ( var_type != VAR_MajorCondition ) |
0 | 6801 { |
492 | 6802 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6803 byte_5E4C15[var_type] = var_value; | |
0 | 6804 return; |
6805 } | |
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
|
6806 memset(this, 0, 0xA0u); |
0 | 6807 } |
6808 } | |
6809 else | |
6810 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6811 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
|
6812 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6813 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6814 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6815 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6816 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6817 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6818 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6819 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6820 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
|
6821 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6822 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6823 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6824 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6825 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6826 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6827 return; |
0 | 6828 } |
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
|
6829 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6830 { |
6831 switch ( var_type ) | |
0 | 6832 { |
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
|
6833 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
|
6834 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6835 break; |
6836 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
|
6837 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6838 break; |
6839 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
|
6840 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6841 break; |
6842 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
|
6843 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6844 break; |
6845 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
|
6846 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
|
6847 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
|
6848 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
|
6849 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
|
6850 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
|
6851 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
|
6852 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
|
6853 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
|
6854 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
|
6855 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
|
6856 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
|
6857 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
|
6858 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
|
6859 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
|
6860 case VAR_PhysicalResistanceBonus: |
1545 | 6861 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
|
6862 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
|
6863 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
|
6864 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
|
6865 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6866 break; |
6867 default: | |
1545 | 6868 Assert("Unexpected var_type: %u", var_type); |
0 | 6869 return; |
6870 break; | |
6871 } | |
6872 goto LABEL_111; | |
6873 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6874 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
|
6875 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6876 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6877 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6878 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6879 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6880 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6881 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6882 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
|
6883 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6884 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
|
6885 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
|
6886 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
|
6887 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6888 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6889 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6890 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
|
6891 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6892 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
|
6893 } |
0 | 6894 |
6895 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6896 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6897 { |
6898 char v3; // bl@1 | |
6899 Player *v4; // esi@1 | |
6900 signed int uPlayerIdx; // edi@1 | |
6901 int v6; // eax@15 | |
6902 unsigned int v7; // esi@18 | |
6903 int *v8; // ebx@21 | |
6904 int v9; // eax@22 | |
6905 signed int v10; // eax@24 | |
6906 int v11; // eax@27 | |
6907 __int16 *v12; // esi@28 | |
6908 Player *v13; // ecx@34 | |
6909 Player *v14; // ecx@36 | |
6910 char *v15; // ecx@37 | |
6911 unsigned __int8 v16; // cf@38 | |
6912 Player *v17; // ecx@42 | |
6913 __int16 *v18; // esi@53 | |
6914 __int16 *v19; // esi@62 | |
6915 char *v20; // esi@107 | |
6916 __int16 v21; // dx@107 | |
6917 int v22; // ecx@107 | |
6918 Player *v23; // ecx@132 | |
6919 int v24; // eax@132 | |
6920 int v25; // eax@150 | |
6921 char v26; // zf@151 | |
6922 DDM_DLV_Header *v27; // eax@153 | |
6923 signed int v28; // eax@176 | |
6924 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6925 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6926 int v31; // [sp-4h] [bp-3Ch]@84 |
6927 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6928 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6929 char v34; // [sp+37h] [bp-1h]@1 | |
6930 | |
6931 auto Dst = this; | |
6932 v3 = 0; | |
6933 v34 = 0; | |
6934 v4 = Dst; | |
6935 uPlayerIdx = 0; | |
6936 if ( Dst == pPlayers[2] ) | |
6937 uPlayerIdx = 1; | |
310 | 6938 else if ( Dst == pPlayers[3] ) |
6939 uPlayerIdx = 2; | |
6940 else if ( Dst == pPlayers[4] ) | |
6941 uPlayerIdx = 3; | |
6942 | |
6943 if ( var_type <= VAR_AutoNotes ) | |
6944 { | |
6945 if ( var_type != VAR_AutoNotes ) | |
6946 { | |
6947 if ( var_type <= VAR_ActualMight ) | |
6948 { | |
6949 if ( var_type != VAR_ActualMight ) | |
0 | 6950 { |
310 | 6951 switch ( var_type ) |
0 | 6952 { |
6953 case VAR_RandomGold: | |
6954 if ( !val ) | |
6955 val = 1; | |
6956 v6 = rand(); | |
6957 party_finds_gold(v6 % val + 1, 1); | |
6958 GameUI_DrawFoodAndGold(); | |
6959 return; | |
6960 case VAR_RandomFood: | |
6961 if ( !val ) | |
6962 val = 1; | |
6963 v7 = rand() % val + 1; | |
6964 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6965 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
|
6966 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6967 GameUI_DrawFoodAndGold(); |
6968 goto _play_sound; | |
6969 case VAR_Sex: | |
6970 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6971 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6972 goto _play_sound; | |
0 | 6973 case VAR_Class: |
135 | 6974 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6975 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6976 goto _play_sound; | |
0 | 6977 case VAR_CurrentHP: |
6978 v8 = &Dst->sHealth; | |
6979 *v8 += val; | |
6980 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6981 { |
6982 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6983 goto _play_sound; | |
6984 } | |
0 | 6985 v9 = v4->GetMaxHealth(); |
6986 goto LABEL_23; | |
6987 case VAR_MaxHP: | |
6988 v10 = Dst->GetMaxHealth(); | |
6989 v4->_health_related = 0; | |
6990 v4->uFullHealthBonus = 0; | |
6991 v4->sHealth = v10; | |
6992 return; | |
6993 case VAR_CurrentSP: | |
6994 v8 = &Dst->sMana; | |
6995 *v8 += val; | |
6996 if ( Dst->sMana > GetMaxMana() ) | |
6997 { | |
6998 v9 = v4->GetMaxMana(); | |
6999 LABEL_23: | |
7000 *v8 = v9; | |
7001 } | |
1507 | 7002 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7003 goto _play_sound; | |
0 | 7004 case VAR_MaxSP: |
7005 v11 = GetMaxMana(); | |
7006 v4->_mana_related = 0; | |
7007 v4->uFullManaBonus = 0; | |
7008 v4->sMana = v11; | |
7009 return; | |
7010 case VAR_ACModifier: | |
7011 v12 = &Dst->sACModifier; | |
7012 goto LABEL_29; | |
7013 case VAR_BaseLevel: | |
7014 v12 = (__int16 *)&Dst->uLevel; | |
7015 goto LABEL_29; | |
7016 case VAR_LevelModifier: | |
7017 v12 = &Dst->sLevelModifier; | |
7018 LABEL_29: | |
7019 *v12 += val; | |
7020 if ( *v12 > 255 ) | |
7021 *v12 = 255; | |
1507 | 7022 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7023 goto _play_sound; | |
0 | 7024 case VAR_Age: |
7025 Dst->sAgeModifier += val; | |
7026 return; | |
7027 case VAR_Award: | |
7028 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7029 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 7030 |
492 | 7031 && pAwards[val].pText ) |
0 | 7032 { |
7033 v14 = pPlayers[uPlayerIdx + 1]; | |
7034 v34 = 1; | |
7035 v3 = 1; | |
187 | 7036 v14->PlaySound(SPEECH_96, 0); |
0 | 7037 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7038 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 7039 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
7040 if ( v34 != 1 ) | |
7041 { | |
7042 if ( v3 != 1 ) | |
7043 return; | |
7044 goto _play_sound; | |
7045 } | |
7046 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7047 if ( v3 != 1 ) | |
7048 return; | |
7049 goto _play_sound; | |
0 | 7050 case VAR_Experience: |
7051 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
7052 LODWORD(Dst->uExperience) += val; | |
7053 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
7054 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
7055 Dst->uExperience = 4000000000i64; | |
1507 | 7056 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7057 goto _play_sound; | |
0 | 7058 case VAR_QBits_QuestsDone: |
484 | 7059 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
|
7060 //&& (&dword_722F10)[4 * val] ) |
1310 | 7061 && pQuestTable[val] ) |
0 | 7062 { |
501 | 7063 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 7064 bFlashQuestBook = 1; |
7065 v34 = 1; | |
7066 v3 = 1; | |
501 | 7067 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 7068 } |
484 | 7069 v15 = (char *)pParty->_quest_bits; |
1507 | 7070 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
7071 if ( v34 != 1 ) | |
7072 { | |
7073 if ( v3 != 1 ) | |
7074 return; | |
7075 goto _play_sound; | |
7076 } | |
7077 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7078 if ( v3 != 1 ) | |
7079 return; | |
7080 goto _play_sound; | |
0 | 7081 case VAR_PlayerItemInHands: |
7082 item.Reset(); | |
7083 item.Reset(); | |
7084 item.uAttributes = 1; | |
7085 item.uItemID = val; | |
7086 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 7087 pParty->pIsArtifactFound[val-500] = 1; |
0 | 7088 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
7089 { | |
7090 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
7091 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
7092 } | |
7093 pParty->SetHoldingItem(&item); | |
7094 return; | |
7095 case VAR_FixedGold: | |
7096 party_finds_gold(val, 1); | |
7097 return; | |
7098 case VAR_BaseMight: | |
7099 v18 = (__int16 *)&Dst->uMight; | |
7100 goto LABEL_82; | |
7101 case VAR_BaseIntellect: | |
7102 v18 = (__int16 *)&Dst->uIntelligence; | |
7103 goto LABEL_82; | |
7104 case VAR_BasePersonality: | |
7105 v18 = (__int16 *)&Dst->uWillpower; | |
7106 goto LABEL_82; | |
7107 case VAR_BaseEndurance: | |
7108 v18 = (__int16 *)&Dst->uEndurance; | |
7109 goto LABEL_82; | |
7110 case VAR_BaseSpeed: | |
7111 v18 = (__int16 *)&Dst->uSpeed; | |
7112 goto LABEL_82; | |
7113 case VAR_BaseAccuracy: | |
7114 v18 = (__int16 *)&Dst->uAccuracy; | |
7115 goto LABEL_82; | |
7116 case VAR_BaseLuck: | |
7117 v18 = (__int16 *)&Dst->uLuck; | |
7118 goto LABEL_82; | |
7119 case VAR_FixedFood: | |
7120 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7121 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7122 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7123 if ( pParty->uNumFoodRations > 0xFFFF ) |
7124 Party::SetFood(0xFFFFu); | |
7125 goto _play_sound; | |
7126 case VAR_MightBonus: | |
7127 goto LABEL_62; | |
7128 case VAR_IntellectBonus: | |
7129 goto LABEL_66; | |
7130 case VAR_PersonalityBonus: | |
7131 goto LABEL_67; | |
7132 case VAR_EnduranceBonus: | |
7133 goto LABEL_68; | |
7134 case VAR_SpeedBonus: | |
7135 goto LABEL_69; | |
7136 case VAR_AccuracyBonus: | |
7137 goto LABEL_70; | |
7138 case VAR_LuckBonus: | |
7139 goto LABEL_71; | |
7140 default: | |
7141 return; | |
7142 } | |
7143 return; | |
7144 } | |
7145 LABEL_62: | |
7146 v19 = (__int16 *)&Dst->uMightBonus; | |
7147 goto LABEL_113; | |
7148 } | |
310 | 7149 if ( var_type <= VAR_FireResistanceBonus ) |
7150 { | |
7151 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7152 { |
310 | 7153 switch ( var_type ) |
0 | 7154 { |
7155 case VAR_ActualIntellect: | |
7156 LABEL_66: | |
7157 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7158 goto LABEL_113; | |
7159 case VAR_ActualPersonality: | |
7160 LABEL_67: | |
7161 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7162 goto LABEL_113; | |
7163 case VAR_ActualEndurance: | |
7164 LABEL_68: | |
7165 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7166 goto LABEL_113; | |
7167 case VAR_ActualSpeed: | |
7168 LABEL_69: | |
7169 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7170 goto LABEL_113; | |
7171 case VAR_ActualAccuracy: | |
7172 LABEL_70: | |
7173 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7174 goto LABEL_113; | |
7175 case VAR_ActualLuck: | |
7176 LABEL_71: | |
7177 v19 = (__int16 *)&Dst->uLuckBonus; | |
7178 goto LABEL_113; | |
7179 case VAR_FireResistance: | |
7180 v18 = &Dst->sResFireBase; | |
7181 goto LABEL_82; | |
7182 case VAR_AirResistance: | |
7183 v18 = &Dst->sResAirBase; | |
7184 goto LABEL_82; | |
7185 case VAR_WaterResistance: | |
7186 v18 = &Dst->sResWaterBase; | |
7187 goto LABEL_82; | |
7188 case VAR_EarthResistance: | |
7189 v18 = &Dst->sResEarthBase; | |
7190 goto LABEL_82; | |
7191 case VAR_SpiritResistance: | |
7192 v18 = &Dst->sResSpiritBase; | |
7193 goto LABEL_82; | |
7194 case VAR_MindResistance: | |
7195 v18 = &Dst->sResMindBase; | |
7196 goto LABEL_82; | |
7197 case VAR_BodyResistance: | |
7198 v18 = &Dst->sResBodyBase; | |
7199 goto LABEL_82; | |
7200 case VAR_LightResistance: | |
7201 v18 = &Dst->sResLightBase; | |
7202 goto LABEL_82; | |
7203 case VAR_DarkResistance: | |
7204 v18 = &Dst->sResDarkBase; | |
7205 goto LABEL_82; | |
7206 case VAR_MagicResistance: | |
7207 v18 = &Dst->sResMagicBase; | |
7208 LABEL_82: | |
7209 *v18 += val; | |
7210 if ( *v18 > 255 ) | |
7211 *v18 = 255; | |
1507 | 7212 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7213 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7214 goto _play_sound; | |
0 | 7215 default: |
7216 return; | |
7217 } | |
7218 return; | |
7219 } | |
7220 v19 = &Dst->sResFireBonus; | |
7221 LABEL_113: | |
7222 *v19 += val; | |
7223 if ( *v19 > 255 ) | |
7224 *v19 = 255; | |
7225 v31 = 0; | |
187 | 7226 v29 = SPEECH_91; |
7227 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7228 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7229 goto _play_sound; | |
0 | 7230 } |
310 | 7231 if ( var_type <= VAR_DisarmTrapSkill ) |
7232 { | |
7233 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7234 { |
310 | 7235 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7236 { |
310 | 7237 switch ( var_type ) |
0 | 7238 { |
7239 case VAR_BodyResistanceBonus: | |
7240 v19 = &Dst->sResBodyBonus; | |
7241 break; | |
7242 case VAR_AirResistanceBonus: | |
7243 v19 = &Dst->sResAirBonus; | |
7244 break; | |
7245 case VAR_WaterResistanceBonus: | |
7246 v19 = &Dst->sResWaterBonus; | |
7247 break; | |
7248 case VAR_EarthResistanceBonus: | |
7249 v19 = &Dst->sResEarthBonus; | |
7250 break; | |
7251 case VAR_SpiritResistanceBonus: | |
7252 v19 = &Dst->sResSpiritBonus; | |
7253 break; | |
7254 default: | |
310 | 7255 if ( var_type != 62 ) |
0 | 7256 return; |
7257 v19 = &Dst->sResMindBonus; | |
7258 break; | |
7259 } | |
7260 goto LABEL_113; | |
7261 } | |
310 | 7262 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7263 { |
7264 v19 = &Dst->sResLightBonus; | |
7265 goto LABEL_113; | |
7266 } | |
310 | 7267 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7268 { |
7269 v19 = &Dst->sResDarkBonus; | |
7270 goto LABEL_113; | |
7271 } | |
310 | 7272 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7273 { |
7274 v19 = &Dst->sResMagicBonus; | |
7275 goto LABEL_113; | |
7276 } | |
310 | 7277 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7278 return; |
7279 } | |
7280 goto LABEL_106; | |
7281 } | |
310 | 7282 if ( var_type == VAR_LearningSkill ) |
0 | 7283 { |
7284 LABEL_106: | |
7285 if ( val <= VAR_BodyResistanceBonus ) | |
7286 { | |
310 | 7287 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7288 } |
7289 else | |
7290 { | |
310 | 7291 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7292 v21 = *(short *)v20; |
7293 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7294 if ( v22 > 60 ) | |
7295 LOWORD(v22) = 60; | |
7296 LOBYTE(v21) = v21 & 0xC0; | |
7297 *(short *)v20 = v22 | v21; | |
7298 } | |
1507 | 7299 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7300 goto _play_sound; | |
0 | 7301 } |
310 | 7302 if ( var_type <= VAR_LearningSkill ) |
0 | 7303 return; |
310 | 7304 if ( var_type <= VAR_Eradicated ) |
7305 { | |
7306 Dst->SetCondition(var_type - 105, 0); | |
0 | 7307 } |
7308 else | |
7309 { | |
310 | 7310 if ( var_type != VAR_MajorCondition ) |
0 | 7311 { |
310 | 7312 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7313 { |
310 | 7314 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7315 byte_5E4C15[var_type] += val; | |
0 | 7316 else |
310 | 7317 byte_5E4C15[var_type] = -1; |
0 | 7318 } |
7319 return; | |
7320 } | |
7321 memset(Dst, 0, 0xA0u); | |
7322 } | |
7323 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7324 goto _play_sound; | |
7325 } | |
7326 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
|
7327 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7328 && pAutonoteTxt[val].pText ) |
0 | 7329 { |
7330 v23 = pPlayers[uPlayerIdx + 1]; | |
7331 v34 = 1; | |
187 | 7332 v23->PlaySound(SPEECH_96, 0); |
1453 | 7333 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7334 bFlashAutonotesBook = 1; |
1453 | 7335 _506568_autonote_type = pAutonoteTxt[val].eType; |
7336 } | |
7337 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7338 v3 = 1; |
7339 if ( v34 != 1 ) | |
1507 | 7340 { |
7341 if ( v3 != 1 ) | |
7342 return; | |
7343 goto _play_sound; | |
7344 } | |
7345 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7346 if ( v3 != 1 ) | |
7347 return; | |
7348 goto _play_sound; | |
0 | 7349 } |
310 | 7350 if ( var_type > VAR_GoldInBank ) |
7351 { | |
7352 if ( var_type == 307 ) | |
0 | 7353 { |
7354 pParty->uNumDeaths += val; | |
1507 | 7355 if ( v34 != 1 ) |
7356 { | |
7357 if ( v3 != 1 ) | |
7358 return; | |
7359 goto _play_sound; | |
7360 } | |
7361 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7362 if ( v3 != 1 ) | |
7363 return; | |
7364 goto _play_sound; | |
0 | 7365 } |
310 | 7366 switch ( var_type ) |
0 | 7367 { |
7368 case 308: | |
7369 pParty->uNumBountiesCollected += val; | |
7370 break; | |
7371 case 309: | |
7372 pParty->uNumPrisonTerms += val; | |
7373 break; | |
7374 case 310: | |
7375 pParty->uNumArenaPageWins += val; | |
7376 break; | |
7377 case 311: | |
7378 pParty->uNumArenaSquireWins += val; | |
7379 break; | |
7380 case 312: | |
7381 pParty->uNumArenaKnightWins += val; | |
7382 break; | |
7383 case 313: | |
7384 pParty->uNumArenaLordWins += val; | |
7385 break; | |
7386 } | |
7387 } | |
7388 else | |
7389 { | |
310 | 7390 if ( var_type == VAR_GoldInBank ) |
0 | 7391 { |
7392 pParty->uNumGoldInBank += val; | |
7393 return; | |
7394 } | |
310 | 7395 if ( var_type <= VAR_Counter8 ) |
7396 { | |
7397 if ( (signed int)var_type >= 245 ) | |
7398 { | |
7399 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7400 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7401 } |
7402 else | |
7403 { | |
310 | 7404 switch ( var_type ) |
0 | 7405 { |
7406 case VAR_MonthEquals|VAR_CurrentSP: | |
7407 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7408 break; | |
7409 case VAR_NPCs2: | |
7410 pParty->field_709 = 0; | |
7411 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7412 pParty->CountHirelings(); |
7413 viewparams->bRedrawGameUI = true; | |
0 | 7414 break; |
7415 case VAR_NumSkillPoints: | |
7416 Dst->uSkillPoints += val; | |
7417 break; | |
7418 } | |
7419 } | |
7420 return; | |
7421 } | |
310 | 7422 if ( var_type < VAR_Counter9 ) |
0 | 7423 return; |
310 | 7424 if ( (signed int)var_type <= 274 ) |
7425 { | |
7426 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7427 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7428 goto _play_sound; |
7429 } | |
310 | 7430 if ( var_type != VAR_ReputationInCurrentLocation ) |
7431 { | |
7432 if ( var_type <= VAR_ReputationInCurrentLocation | |
7433 || var_type > VAR_History_28 | |
7434 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7435 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7436 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7437 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7438 v26) ) |
7439 return; | |
7440 bFlashHistoryBook = 1; | |
7441 _play_sound: | |
7442 v28 = 8 * uPlayerIdx + 400; | |
862 | 7443 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7444 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7445 return; | |
7446 } | |
7447 v27 = &pOutdoor->ddm; | |
7448 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7449 v27 = &pIndoor->dlv; | |
7450 v27->uReputation += val; | |
7451 if ( v27->uReputation > 10000 ) | |
7452 v27->uReputation = 10000; | |
7453 } | |
7454 } | |
7455 | |
7456 | |
7457 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7458 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7459 { |
7460 unsigned int v3; // ebx@1 | |
7461 signed int v4; // esi@1 | |
501 | 7462 bool result; // eax@8 |
0 | 7463 int v6; // esi@11 |
7464 int v7; // edi@14 | |
7465 signed int v8; // eax@17 | |
7466 char *v9; // eax@20 | |
7467 char v10; // sf@20 | |
7468 char *v11; // ecx@26 | |
7469 char *v12; // ecx@27 | |
7470 __int64 v13; // qax@27 | |
7471 unsigned __int8 v14; // cf@27 | |
501 | 7472 int *v15; // edx@29 |
0 | 7473 char *v16; // eax@90 |
7474 char *v17; // ecx@94 | |
501 | 7475 int v18; // esi@97 |
0 | 7476 signed int v19; // edx@97 |
7477 char *v20; // ecx@98 | |
7478 int v21; // eax@100 | |
7479 __int16 v22; // dx@112 | |
7480 int v23; // [sp-8h] [bp-14h]@45 | |
7481 signed int v24; // [sp-4h] [bp-10h]@4 | |
7482 int v25; // [sp-4h] [bp-10h]@45 | |
7483 | |
7484 v3 = 0; | |
605 | 7485 v4 = uActiveCharacter - 1; |
501 | 7486 result = false; |
7487 if ( (signed int)VarNum > 222 ) | |
7488 { | |
7489 if ( (signed int)VarNum <= 307 ) | |
7490 { | |
7491 if ( VarNum == 307 ) | |
7492 { | |
7493 pParty->uNumDeaths -= (unsigned int)pValue; | |
7494 return pValue; | |
7495 } | |
7496 if ( VarNum == 223 ) | |
0 | 7497 { |
7498 v11 = (char *)pParty->_autonote_bits; | |
501 | 7499 v22 = (short)pValue - 1; |
0 | 7500 } |
7501 else | |
7502 { | |
501 | 7503 if ( VarNum != 231 ) |
0 | 7504 { |
501 | 7505 switch ( VarNum ) |
0 | 7506 { |
7507 case 232: | |
501 | 7508 VarNum = (VariableType)0; |
1094 | 7509 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7510 result = (bool) pValue; |
7511 dword_5B65CC = 0; | |
7512 if ( (int)VarNum == pValue ) | |
0 | 7513 { |
501 | 7514 dword_5B65CC = (int)pValue; |
0 | 7515 } |
7516 else | |
7517 { | |
7518 pParty->field_709 = 0; | |
501 | 7519 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7520 pParty->CountHirelings(); |
7521 viewparams->bRedrawGameUI = true; | |
0 | 7522 } |
7523 break; | |
7524 case 241: | |
7525 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7526 { | |
7527 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7528 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7529 { |
605 | 7530 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7531 { |
7532 v21 = *(int *)v20; | |
7533 if ( (char)*(int *)v20 < 0 ) | |
7534 { | |
7535 LOBYTE(v21) = v21 & 0x7F; | |
7536 *(int *)v20 = v21; | |
7537 } | |
7538 } | |
7539 v20 += 76; | |
7540 } | |
7541 } | |
605 | 7542 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7543 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7544 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7545 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7546 pParty->field_709 = 0; | |
1035 | 7547 pParty->CountHirelings(); |
0 | 7548 break; |
7549 case 243: | |
7550 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7551 result = *v17 != NULL; |
501 | 7552 if ( (unsigned int)pValue <= *(int *)v17 ) |
7553 { | |
7554 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7555 result = (v17 != NULL); |
501 | 7556 } |
0 | 7557 else |
7558 *(int *)v17 = 0; | |
7559 break; | |
7560 case 275: | |
7561 v16 = (char *)&pOutdoor->ddm; | |
7562 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7563 v16 = (char *)&pIndoor->dlv; | |
501 | 7564 *((int *)v16 + 2) -= (int)pValue; |
0 | 7565 if ( *((int *)v16 + 2) < -10000 ) |
7566 *((int *)v16 + 2) = -10000; | |
7567 break; | |
7568 case 306: | |
501 | 7569 result = VarNum - 306; |
7570 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7571 { | |
7572 result = (bool)pValue; | |
7573 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7574 } |
0 | 7575 else |
7576 LABEL_88: | |
7577 dword_5B65C4 = 1; | |
7578 break; | |
7579 } | |
501 | 7580 return result; |
0 | 7581 } |
7582 v11 = this->field_1A50; | |
501 | 7583 v22 = (signed __int16)pValue; |
0 | 7584 } |
7585 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7586 return result; |
7587 } | |
7588 switch ( VarNum ) | |
0 | 7589 { |
7590 case 308: | |
501 | 7591 result = (bool)pValue; |
7592 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7593 break; |
7594 case 309: | |
501 | 7595 result = (bool)pValue; |
7596 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7597 break; |
7598 case 310: | |
501 | 7599 result = (bool)pValue; |
7600 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7601 break; |
7602 case 311: | |
501 | 7603 result = (bool)pValue; |
7604 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7605 break; |
7606 case 312: | |
501 | 7607 result = (bool)pValue; |
7608 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7609 break; |
7610 case 313: | |
501 | 7611 result = (bool)pValue; |
7612 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7613 break; |
7614 } | |
1545 | 7615 Error("Function not returning any value! (%u)", VarNum); |
0 | 7616 } |
7617 else | |
7618 { | |
501 | 7619 if ( (signed int)VarNum >= 123 ) |
7620 { | |
7621 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7622 } |
7623 else | |
7624 { | |
501 | 7625 switch ( VarNum ) |
0 | 7626 { |
7627 case VAR_RandomGold: | |
501 | 7628 v6 = rand() % (signed int)pValue + 1; |
0 | 7629 if ( v6 > pParty->uNumGold ) |
7630 v6 = pParty->uNumGold; | |
7631 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7632 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7633 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7634 GameUI_DrawFoodAndGold(); |
501 | 7635 return result; |
0 | 7636 case VAR_RandomFood: |
501 | 7637 v7 = rand() % (signed int)pValue + 1; |
0 | 7638 if ( v7 > pParty->uNumFoodRations ) |
7639 v7 = pParty->uNumFoodRations; | |
7640 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7641 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7642 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7643 GameUI_DrawFoodAndGold(); |
605 | 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); |
501 | 7648 return result; |
0 | 7649 case VAR_CurrentHP: |
1036 | 7650 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7651 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7652 v8 = 8 * v4 + 400; | |
862 | 7653 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7654 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7655 return result; | |
0 | 7656 case VAR_CurrentSP: |
7657 v9 = (char *)&this->sMana; | |
501 | 7658 v10 = this->sMana - (signed int)pValue < 0; |
7659 *(int *)v9 -= (int)pValue; | |
0 | 7660 if ( v10 ) |
7661 *(int *)v9 = 0; | |
605 | 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_ACModifier: |
501 | 7668 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7669 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7670 v8 = 8 * v4 + 400; | |
862 | 7671 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7672 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7673 return result; | |
0 | 7674 case VAR_BaseLevel: |
501 | 7675 this->uLevel -= (unsigned __int8)pValue; |
605 | 7676 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7677 v8 = 8 * v4 + 400; | |
862 | 7678 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7679 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7680 return result; | |
0 | 7681 case VAR_LevelModifier: |
501 | 7682 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7683 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7684 v8 = 8 * v4 + 400; | |
862 | 7685 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7686 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7687 return result; | |
0 | 7688 case VAR_Age: |
501 | 7689 this->sAgeModifier -= (signed __int16)pValue; |
7690 return result; | |
0 | 7691 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7692 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7693 return result; |
0 | 7694 case VAR_Experience: |
7695 v12 = (char *)&this->uExperience; | |
501 | 7696 v13 = (signed int)pValue; |
7697 v14 = *(int *)v12 < (unsigned int)pValue; | |
7698 *(int *)v12 -= (int)pValue; | |
0 | 7699 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7700 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7701 v8 = 8 * v4 + 400; | |
862 | 7702 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7703 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7704 return result; | |
0 | 7705 case VAR_QBits_QuestsDone: |
501 | 7706 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7707 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7708 return true; |
0 | 7709 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7710 v15 = this->pInventoryMatrix; |
0 | 7711 break; |
7712 case VAR_FixedGold: | |
501 | 7713 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7714 goto LABEL_88; |
501 | 7715 Party::TakeGold((unsigned int)pValue); |
7716 return result; | |
0 | 7717 case VAR_MightBonus: |
7718 case VAR_ActualMight: | |
501 | 7719 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7720 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 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_IntellectBonus: |
7727 case VAR_ActualIntellect: | |
501 | 7728 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7729 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7730 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7731 v8 = 8 * v4 + 400; | |
862 | 7732 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7733 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7734 return result; | |
0 | 7735 case VAR_PersonalityBonus: |
7736 case VAR_ActualPersonality: | |
501 | 7737 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7738 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7739 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7740 v8 = 8 * v4 + 400; | |
862 | 7741 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7742 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7743 return result; | |
0 | 7744 case VAR_EnduranceBonus: |
7745 case VAR_ActualEndurance: | |
501 | 7746 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7747 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7748 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7749 v8 = 8 * v4 + 400; | |
862 | 7750 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7751 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7752 return result; | |
0 | 7753 case VAR_SpeedBonus: |
7754 case VAR_ActualSpeed: | |
501 | 7755 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7756 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7757 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7758 v8 = 8 * v4 + 400; | |
862 | 7759 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7760 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7761 return result; | |
0 | 7762 case VAR_AccuracyBonus: |
7763 case VAR_ActualAccuracy: | |
501 | 7764 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7765 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7766 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7767 v8 = 8 * v4 + 400; | |
862 | 7768 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7769 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7770 return result; | |
0 | 7771 case VAR_LuckBonus: |
7772 case VAR_ActualLuck: | |
501 | 7773 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7774 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7775 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7776 v8 = 8 * v4 + 400; | |
862 | 7777 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7778 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7779 return result; | |
0 | 7780 case VAR_BaseMight: |
501 | 7781 this->uMight -= (unsigned __int16)pValue; |
605 | 7782 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7783 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7784 v8 = 8 * v4 + 400; | |
862 | 7785 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7786 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7787 return result; | |
0 | 7788 case VAR_BaseIntellect: |
501 | 7789 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 7790 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7791 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7792 v8 = 8 * v4 + 400; | |
862 | 7793 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7794 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7795 return result; | |
0 | 7796 case VAR_BasePersonality: |
501 | 7797 this->uWillpower -= (unsigned __int16)pValue; |
605 | 7798 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7799 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7800 v8 = 8 * v4 + 400; | |
862 | 7801 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7802 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7803 return result; | |
0 | 7804 case VAR_BaseEndurance: |
501 | 7805 this->uEndurance -= (unsigned __int16)pValue; |
605 | 7806 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7807 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7808 v8 = 8 * v4 + 400; | |
862 | 7809 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7810 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7811 return result; | |
0 | 7812 case VAR_BaseSpeed: |
501 | 7813 this->uSpeed -= (unsigned __int16)pValue; |
605 | 7814 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7815 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7816 v8 = 8 * v4 + 400; | |
862 | 7817 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7818 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7819 return result; | |
0 | 7820 case VAR_BaseAccuracy: |
501 | 7821 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 7822 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7823 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7824 v8 = 8 * v4 + 400; | |
862 | 7825 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7826 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7827 return result; | |
0 | 7828 case VAR_BaseLuck: |
501 | 7829 this->uLuck -= (unsigned __int16)pValue; |
605 | 7830 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7831 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7832 v8 = 8 * v4 + 400; | |
862 | 7833 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7834 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7835 return result; | |
0 | 7836 case VAR_FireResistance: |
501 | 7837 this->sResFireBase -= (signed __int16)pValue; |
605 | 7838 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7839 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7840 v8 = 8 * v4 + 400; | |
862 | 7841 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7842 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7843 return result; | |
0 | 7844 case VAR_AirResistance: |
501 | 7845 this->sResAirBase -= (signed __int16)pValue; |
605 | 7846 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7847 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7848 v8 = 8 * v4 + 400; | |
862 | 7849 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7850 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7851 return result; | |
0 | 7852 case VAR_WaterResistance: |
501 | 7853 this->sResWaterBase -= (signed __int16)pValue; |
605 | 7854 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7855 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7856 v8 = 8 * v4 + 400; | |
862 | 7857 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7858 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7859 return result; | |
0 | 7860 case VAR_EarthResistance: |
501 | 7861 this->sResEarthBase -= (signed __int16)pValue; |
605 | 7862 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7863 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7864 v8 = 8 * v4 + 400; | |
862 | 7865 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7866 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7867 return result; | |
0 | 7868 case VAR_SpiritResistance: |
501 | 7869 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 7870 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7871 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7872 v8 = 8 * v4 + 400; | |
862 | 7873 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7874 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7875 return result; | |
0 | 7876 case VAR_MindResistance: |
501 | 7877 this->sResMindBase -= (signed __int16)pValue; |
605 | 7878 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7879 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7880 v8 = 8 * v4 + 400; | |
862 | 7881 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7882 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7883 return result; | |
0 | 7884 case VAR_BodyResistance: |
501 | 7885 this->sResBodyBase -= (signed __int16)pValue; |
605 | 7886 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7887 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7888 v8 = 8 * v4 + 400; | |
862 | 7889 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7890 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7891 return result; | |
0 | 7892 case VAR_LightResistance: |
501 | 7893 this->sResLightBase -= (signed __int16)pValue; |
605 | 7894 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7895 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7896 v8 = 8 * v4 + 400; | |
862 | 7897 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7898 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7899 return result; | |
0 | 7900 case VAR_DarkResistance: |
501 | 7901 this->sResDarkBase -= (signed __int16)pValue; |
605 | 7902 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7903 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7904 v8 = 8 * v4 + 400; | |
862 | 7905 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7906 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7907 return result; | |
0 | 7908 case VAR_MagicResistance: |
501 | 7909 this->sResMagicBase -= (signed __int16)pValue; |
605 | 7910 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7911 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7912 v8 = 8 * v4 + 400; | |
862 | 7913 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7914 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7915 return result; | |
0 | 7916 case VAR_FireResistanceBonus: |
501 | 7917 this->sResFireBonus -= (signed __int16)pValue; |
605 | 7918 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7919 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7920 v8 = 8 * v4 + 400; | |
862 | 7921 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7922 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7923 return result; | |
0 | 7924 case VAR_AirResistanceBonus: |
501 | 7925 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7926 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7927 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7928 v8 = 8 * v4 + 400; | |
862 | 7929 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7930 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7931 return result; | |
0 | 7932 case VAR_WaterResistanceBonus: |
501 | 7933 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 7934 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7935 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7936 v8 = 8 * v4 + 400; | |
862 | 7937 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7938 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7939 return result; | |
0 | 7940 case VAR_EarthResistanceBonus: |
501 | 7941 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 7942 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7943 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7944 v8 = 8 * v4 + 400; | |
862 | 7945 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7946 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7947 return result; | |
0 | 7948 case VAR_SpiritResistanceBonus: |
501 | 7949 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 7950 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7951 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7952 v8 = 8 * v4 + 400; | |
862 | 7953 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7954 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7955 return result; | |
0 | 7956 case VAR_MindResistanceBonus: |
501 | 7957 this->sResMindBonus -= (signed __int16)pValue; |
605 | 7958 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7959 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7960 v8 = 8 * v4 + 400; | |
862 | 7961 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7962 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7963 return result; | |
0 | 7964 case VAR_BodyResistanceBonus: |
501 | 7965 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 7966 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7967 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7968 v8 = 8 * v4 + 400; | |
862 | 7969 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7970 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7971 return result; | |
0 | 7972 case VAR_LightResistanceBonus: |
501 | 7973 this->sResLightBonus -= (signed __int16)pValue; |
605 | 7974 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7975 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7976 v8 = 8 * v4 + 400; | |
862 | 7977 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7978 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7979 return result; | |
0 | 7980 case VAR_DarkResistanceBonus: |
501 | 7981 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7982 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7983 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7984 v8 = 8 * v4 + 400; | |
862 | 7985 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7986 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7987 return result; | |
0 | 7988 case VAR_MagicResistanceBonus: |
501 | 7989 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7990 v25 = 0; |
187 | 7991 v23 = SPEECH_91; |
7992 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7993 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7994 v8 = 8 * v4 + 400; | |
862 | 7995 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7996 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7997 return result; | |
0 | 7998 case VAR_FixedFood: |
501 | 7999 Party::TakeFood((unsigned int)pValue); |
605 | 8000 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8001 v8 = 8 * v4 + 400; | |
862 | 8002 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8003 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8004 return result; | |
0 | 8005 case VAR_StaffSkill: |
8006 case VAR_SwordSkill: | |
8007 case VAR_DaggerSkill: | |
8008 case VAR_AxeSkill: | |
8009 case VAR_SpearSkill: | |
8010 case VAR_BowSkill: | |
8011 case VAR_MaceSkill: | |
8012 case VAR_BlasterSkill: | |
8013 case VAR_ShieldSkill: | |
8014 case VAR_LeatherSkill: | |
8015 case VAR_SkillChain: | |
8016 case VAR_PlateSkill: | |
8017 case VAR_FireSkill: | |
8018 case VAR_AirSkill: | |
8019 case VAR_WaterSkill: | |
8020 case VAR_EarthSkill: | |
8021 case VAR_SpiritSkill: | |
8022 case VAR_MindSkill: | |
8023 case VAR_BodySkill: | |
8024 case VAR_LightSkill: | |
8025 case VAR_DarkSkill: | |
8026 case VAR_IdentifyItemSkill: | |
8027 case VAR_MerchantSkill: | |
8028 case VAR_RepairSkill: | |
8029 case VAR_BodybuildingSkill: | |
8030 case VAR_MeditationSkill: | |
8031 case VAR_PerceptionSkill: | |
8032 case VAR_DiplomacySkill: | |
8033 case VAR_DisarmTrapSkill: | |
8034 case VAR_LearningSkill: | |
501 | 8035 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 8036 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8037 v8 = 8 * v4 + 400; | |
862 | 8038 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8039 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8040 return result; | |
0 | 8041 case VAR_Cursed: |
8042 case VAR_Weak: | |
8043 case VAR_Asleep: | |
8044 case VAR_Afraid: | |
8045 case VAR_Drunk: | |
8046 case VAR_Insane: | |
8047 case VAR_PoisonedGreen: | |
8048 case VAR_DiseasedGreen: | |
8049 case VAR_PoisonedYellow: | |
8050 case VAR_DiseasedYellow: | |
8051 case VAR_PoisonedRed: | |
8052 case VAR_DiseasedRed: | |
8053 case VAR_Paralyzed: | |
8054 case VAR_Unconsious: | |
8055 case VAR_Dead: | |
8056 case VAR_Stoned: | |
8057 case VAR_Eradicated: | |
1071 | 8058 //*((int *)this + 2 * VarNum - 210) = 0; |
8059 //*((int *)this + 2 * result - 209) = 0; | |
8060 this->pConditions[VarNum] = 0; | |
0 | 8061 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8062 v8 = 8 * v4 + 400; | |
862 | 8063 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 8064 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 8065 return result; |
605 | 8066 default: |
8067 return result; | |
8068 } | |
8069 for (v3 = 1; v3 < 126; v3++) | |
8070 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8071 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 8072 { |
605 | 8073 RemoveItemAtInventoryIndex(v3); |
501 | 8074 return true; |
0 | 8075 } |
605 | 8076 } |
501 | 8077 if ( pParty->pPickedItem.uItemID == pValue ) |
8078 { | |
605 | 8079 pMouse->RemoveHoldingItem(); |
8080 return true; | |
8081 } | |
8082 return false; | |
0 | 8083 } |
8084 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8085 |
1430 | 8086 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8087 return false; |
0 | 8088 } |
8089 // 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
|
8090 // 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
|
8091 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8092 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8093 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8094 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
|
8095 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8096 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8097 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8098 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8099 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8100 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8101 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8102 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8103 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
|
8104 //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
|
8105 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
|
8106 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
|
8107 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8108 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8109 _this.Reset(); |
1374 | 8110 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8111 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8112 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8113 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8114 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8115 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8116 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8117 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8118 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
|
8119 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8120 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8121 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8122 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8123 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8124 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8125 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8126 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8127 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8128 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8129 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8130 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8131 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8132 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
|
8133 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8134 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8135 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8136 } |
1295 | 8137 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8138 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8139 |
1295 | 8140 //----- (0049387A) -------------------------------------------------------- |
1459 | 8141 int CycleCharacter(bool backwards) |
1295 | 8142 { |
8143 signed int result; // eax@1 | |
8144 signed int v2; // ecx@2 | |
8145 signed int v3; // ecx@8 | |
8146 | |
8147 result = uActiveCharacter; | |
1459 | 8148 if ( backwards ) |
1295 | 8149 { |
8150 v2 = 0; | |
8151 while ( 1 ) | |
8152 { | |
8153 --result; | |
8154 if ( result < 1 ) | |
8155 result = 4; | |
8156 if ( !pPlayers[result]->uTimeToRecovery ) | |
8157 break; | |
8158 ++v2; | |
8159 if ( v2 >= 4 ) | |
8160 return uActiveCharacter; | |
8161 } | |
8162 } | |
8163 else | |
8164 { | |
8165 v3 = 0; | |
8166 while ( 1 ) | |
8167 { | |
8168 ++result; | |
8169 if ( result > 4 ) | |
8170 result = 1; | |
8171 if ( !pPlayers[result]->uTimeToRecovery ) | |
8172 break; | |
8173 ++v3; | |
8174 if ( v3 >= 4 ) | |
8175 return uActiveCharacter; | |
8176 } | |
8177 } | |
8178 return result; | |
1297 | 8179 } |
8180 //----- (0043EE77) -------------------------------------------------------- | |
8181 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8182 { | |
8183 bool result; // eax@0 | |
8184 Player *v2; // edx@3 | |
8185 int v3; // ecx@3 | |
8186 Player **pPlayers; // esi@8 | |
1424 | 8187 //bool item_flag; |
1297 | 8188 Player *v6; // edx@9 |
8189 | |
1424 | 8190 //if ( a1 < 1 || a1 > 4 ) |
8191 //{ | |
8192 //if ( !a1 ) | |
8193 //{ | |
8194 //pPlayers = &::pPlayers[1]; | |
8195 //v5 = 604; | |
8196 //while ( 1 ) | |
1545 | 8197 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8198 for ( uint i = 1; i < 5; ++i ) |
1424 | 8199 { |
8200 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8201 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8202 return false; | |
8203 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8204 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8205 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8206 return false; | |
8207 //result *= 9; | |
1432 | 8208 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8209 return false; |
8210 //++pPlayers; | |
8211 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8212 //return true; | |
8213 } | |
8214 return true; | |
8215 } | |
1432 | 8216 |
1297 | 8217 //----- (0043EE15) -------------------------------------------------------- |
8218 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8219 { | |
8220 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8221 { | |
8222 for ( uint i = 0; i < 126; ++i ) | |
8223 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8224 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8225 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8226 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8227 return true; |
8228 } | |
8229 } | |
8230 for ( uint i = 0; i < 16; ++i ) | |
8231 { | |
8232 if ( pPlayer->pEquipment.pIndices[i] ) | |
8233 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8234 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8235 return true; |
8236 } | |
8237 } | |
8238 } | |
8239 return false; | |
8240 } | |
8241 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8242 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8243 { |
8244 unsigned int pNum; // ebp@1 | |
8245 Player **pPlayer; // ebx@1 | |
8246 Player *pPlayer2; // esi@2 | |
8247 enum CHARACTER_RACE pRace; // edi@2 | |
8248 bool pSex; // eax@2 | |
8249 char v6; // zf@7 | |
8250 | |
8251 //pPlayer = &pPlayers[1]; | |
8252 /*pNum = a1; | |
8253 | |
8254 while ( 1 ) | |
8255 { | |
8256 pPlayer2 = *pPlayer; | |
8257 pRace = pPlayer2->GetRace(); | |
8258 pSex = pPlayer2->GetSexByVoice(); | |
8259 if ( !pRace ) | |
8260 break; | |
8261 if ( pRace == 1 || pRace == 2 ) | |
8262 break; | |
8263 if ( !pSex && pNum == 2 )// | |
8264 //goto LABEL_15; | |
8265 { | |
8266 pSex = 1; | |
8267 return pSex; | |
8268 } | |
8269 v6 = pNum == 3;// | |
8270 LABEL_11: | |
8271 if ( v6 ) | |
8272 //goto LABEL_15; | |
8273 { | |
8274 pSex = 1; | |
8275 return pSex; | |
8276 } | |
8277 ++pPlayer; | |
8278 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8279 { | |
8280 pSex = 0; | |
8281 return pSex; | |
8282 } | |
8283 } | |
8284 if ( pSex || pNum ) | |
8285 { | |
8286 v6 = pNum == 1; | |
8287 goto LABEL_11; | |
8288 } | |
8289 //LABEL_15: | |
8290 pSex = 1; | |
8291 return pSex;*/ | |
8292 for (uint i = 1; i <= 4; ++i) | |
8293 { | |
8294 pRace = pPlayers[i]->GetRace(); | |
8295 pSex = pPlayers[i]->GetSexByVoice(); | |
8296 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8297 return 1; | |
8298 } | |
8299 return 0; | |
8300 } | |
8301 //----- (0043ED6F) -------------------------------------------------------- | |
8302 bool _43ED6F_check_party_races(bool a1) | |
8303 { | |
8304 bool v6; // zf@5 | |
8305 | |
8306 for (uint i = 0; i < 4; ++i) | |
8307 { | |
8308 auto player = pParty->pPlayers + i; | |
8309 auto race = player->GetRace(); | |
8310 | |
8311 if (race != CHARACTER_RACE_HUMAN && | |
8312 race != CHARACTER_RACE_ELF && | |
8313 race != CHARACTER_RACE_GOBLIN) | |
8314 v6 = a1 == 1; | |
8315 else | |
8316 v6 = !a1; | |
8317 | |
8318 if (v6) | |
8319 return true; | |
8320 } | |
8321 return false; | |
8322 } | |
8323 //----- (00439FCB) -------------------------------------------------------- | |
8324 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8325 { | |
8326 signed int v4; // esi@1 | |
8327 unsigned int v5; // ecx@1 | |
8328 Player *v6; // ebx@3 | |
8329 Actor *v7; // esi@3 | |
8330 unsigned int v8; // eax@4 | |
8331 char *v9; // eax@5 | |
8332 signed int v10; // eax@6 | |
8333 int v11; // edx@8 | |
8334 int v12; // edx@9 | |
8335 int v13; // edx@10 | |
8336 int v14; // edx@16 | |
8337 int v15; // edx@17 | |
8338 int v16; // edx@18 | |
8339 enum SoundID v17; // eax@24 | |
8340 int v18; // eax@26 | |
8341 unsigned __int8 v19; // zf@26 | |
8342 unsigned __int8 v20; // sf@26 | |
8343 unsigned __int16 v21; // ax@29 | |
8344 signed int v22; // edi@36 | |
8345 int v23; // eax@38 | |
8346 signed int v24; // eax@44 | |
8347 unsigned __int16 v25; // cx@47 | |
8348 signed int v26; // eax@49 | |
8349 int v27; // eax@54 | |
8350 float v28; // ST18_4@58 | |
8351 double v29; // st7@58 | |
8352 float v30; // ST08_4@58 | |
8353 double v31; // st7@58 | |
8354 float v32; // ST04_4@58 | |
8355 float v33; // ST00_4@58 | |
8356 int v34; // edi@61 | |
8357 int v35; // eax@70 | |
8358 double v36; // st7@70 | |
8359 SpriteObject *v37; // ebx@77 | |
8360 int v38; // edi@77 | |
8361 int v39; // esi@77 | |
8362 int v40; // eax@77 | |
8363 int v41; // eax@77 | |
8364 int v42; // eax@78 | |
8365 Player *v43; // eax@81 | |
8366 Actor *v44; // esi@82 | |
8367 Player *v45; // edi@84 | |
8368 unsigned __int16 v46; // ax@84 | |
8369 int v47; // ebx@105 | |
8370 int v48; // eax@107 | |
8371 unsigned __int16 v49; // ax@116 | |
8372 int v50; // ebx@123 | |
8373 unsigned __int16 v51; // ax@124 | |
8374 char v52; // bl@124 | |
8375 int v53; // eax@128 | |
8376 signed int v54; // eax@134 | |
8377 unsigned __int16 v55; // cx@137 | |
8378 signed int v56; // eax@139 | |
8379 int v57; // eax@144 | |
8380 float v58; // ST18_4@148 | |
8381 double v59; // st7@148 | |
8382 float v60; // ST08_4@148 | |
8383 double v61; // st7@148 | |
8384 float v62; // ST04_4@148 | |
8385 float v63; // ST00_4@148 | |
8386 int v64; // ebx@151 | |
8387 int v65; // eax@161 | |
8388 double v66; // st7@161 | |
8389 signed int v67; // ecx@164 | |
8390 signed int v68; // eax@170 | |
8391 int v69; // ecx@170 | |
8392 int v70; // eax@171 | |
8393 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8394 int v72; // [sp+30h] [bp-24h]@164 | |
8395 double v73; // [sp+40h] [bp-14h]@72 | |
8396 signed int v74; // [sp+44h] [bp-10h]@1 | |
8397 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8398 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8399 int v77; // [sp+50h] [bp-4h]@26 | |
8400 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8401 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8402 | |
8403 v4 = PID_ID(uObjID); | |
8404 v5 = PID_TYPE(uObjID) - 2; | |
8405 v74 = a2; | |
8406 uActorID = v4; | |
8407 if ( v5 ) | |
8408 { | |
8409 if ( v5 != 1 | |
8410 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8411 v75 = v6->sHealth, | |
8412 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8413 return; | |
8414 v8 = v6->pEquipment.uArmor; | |
8415 if ( !v8 | |
8416 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8417 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8418 || v10 > 11 ) | |
8419 { | |
8420 v14 = rand() % 4; | |
8421 if ( !v14 ) | |
8422 { | |
8423 v71 = (SoundID)108; | |
8424 goto LABEL_24; | |
8425 } | |
8426 v15 = v14 - 1; | |
8427 if ( !v15 ) | |
8428 { | |
8429 v71 = (SoundID)109; | |
8430 goto LABEL_24; | |
8431 } | |
8432 v16 = v15 - 1; | |
8433 if ( !v16 ) | |
8434 { | |
8435 v71 = (SoundID)110; | |
8436 goto LABEL_24; | |
8437 } | |
8438 if ( v16 == 1 ) | |
8439 { | |
8440 v71 = (SoundID)44; | |
8441 goto LABEL_24; | |
8442 } | |
8443 } | |
8444 else | |
8445 { | |
8446 v11 = rand() % 4; | |
8447 if ( !v11 ) | |
8448 { | |
8449 v71 = (SoundID)105; | |
8450 goto LABEL_24; | |
8451 } | |
8452 v12 = v11 - 1; | |
8453 if ( !v12 ) | |
8454 { | |
8455 v71 = (SoundID)106; | |
8456 goto LABEL_24; | |
8457 } | |
8458 v13 = v12 - 1; | |
8459 if ( !v13 ) | |
8460 { | |
8461 v71 = (SoundID)107; | |
8462 goto LABEL_24; | |
8463 } | |
8464 if ( v13 == 1 ) | |
8465 { | |
8466 v71 = (SoundID)45; | |
8467 LABEL_24: | |
8468 v17 = v71; | |
8469 goto LABEL_26; | |
8470 } | |
8471 } | |
8472 v17 = (SoundID)a4; | |
8473 LABEL_26: | |
8474 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8475 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8476 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8477 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8478 v77 = v18; | |
8479 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8480 { | |
8481 v21 = v7->pActorBuffs[3].uPower; | |
8482 if ( v21 ) | |
8483 v77 /= (signed int)v21; | |
8484 } | |
8485 if ( v74 ) | |
8486 { | |
8487 if ( v74 == 1 ) | |
8488 { | |
8489 v22 = v7->pMonsterInfo.uAttack2Type; | |
8490 } | |
8491 else | |
8492 { | |
8493 if ( v74 == 2 ) | |
8494 { | |
8495 v23 = v7->pMonsterInfo.uSpell1ID; | |
8496 } | |
8497 else | |
8498 { | |
8499 if ( v74 != 3 ) | |
8500 { | |
8501 if ( v74 == 4 ) | |
8502 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8503 else | |
8504 v22 = 4; | |
8505 goto LABEL_43; | |
8506 } | |
8507 v23 = v7->pMonsterInfo.uSpell2ID; | |
8508 } | |
8509 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8510 } | |
8511 } | |
8512 else | |
8513 { | |
8514 v22 = v7->pMonsterInfo.uAttack1Type; | |
8515 } | |
8516 LABEL_43: | |
8517 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8518 { | |
8519 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8520 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8521 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8522 { | |
8523 v25 = v7->uAIState; | |
8524 if ( v25 != 5 ) | |
8525 { | |
8526 if ( v25 != 4 ) | |
8527 { | |
8528 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8529 v7->sCurrentHP -= v26; | |
8530 if ( v26 ) | |
8531 { | |
8532 if ( v7->sCurrentHP >= 1 ) | |
8533 { | |
8534 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8535 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8536 } | |
8537 else | |
8538 { | |
8539 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8540 { | |
8541 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8542 v74 = v27; | |
8543 if ( pRenderer->pRenderD3D ) | |
8544 { | |
8545 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8546 { | |
8547 v28 = (double)v74; | |
8548 v74 = v7->vPosition.z; | |
8549 v29 = (double)v74; | |
8550 v74 = v7->vPosition.y; | |
8551 v30 = v29; | |
8552 v31 = (double)v74; | |
8553 v74 = v7->vPosition.x; | |
8554 v32 = v31; | |
8555 v33 = (double)v74; | |
8556 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8557 } | |
8558 } | |
8559 } | |
8560 Actor::Die(uActorID); | |
8561 Actor::ApplyFineForKillingPeasant(uActorID); | |
8562 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8563 if ( v7->pMonsterInfo.uExp ) | |
8564 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8565 v34 = SPEECH_51; | |
8566 if ( rand() % 100 < 20 ) | |
8567 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8568 v6->PlaySound((PlayerSpeech)v34, 0); | |
8569 } | |
8570 } | |
8571 } | |
8572 } | |
8573 } | |
8574 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8575 && v7->pMonsterInfo.uSpecialAttack | |
8576 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8577 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8578 } | |
8579 if ( !pParty->bTurnBasedModeOn ) | |
8580 { | |
8581 v35 = v6->GetActualEndurance(); | |
8582 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8583 v6->SetRecoveryTime((signed __int64)v36); | |
8584 } | |
8585 if ( v77 ) | |
8586 { | |
8587 v73 = (double)(signed int)v75; | |
8588 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8589 { | |
8590 if ( v6->sHealth > 0 ) | |
8591 { | |
8592 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8593 v6->PlaySound(SPEECH_48, 0); | |
8594 } | |
8595 } | |
8596 } | |
8597 viewparams->bRedrawGameUI = 1; | |
8598 return; | |
8599 } | |
8600 v37 = &pSpriteObjects[uActorID]; | |
8601 v38 = PID_TYPE(v37->spell_caster_pid); | |
8602 v39 = PID_ID(v37->spell_caster_pid); | |
8603 v40 = PID_TYPE(v37->spell_caster_pid); | |
8604 uActorID = PID_ID(v37->spell_caster_pid); | |
8605 v41 = v40 - 2; | |
8606 if ( !v41 ) | |
8607 goto LABEL_80; | |
8608 v42 = v41 - 1; | |
8609 if ( !v42 ) | |
8610 { | |
8611 v44 = &pActors[v39]; | |
8612 if ( a4 == -1 ) | |
8613 a4 = stru_50C198.which_player_would_attack(v44); | |
8614 v45 = &pParty->pPlayers[a4]; | |
8615 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8616 v46 = v37->uType; | |
8617 if ( v37->uType == 545 ) | |
8618 { | |
8619 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8620 v52 = v51; | |
8621 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8622 { | |
8623 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8624 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8625 v45->PlaySound(SPEECH_6, 0); | |
8626 return; | |
8627 } | |
8628 } | |
8629 else | |
8630 { | |
8631 if ( v46 != 555 | |
8632 && v46 != 510 | |
8633 && v46 != 500 | |
8634 && v46 != 515 | |
8635 && v46 != 505 | |
8636 && v46 != 530 | |
8637 && v46 != 525 | |
8638 && v46 != 520 | |
8639 && v46 != 535 | |
8640 && v46 != 540 ) | |
8641 goto LABEL_115; | |
8642 } | |
8643 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8644 return; | |
8645 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8646 v77 >>= 1; | |
8647 if ( v45->HasEnchantedItemEquipped(36) ) | |
8648 v77 >>= 1; | |
8649 if ( v45->HasEnchantedItemEquipped(69) ) | |
8650 v77 >>= 1; | |
8651 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8652 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8653 v77 >>= 1; |
8654 v75 = 0; | |
8655 v47 = (int)&v45->pEquipment; | |
8656 do | |
8657 { | |
8658 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8659 { | |
8660 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8661 if ( v48 == 520 ) | |
8662 v77 >>= 1; | |
8663 if ( v48 == 531 ) | |
8664 v77 >>= 1; | |
8665 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8666 v77 >>= 1; | |
8667 } | |
8668 ++v75; | |
8669 v47 += 4; | |
8670 } | |
8671 while ( (signed int)v75 <= 1 ); | |
8672 LABEL_115: | |
8673 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8674 { | |
8675 v49 = v44->pActorBuffs[3].uPower; | |
8676 if ( v49 ) | |
8677 v77 /= (signed int)v49; | |
8678 } | |
8679 if ( !v74 ) | |
8680 { | |
8681 v50 = v44->pMonsterInfo.uAttack1Type; | |
8682 goto LABEL_133; | |
8683 } | |
8684 if ( v74 == 1 ) | |
8685 { | |
8686 v50 = v44->pMonsterInfo.uAttack2Type; | |
8687 goto LABEL_133; | |
8688 } | |
8689 if ( v74 == 2 ) | |
8690 { | |
8691 v53 = v44->pMonsterInfo.uSpell1ID; | |
8692 } | |
8693 else | |
8694 { | |
8695 if ( v74 != 3 ) | |
8696 { | |
8697 if ( v74 == 4 ) | |
8698 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8699 else | |
8700 v50 = 4; | |
8701 LABEL_133: | |
8702 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8703 { | |
8704 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8705 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8706 { | |
8707 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8708 { | |
8709 v55 = v44->uAIState; | |
8710 if ( v55 != 5 ) | |
8711 { | |
8712 if ( v55 != 4 ) | |
8713 { | |
8714 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8715 v44->sCurrentHP -= v56; | |
8716 if ( v56 ) | |
8717 { | |
8718 if ( v44->sCurrentHP >= 1 ) | |
8719 { | |
8720 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8721 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8722 } | |
8723 else | |
8724 { | |
8725 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8726 { | |
8727 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8728 v75 = v57; | |
8729 if ( pRenderer->pRenderD3D ) | |
8730 { | |
8731 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8732 { | |
8733 v58 = (double)(signed int)v75; | |
8734 v75 = v44->vPosition.z; | |
8735 v59 = (double)(signed int)v75; | |
8736 v75 = v44->vPosition.y; | |
8737 v60 = v59; | |
8738 v61 = (double)(signed int)v75; | |
8739 v75 = v44->vPosition.x; | |
8740 v62 = v61; | |
8741 v63 = (double)(signed int)v75; | |
8742 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8743 } | |
8744 } | |
8745 } | |
8746 Actor::Die(uActorID); | |
8747 Actor::ApplyFineForKillingPeasant(uActorID); | |
8748 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8749 if ( v44->pMonsterInfo.uExp ) | |
8750 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8751 v64 = SPEECH_51; | |
8752 if ( rand() % 100 < 20 ) | |
8753 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8754 v45->PlaySound((PlayerSpeech)v64, 0); | |
8755 } | |
8756 } | |
8757 } | |
8758 } | |
8759 } | |
8760 } | |
8761 } | |
8762 if ( !v74 | |
8763 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8764 && v44->pMonsterInfo.uSpecialAttack | |
8765 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8766 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8767 if ( !pParty->bTurnBasedModeOn ) | |
8768 { | |
8769 v65 = v45->GetActualEndurance(); | |
8770 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8771 * flt_6BE3A4_debug_recmod1 | |
8772 * 2.133333333333333; | |
8773 v45->SetRecoveryTime((signed __int64)v66); | |
8774 } | |
8775 return; | |
8776 } | |
8777 v53 = v44->pMonsterInfo.uSpell2ID; | |
8778 } | |
8779 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8780 goto LABEL_133; | |
8781 } | |
8782 if ( v42 != 1 ) | |
8783 return; | |
8784 LABEL_80: | |
8785 if ( a4 != -1 ) | |
8786 { | |
8787 v43 = &pParty->pPlayers[a4]; | |
8788 LABEL_168: | |
8789 a4b = v43; | |
8790 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8791 { | |
8792 v70 = v43->GetMaxHealth(); | |
8793 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8794 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8795 } | |
8796 else | |
8797 { | |
8798 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8799 v69 = 0; | |
8800 } | |
8801 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8802 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8803 { | |
8804 qword_A750D8 = 256i64; | |
1406 | 8805 PlayerSpeechID = SPEECH_44; |
1407 | 8806 uSpeakingCharacter = uActorID + 1; |
1297 | 8807 } |
8808 return; | |
8809 } | |
8810 v74 = 0; | |
8811 a4a = 1; | |
8812 do | |
8813 { | |
8814 if ( pPlayers[a4a]->CanAct() ) | |
8815 { | |
8816 v67 = v74++; | |
8817 *(&v72 + v67) = a4a; | |
8818 } | |
8819 ++a4a; | |
8820 } | |
8821 while ( a4a <= 4 ); | |
8822 if ( v74 ) | |
8823 { | |
8824 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8825 goto LABEL_168; | |
8826 } | |
8827 } | |
8828 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8829 void OnInventoryLeftClick() |
1297 | 8830 { |
8831 Player *v0; // ebx@1 | |
8832 signed int v1; // eax@2 | |
8833 signed int v2; // ecx@2 | |
8834 int v3; // eax@2 | |
8835 char v4; // sf@2 | |
8836 int v5; // eax@2 | |
8837 unsigned int v6; // eax@7 | |
8838 unsigned int v7; // esi@12 | |
8839 unsigned int v8; // eax@12 | |
8840 unsigned int v9; // eax@16 | |
8841 unsigned int v10; // eax@18 | |
8842 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8843 POINT a2; // [sp+30h] [bp-18h]@4 | |
8844 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8845 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8846 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8847 int a4; // [sp+44h] [bp-4h]@2 | |
8848 | |
8849 v0 = pPlayers[uActiveCharacter]; | |
8850 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8851 { | |
8852 pMouse->GetClickPos(&pX, &pY); | |
8853 pY = pY - 17; | |
8854 v2 =pX - 14; | |
8855 pX = v2; | |
8856 v3 = 14 * (pY >> 5); | |
8857 v2 >>= 5; | |
8858 v4 = v2 + v3 < 0; | |
8859 v5 = v2 + v3; | |
8860 a4 = v5; | |
8861 if ( !v4 ) | |
8862 { | |
8863 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8864 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8865 { | |
8866 if ( unk_50C9A0 ) | |
8867 { | |
8868 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8869 if ( v6 ) | |
8870 { | |
8871 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8872 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8873 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8874 *((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
|
8875 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8876 unk_50C9A0 = 0; |
8877 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8878 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8879 pMouse->SetCursorBitmap("MICON1"); | |
8880 dword_50C9D0 = 113; | |
8881 dword_50C9D4 = 0; | |
8882 dword_50C9D8 = 256; | |
8883 } | |
8884 return; | |
8885 } | |
8886 if ( ptr_50C9A4 ) | |
8887 return; | |
8888 v7 = pParty->pPickedItem.uItemID; | |
8889 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8890 if ( !v7 ) | |
8891 { | |
8892 if ( !v8 ) | |
8893 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8894 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8895 v0->RemoveItemAtInventoryIndex(a4); |
8896 v9 = pParty->pPickedItem.uItemID; | |
8897 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8898 return; | |
8899 } | |
8900 v13 = v8; | |
8901 if ( v8 ) | |
8902 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8903 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8904 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8905 v0->RemoveItemAtInventoryIndex(a4); | |
8906 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8907 if ( !pX ) | |
8908 { | |
8909 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8910 if ( !pX ) | |
8911 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8912 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8913 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8914 return; | |
8915 } | |
8916 } | |
8917 v9 = this_.uItemID; | |
8918 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8919 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8920 return; | |
8921 } | |
8922 v10 = v0->AddItem(a4, v7); | |
8923 pX = v10; | |
8924 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8925 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8926 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8927 pMouse->RemoveHoldingItem(); |
8928 } | |
8929 } | |
8930 } | |
8931 } | |
1361
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8935 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8936 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8937 return pConditions[Condition_Weak] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8940 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8941 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8942 return pConditions[Condition_Dead] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8945 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8946 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8947 return pConditions[Condition_Eradicated] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8950 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8951 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8952 return pConditions[Condition_Zombie] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8955 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8956 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8957 return pConditions[Condition_Cursed] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8960 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8961 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8962 return pConditions[Condition_Pertified] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8965 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8966 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8967 return pConditions[Condition_Unconcious] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8970 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8971 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8972 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8973 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8974 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8975 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8976 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8977 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8978 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8979 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8980 void Player::SetCursed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8981 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8982 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8983 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8984 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8985 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8986 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8987 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8988 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8989 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8990 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8991 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8992 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8993 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8994 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8995 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8996 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8997 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8998 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8999 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9000 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9001 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9002 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9003 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9004 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9005 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9006 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9007 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9008 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9009 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9010 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9011 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9012 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9013 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9014 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9015 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9016 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9017 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9018 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9019 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9020 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9021 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9022 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9023 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9024 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9025 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9026 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9027 pConditions[Condition_Disease2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9028 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9029 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9030 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9031 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9032 pConditions[Condition_Poison3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9033 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9034 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9035 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9036 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9037 pConditions[Condition_Disease3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9038 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9039 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9040 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9041 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9042 pConditions[Condition_Paralyzed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9043 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9044 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9045 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9046 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9047 pConditions[Condition_Unconcious] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9048 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9049 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9050 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9051 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9052 pConditions[Condition_Dead] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9053 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9054 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9055 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9056 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9057 pConditions[Condition_Pertified] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9058 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9059 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9060 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9061 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9062 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9063 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9064 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9065 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9066 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9067 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9068 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9069 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9070 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9071 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9072 SetCondition(Condition_Weak, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9073 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9074 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9075 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9076 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9077 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9078 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9079 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9080 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9081 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9082 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9083 } |