Mercurial > mm7
annotate Player.cpp @ 1593:5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
author | Grumpy7 |
---|---|
date | Sun, 08 Sep 2013 08:01:05 +0200 |
parents | addae48bc203 |
children | c0238b60d0f2 |
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); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
245 if ( pOwnItems[item_index].IsBroken() ) |
1014 | 246 sell_price = 1; |
247 if ( sell_price < 1 ) | |
248 sell_price = 1; | |
249 RemoveItemAtInventoryIndex(inventory_idnx); | |
250 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 251 } |
252 | |
253 | |
254 | |
255 //----- (0043EEF3) -------------------------------------------------------- | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
256 bool Player::NothingOrJustBlastersEquipped() |
0 | 257 { |
1014 | 258 signed int item_idx; // esi@1 |
259 signed int item_id; // esi@1 | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
260 for (int i = 0; i < 16; ++i) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
261 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
262 item_idx = pEquipment.pIndices[i]; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
263 if (item_idx) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
264 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
265 item_id = pOwnItems[item_idx - 1].uItemID; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
266 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
267 return false; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
268 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
269 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
270 return true; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
271 } |
1014 | 272 |
0 | 273 |
274 | |
275 | |
276 //----- (004B8040) -------------------------------------------------------- | |
1036 | 277 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
278 { | |
279 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 280 } |
281 | |
282 //----- (004B807C) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
283 int Player::GetTempleHealCostModifier(float a2) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
284 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
285 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 int conditionTimeMultiplier; // esi@1 |
0 | 287 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 290 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 conditionIdx = GetMajorConditionIdx(); |
1275 | 292 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
293 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
295 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
296 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
297 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
298 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
299 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
300 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 } |
1350 | 304 else |
305 { | |
1275 | 306 conditionTimeMultiplier = 1; |
307 baseConditionMultiplier = 1; | |
1350 | 308 if (conditionIdx < 14) |
309 { | |
310 for (int i = 0; i <= 13; i++) | |
311 { | |
312 v6 = GetConditionDayOfWeek(i); | |
313 if ( v6 > conditionTimeMultiplier ) | |
314 conditionTimeMultiplier = v6; | |
315 } | |
316 } | |
1275 | 317 } |
318 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
319 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
320 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
321 return result; |
0 | 322 } |
323 | |
324 //----- (004B8102) -------------------------------------------------------- | |
917 | 325 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 326 { |
327 signed int v3; // esi@1 | |
328 signed int result; // eax@3 | |
329 | |
1275 | 330 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 331 if ( v3 > uRealValue ) |
332 v3 = uRealValue; | |
0 | 333 result = 1; |
334 if ( v3 >= 1 ) | |
335 result = v3; | |
336 return result; | |
337 } | |
338 | |
339 //----- (004B8142) -------------------------------------------------------- | |
749 | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
341 { | |
1275 | 342 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 343 |
344 if (price < uRealValue) | |
345 price = uRealValue; | |
346 return price; | |
0 | 347 } |
348 | |
349 //----- (004B8179) -------------------------------------------------------- | |
916 | 350 int Player::GetPriceIdentification(float a2) |
0 | 351 { |
352 signed int v2; // esi@1 | |
353 int v3; // ecx@1 | |
354 signed int result; // eax@3 | |
355 | |
1275 | 356 v2 = (signed int)(a2 * 50.0); |
0 | 357 v3 = v2 * (100 - GetMerchant()) / 100; |
358 if ( v3 < v2 / 3 ) | |
359 v3 = v2 / 3; | |
360 result = 1; | |
361 if ( v3 >= 1 ) | |
362 result = v3; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B81C3) -------------------------------------------------------- | |
916 | 367 int Player::GetPriceRepair(int a2, float a3) |
0 | 368 { |
369 signed int v3; // esi@1 | |
370 int v4; // ecx@1 | |
371 signed int result; // eax@3 | |
372 | |
1275 | 373 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 374 v4 = v3 * (100 - GetMerchant()) / 100; |
375 if ( v4 < v3 / 3 ) | |
376 v4 = v3 / 3; | |
377 result = 1; | |
378 if ( v4 >= 1 ) | |
379 result = v4; | |
380 return result; | |
381 } | |
382 | |
383 //----- (004B8213) -------------------------------------------------------- | |
1275 | 384 int Player::GetBaseSellingPrice(int a2, float a3) |
385 { | |
386 signed int v3; // qax@1 | |
387 | |
388 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
389 if ( v3 < 1 ) | |
390 v3 = 1; | |
0 | 391 return v3; |
392 } | |
393 | |
394 //----- (004B8233) -------------------------------------------------------- | |
1275 | 395 int Player::GetBaseBuyingPrice(int a2, float a3) |
396 { | |
397 signed int v3; // qax@1 | |
398 | |
399 v3 = (signed int)((double)a2 * a3); | |
400 if ( v3 < 1 ) | |
401 v3 = 1; | |
0 | 402 return v3; |
403 } | |
404 | |
405 //----- (004B824B) -------------------------------------------------------- | |
1275 | 406 int Player::GetBaseIdentifyPrice(float a2) |
407 { | |
408 signed int v2; // qax@1 | |
409 | |
410 v2 = (signed int)(a2 * 50.0); | |
411 if ( v2 < 1 ) | |
412 v2 = 1; | |
0 | 413 return v2; |
414 } | |
415 | |
416 //----- (004B8265) -------------------------------------------------------- | |
1275 | 417 int Player::GetBaseRepairPrice(int a2, float a3) |
418 { | |
419 signed int v3; // qax@1 | |
420 | |
421 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
422 if ( v3 < 1 ) | |
423 v3 = 1; | |
0 | 424 return v3; |
425 } | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 432 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
433 { |
0 | 434 signed int v2; // eax@1 |
336 | 435 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 436 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
437 { | |
438 return false; | |
439 } | |
440 else | |
441 { | |
442 if (GetMajorConditionIdx() == Condition_Zombie) | |
443 { | |
444 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
445 { | |
446 return false; | |
447 } | |
448 else | |
449 { | |
450 return true; | |
451 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
452 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
453 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
454 { |
1348 | 455 return true; |
456 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
457 } |
0 | 458 } |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
1351 | 468 |
1012 | 469 item_idx = *pitem_index; |
470 if ( item_idx >125 || item_idx < 0 ) | |
471 { | |
472 return 0; | |
473 } | |
474 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
475 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 476 if ( inv_index < 0 ) |
477 { | |
478 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
479 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 480 } |
481 | |
482 return inv_index; | |
0 | 483 } |
484 | |
485 | |
486 | |
487 //----- (004160CA) -------------------------------------------------------- | |
1012 | 488 void Player::ItemsEnchant( int enchant_count ) |
489 { | |
490 int avalible_items; // ebx@1 | |
491 int i; // edx@8 | |
492 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
493 | |
494 avalible_items = 0; | |
495 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
496 | |
1349 | 497 for (i = 0; i < 138; ++i) |
498 { | |
499 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
500 item_index_tabl[avalible_items++] = i; | |
501 } | |
1012 | 502 |
503 if ( avalible_items ) | |
504 { | |
505 if ( enchant_count ) | |
506 { | |
1349 | 507 for ( i = 0; i < enchant_count; ++i ) |
508 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
509 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
510 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 511 } |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
517 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 518 } |
519 } | |
520 } | |
0 | 521 } |
522 | |
523 //----- (004948B1) -------------------------------------------------------- | |
187 | 524 void Player::PlaySound(PlayerSpeech speech, int a3) |
525 { | |
1351 | 526 signed int speechCount = 0; // esi@4 |
527 signed int expressionCount = 0; // esi@4 | |
528 int pickedVariant; // esi@10 | |
248 | 529 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 530 signed int pSoundID; // ecx@19 |
1351 | 531 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
532 int expressionVariantArray[5]; | |
533 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
534 unsigned int expressionDuration = 0; | |
187 | 535 |
1351 | 536 pickedSoundID = 0; |
203 | 537 if (uVoicesVolumeMultiplier) |
0 | 538 { |
1351 | 539 for (int i = 0; i < 2; i++) |
540 { | |
1406 | 541 if ( SoundSetAction[speech][i] ) |
542 { | |
543 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 544 speechCount++; |
545 } | |
546 } | |
547 if ( speechCount ) | |
548 { | |
549 pickedVariant = speechVariantArray[rand() % speechCount]; | |
550 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
551 if (numberOfSubvariants > 0) | |
552 { | |
553 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 554 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 555 } |
556 } | |
557 } | |
558 | |
559 for (int i = 0; i < 5; i++) | |
560 { | |
1406 | 561 if ( SoundSetAction[speech][i + 3] ) |
562 { | |
563 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 564 expressionCount++; |
565 } | |
566 } | |
567 if ( expressionCount ) | |
568 { | |
569 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
570 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
571 { | |
1406 | 572 pSoundID = 0; |
573 if ( pSoundList->sNumSounds ) | |
574 { | |
1351 | 575 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 576 { |
1406 | 577 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
578 pSoundID = i; | |
0 | 579 } |
580 } | |
1406 | 581 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 582 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
583 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
584 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
585 } |
0 | 586 } |
587 // 4948B1: using guessed type int var_1C[5]; | |
588 | |
589 //----- (00494A25) -------------------------------------------------------- | |
187 | 590 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
591 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
592 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
593 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
594 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
595 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
598 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
599 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
600 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
601 else |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
602 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
604 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
605 if (v3 >= 2 && v3 <= 11 && v3 != 8 && !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR)) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
606 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
607 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
608 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
609 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
610 } |
0 | 611 this->uExpressionTimePassed = 0; |
612 if ( !a3 ) | |
613 { | |
187 | 614 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
615 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
616 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
617 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
618 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
619 } |
187 | 620 expression = new_expression; |
0 | 621 viewparams->bRedrawGameUI = 1; |
622 } | |
623 | |
624 //----- (0049327B) -------------------------------------------------------- | |
1355 | 625 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 ) |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
626 { |
135 | 627 if ( this->classType == uClass ) |
0 | 628 { |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
629 return true; |
0 | 630 } |
631 else | |
632 { | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
633 if (!a3) |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
634 { |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
635 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
636 } |
0 | 637 switch ( uClass ) |
638 { | |
639 case 0x1Au: | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
640 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); |
0 | 641 case 0x1Bu: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
642 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); |
0 | 643 case 0x22u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
644 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
0 | 645 case 0x23u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
646 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
0 | 647 break; |
648 default: | |
1545 | 649 Error("Should not be able to get here (%u)", uClass); |
0 | 650 break; |
651 } | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
652 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
653 } |
0 | 654 } |
655 | |
656 | |
657 //----- (00492C0B) -------------------------------------------------------- | |
658 bool Player::CanAct() | |
659 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
660 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
661 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
662 this->IsPertified() || this->IsEradicated() ) |
1355 | 663 return false; |
0 | 664 else |
1355 | 665 return true; |
0 | 666 } |
667 | |
668 //----- (00492C40) -------------------------------------------------------- | |
669 bool Player::CanSteal() | |
670 { | |
1355 | 671 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 672 } |
673 | |
674 //----- (00492C4E) -------------------------------------------------------- | |
675 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
676 { | |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
677 switch (uItemID) |
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
678 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
679 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
680 case ITEM_RELIC_OLD_NICK: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
681 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
682 case ITEM_RELIC_TALEDONS_HELM: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
683 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
684 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
685 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
686 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
687 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
688 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
689 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
690 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break; |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
691 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
692 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
693 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
694 |
0 | 695 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
696 void Player::SetCondition( unsigned int uConditionIdx, int a3 ) |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
697 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
698 signed int player_sex; // ecx@77 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
699 signed int remainig_player; // ebx@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
700 int players_before; // [sp+10h] [bp-4h]@2 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
701 int players_after; // [sp+20h] [bp+Ch]@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
702 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
703 if ( pConditions[uConditionIdx] ) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
704 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
705 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
706 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
707 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
708 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
709 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
710 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
711 switch ( uConditionIdx ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
712 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
713 case Condition_Cursed: PlaySound(SPEECH_30, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
714 case Condition_Weak: PlaySound(SPEECH_25, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
715 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
716 case Condition_Fear: PlaySound(SPEECH_26, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 case Condition_Drunk: PlaySound(SPEECH_31, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
718 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 719 case Condition_Poison1: |
720 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
721 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 722 case Condition_Disease1: |
723 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
724 case Condition_Disease3: PlaySound(SPEECH_28, 0);break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 case Condition_Paralyzed: break; //nosound |
1014 | 726 case Condition_Unconcious: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
727 PlaySound(SPEECH_32, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
728 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
729 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
730 break; |
1014 | 731 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
732 PlaySound(SPEECH_33, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
733 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
734 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
735 if ( sMana > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
736 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
737 break; |
1014 | 738 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
739 PlaySound(SPEECH_34, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
740 break; |
1014 | 741 case Condition_Eradicated: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
742 PlaySound(SPEECH_35, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
743 if (sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
744 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
745 if ( sMana > 0 ) |
1014 | 746 sMana = 0; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
747 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
748 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
749 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
750 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
751 memset(&pConditions[0], 0, sizeof(pConditions)); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
752 sHealth = GetMaxHealth(); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
753 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
754 player_sex = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
755 uPrevFace = uCurrentFace; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
756 uPrevVoiceID = uVoiceID; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
757 if (IsMale()) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
758 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
759 uCurrentFace = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
760 uVoiceID = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
761 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
762 else |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
763 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
764 uCurrentFace = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
765 uVoiceID = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
766 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
767 PlaySound(SPEECH_99, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
768 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
769 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
770 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
771 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
772 for (int i = 1; i < 5; ++i) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
773 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
774 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 ++players_before; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
777 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
778 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
780 remainig_player = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
781 players_after = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
782 for (int i = 1; i < 5; ++i) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
783 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
784 if ( pPlayers[i]->CanAct() ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
785 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
786 remainig_player = i; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
787 ++players_after; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
788 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
789 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
790 if (( players_before == 2 ) && ( players_after == 1 )) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
791 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
792 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
793 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
794 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
795 } |
0 | 796 |
797 //----- (00492528) -------------------------------------------------------- | |
798 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
799 { | |
1363 | 800 Texture *texture; // esi@1 |
801 unsigned int slotWidth; // ebx@1 | |
802 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
803 | |
804 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
805 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
806 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 807 if ( !areWeLoadingTexture ) |
808 { | |
1363 | 809 texture->Release(); |
1006 | 810 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 811 } |
1555 | 812 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions"); |
1363 | 813 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
814 { | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
815 for (unsigned int x = 0; x < slotWidth; x++) |
1363 | 816 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
817 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 818 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
819 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
820 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
821 return false; |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
822 } |
1363 | 823 } |
824 } | |
825 return true; | |
826 } | |
827 return false; | |
0 | 828 } |
829 // 506128: using guessed type int areWeLoadingTexture; | |
830 | |
831 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
832 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
833 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
834 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
835 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
836 if (pInventoryItemList[i].uItemID == 0) |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
837 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
838 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
839 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
840 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
841 return -1; |
0 | 842 } |
843 | |
844 //----- (00492600) -------------------------------------------------------- | |
845 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
846 { | |
847 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
848 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
849 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
850 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 if ( freeSlot == -1 ) |
0 | 852 { |
853 if ( uActiveCharacter ) | |
201 | 854 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
855 return 0; |
0 | 856 } |
857 else | |
858 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
859 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
860 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
861 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 862 } |
863 return result; | |
864 } | |
865 // 506128: using guessed type int areWeLoadingTexture; | |
866 | |
867 //----- (00492700) -------------------------------------------------------- | |
868 int Player::HasSkill(unsigned int uSkillType) | |
869 { | |
1374 | 870 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
871 { | |
872 return 1; | |
0 | 873 } |
874 else | |
875 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
876 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
877 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 878 return 0; |
879 } | |
0 | 880 } |
881 | |
882 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
883 void Player::WearItem( unsigned int uItemID ) |
0 | 884 { |
1010 | 885 int item_body_anch; // edi@6 |
886 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
887 item_indx = FindFreeInventoryListSlot(); |
1010 | 888 |
889 if ( item_indx != -1 ) | |
890 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
891 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 892 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
893 pEquipment.pIndices[item_body_anch] = item_indx + 1; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
894 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 895 } |
896 } | |
897 | |
898 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
899 int Player::AddItem(int index, unsigned int uItemID) |
0 | 900 { |
1374 | 901 int xStartValue = 0; |
902 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
903 if ( index == -1 ) |
0 | 904 { |
1385 | 905 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
906 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
907 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
0 | 908 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
909 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
910 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
911 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID); |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
912 } |
0 | 913 } |
1385 | 914 } |
0 | 915 return 0; |
916 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
917 if ( !CanFitItem(index, uItemID) ) |
0 | 918 { |
919 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
920 return 0; | |
921 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
922 return CreateItemInInventory(index, uItemID); |
0 | 923 } |
924 | |
925 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
926 int Player::AddItem2(int index, ItemGen *Src) |
0 | 927 { |
928 pItemsTable->SetSpecialBonus(Src); | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
929 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
930 if ( index == -1 ) |
0 | 931 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
932 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
933 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
934 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
1385 | 935 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
936 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) ) |
0 | 937 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
938 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src); |
0 | 939 } |
1385 | 940 } |
0 | 941 } |
942 return 0; | |
943 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
944 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 945 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
946 return CreateItemInInventory2(index, Src); |
0 | 947 } |
948 | |
949 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
950 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 951 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
952 signed int freeSlot; // ebx@1 |
0 | 953 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
954 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
955 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
956 if ( freeSlot == -1 ) |
0 | 957 { |
958 result = 0; | |
959 } | |
960 else | |
961 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
962 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
963 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
964 result = freeSlot + 1; |
0 | 965 } |
966 return result; | |
967 } | |
968 // 506128: using guessed type int areWeLoadingTexture; | |
969 | |
970 //----- (0049298B) -------------------------------------------------------- | |
1385 | 971 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
972 { |
1014 | 973 Texture *item_texture; // esi@1 |
974 int *pInvPos; // esi@4 | |
975 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
976 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
977 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
978 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 979 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
980 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 981 if ( !areWeLoadingTexture ) |
982 { | |
1014 | 983 item_texture->Release(); |
1006 | 984 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 985 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
986 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
987 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
988 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
989 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
990 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
991 memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
992 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
993 } |
1014 | 994 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
995 pInventoryMatrix[index] = itemListPos + 1; |
0 | 996 } |
278 | 997 |
0 | 998 // 506128: using guessed type int areWeLoadingTexture; |
999 | |
1000 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1001 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1002 { |
1014 | 1003 ItemGen *item_in_slot; // ecx@1 |
1004 Texture *item_texture; // esi@1 | |
1005 unsigned int slot_height; // ebp@1 | |
1006 int *pInvPos; // edx@4 | |
1007 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1008 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1009 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1010 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1011 item_in_slot->Reset(); | |
1012 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1013 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1014 if ( !areWeLoadingTexture ) |
1015 { | |
1014 | 1016 item_texture->Release(); |
1006 | 1017 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1018 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1019 if ( slot_width > 0 ) |
1014 | 1020 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1021 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1022 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1023 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1024 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1025 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1026 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1027 } |
0 | 1028 } |
1029 // 506128: using guessed type int areWeLoadingTexture; | |
1030 | |
1031 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1032 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1033 { | |
1034 unsigned int idemId; // edx@1 | |
1035 signed int equipType; // esi@1 | |
1036 float multiplier; // ST04_4@26 | |
1037 int price; // edi@26 | |
1038 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1039 int itemValue; | |
1040 | |
1041 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1042 idemId = pItem->uItemID; | |
1043 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1044 itemValue = pItem->GetValue(); | |
1045 | |
1046 switch (building_type) | |
1047 { | |
1411 | 1048 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1049 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1050 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1051 if (equipType > EQUIP_BOW) |
1386 | 1052 return 4; |
1053 break; | |
1411 | 1054 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1055 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1056 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1057 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1058 return 4; |
1059 break; | |
1411 | 1060 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1061 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1062 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1063 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1064 return 4; |
1065 break; | |
1411 | 1066 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1067 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1068 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1069 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1070 return 4; |
1071 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1072 default: |
1545 | 1073 Error("(%u)", building_type); |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1074 break; |
1386 | 1075 } |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1076 if (pItem->IsStolen()) |
1386 | 1077 return 6; |
1078 | |
1079 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1080 switch (ShopMenuType) | |
1081 { | |
1082 case 2: | |
1083 price = GetBuyingPrice(itemValue, multiplier); | |
1084 break; | |
1085 case 3: | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1086 if (pItem->IsBroken()) |
1386 | 1087 price = 1; |
917 | 1088 else |
1386 | 1089 price = this->GetPriceSell(itemValue, multiplier); |
1090 break; | |
1091 case 4: | |
1092 price = this->GetPriceIdentification(multiplier); | |
1093 break; | |
1094 case 5: | |
1095 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1096 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1097 default: |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1098 Error("(%u)", ShopMenuType); |
1386 | 1099 break; |
1100 } | |
1101 if ( merchantLevel ) | |
1102 { | |
1103 if (price == itemValue) | |
1104 { | |
1105 return 3; | |
1106 } | |
917 | 1107 else |
1386 | 1108 { |
1109 return 2; | |
1110 } | |
1111 } | |
0 | 1112 else |
1386 | 1113 { |
1114 return 1; | |
1115 } | |
0 | 1116 } |
1117 | |
1118 //----- (0049107D) -------------------------------------------------------- | |
1119 int Player::GetBodybuilding() | |
1120 { | |
1010 | 1121 int v1; // al@1 |
0 | 1122 |
1123 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1124 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1125 return multiplier * (v1 & 0x3F); |
0 | 1126 } |
1127 | |
1128 //----- (004910A8) -------------------------------------------------------- | |
607 | 1129 int Player::GetMeditation() |
0 | 1130 { |
1010 | 1131 int v1; // al@1 |
0 | 1132 |
1133 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1134 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1135 return multiplier * (v1 & 0x3F); |
0 | 1136 } |
1137 | |
1138 //----- (004910D3) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1139 bool Player::CanIdentify( ItemGen *pItem ) |
0 | 1140 { |
1141 unsigned __int16 v2; // ax@1 | |
1142 int v5; // edi@7 | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
1143 |
652 | 1144 if (CheckHiredNPCSpeciality(Scholar)) |
1145 return true; | |
0 | 1146 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1147 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1148 if ( (signed int)SkillToMastery(v2) >= 4 ) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1149 return true; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1150 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1151 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1152 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1153 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St; |
0 | 1154 } |
1155 | |
1156 //----- (00491151) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1157 bool Player::CanRepair( ItemGen *pItem ) |
0 | 1158 { |
1159 unsigned __int16 v2; // ax@1 | |
1160 int v5; // edi@7 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1161 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1162 ItemDesc* v7 = &pItemsTable->pItems[pItem->uItemID]; |
652 | 1163 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || |
1164 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1165 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1166 return true; | |
1167 | |
1010 | 1168 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1169 if ( (signed int)SkillToMastery(v2) >= 4 ) |
0 | 1170 return true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1171 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1172 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1173 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1174 return v5 >= v7->uItemID_Rep_St; |
0 | 1175 } |
1176 | |
1177 //----- (004911F3) -------------------------------------------------------- | |
1178 int Player::GetMerchant() | |
1179 { | |
1180 unsigned __int16 v2; // ax@1 | |
1181 int v5; // edi@1 | |
1182 int v7; // eax@3 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1183 |
607 | 1184 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1185 if ( SkillToMastery(v2) >= 4 ) |
0 | 1186 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1187 |
0 | 1188 v7 = GetPartyReputation(); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1189 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1190 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1191 if (v5 == 0) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1192 { |
0 | 1193 return -v7; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1194 } |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1195 return v5 - v7 + 7; |
0 | 1196 } |
1197 | |
1198 //----- (0049125A) -------------------------------------------------------- | |
1199 int Player::GetPerception() | |
1200 { | |
1201 unsigned __int16 v2; // ax@1 | |
1202 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1203 |
1010 | 1204 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1205 if ( SkillToMastery(v2) >= 4 ) |
0 | 1206 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1207 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1208 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1209 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1210 return v5; |
0 | 1211 } |
1212 | |
1213 //----- (004912B0) -------------------------------------------------------- | |
1214 int Player::GetDisarmTrap() | |
1215 { | |
1216 unsigned __int16 v2; // ax@1 | |
1217 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1218 |
1010 | 1219 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 1220 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1221 return 10000; | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1222 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1223 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1224 if ( HasEnchantedItemEquipped(35) ) //only the real skill level is supposed to be added again, not the multiplied value |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1225 multiplier++; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1226 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1227 return v5; |
0 | 1228 } |
1229 | |
1230 //----- (00491317) -------------------------------------------------------- | |
1231 char Player::GetLearningPercent() | |
1232 { | |
1233 int v2; // eax@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1234 |
1010 | 1235 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1236 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1237 return multiplier * v2 + 9; |
0 | 1238 } |
1239 | |
1240 //----- (0048C6AF) -------------------------------------------------------- | |
1241 Player::Player() | |
1242 { | |
1243 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1244 memset(pInventoryMatrix, 0, 126 * sizeof(int)); |
0 | 1245 for (uint i = 0; i < 126; ++i) |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1246 pInventoryItemList[i].Reset(); |
0 | 1247 for (uint i = 0; i < 12; ++i) |
1248 pEquippedItems[i].Reset(); | |
1249 | |
1250 | |
1251 for (uint i = 0; i < 24; ++i) | |
1252 { | |
1253 pPlayerBuffs[i].uSkill = 0; | |
1254 pPlayerBuffs[i].uSkill = 0; | |
1255 pPlayerBuffs[i].uPower = 0; | |
1256 pPlayerBuffs[i].uExpireTime = 0; | |
1257 pPlayerBuffs[i].uCaster = 0; | |
1258 pPlayerBuffs[i].uFlags = 0; | |
1259 } | |
1260 | |
1261 pName[0] = 0; | |
1014 | 1262 uCurrentFace = 0; |
0 | 1263 uVoiceID = 0; |
1264 memset(pConditions, 0, 20 * sizeof(__int64)); | |
1265 | |
1266 field_BB = 0; | |
1267 | |
1268 uMight = uMightBonus = 0; | |
1269 uIntelligence = uIntelligenceBonus = 0; | |
1270 uWillpower = uWillpowerBonus = 0; | |
1271 uEndurance = uEnduranceBonus = 0; | |
1272 uSpeed = uSpeedBonus = 0; | |
1273 uAccuracy = uAccuracyBonus = 0; | |
1274 uLuck = uLuckBonus = 0; | |
1275 uLevel = sLevelModifier = 0; | |
1276 sAgeModifier = 0; | |
1388
60d4885eb107
sACModifier zeroed in player constructor so AC is not always 0(or -some value) ingame
Grumpy7
parents:
1387
diff
changeset
|
1277 sACModifier = 0; |
0 | 1278 |
1019 | 1279 // memset(field_1F5, 0, 30); |
1280 pure_luck_used=0; | |
1281 pure_speed_used=0; | |
1282 pure_intellect_used=0; | |
1283 pure_endurance_used=0; | |
1284 pure_willpower_used=0; | |
1285 pure_accuracy_used=0; | |
1286 pure_might_used=0; | |
0 | 1287 |
1288 sResFireBase = sResFireBonus = 0; | |
1289 sResAirBase = sResAirBonus = 0; | |
1290 sResWaterBase = sResWaterBonus = 0; | |
1291 sResEarthBase = sResEarthBonus = 0; | |
1292 sResMagicBase = sResMagicBonus = 0; | |
1293 sResSpiritBase = sResSpiritBonus = 0; | |
1294 sResMindBase = sResMindBonus = 0; | |
1295 sResBodyBase = sResBodyBonus = 0; | |
1296 sResLightBase = sResLightBonus = 0; | |
1297 sResDarkBase = sResDarkBonus = 0; | |
1298 | |
1299 uTimeToRecovery = 0; | |
1300 | |
1301 uSkillPoints = 0; | |
1302 | |
1303 sHealth = 0; | |
1304 uFullHealthBonus = 0; | |
1305 _health_related = 0; | |
1306 | |
1307 sMana = 0; | |
1308 uFullManaBonus = 0; | |
1309 _mana_related = 0; | |
1310 | |
1311 uQuickSpell = 0; | |
1312 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
1313 | |
1314 _some_attack_bonus = 0; | |
1315 field_1A91 = 0; | |
1316 _melee_dmg_bonus = 0; | |
1317 field_1A93 = 0; | |
1318 _ranged_atk_bonus = 0; | |
1319 field_1A95 = 0; | |
1320 _ranged_dmg_bonus = 0; | |
1321 field_1A97 = 0; | |
1322 | |
130 | 1323 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 1324 uExpressionTimePassed = 0; |
1325 uExpressionTimeLength = 0; | |
1326 | |
1327 uNumDivineInterventionCastsThisDay = 0; | |
1328 uNumArmageddonCasts = 0; | |
1329 uNumFireSpikeCasts = 0; | |
1330 | |
1331 memset(field_1988, 0, 49 * sizeof(int)); | |
1332 memset(field_1A50, 0, 64 * sizeof(char)); | |
1333 | |
1334 field_E0 = 0; | |
1335 field_E4 = 0; | |
1336 field_E8 = 0; | |
1337 field_EC = 0; | |
1338 field_F0 = 0; | |
1339 field_F4 = 0; | |
1340 field_F8 = 0; | |
1341 field_FC = 0; | |
1342 field_100 = 0; | |
1343 field_104 = 0; | |
198 | 1344 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1345 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1346 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1347 |
198 | 1348 lastOpenedSpellbookPage = 0; |
0 | 1349 } |
1350 | |
1351 //----- (0048C6F6) -------------------------------------------------------- | |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1352 bool Party::AddItemToParty(ItemGen *pItem) //TODO move to party.cpp |
0 | 1353 { |
1354 unsigned int v2; // eax@1 | |
1355 char *v5; // eax@8 | |
1356 Texture *v7; // ebx@10 | |
1357 signed int v8; // esi@10 | |
1358 Player *v9; // edi@11 | |
1359 int v10; // eax@11 | |
1360 int v21; // [sp+24h] [bp-4h]@10 | |
1361 | |
1362 v2 = pItem->uItemID; | |
222 | 1363 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1364 pItem->SetIdentified(); |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1365 |
0 | 1366 v5 = pItemsTable->pItems[v2].pIconName; |
1367 if ( v5 ) | |
1368 { | |
973 | 1369 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1370 v21 = areWeLoadingTexture; |
1371 v8 = 0; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1372 int startId = uActiveCharacter >= 0 ? uActiveCharacter - 1 : 0; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1373 for (int i = 0; i < 4; i++) |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1374 { |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1375 v9 = &pPlayers[(startId + i) % 4]; //start with current active player, then cycle right if item won't fit |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1376 v10 = v9->AddItem(-1, pItem->uItemID); |
0 | 1377 if ( v10 ) |
1378 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1379 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1380 pItem->Reset(); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1381 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1382 v9->PlaySound(SPEECH_60, 0); |
0 | 1383 if ( !v21 ) |
1384 { | |
1385 v7->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1388 return true; |
0 | 1389 } |
1390 } | |
1391 if ( !v21 ) | |
1392 { | |
1393 v7->Release(); | |
1006 | 1394 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1395 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1396 return false; |
0 | 1397 } |
1398 else | |
1399 { | |
1400 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1401 return false; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1402 } |
0 | 1403 } |
1404 // 506128: using guessed type int areWeLoadingTexture; | |
1405 | |
1406 //----- (0048C855) -------------------------------------------------------- | |
1407 int Player::GetBaseStrength() | |
1408 { | |
1409 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1410 } | |
1411 | |
1412 //----- (0048C86C) -------------------------------------------------------- | |
1413 int Player::GetBaseIntelligence() | |
1414 { | |
1415 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1416 } | |
1417 | |
1418 //----- (0048C883) -------------------------------------------------------- | |
1419 int Player::GetBaseWillpower() | |
1420 { | |
1421 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1422 } | |
1423 | |
1424 //----- (0048C89A) -------------------------------------------------------- | |
1425 int Player::GetBaseEndurance() | |
1426 { | |
1427 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1428 } | |
1429 | |
1430 //----- (0048C8B1) -------------------------------------------------------- | |
1431 int Player::GetBaseAccuracy() | |
1432 { | |
1433 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1434 } | |
1435 | |
1436 //----- (0048C8C8) -------------------------------------------------------- | |
1437 int Player::GetBaseSpeed() | |
1438 { | |
1439 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1440 } | |
1441 | |
1442 //----- (0048C8DF) -------------------------------------------------------- | |
1443 int Player::GetBaseLuck() | |
1444 { | |
1445 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1446 } | |
1447 | |
1448 //----- (0048C8F6) -------------------------------------------------------- | |
1449 int Player::GetBaseLevel() | |
1450 { | |
1451 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1452 } | |
1453 | |
1454 //----- (0048C90D) -------------------------------------------------------- | |
1455 int Player::GetActualLevel() | |
1456 { | |
1457 return uLevel + sLevelModifier + | |
1458 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1459 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1460 } | |
1461 | |
1462 //----- (0048C93C) -------------------------------------------------------- | |
1463 int Player::GetActualMight() | |
1464 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1465 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus); |
0 | 1466 } |
1467 | |
1468 //----- (0048C9C2) -------------------------------------------------------- | |
1469 int Player::GetActualIntelligence() | |
1470 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1471 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus); |
0 | 1472 } |
1473 | |
1474 //----- (0048CA3F) -------------------------------------------------------- | |
1475 int Player::GetActualWillpower() | |
1476 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1477 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus); |
0 | 1478 } |
1479 | |
1480 //----- (0048CABC) -------------------------------------------------------- | |
1481 int Player::GetActualEndurance() | |
1482 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1483 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus); |
0 | 1484 } |
1485 | |
1486 //----- (0048CB39) -------------------------------------------------------- | |
1487 int Player::GetActualAccuracy() | |
1488 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1489 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus); |
0 | 1490 } |
1491 | |
1492 //----- (0048CBB6) -------------------------------------------------------- | |
1493 int Player::GetActualSpeed() | |
1494 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1495 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus); |
0 | 1496 } |
1497 | |
1498 //----- (0048CC33) -------------------------------------------------------- | |
1499 int Player::GetActualLuck() | |
1500 { | |
1036 | 1501 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1502 | |
1503 npc_luck_bonus = 0; | |
652 | 1504 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1505 npc_luck_bonus = 5; |
652 | 1506 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1507 npc_luck_bonus += 20; |
652 | 1508 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1509 npc_luck_bonus += 10; |
1324 | 1510 |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1511 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus) |
1325 | 1512 + npc_luck_bonus; |
1513 } | |
1514 | |
1515 //----- (new function) -------------------------------------------------------- | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1516 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::* attrValue, unsigned short Player::* attrBonus ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1517 { |
1324 | 1518 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1519 uint uAgeingMultiplier = 100; | |
1520 for (uint i = 0; i < 4; ++i) | |
1325 | 1521 { |
1324 | 1522 if (uActualAge >= pAgeingTable[i]) |
1325 | 1523 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1524 else | |
1525 break; | |
1526 } | |
1527 | |
1528 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1529 int magicBonus = GetMagicalBonus(attrId); | |
1530 int itemBonus = GetItemsBonus(attrId, 0); | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1531 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 |
1325 | 1532 + magicBonus |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1533 + itemBonus |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1534 + this->*attrBonus; |
0 | 1535 } |
1536 | |
1537 //----- (0048CCF5) -------------------------------------------------------- | |
1538 int Player::GetActualAttack(int a2) | |
1539 { | |
1540 int v3; // eax@1 | |
1541 int v4; // edi@1 | |
1542 int v5; // ebx@1 | |
1543 int v6; // ebp@1 | |
1544 | |
1545 v3 = GetActualAccuracy(); | |
1036 | 1546 v4 = GetParameterBonus(v3); |
0 | 1547 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1548 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1549 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + this->_some_attack_bonus; |
0 | 1550 } |
1551 | |
1552 //----- (0048CD45) -------------------------------------------------------- | |
1553 int Player::GetMeleeDamageMinimal() | |
1554 { | |
1555 int v2; // eax@1 | |
1556 int v3; // esi@1 | |
1557 int v4; // esi@1 | |
1558 int v5; // esi@1 | |
1559 signed int result; // eax@1 | |
1036 | 1560 |
0 | 1561 v2 = GetActualMight(); |
1036 | 1562 v3 = GetParameterBonus(v2); |
0 | 1563 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1564 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1565 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1566 if ( result < 1 ) | |
1567 result = 1; | |
0 | 1568 return result; |
1569 } | |
1570 | |
1571 //----- (0048CD90) -------------------------------------------------------- | |
1572 int Player::GetMeleeDamageMaximal() | |
1573 { | |
1574 int v2; // eax@1 | |
1575 int v3; // esi@1 | |
1576 int v4; // esi@1 | |
1577 int v5; // esi@1 | |
1578 int v6; // esi@1 | |
1579 signed int result; // eax@1 | |
1580 | |
1581 v2 = GetActualMight(); | |
1036 | 1582 v3 = GetParameterBonus(v2); |
0 | 1583 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1584 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1585 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
0 | 1586 result = 1; |
1587 if ( v6 >= 1 ) | |
1588 result = v6; | |
1589 return result; | |
1590 } | |
1591 | |
1592 //----- (0048CDDB) -------------------------------------------------------- | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1593 int Player::CalculateMeleeDamageTo( bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1594 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1595 int dmgSum; // esi@62 |
0 | 1596 signed int result; // eax@64 |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1597 int mainWpnDmg; // [sp+18h] [bp-8h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1598 int offHndWpnDmg; // [sp+1Ch] [bp-4h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1599 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1600 offHndWpnDmg = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1601 mainWpnDmg = 0; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1602 if ( IsUnarmed() ) |
0 | 1603 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1604 mainWpnDmg = rand() % 3 + 1; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1605 } |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1606 else |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1607 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1608 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1609 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1610 ItemGen *mainHandItemGen = &this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1611 int itemId = mainHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1612 bool addOneDice = false; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1613 if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1614 addOneDice = true; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1615 mainWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(mainHandItemGen, uTargetActorID, addOneDice); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1616 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1617 if ( !ignoreOffhand ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1618 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1619 if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) |
0 | 1620 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1621 ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1622 int itemId = offHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1623 if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) |
0 | 1624 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1625 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); |
0 | 1626 } |
1627 } | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1628 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1629 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1630 dmgSum = mainWpnDmg + offHndWpnDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1631 if ( !ignoreSkillBonus ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1632 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1633 int might = GetActualMight(); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1634 int mightBonus = GetParameterBonus(might); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1635 int mightAndSkillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightBonus; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1636 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus; |
0 | 1637 } |
1638 result = 1; | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1639 if ( dmgSum >= 1 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1640 result = dmgSum; |
0 | 1641 return result; |
1642 } | |
1643 | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1644 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1645 int Player::CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1646 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1647 int itemId = weapon->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1648 int diceCount = pItemsTable->pItems[itemId].uDamageDice; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1649 if (addOneDice) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1650 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1651 diceCount++; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1652 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1653 int diceSides = pItemsTable->pItems[itemId].uDamageRoll; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1654 int diceResult = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1655 for (int i = 0; i < diceCount; i++) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1656 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1657 diceResult += rand() % diceSides + 1; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1658 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1659 int totalDmg = pItemsTable->pItems[itemId].uDamageMod + diceResult; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1660 if ( uTargetActorID > 0) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1661 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1662 int enchType = weapon->uSpecEnchantmentType; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1663 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1664 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1665 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1666 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1667 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1668 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1669 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1670 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1671 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1672 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1673 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1674 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1675 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 )) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1676 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1677 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1678 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1679 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1680 if ( (signed int)SkillToMastery(this->pActiveSkills[2]) >= 3 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1681 && pItemsTable->pItems[itemId].uSkillType == 2 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1682 && rand() % 100 < 10 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1683 totalDmg *= 3; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1684 return totalDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1685 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1686 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1687 |
0 | 1688 //----- (0048D0B9) -------------------------------------------------------- |
1689 int Player::GetRangedAttack() | |
1690 { | |
1691 int v2; // eax@1 | |
1692 int v3; // edi@3 | |
1693 int v4; // eax@4 | |
1694 int v5; // edi@4 | |
1695 int v6; // edi@4 | |
1696 int v7; // edi@4 | |
1697 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1698 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1699 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) |
0 | 1700 { |
1701 v4 = GetActualAccuracy(); | |
1036 | 1702 v5 = GetParameterBonus(v4); |
0 | 1703 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
1704 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1705 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; |
0 | 1706 } |
1707 else | |
1708 { | |
1709 v3 = GetActualAttack(1); | |
1710 } | |
1711 return v3; | |
1712 } | |
1713 | |
1714 //----- (0048D124) -------------------------------------------------------- | |
1715 int Player::GetRangedDamageMin() | |
1716 { | |
1717 int v2; // edi@1 | |
1718 int v3; // edi@1 | |
1719 int v4; // edi@1 | |
1720 int result; // eax@6 | |
1721 | |
1040 | 1722 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
1723 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1724 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1725 if ( v4 >= 1 ) |
1726 result = v4; | |
1727 else | |
1728 result = 0; | |
1729 return result; | |
1730 } | |
1731 | |
1732 //----- (0048D191) -------------------------------------------------------- | |
1733 int Player::GetRangedDamageMax() | |
1734 { | |
1735 int v2; // edi@1 | |
1736 int v3; // edi@1 | |
1737 int v4; // edi@1 | |
1738 int result; // eax@6 | |
1739 | |
1040 | 1740 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
1741 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1742 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1743 if ( v4 >= 1 ) |
1744 result = v4; | |
1745 else | |
1746 result = 0; | |
1747 return result; | |
1748 } | |
1749 | |
1750 //----- (0048D1FE) -------------------------------------------------------- | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1751 int Player::CalculateRangedDamageTo( int a2 ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1752 { |
0 | 1753 ItemGen *v4; // ebx@2 |
1754 unsigned int v5; // edi@2 | |
1755 int v9; // esi@5 | |
1756 int v10; // ebx@6 | |
1757 signed int v15; // [sp+8h] [bp-Ch]@2 | |
1758 int v17; // [sp+10h] [bp-4h]@1 | |
1759 | |
1760 v17 = 0; | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1761 if ( !HasItemEquipped(EQUIP_BOW) ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1762 return 0; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1763 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
0 | 1764 v5 = v4->uItemID; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1765 v15 = pItemsTable->pItems[v5].uDamageRoll; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1766 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1767 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1768 int v7 = rand() % v15; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1769 v17 += v7 + 1; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1770 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1771 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
0 | 1772 if ( a2 ) |
1773 { | |
377 | 1774 v10 = v4->uSpecEnchantmentType; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1775 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1776 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1777 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1778 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1779 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1780 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1781 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1782 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1783 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1784 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1785 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1786 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1787 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1788 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1789 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1790 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1791 } |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1792 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
0 | 1793 } |
1794 | |
1795 //----- (0048D2EA) -------------------------------------------------------- | |
1796 char *Player::GetMeleeDamageString() | |
1797 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1798 signed int itemid; // eax@1 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1799 int min_damage; // edi@3 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1800 int max_damage; // eax@3 |
0 | 1801 |
1802 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1803 | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1804 if (pEquipment.uMainHand >= 0) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1805 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1806 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1807 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1808 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1809 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1810 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1811 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1812 return player__getmeleedamagestring_static_buff; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1813 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1814 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1815 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1816 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1817 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1818 } |
0 | 1819 else |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1820 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1821 min_damage = GetMeleeDamageMinimal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1822 max_damage = GetMeleeDamageMaximal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1823 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1824 if ( min_damage == max_damage ) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1825 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1826 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1827 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1828 else |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1829 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1830 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1831 } |
1036 | 1832 return player__getmeleedamagestring_static_buff; |
0 | 1833 } |
1834 | |
1835 //----- (0048D396) -------------------------------------------------------- | |
1836 char *Player::GetRangedDamageString() | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1837 { |
1036 | 1838 signed int itemid; // eax@1 |
1839 int min_damage; // edi@3 | |
1840 int max_damage; // eax@3 | |
1841 | |
1842 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1843 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1844 if (pEquipment.uMainHand >= 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1845 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1846 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1847 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1848 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1849 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1850 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1851 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1852 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1853 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1854 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1855 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1856 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1857 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1858 } |
0 | 1859 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1860 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1861 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1862 max_damage = GetRangedDamageMax(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1863 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1864 if ( max_damage > 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1865 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1866 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1867 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1868 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1869 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1870 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1871 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1872 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1873 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1874 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1875 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1876 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1877 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1878 } |
1036 | 1879 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1880 } |
0 | 1881 |
1882 //----- (0048D45A) -------------------------------------------------------- | |
1883 bool Player::CanTrainToNextLevel() | |
1884 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1885 int lvl = this->uLevel + 1; |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1886 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); |
1564 | 1887 return this->uExperience >= neededExp; |
0 | 1888 } |
1889 | |
1890 //----- (0048D498) -------------------------------------------------------- | |
1891 unsigned int Player::GetExperienceDisplayColor() | |
1892 { | |
1893 if ( CanTrainToNextLevel() ) | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1894 return ui_character_bonus_text_color; |
0 | 1895 else |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1896 return ui_character_default_text_color; |
0 | 1897 } |
1898 | |
1899 //----- (0048D4B3) -------------------------------------------------------- | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1900 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg ) |
1561 | 1901 { |
1036 | 1902 int resist_value; // edi@8 |
1903 int player_luck; // eax@21 | |
1904 signed int res_rand_divider; // ebx@2 | |
1905 int armor_skill; // eax@29 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1906 |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1907 if ( classType == PLAYER_CLASS_LICH && (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND || dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY || dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT )) //TODO: determine if spirit resistance should be handled by body res. modifier |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1908 return 0; |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1909 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1910 resist_value = 0; |
1036 | 1911 switch(dmg_type) |
1912 { | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1913 case DMGT_FIRE: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1914 case DMGT_ELECTR: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1915 case DMGT_COLD: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); break; |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1916 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break; |
1036 | 1917 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1918 case DMGT_SPIRIT: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_SPIRIT);break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1919 case DMGT_MIND: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1920 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break; |
1036 | 1921 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1922 |
1036 | 1923 player_luck = GetActualLuck(); |
1924 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
1925 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1926 if ( GetParameterBonus(player_luck) + resist_value > 0 ) |
1036 | 1927 { |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1928 for (int i = 0; i < 4; i++) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1929 { |
1036 | 1930 if ( rand() % res_rand_divider >= 30 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1931 dmg >>= 1; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1932 else |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1933 break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1934 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1935 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1936 if (( dmg_type == DMGT_PHISYCAL ) && ( pEquipment.uArmor )) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1937 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1938 if (!pOwnItems[pEquipment.uArmor - 1].IsBroken()) |
0 | 1939 { |
1036 | 1940 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
1941 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 1942 { |
1036 | 1943 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1944 return dmg / 2; |
0 | 1945 } |
1036 | 1946 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 1947 { |
1036 | 1948 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1949 return dmg * 2 / 3; |
0 | 1950 } |
1951 } | |
1036 | 1952 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1953 return dmg; |
0 | 1954 } |
1955 | |
1956 //----- (0048D62C) -------------------------------------------------------- | |
816 | 1957 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
1958 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1959 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 1960 } |
1961 | |
1962 //----- (0048D651) -------------------------------------------------------- | |
816 | 1963 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
1964 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1965 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 1966 } |
1967 | |
1968 //----- (0048D676) -------------------------------------------------------- | |
1969 bool Player::IsUnarmed() | |
1970 { | |
1561 | 1971 return !HasItemEquipped(EQUIP_MAIN_HAND) && |
1972 (!HasItemEquipped(EQUIP_OFF_HAND) || GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD); | |
0 | 1973 } |
1974 | |
1975 //----- (0048D6AA) -------------------------------------------------------- | |
1976 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
1977 { | |
1978 auto i = pEquipment.pIndices[uEquipIndex]; | |
1979 if (i) | |
1568 | 1980 return (~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN)) != 0; |
1036 | 1981 else |
1982 return false; | |
0 | 1983 } |
1984 | |
1985 //----- (0048D6D0) -------------------------------------------------------- | |
1986 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
1987 { | |
1988 for (uint i = 0; i < 16; ++i) | |
1989 { | |
1990 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 1991 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 1992 return true; |
1993 } | |
1994 return false; | |
1995 } | |
1996 | |
1997 //----- (0048D709) -------------------------------------------------------- | |
1080 | 1998 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
1563 | 1999 { |
2000 return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); | |
2001 } | |
2002 | |
2003 bool Player::WearsItemAnyWhere(int item_id) | |
2004 { | |
2005 for (int i = 0; i < 16; i++) | |
2006 { | |
2007 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i)) | |
2008 { | |
2009 return true; | |
2010 } | |
2011 } | |
2012 return false; | |
0 | 2013 } |
2014 | |
2015 //----- (0048D76C) -------------------------------------------------------- | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2016 bool Player::StealFromShop(ItemGen *itemToSteal, int a3, int reputation, int a5, int *a6) //check stealing in IDA pro once I get home. The whole thing looks odd, dword_4EDEB4 and dword_4EDEA0 are never filled, might be a bug, might me on purpose |
0 | 2017 { |
2018 unsigned __int16 v6; // cx@8 | |
2019 int v7; // edi@8 | |
2020 unsigned int v8; // ebx@8 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2021 unsigned int itemvalue; // esi@8 |
0 | 2022 int v10; // eax@8 |
2023 int v11; // edi@12 | |
2024 bool result; // eax@13 | |
2025 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2026 if ( !itemToSteal |
0 | 2027 || this->pConditions[16] |
2028 || this->pConditions[14] | |
2029 || this->pConditions[15] | |
2030 || this->pConditions[4] | |
2031 || this->pConditions[13] | |
2032 || this->pConditions[2] ) | |
2033 { | |
2034 result = 0; | |
2035 } | |
2036 else | |
2037 { | |
2038 v6 = this->pActiveSkills[34]; | |
2039 v7 = v6 & 0x3F; | |
2040 v8 = SkillToMastery(v6); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2041 itemvalue = itemToSteal->GetValue(); |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2042 v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2043 if ( !pItemsTable->pItems[itemToSteal->uItemID].uEquipType || v10 == 1 || v10 == 2 ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2044 itemvalue *= 3; |
0 | 2045 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2046 *a6 = 100 * (reputation + a3) + itemvalue + (a5 != 0 ? 0x1F4 : 0); |
0 | 2047 if ( rand() % 100 >= 5 ) |
2048 { | |
2049 if ( *a6 > v11 ) | |
2050 result = *a6 - v11 < 500; | |
2051 else | |
2052 result = 2; | |
2053 } | |
2054 else | |
2055 { | |
2056 result = 0; | |
2057 } | |
2058 } | |
2059 return result; | |
2060 } | |
2061 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2062 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2063 | |
2064 //----- (0048D88B) -------------------------------------------------------- | |
2065 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2066 { | |
2067 Player *v4; // esi@1 | |
2068 Actor *v5; // edi@1 | |
2069 unsigned __int16 v6; // cx@10 | |
2070 int v7; // ebx@10 | |
2071 unsigned int v8; // esi@10 | |
2072 int v9; // eax@10 | |
2073 int v10; // esi@10 | |
2074 int v11; // eax@13 | |
2075 signed int v12; // ebx@15 | |
2076 signed int v13; // edx@15 | |
2077 int v14; // ecx@15 | |
2078 unsigned __int16 v15; // si@21 | |
2079 unsigned int v16; // ebx@24 | |
2080 int v17; // esi@24 | |
2081 const void *v18; // eax@29 | |
2082 unsigned int v19; // esi@31 | |
2083 int v20; // eax@34 | |
2084 char v21; // zf@36 | |
2085 unsigned int v22; // ST0C_4@39 | |
2086 char *v23; // esi@39 | |
2087 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2088 int v26; // [sp-8h] [bp-44h]@40 | |
2089 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2090 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2091 int v29; // [sp+30h] [bp-Ch]@10 | |
2092 int v30; // [sp+34h] [bp-8h]@10 | |
2093 Player *v31; // [sp+38h] [bp-4h]@1 | |
2094 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2095 | |
2096 v4 = this; | |
2097 v5 = &pActors[uActorID]; | |
2098 v31 = this; | |
2099 if ( &pActors[uActorID] | |
2100 && !this->pConditions[16] | |
2101 && !this->pConditions[14] | |
2102 && !this->pConditions[15] | |
2103 && !this->pConditions[4] | |
2104 && !this->pConditions[13] | |
2105 && !this->pConditions[2] ) | |
2106 { | |
2107 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2108 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2109 v6 = v4->pActiveSkills[34]; | |
2110 v7 = v6 & 0x3F; | |
2111 v8 = SkillToMastery(v6); | |
2112 v9 = rand(); | |
2113 v28 = 4 * v8; | |
2114 v30 = dword_4EDEA0[v8]; | |
2115 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2116 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2117 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2118 { | |
322 | 2119 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2120 _steal_perma = 0; |
2121 v26 = (int)v31->pName; | |
2122 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2123 } | |
2124 else | |
2125 { | |
2126 v11 = rand(); | |
2127 if ( v11 % 100 >= 40 ) | |
2128 { | |
2129 if ( v11 % 100 >= 70 ) | |
2130 { | |
2131 v19 = 0; | |
2132 if ( v7 > 0 ) | |
2133 { | |
2134 do | |
2135 { | |
2136 --v7; | |
2137 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2138 } | |
2139 while ( v7 ); | |
2140 } | |
2141 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2142 return _steal_perma; | |
377 | 2143 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2144 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2145 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2146 v21 = *(int *)v20 == v19; |
2147 *(int *)v20 -= v19; | |
2148 if ( v21 ) | |
2149 v5->array_000234[3].uItemID = 0; | |
2150 if ( v19 ) | |
2151 { | |
2152 party_finds_gold(v19, 2); | |
2153 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2154 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2155 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2156 LABEL_43: |
2157 ShowStatusBarString(v23, 2u); | |
2158 return _steal_perma; | |
2159 } | |
2160 } | |
2161 else | |
2162 { | |
2163 v27.Reset(); | |
2164 v12 = 0; | |
2165 v13 = 0; | |
2166 v14 = (int)v5->array_000234; | |
2167 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2168 { | |
2169 ++v13; | |
2170 v14 += 36; | |
2171 if ( v13 >= 4 ) | |
2172 goto LABEL_21; | |
2173 } | |
2174 v12 = 1; | |
2175 LABEL_21: | |
2176 v15 = v5->uCarriedItemID; | |
2177 if ( v15 || v12 ) | |
2178 { | |
2179 v27.Reset(); | |
2180 if ( v15 ) | |
2181 { | |
2182 v16 = (signed __int16)v15; | |
2183 v5->uCarriedItemID = 0; | |
2184 v27.uItemID = (signed __int16)v15; | |
2185 v17 = (signed __int16)v15; | |
2186 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2187 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2188 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2189 { | |
2190 if ( v16 != 220 ) | |
570 | 2191 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2192 } |
2193 } | |
2194 else | |
2195 { | |
2196 v18 = &v5->array_000234[rand() % 4]; | |
2197 memcpy(&v27, v18, sizeof(v27)); | |
2198 ((ItemGen *)v18)->Reset(); | |
2199 v16 = v27.uItemID; | |
2200 } | |
2201 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2202 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2203 pTmpBuf2.data(), |
0 | 2204 pGlobalTXT_LocalizationStrings[304], |
2205 v31->pName, | |
2206 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2207 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2208 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2209 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2210 pMouse->SetCursorBitmapFromItemID(v16); | |
2211 return _steal_perma; | |
2212 } | |
2213 } | |
2214 } | |
2215 v26 = (int)v31->pName; | |
2216 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2217 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2218 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2219 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2220 goto LABEL_43; |
2221 } | |
2222 return 0; | |
2223 } | |
2224 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2225 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2226 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2227 | |
2228 //----- (0048DBB9) -------------------------------------------------------- | |
2229 void Player::Heal(int amount) | |
2230 { | |
1010 | 2231 signed int max_health; // eax@3 |
2232 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2233 if ( !IsEradicated() && !IsDead() ) |
1010 | 2234 { |
2235 max_health = GetMaxHealth(); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2236 if ( IsZombie() ) |
1010 | 2237 max_health /= 2; |
2238 sHealth += amount; | |
2239 if ( sHealth > max_health ) | |
2240 sHealth = max_health; | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2241 if ( IsUnconcious() ) |
1010 | 2242 { |
2243 if ( sHealth > 0 ) | |
2244 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2245 SetUnconcious(false); |
0 | 2246 } |
2247 } | |
2248 } | |
2249 } | |
2250 | |
2251 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2252 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2253 { | |
2254 signed int recieved_dmg; // eax@1 | |
2255 unsigned int armor_indx; // eax@8 | |
2256 bool broke_armor; | |
2257 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2258 SetAsleep(false); |
1036 | 2259 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); |
2260 sHealth -= recieved_dmg; | |
2261 broke_armor = sHealth <= -10; | |
2262 if ( sHealth < 1 ) // | |
2263 { | |
2264 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2265 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2266 { |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2267 SetCondUnconsciousWithBlockCheck(false); |
0 | 2268 } |
2269 else | |
2270 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2271 SetCondDeadWithBlockCheck(false); |
1036 | 2272 if ( sHealth > 0 ) |
2273 sHealth = 0; | |
2274 } | |
2275 if (broke_armor ) | |
2276 { | |
2277 armor_indx = pEquipment.uArmor; | |
2278 if ( armor_indx ) | |
0 | 2279 { |
1568 | 2280 if ( !(pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED)) |
0 | 2281 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2282 pOwnItems[armor_indx-1].SetBroken(); |
0 | 2283 } |
2284 } | |
2285 } | |
2286 } | |
1036 | 2287 if ( recieved_dmg && CanAct() ) |
187 | 2288 PlaySound(SPEECH_24, 0); |
1036 | 2289 return recieved_dmg; |
0 | 2290 } |
2291 | |
2292 //----- (0048DCF6) -------------------------------------------------------- | |
1568 | 2293 int Player::_48DCF6(int a2, Actor *pActor) //TODO check this with IDA to see what the uninitialized vars are supposed to contain |
0 | 2294 { |
2295 signed int v3; // edi@1 | |
2296 signed int v4; // ebx@1 | |
2297 Player *v5; // esi@1 | |
2298 int v6; // eax@2 | |
2299 int v7; // eax@5 | |
2300 int v8; // eax@8 | |
2301 int v9; // ebx@8 | |
2302 int v10; // eax@8 | |
2303 int v11; // ebx@8 | |
2304 signed int v12; // edx@9 | |
2305 ItemGen *v13; // eax@9 | |
2306 int v14; // edx@16 | |
2307 unsigned int v15; // edx@17 | |
2308 int v16; // edx@26 | |
2309 unsigned int v17; // edx@27 | |
2310 signed int v19; // edx@38 | |
2311 int *v20; // ecx@38 | |
2312 signed int v21; // eax@40 | |
2313 int v22; // eax@49 | |
2314 signed int v23; // ebx@49 | |
2315 unsigned int v24; // eax@60 | |
2316 int v25; // ecx@61 | |
2317 int v26; // ebx@74 | |
2318 void *v27; // ecx@76 | |
2319 unsigned int v28; // ebx@78 | |
2320 signed int result; // eax@86 | |
2321 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2322 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2323 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2324 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2325 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2326 int v35; // [sp-Ch] [bp-ACh]@56 | |
2327 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2328 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2329 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2330 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2331 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2332 int v41; // [sp-4h] [bp-A4h]@51 | |
2333 int v42; // [sp-4h] [bp-A4h]@56 | |
2334 int v43; // [sp-4h] [bp-A4h]@57 | |
2335 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2336 int v45; // [sp-4h] [bp-A4h]@68 | |
2337 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2338 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2339 int v48; // [sp+9Ch] [bp-4h]@1 | |
2340 | |
2341 v3 = 0; | |
2342 v4 = 0; | |
2343 v5 = this; | |
2344 v47 = 0; | |
2345 v48 = 0; | |
2346 switch ( a2 ) | |
2347 { | |
2348 case 1: | |
2349 v6 = GetActualWillpower(); | |
2350 goto LABEL_46; | |
2351 case 2: | |
2352 case 3: | |
2353 case 4: | |
2354 case 9: | |
2355 case 10: | |
2356 case 11: | |
2357 case 13: | |
2358 case 21: | |
2359 v6 = GetActualEndurance(); | |
2360 goto LABEL_46; | |
2361 case 5: | |
2362 case 12: | |
2363 case 23: | |
2364 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2365 goto LABEL_5; | |
2366 case 15: | |
2367 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2368 goto LABEL_5; | |
2369 case 6: | |
2370 case 7: | |
2371 case 8: | |
2372 case 14: | |
2373 case 16: | |
2374 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2375 LABEL_5: | |
2376 v7 = GetActualResistance(v40); | |
2377 goto LABEL_47; | |
2378 case 22: | |
2379 v8 = GetActualWillpower(); | |
1036 | 2380 v9 = GetParameterBonus(v8); |
0 | 2381 v10 = GetActualIntelligence(); |
1036 | 2382 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2383 break; |
2384 case 17: | |
2385 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2386 v13 = this->pInventoryItemList; |
0 | 2387 do |
2388 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2389 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->IsBroken()) |
0 | 2390 v46[v4++] = v12; |
2391 ++v12; | |
2392 ++v13; | |
2393 } | |
2394 while ( v12 < 138 ); | |
2395 goto LABEL_36; | |
2396 case 18: | |
2397 v14 = 0; | |
2398 do | |
2399 { | |
2400 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2401 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2402 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2403 if ( v15 == EQUIP_ARMOUR ) |
898 | 2404 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2405 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2406 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2407 } |
2408 v14 = v15 + 1; | |
2409 } | |
2410 while ( v14 < 16 ); | |
2411 goto LABEL_36; | |
2412 case 19: | |
2413 v16 = 0; | |
2414 do | |
2415 { | |
2416 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2417 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2418 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2419 if ( v17 == 2 ) |
2420 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2421 if ( (!v17 || v17 == 1) | |
816 | 2422 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2423 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2424 } |
2425 v16 = v17 + 1; | |
2426 } | |
2427 while ( v16 < 16 ); | |
2428 LABEL_36: | |
2429 if ( !v4 ) | |
2430 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2431 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2432 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2433 break; | |
2434 case 20: | |
2435 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2436 v20 = this->pInventoryMatrix; |
0 | 2437 do |
2438 { | |
2439 if ( *v20 > 0 ) | |
2440 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2441 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2442 if ( v21 > 0 ) |
2443 { | |
2444 if ( v21 <= 134 ) | |
2445 v46[v4++] = v19; | |
2446 } | |
2447 } | |
2448 ++v19; | |
2449 ++v20; | |
2450 } | |
2451 while ( v19 < 126 ); | |
2452 if ( !v4 ) | |
2453 goto LABEL_87; | |
2454 v47 = (unsigned __int8)v46[rand() % v4]; | |
2455 v6 = GetActualAccuracy(); | |
2456 LABEL_46: | |
1036 | 2457 v7 = GetParameterBonus(v6); |
0 | 2458 LABEL_47: |
2459 v11 = v7; | |
2460 break; | |
2461 default: | |
2462 v11 = 0; | |
2463 break; | |
2464 } | |
2465 v22 = GetActualLuck(); | |
1036 | 2466 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2467 if ( rand() % v23 >= 30 ) |
2468 { | |
2469 LABEL_87: | |
2470 result = 0; | |
2471 } | |
2472 else | |
2473 { | |
2474 switch ( a2 ) | |
2475 { | |
2476 case 1: | |
2477 v41 = 1; | |
2478 v36 = 0; | |
2479 goto LABEL_56; | |
2480 case 2: | |
2481 v41 = 1; | |
2482 v36 = 1; | |
2483 goto LABEL_56; | |
2484 case 3: | |
2485 v41 = 1; | |
2486 v36 = 2; | |
2487 goto LABEL_56; | |
2488 case 23: | |
2489 v41 = 1; | |
2490 v36 = 3; | |
2491 goto LABEL_56; | |
2492 case 4: | |
2493 v41 = 1; | |
2494 v36 = 4; | |
2495 LABEL_56: | |
2496 SetCondition(v36, v41); | |
2497 v42 = 0; | |
2498 v37 = 0; | |
2499 v35 = 0; | |
2500 v34 = 0; | |
2501 v33 = -1; | |
2502 v32 = 0; | |
2503 v31 = 0; | |
2504 v30 = (SoundID)221; | |
2505 goto LABEL_83; | |
2506 case 5: | |
2507 v43 = 1; | |
2508 v38 = 5; | |
2509 goto LABEL_70; | |
2510 case 6: | |
2511 case 7: | |
2512 case 8: | |
2513 if ( a2 == 6 ) | |
2514 { | |
2515 v44 = 6; | |
2516 goto LABEL_60; | |
2517 } | |
2518 v25 = 2 * (a2 != 8) + 8; | |
2519 goto LABEL_65; | |
2520 case 9: | |
2521 if ( a2 == 6 ) | |
2522 { | |
2523 v44 = 7; | |
2524 LABEL_60: | |
2525 v24 = v44; | |
2526 } | |
2527 else | |
2528 { | |
2529 v25 = 2 * (a2 != 8) + 9; | |
2530 LABEL_65: | |
2531 v24 = v25; | |
2532 } | |
2533 SetCondition(v24, 1); | |
2534 v42 = 0; | |
2535 v37 = 0; | |
2536 v35 = 0; | |
2537 v34 = 0; | |
2538 v33 = -1; | |
2539 v32 = 0; | |
2540 v31 = 0; | |
2541 v30 = (SoundID)222; | |
2542 LABEL_83: | |
2543 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2544 do | |
2545 { | |
2546 LABEL_84: | |
2547 if ( v5 == pPlayers[v3 + 1] ) | |
2548 break; | |
2549 ++v3; | |
2550 } | |
2551 while ( v3 < 4 ); | |
2552 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2553 result = 1; | |
2554 break; | |
2555 case 12: | |
2556 v43 = 1; | |
2557 v38 = 12; | |
2558 goto LABEL_70; | |
2559 case 15: | |
2560 v45 = 1; | |
2561 v39 = 15; | |
2562 goto LABEL_73; | |
2563 case 13: | |
2564 v43 = 1; | |
2565 v38 = 13; | |
2566 LABEL_70: | |
2567 SetCondition(v38, v43); | |
2568 v42 = 0; | |
2569 v37 = 0; | |
2570 v35 = 0; | |
2571 v34 = 0; | |
2572 v33 = -1; | |
2573 v32 = 0; | |
2574 v31 = 0; | |
2575 v30 = (SoundID)224; | |
2576 goto LABEL_83; | |
2577 case 14: | |
2578 v45 = 1; | |
2579 v39 = 14; | |
2580 goto LABEL_73; | |
2581 case 16: | |
2582 v45 = 1; | |
2583 v39 = 16; | |
2584 LABEL_73: | |
2585 SetCondition(v39, v45); | |
2586 v42 = 0; | |
2587 v37 = 0; | |
2588 v35 = 0; | |
2589 v34 = 0; | |
2590 v33 = -1; | |
2591 v32 = 0; | |
2592 v31 = 0; | |
2593 v30 = (SoundID)225; | |
2594 goto LABEL_83; | |
2595 case 17: | |
2596 case 18: | |
2597 case 19: | |
2598 v26 = v48; | |
2599 if ( *(char *)(v48 + 21) & 2 ) | |
2600 goto LABEL_84; | |
187 | 2601 PlaySound(SPEECH_40, 0); |
0 | 2602 *(int *)(v26 + 20) |= 2u; |
2603 goto LABEL_79; | |
2604 case 20: | |
187 | 2605 PlaySound(SPEECH_40, 0); |
0 | 2606 v27 = pActor->array_000234; |
2607 if ( pActor->array_000234[0].uItemID ) | |
2608 { | |
2609 v27 = &pActor->array_000234[1]; | |
2610 if ( pActor->array_000234[1].uItemID ) | |
2611 goto LABEL_84; | |
2612 } | |
2613 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2614 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2615 RemoveItemAtInventoryIndex(v28); |
2616 LABEL_79: | |
2617 v42 = 0; | |
2618 v37 = 0; | |
2619 v35 = 0; | |
2620 v34 = 0; | |
2621 v33 = -1; | |
2622 v32 = 0; | |
2623 v31 = 0; | |
2624 v30 = (SoundID)47; | |
2625 goto LABEL_83; | |
2626 case 21: | |
187 | 2627 PlaySound(SPEECH_42, 0); |
0 | 2628 ++v5->sAgeModifier; |
2629 goto LABEL_82; | |
2630 case 22: | |
187 | 2631 PlaySound(SPEECH_41, 0); |
0 | 2632 v5->sMana = 0; |
2633 LABEL_82: | |
2634 v42 = 0; | |
2635 v37 = 0; | |
2636 v35 = 0; | |
2637 v34 = 0; | |
2638 v33 = -1; | |
2639 v32 = 0; | |
2640 v31 = 0; | |
2641 v30 = (SoundID)226; | |
2642 goto LABEL_83; | |
2643 default: | |
2644 goto LABEL_87; | |
2645 } | |
2646 } | |
2647 return result; | |
2648 } | |
324 | 2649 |
0 | 2650 // 48DCF6: using guessed type char var_94[140]; |
2651 | |
2652 //----- (0048E1A3) -------------------------------------------------------- | |
2653 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2654 { | |
1091 | 2655 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2656 } |
2657 | |
2658 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2659 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2660 { | |
2661 ItemGen *weapon = nullptr; | |
2662 ItemDesc *weapon_desc = nullptr; | |
2663 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2664 if (bRangedAttack) | |
0 | 2665 { |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2666 if ( HasItemEquipped(EQUIP_BOW) ) |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2667 { |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2668 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2669 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2670 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2671 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2672 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2673 else if ( IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2674 { |
816 | 2675 weapon_recovery = base_recovery_times_per_weapon_type[1]; |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2676 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2677 else if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
816 | 2678 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2679 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2680 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2681 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2682 { | |
2683 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2684 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2685 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2686 } | |
0 | 2687 else |
816 | 2688 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2689 } | |
1010 | 2690 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2691 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2692 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2693 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2694 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2695 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2696 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2697 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2698 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2699 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2700 } | |
2701 } | |
2702 | |
2703 uint armour_recovery = 0; | |
0 | 2704 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2705 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2706 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2707 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2708 float multiplier; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2709 |
816 | 2710 if (armour_skill_type == PLAYER_SKILL_LEATHER) |
2711 { | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2712 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0, 0, 0); |
816 | 2713 } |
2714 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2715 { | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2716 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0, 0); |
816 | 2717 } |
2718 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2719 { | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2720 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0.5f, 0); |
0 | 2721 } |
2722 else | |
2723 { | |
1545 | 2724 Error("Unknown armour type"); // what kind of armour is that? |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2725 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f); |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2726 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2727 |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2728 armour_recovery = base_armour_recovery * multiplier; |
816 | 2729 } |
2730 | |
2731 uint shield_recovery = 0; | |
2732 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2733 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2734 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2735 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2736 | |
2737 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2738 float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0); |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2739 shield_recovery = shield_base_recovery * multiplier; |
816 | 2740 } |
2741 | |
1036 | 2742 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2743 sword_axe_bow_recovery_reduction = 0; |
2744 bool shooting_laser = false; | |
2745 if (weapon_desc) | |
2746 { | |
2747 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2748 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2749 { | |
2750 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2751 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2752 } | |
2753 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2754 shooting_laser = true; | |
2755 } | |
2756 | |
2757 uint armsmaster_recovery_reduction = 0; | |
2758 if (!bRangedAttack && !shooting_laser) | |
2759 { | |
2760 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2761 { | |
2762 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2763 if (SkillToMastery(armsmaster_level) >= 4) | |
2764 armsmaster_recovery_reduction *= 2; | |
2765 } | |
2766 } | |
2767 | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2768 uint hasteRecoveryReduction = 0; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2769 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 ) |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2770 hasteRecoveryReduction = 25; |
816 | 2771 |
2772 uint weapon_enchantment_recovery_reduction = 0; | |
2773 if ( weapon ) | |
2774 { | |
2775 if (weapon->uSpecEnchantmentType == 59 || | |
2776 weapon->uSpecEnchantmentType == 41 || | |
2777 weapon->uSpecEnchantmentType == 500) | |
2778 weapon_enchantment_recovery_reduction = 20; | |
2779 } | |
2780 | |
2781 | |
2782 int recovery = weapon_recovery + | |
2783 armour_recovery + | |
2784 shield_recovery | |
2785 - armsmaster_recovery_reduction | |
2786 - weapon_enchantment_recovery_reduction | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2787 - hasteRecoveryReduction |
816 | 2788 - sword_axe_bow_recovery_reduction |
2789 - player_speed_recovery_reduction; | |
2790 | |
2791 if (recovery < 0) | |
2792 recovery = 0; | |
2793 return recovery; | |
0 | 2794 } |
2795 | |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2796 |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2797 //----- new -------------------------------------------------------- |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2798 float Player::GetArmorRecoveryMultiplierFromSkillLevel( unsigned char armour_skill_type, float mult1, float mult2, float mult3, float mult4 ) |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2799 { |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2800 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2801 switch (skill_mastery) |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2802 { |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2803 case 1: return mult1; break; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2804 case 2: return mult2; break; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2805 case 3: return mult3; break; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2806 case 4: return mult4; break; |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2807 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2808 } |
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
2809 |
0 | 2810 //----- (0048E4F8) -------------------------------------------------------- |
2811 int Player::GetMaxHealth() | |
2812 { | |
2813 int v3; // esi@1 | |
2814 int v4; // esi@1 | |
2815 int v6; // esi@1 | |
2816 | |
1036 | 2817 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2818 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2819 v6 = uFullHealthBonus |
135 | 2820 + pBaseHealthByClass[classType / 4] |
0 | 2821 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2822 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2823 if (v6 <= 0) | |
2824 return 1; | |
2825 return v6; | |
2826 } | |
2827 | |
2828 //----- (0048E565) -------------------------------------------------------- | |
2829 int Player::GetMaxMana() | |
2830 { | |
2831 int v2; // eax@2 | |
2832 int v3; // esi@4 | |
2833 int v4; // eax@5 | |
2834 int v5; // esi@5 | |
2835 int v6; // eax@5 | |
2836 int v7; // esi@6 | |
2837 int v8; // esi@6 | |
2838 int v9; // esi@6 | |
2839 int result; // eax@7 | |
1116 | 2840 |
135 | 2841 switch (classType) |
0 | 2842 { |
1116 | 2843 case PLAYER_CLASS_ROGUE: |
2844 case PLAYER_CLASS_SPY: | |
2845 case PLAYER_CLASS_ASSASSIN: | |
2846 case PLAYER_CLASS_ARCHER: | |
2847 case PLAYER_CLASS_WARRIOR_MAGE: | |
2848 case PLAYER_CLASS_MASTER_ARCHER: | |
2849 case PLAYER_CLASS_SNIPER: | |
2850 case PLAYER_CLASS_SORCERER: | |
2851 case PLAYER_CLASS_WIZARD: | |
2852 case PLAYER_CLASS_ARCHMAGE: | |
2853 case PLAYER_CLASS_LICH: | |
0 | 2854 v2 = GetActualIntelligence(); |
1036 | 2855 v3 = GetParameterBonus(v2); |
1116 | 2856 break; |
2857 case PLAYER_CLASS_INITIATE: | |
2858 case PLAYER_CLASS_MASTER: | |
2859 case PLAYER_CLASS_NINJA: | |
2860 case PLAYER_CLASS_PALADIN: | |
2861 case PLAYER_CLASS_CRUSADER: | |
2862 case PLAYER_CLASS_HERO: | |
2863 case PLAYER_CLASS_VILLIAN: | |
2864 case PLAYER_CLASS_CLERIC: | |
2865 case PLAYER_CLASS_PRIEST: | |
2866 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2867 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2868 v2 = GetActualWillpower(); |
1036 | 2869 v3 = GetParameterBonus(v2); |
1116 | 2870 break; |
2871 case PLAYER_CLASS_HUNTER: | |
2872 case PLAYER_CLASS_RANGER_LORD: | |
2873 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2874 case PLAYER_CLASS_DRUID: | |
2875 case PLAYER_CLASS_GREAT_DRUID: | |
2876 case PLAYER_CLASS_ARCH_DRUID: | |
2877 case PLAYER_CLASS_WARLOCK: | |
0 | 2878 v4 = GetActualWillpower(); |
1036 | 2879 v5 = GetParameterBonus(v4); |
0 | 2880 v6 = GetActualIntelligence(); |
1036 | 2881 v3 = GetParameterBonus(v6) + v5; |
0 | 2882 break; |
2883 default: | |
1116 | 2884 return 0; |
0 | 2885 break; |
2886 } | |
1116 | 2887 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2888 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2889 v9 = uFullManaBonus | |
2890 + pBaseManaByClass[classType / 4] | |
2891 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2892 + v8; | |
2893 return max(0,v9); | |
0 | 2894 } |
2895 | |
2896 //----- (0048E656) -------------------------------------------------------- | |
2897 int Player::GetBaseAC() | |
2898 { | |
2899 Player *v1; // edi@1 | |
2900 int v2; // eax@1 | |
2901 int v3; // esi@1 | |
2902 int v4; // esi@1 | |
2903 int v5; // esi@1 | |
2904 int result; // eax@2 | |
2905 | |
2906 v1 = this; | |
2907 v2 = GetActualSpeed(); | |
1036 | 2908 v3 = GetParameterBonus(v2); |
0 | 2909 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2910 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2911 if ( v5 >= 1 ) | |
2912 result = v5; | |
2913 else | |
2914 result = 0; | |
2915 return result; | |
2916 } | |
2917 | |
2918 //----- (0048E68F) -------------------------------------------------------- | |
2919 int Player::GetActualAC() | |
2920 { | |
2921 Player *v1; // edi@1 | |
2922 int v2; // eax@1 | |
2923 int v3; // esi@1 | |
2924 int v4; // esi@1 | |
2925 int v5; // esi@1 | |
2926 int v6; // esi@1 | |
2927 int result; // eax@2 | |
2928 | |
2929 v1 = this; | |
2930 v2 = GetActualSpeed(); | |
1036 | 2931 v3 = GetParameterBonus(v2); |
0 | 2932 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2933 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2934 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
2935 if ( v6 >= 1 ) | |
2936 result = v6; | |
2937 else | |
2938 result = 0; | |
2939 return result; | |
2940 } | |
2941 | |
2942 //----- (0048E6DC) -------------------------------------------------------- | |
2943 unsigned int Player::GetBaseAge() | |
2944 { | |
352 | 2945 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 2946 } |
2947 | |
2948 //----- (0048E72C) -------------------------------------------------------- | |
2949 unsigned int Player::GetActualAge() | |
2950 { | |
2951 return this->sAgeModifier + GetBaseAge(); | |
2952 } | |
2953 | |
2954 //----- (0048E73F) -------------------------------------------------------- | |
2955 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
2956 { | |
2957 Player *v2; // ebx@1 | |
2958 signed int v3; // esi@1 | |
2959 enum CHARACTER_RACE v4; // eax@1 | |
2960 signed int v5; // edi@8 | |
2961 char v6; // zf@9 | |
2962 int v7; // esi@20 | |
2963 int result; // eax@21 | |
2964 signed int v9; // [sp-4h] [bp-10h]@11 | |
2965 | |
2966 v2 = this; | |
2967 v3 = 0; | |
2968 v4 = GetRace(); | |
2969 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
2970 { | |
2971 v5 = 0; | |
2972 goto LABEL_16; | |
2973 } | |
2974 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
2975 { | |
2976 v5 = 1; | |
2977 LABEL_16: | |
2978 v6 = v4 == 2; | |
2979 goto LABEL_17; | |
2980 } | |
2981 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
2982 { | |
2983 v6 = v4 == 3; | |
2984 v5 = 2; | |
2985 goto LABEL_17; | |
2986 } | |
2987 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
2988 { | |
2989 v5 = 3; | |
2990 v6 = v4 == 3; | |
2991 goto LABEL_17; | |
2992 } | |
2993 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
2994 { | |
2995 v5 = 7; | |
2996 if ( v4 != 1 ) | |
2997 goto LABEL_20; | |
2998 v9 = 10; | |
2999 LABEL_19: | |
3000 v3 = v9; | |
3001 goto LABEL_20; | |
3002 } | |
3003 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3004 { | |
3005 v5 = 8; | |
3006 v6 = v4 == 0; | |
3007 LABEL_17: | |
3008 if ( !v6 ) | |
3009 goto LABEL_20; | |
3010 v9 = 5; | |
3011 goto LABEL_19; | |
3012 } | |
3013 v5 = 0; | |
3014 LABEL_20: | |
3015 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3016 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3017 result = v7 + *(&v2->sResFireBase + v5); |
3018 return result; | |
3019 } | |
3020 | |
3021 //----- (0048E7D0) -------------------------------------------------------- | |
3022 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3023 { | |
3024 signed int v2; // edi@1 | |
3025 Player *v3; // esi@1 | |
3026 enum CHARACTER_RACE v4; // ebx@1 | |
3027 char v6; // zf@18 | |
3028 int v7; // ebx@28 | |
3029 int result; // eax@28 | |
3030 signed int v9; // [sp+10h] [bp-8h]@1 | |
3031 signed int v10; // [sp+14h] [bp-4h]@1 | |
3032 | |
3033 v2 = 0; | |
3034 v3 = this; | |
3035 v10 = 0; | |
3036 v9 = 0; | |
3037 v4 = GetRace(); | |
652 | 3038 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3039 v10 = 20; |
3040 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3041 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3042 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3043 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3044 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3045 && HasItemEquipped(EQUIP_ARMOUR) | |
3046 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3047 v10 += v3->pActiveSkills[9] & 0x3F; | |
3048 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3049 goto LABEL_25; | |
3050 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3051 { | |
3052 v2 = 1; | |
3053 LABEL_25: | |
3054 v6 = v4 == 2; | |
3055 LABEL_26: | |
3056 if ( v6 ) | |
3057 v9 = 5; | |
3058 goto LABEL_28; | |
3059 } | |
3060 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3061 { | |
3062 v6 = v4 == 3; | |
3063 v2 = 2; | |
3064 goto LABEL_26; | |
3065 } | |
3066 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3067 { | |
3068 v2 = 3; | |
3069 if ( v4 == 3 ) | |
3070 v10 += 5; | |
3071 } | |
3072 else | |
3073 { | |
3074 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3075 { | |
3076 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3077 goto LABEL_28; | |
3078 v2 = 8; | |
3079 v6 = v4 == 0; | |
3080 goto LABEL_26; | |
3081 } | |
3082 v2 = 7; | |
3083 if ( v4 == 1 ) | |
3084 v9 = 10; | |
3085 } | |
3086 LABEL_28: | |
3087 v7 = GetItemsBonus(a2, 0); | |
3088 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3089 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3090 { |
3091 if ( result > 200 ) | |
3092 result = 200; | |
3093 } | |
3094 return result; | |
3095 } | |
3096 | |
3097 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3098 bool Player::Recover(int dt) |
3099 { | |
3100 //Player *v2; // esi@1 | |
0 | 3101 signed __int64 v3; // qax@1 |
816 | 3102 //bool result; // eax@4 |
3103 | |
3104 //v2 = this; | |
3105 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3106 | |
3107 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3108 | |
3109 if (uTimeToRecovery > v3) | |
3110 { | |
3111 uTimeToRecovery -= v3; | |
3112 return true; | |
0 | 3113 } |
3114 else | |
3115 { | |
816 | 3116 uTimeToRecovery = 0; |
3117 viewparams->bRedrawGameUI = true; | |
3118 if (!uActiveCharacter) | |
0 | 3119 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3120 return false; |
3121 } | |
0 | 3122 } |
3123 | |
3124 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3125 void Player::SetRecoveryTime(signed int rec) |
3126 { | |
1545 | 3127 Assert(rec >= 0); |
816 | 3128 |
3129 if (rec > uTimeToRecovery) | |
3130 uTimeToRecovery = rec; | |
3131 | |
3132 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3133 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3134 |
3135 viewparams->bRedrawGameUI = true; | |
0 | 3136 } |
3137 // 50C0C4: using guessed type int some_active_character; | |
3138 | |
3139 //----- (0048E9B7) -------------------------------------------------------- | |
3140 void Player::RandomizeName() | |
3141 { | |
3142 if (!uExpressionTimePassed) | |
3143 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3144 } | |
3145 | |
3146 //----- (0048E9F4) -------------------------------------------------------- | |
3147 unsigned int Player::GetMajorConditionIdx() | |
3148 { | |
3149 for (uint i = 0; i < 18; ++i) | |
3150 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3151 return pConditionImportancyTable[i]; | |
3152 | |
3153 return 18; | |
3154 } | |
3155 | |
3156 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3157 int Player::GetParameterBonus( int player_parameter ) |
3158 { | |
3159 int i; // eax@1 | |
3160 i = 0; | |
3161 while (param_to_bonus_table[i]) | |
3162 { | |
3163 if (player_parameter >= param_to_bonus_table[i]) | |
3164 break; | |
3165 ++i; | |
3166 } | |
3167 return parameter_to_bonus_value[i]; | |
0 | 3168 } |
3169 | |
3170 //----- (0048EA46) -------------------------------------------------------- | |
3171 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3172 { | |
1032 | 3173 int inv_indx; // eax@3 |
3174 | |
3175 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3176 { | |
3177 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3178 continue; | |
3179 inv_indx = pEquipment.pIndices[i] - 1; | |
3180 if (a2==17) | |
3181 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3182 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3183 return 50; |
3184 } | |
3185 if (a2==24) | |
3186 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3187 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3188 return 5; |
3189 } | |
3190 } | |
3191 return 0; | |
0 | 3192 } |
3193 | |
3194 //----- (0048EAAE) -------------------------------------------------------- | |
3195 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3196 { | |
3197 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3198 // signed int v4; // eax@1 |
0 | 3199 int v5; // edi@1 |
3200 Player *v6; // ebx@1 | |
3201 Player *v8; // ecx@48 | |
3202 int v9; // eax@49 | |
3203 int v10; // edx@49 | |
3204 Player *v11; // ecx@55 | |
3205 int v12; // eax@56 | |
3206 int v13; // edx@56 | |
3207 int v14; // ecx@58 | |
3208 int v15; // eax@58 | |
3209 Player *v16; // ecx@61 | |
3210 int v17; // eax@62 | |
3211 Player *v18; // ecx@66 | |
3212 int v19; // eax@67 | |
3213 int v20; // eax@69 | |
3214 Player *v21; // ecx@75 | |
3215 int v22; // eax@76 | |
3216 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3217 //int v24; // eax@79 |
0 | 3218 int v25; // ecx@80 |
3219 int v26; // edi@80 | |
3220 Player *v27; // ecx@84 | |
3221 int v28; // eax@85 | |
3222 int v29; // edx@85 | |
3223 Player *v30; // ecx@96 | |
3224 int v31; // ebp@97 | |
3225 int v32; // eax@98 | |
3226 unsigned int v33; // eax@100 | |
3227 int v34; // eax@103 | |
3228 char v35; // zf@104 | |
3229 char v36; // zf@107 | |
3230 unsigned __int8 v37; // zf@119 | |
3231 char v38; // sf@119 | |
3232 unsigned __int8 v39; // of@119 | |
3233 char v40; // zf@122 | |
3234 char v41; // zf@145 | |
3235 char v42; // zf@164 | |
3236 char v43; // zf@173 | |
3237 char v44; // zf@189 | |
3238 char v45; // zf@198 | |
3239 char v46; // zf@239 | |
3240 int v47; // eax@268 | |
3241 int v48; // eax@269 | |
3242 int v49; // eax@291 | |
3243 char v50; // zf@295 | |
3244 int v51; // eax@306 | |
3245 int v52; // eax@307 | |
3246 char v53; // zf@312 | |
3247 char v54; // zf@336 | |
3248 char v55; // zf@348 | |
3249 int v56; // eax@365 | |
3250 int v57; // ebx@368 | |
3251 signed int v58; // [sp-4h] [bp-20h]@10 | |
3252 signed int v59; // [sp-4h] [bp-20h]@71 | |
3253 signed int v60; // [sp-4h] [bp-20h]@347 | |
3254 int v61; // [sp+10h] [bp-Ch]@1 | |
3255 int v62; // [sp+14h] [bp-8h]@1 | |
3256 int v63; // [sp+18h] [bp-4h]@101 | |
3257 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3258 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3259 bool no_skills; |
0 | 3260 |
3261 v3 = attr; | |
3262 v5 = 0; | |
3263 v6 = this; | |
3264 v62 = 0; | |
3265 v61 = 0; | |
3266 | |
1040 | 3267 |
3268 no_skills=false; | |
0 | 3269 switch (attr) |
3270 { | |
1040 | 3271 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3272 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3273 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3274 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3275 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3276 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3277 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3278 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3279 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3280 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3281 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3282 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3283 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3284 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3285 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3286 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3287 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3288 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3289 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3290 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3291 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3292 default: | |
3293 no_skills=true; | |
0 | 3294 } |
1040 | 3295 if (!no_skills) |
0 | 3296 { |
1040 | 3297 if ( !this->pActiveSkills[v58] ) |
3298 return 0; | |
0 | 3299 } |
1040 | 3300 |
0 | 3301 if ( (signed int)attr > 28 ) |
3302 { | |
3303 if ( (signed int)attr < 29 ) | |
3304 return v5 + v62 + v61; | |
1040 | 3305 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3306 { |
3307 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3308 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3309 return v5 + v62 + v61; |
3310 } | |
1040 | 3311 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3312 { |
3313 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3314 return v5 + v62 + v61; | |
1040 | 3315 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3316 v5 = pItemsTable->pItems[v57].uDamageMod; |
3317 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3318 v5 += v56; |
3319 return v5 + v62 + v61; | |
3320 } | |
3321 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3322 { |
3323 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3324 return v5 + v62 + v61; | |
1040 | 3325 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3326 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3327 LABEL_365: | |
3328 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3329 LABEL_366: | |
3330 v5 += v56; | |
3331 return v5 + v62 + v61; | |
3332 } | |
3333 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3334 return v5 + v62 + v61; | |
3335 LABEL_95: | |
3336 v65 = 0; | |
3337 while ( 1 ) | |
3338 { | |
3339 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3340 goto LABEL_361; | |
898 | 3341 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3342 if ( v3 == 9 ) |
3343 { | |
816 | 3344 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3345 if ( v32 >= 3 ) |
3346 { | |
3347 if ( v32 <= 11 ) | |
3348 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3349 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3350 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3351 } | |
3352 } | |
3353 } | |
3354 v63 = (int)((char *)v6 + 36 * v31); | |
3355 attra = (ItemGen *)(v63 + 532); | |
377 | 3356 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3357 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3358 { |
3359 v34 = attra->uItemID; | |
3360 switch ( attra->uItemID ) | |
3361 { | |
3362 case 0x1F4u: | |
3363 v35 = v3 == 5; | |
3364 goto LABEL_105; | |
3365 case 0x1F5u: | |
3366 v36 = v3 == 0; | |
3367 goto LABEL_108; | |
3368 case 0x1F6u: | |
3369 if ( v3 == 21 ) | |
3370 v61 += 10; | |
3371 v36 = v3 == 2; | |
3372 goto LABEL_108; | |
3373 case 0x1F7u: | |
3374 if ( v3 == 17 ) | |
3375 v61 += 5; | |
3376 if ( v3 == 18 ) | |
3377 v61 += 5; | |
3378 v36 = v3 == 6; | |
3379 goto LABEL_108; | |
3380 case 0x1F8u: | |
3381 goto LABEL_118; | |
3382 case 0x1F9u: | |
3383 v40 = v3 == 3; | |
3384 goto LABEL_123; | |
3385 case 0x1FAu: | |
3386 v35 = v3 == 10; | |
3387 goto LABEL_105; | |
3388 case 0x1FEu: | |
3389 v35 = v3 == 4; | |
3390 goto LABEL_105; | |
3391 case 0x1FFu: | |
3392 if ( v3 == 23 ) | |
3393 v61 += 10; | |
3394 if ( v3 == 22 ) | |
3395 v61 += 10; | |
3396 goto LABEL_361; | |
3397 case 0x200u: | |
3398 if ( v3 == 36 ) | |
3399 { | |
3400 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3401 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3402 } | |
3403 v36 = v3 == 5; | |
3404 LABEL_108: | |
3405 if ( v36 ) | |
3406 v5 += 40; | |
3407 goto LABEL_361; | |
3408 case 0x201u: | |
3409 if ( v3 == 39 ) | |
3410 { | |
3411 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3412 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3413 v62 = v34; | |
3414 } | |
3415 goto LABEL_136; | |
3416 case 0x202u: | |
3417 if ( !v3 ) | |
3418 v5 += 150; | |
3419 if ( v3 == 1 ) | |
3420 v5 -= 40; | |
3421 if ( v3 == 2 ) | |
3422 v5 -= 40; | |
3423 goto LABEL_145; | |
3424 case 0x203u: | |
3425 if ( v3 == 42 ) | |
3426 { | |
3427 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3428 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3429 } | |
3430 if ( v3 == 43 ) | |
3431 v61 += 15; | |
3432 goto LABEL_361; | |
3433 case 0x204u: | |
3434 if ( v3 == 17 ) | |
3435 v61 += 5; | |
3436 if ( v3 == 18 ) | |
3437 v61 += 5; | |
3438 if ( v3 == 6 ) | |
3439 v5 += 50; | |
3440 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3441 goto LABEL_166; | |
3442 v42 = v3 == 15; | |
3443 goto LABEL_165; | |
3444 case 0x205u: | |
3445 if ( v3 == 18 ) | |
3446 v61 += 5; | |
3447 goto LABEL_361; | |
3448 case 0x206u: | |
3449 if ( !v3 ) | |
3450 v5 += 100; | |
3451 if ( v3 == 3 ) | |
3452 v5 += 100; | |
3453 v43 = v3 == 9; | |
3454 goto LABEL_174; | |
3455 case 0x207u: | |
3456 if ( v3 == 45 ) | |
3457 v61 += 5; | |
3458 if ( v3 == 15 ) | |
3459 v5 -= 10; | |
3460 v42 = v3 == 14; | |
3461 LABEL_165: | |
3462 if ( v42 ) | |
3463 LABEL_166: | |
3464 v5 -= 10; | |
3465 goto LABEL_361; | |
3466 case 0x208u: | |
3467 v35 = v3 == 3; | |
3468 goto LABEL_105; | |
3469 case 0x209u: | |
3470 if ( v3 == 2 ) | |
3471 v5 += 15; | |
3472 if ( !v3 ) | |
3473 v5 += 15; | |
3474 v41 = v3 == 6; | |
3475 goto LABEL_146; | |
3476 case 0x20Au: | |
3477 if ( v3 == 46 ) | |
3478 v61 += 15; | |
3479 v44 = v3 == 3; | |
3480 goto LABEL_190; | |
3481 case 0x20Bu: | |
3482 if ( v3 == 34 ) | |
3483 { | |
3484 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3485 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3486 } | |
3487 if ( v3 == 12 ) | |
3488 v5 += 50; | |
3489 if ( v3 == 2 ) | |
3490 v5 += 30; | |
3491 v45 = v3 == 9; | |
3492 goto LABEL_199; | |
3493 case 0x20Cu: | |
3494 if ( !v3 ) | |
3495 v5 += 75; | |
3496 goto LABEL_145; | |
3497 case 0x20Du: | |
3498 if ( v3 == 5 ) | |
3499 v5 += 50; | |
3500 if ( v3 == 6 ) | |
3501 v5 += 50; | |
3502 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3503 goto LABEL_374; | |
3504 v43 = v3 == 15; | |
3505 LABEL_174: | |
3506 if ( v43 ) | |
3507 LABEL_374: | |
3508 v5 -= 15; | |
3509 goto LABEL_361; | |
3510 case 0x20Eu: | |
3511 if ( v3 == 4 ) | |
3512 v5 += 150; | |
3513 if ( v3 == 44 ) | |
3514 v61 += 5; | |
3515 if ( v3 == 9 ) | |
3516 v5 -= 25; | |
3517 goto LABEL_361; | |
3518 case 0x20Fu: | |
3519 if ( v3 == 39 ) | |
3520 { | |
3521 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3522 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3523 v62 = v34; | |
3524 } | |
3525 if ( v3 == 40 ) | |
3526 { | |
3527 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3528 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3529 } | |
3530 LABEL_145: | |
3531 v41 = v3 == 5; | |
3532 LABEL_146: | |
3533 if ( v41 ) | |
3534 v5 -= 40; | |
3535 goto LABEL_361; | |
3536 case 0x210u: | |
3537 if ( v3 == 38 ) | |
3538 { | |
3539 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3540 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3541 } | |
3542 if ( !v3 ) | |
3543 v5 += 75; | |
3544 v44 = v3 == 11; | |
3545 LABEL_190: | |
3546 if ( v44 ) | |
3547 v5 -= 50; | |
3548 goto LABEL_361; | |
3549 case 0x211u: | |
3550 if ( v3 == 5 ) | |
3551 v5 += 100; | |
3552 if ( v3 == 4 ) | |
3553 v5 += 50; | |
3554 v35 = v3 == 11; | |
3555 LABEL_105: | |
3556 if ( v35 ) | |
3557 v5 += 50; | |
3558 goto LABEL_361; | |
3559 case 0x212u: | |
3560 if ( v3 == 1 ) | |
3561 v5 -= 20; | |
3562 v45 = v3 == 2; | |
3563 LABEL_199: | |
3564 if ( v45 ) | |
3565 v5 -= 20; | |
3566 goto LABEL_361; | |
3567 case 0x214u: | |
3568 if ( v3 == 1 ) | |
3569 v5 += 15; | |
3570 v46 = v3 == 2; | |
3571 goto LABEL_240; | |
3572 case 0x215u: | |
3573 if ( v3 == 5 ) | |
3574 v5 += 15; | |
3575 v46 = v3 == 4; | |
3576 goto LABEL_240; | |
3577 case 0x216u: | |
3578 if ( v3 == 10 ) | |
3579 v5 += 30; | |
3580 if ( !v3 ) | |
3581 v5 += 15; | |
3582 goto LABEL_315; | |
3583 case 0x217u: | |
3584 if ( v3 == 21 ) | |
3585 v61 += 5; | |
3586 if ( !v3 ) | |
3587 v5 += 15; | |
3588 goto LABEL_253; | |
3589 case 0x218u: | |
3590 goto LABEL_253; | |
3591 default: | |
3592 goto LABEL_361; | |
3593 } | |
3594 goto LABEL_361; | |
3595 } | |
3596 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3597 { | |
3598 if ( (signed int)v3 >= 0 ) | |
3599 { | |
3600 if ( (signed int)v3 <= 15 ) | |
3601 { | |
3602 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3603 } | |
3604 else | |
3605 { | |
3606 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3607 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3608 } | |
3609 } | |
3610 goto LABEL_361; | |
3611 } | |
3612 v34 = *(int *)(v63 + 544); | |
3613 if ( v34 > 48 ) | |
3614 { | |
3615 switch ( v34 ) | |
3616 { | |
3617 case 54: | |
3618 goto LABEL_315; | |
3619 case 49: | |
3620 if ( v3 == 6 ) | |
3621 goto LABEL_121; | |
3622 v50 = v3 == 1; | |
3623 goto LABEL_296; | |
3624 case 51: | |
3625 if ( v3 != 5 && v3 != 1 ) | |
3626 goto LABEL_309; | |
3627 goto LABEL_121; | |
3628 case 52: | |
3629 if ( v3 == 3 ) | |
3630 goto LABEL_121; | |
3631 v50 = v3 == 4; | |
3632 goto LABEL_296; | |
3633 case 53: | |
3634 if ( !v3 ) | |
3635 goto LABEL_121; | |
3636 v50 = v3 == 2; | |
3637 goto LABEL_296; | |
3638 case 55: | |
3639 v46 = v3 == 6; | |
3640 goto LABEL_240; | |
3641 case 56: | |
3642 if ( !v3 ) | |
3643 goto LABEL_351; | |
3644 v53 = v3 == 3; | |
3645 goto LABEL_350; | |
3646 case 57: | |
3647 if ( v3 == 1 ) | |
3648 goto LABEL_351; | |
3649 v53 = v3 == 2; | |
3650 goto LABEL_350; | |
3651 case 50: | |
3652 if ( v3 == 10 ) | |
3653 v5 += 30; | |
3654 goto LABEL_361; | |
3655 case 60: | |
3656 if ( v3 != 23 ) | |
3657 goto LABEL_336; | |
3658 if ( v5 >= 3 ) | |
3659 goto LABEL_361; | |
3660 v5 = 3; | |
3661 LABEL_336: | |
3662 v54 = v3 == 22; | |
3663 goto LABEL_345; | |
3664 case 61: | |
3665 if ( v3 != 17 ) | |
3666 goto LABEL_340; | |
3667 if ( v5 >= 3 ) | |
3668 goto LABEL_361; | |
3669 v5 = 3; | |
3670 LABEL_340: | |
3671 v54 = v3 == 18; | |
3672 goto LABEL_345; | |
3673 case 62: | |
3674 if ( v3 != 19 ) | |
3675 goto LABEL_344; | |
3676 if ( v5 >= 3 ) | |
3677 goto LABEL_361; | |
3678 v5 = 3; | |
3679 LABEL_344: | |
3680 v54 = v3 == 20; | |
3681 LABEL_345: | |
3682 if ( !v54 ) | |
3683 goto LABEL_361; | |
3684 if ( v5 >= 3 ) | |
3685 goto LABEL_361; | |
3686 v60 = 3; | |
3687 goto LABEL_360; | |
3688 case 67: | |
3689 v55 = v3 == 18; | |
3690 goto LABEL_357; | |
3691 case 68: | |
3692 v53 = v3 == 9; | |
3693 goto LABEL_350; | |
3694 case 69: | |
3695 if ( v3 == 11 ) | |
3696 v5 += 20; | |
3697 break; | |
3698 case 70: | |
3699 if ( v3 == 12 ) | |
3700 v5 += 10; | |
3701 v55 = v3 == 16; | |
3702 LABEL_357: | |
3703 if ( v55 && v5 < 2 ) | |
3704 { | |
3705 v60 = 2; | |
3706 LABEL_360: | |
3707 v5 = v60; | |
3708 } | |
3709 break; | |
3710 default: | |
3711 goto LABEL_361; | |
3712 } | |
3713 goto LABEL_361; | |
3714 } | |
3715 if ( v34 == 48 ) | |
3716 { | |
3717 if ( v3 == 9 ) | |
3718 v5 += 5; | |
3719 LABEL_315: | |
3720 v46 = v3 == 3; | |
3721 LABEL_240: | |
3722 if ( v46 ) | |
3723 v5 += 15; | |
3724 goto LABEL_361; | |
3725 } | |
3726 if ( v34 > 32 ) | |
3727 { | |
3728 if ( v34 > 44 ) | |
3729 { | |
3730 v51 = v34 - 45; | |
3731 if ( !v51 ) | |
3732 { | |
3733 if ( v3 == 5 ) | |
3734 goto LABEL_351; | |
3735 v53 = v3 == 4; | |
3736 LABEL_350: | |
3737 if ( v53 ) | |
3738 LABEL_351: | |
3739 v5 += 5; | |
3740 goto LABEL_361; | |
3741 } | |
3742 v52 = v51 - 1; | |
3743 if ( !v52 ) | |
3744 { | |
3745 v40 = v3 == 0; | |
3746 LABEL_123: | |
3747 if ( v40 ) | |
3748 v5 += 25; | |
3749 goto LABEL_361; | |
3750 } | |
3751 if ( v52 == 1 ) | |
3752 { | |
3753 LABEL_309: | |
3754 v50 = v3 == 8; | |
3755 goto LABEL_296; | |
3756 } | |
3757 } | |
3758 else | |
3759 { | |
3760 if ( v34 == 44 ) | |
3761 { | |
3762 v50 = v3 == 7; | |
3763 goto LABEL_296; | |
3764 } | |
3765 v34 -= 33; | |
3766 if ( !v34 ) | |
3767 { | |
3768 if ( v3 != 38 ) | |
3769 goto LABEL_361; | |
3770 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3771 goto LABEL_138; | |
3772 } | |
3773 --v34; | |
3774 if ( !v34 ) | |
3775 { | |
3776 if ( v3 != 36 ) | |
3777 goto LABEL_361; | |
3778 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3779 goto LABEL_138; | |
3780 } | |
3781 v49 = v34 - 8; | |
3782 if ( !v49 ) | |
3783 { | |
3784 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3785 ++v5; | |
3786 goto LABEL_361; | |
3787 } | |
3788 if ( v49 == 1 ) | |
3789 { | |
3790 if ( v3 != 3 && v3 != 7 ) | |
3791 { | |
3792 v50 = v3 == 9; | |
3793 LABEL_296: | |
3794 if ( !v50 ) | |
3795 goto LABEL_361; | |
3796 } | |
3797 LABEL_121: | |
3798 v5 += 10; | |
3799 goto LABEL_361; | |
3800 } | |
3801 } | |
3802 } | |
3803 else | |
3804 { | |
3805 if ( v34 == 32 ) | |
3806 { | |
3807 if ( v3 != 39 ) | |
3808 goto LABEL_361; | |
3809 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3810 goto LABEL_138; | |
3811 } | |
3812 if ( v34 > 28 ) | |
3813 { | |
3814 v34 -= 29; | |
3815 if ( v34 ) | |
3816 { | |
3817 --v34; | |
3818 if ( v34 ) | |
3819 { | |
3820 --v34; | |
3821 if ( v34 || v3 != 41 ) | |
3822 goto LABEL_361; | |
3823 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3824 } | |
3825 else | |
3826 { | |
3827 if ( v3 != 34 ) | |
3828 goto LABEL_361; | |
3829 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3830 } | |
3831 } | |
3832 else | |
3833 { | |
3834 if ( v3 != 37 ) | |
3835 goto LABEL_361; | |
3836 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3837 } | |
3838 goto LABEL_138; | |
3839 } | |
3840 if ( v34 == 28 ) | |
3841 { | |
3842 LABEL_136: | |
3843 if ( v3 == 42 ) | |
3844 { | |
3845 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3846 LABEL_138: | |
3847 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3848 goto LABEL_361; | |
3849 } | |
3850 } | |
3851 else | |
3852 { | |
3853 v47 = v34 - 1; | |
3854 if ( v47 ) | |
3855 { | |
3856 v48 = v47 - 1; | |
3857 if ( v48 ) | |
3858 { | |
3859 v34 = v48 - 24; | |
3860 if ( v34 ) | |
3861 { | |
3862 --v34; | |
3863 if ( v34 || v3 != 40 ) | |
3864 goto LABEL_361; | |
3865 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3866 } | |
3867 else | |
3868 { | |
3869 if ( v3 != 35 ) | |
3870 goto LABEL_361; | |
3871 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3872 } | |
3873 goto LABEL_138; | |
3874 } | |
3875 LABEL_118: | |
3876 if ( (signed int)v3 < 0 ) | |
3877 goto LABEL_361; | |
3878 v39 = __OFSUB__((int)v3, 6); | |
3879 v37 = v3 == 6; | |
3880 v38 = v3 - 6 < 0; | |
3881 } | |
3882 else | |
3883 { | |
3884 LABEL_253: | |
3885 if ( (signed int)v3 < 10 ) | |
3886 goto LABEL_361; | |
3887 v39 = __OFSUB__((int)v3, 15); | |
3888 v37 = v3 == 15; | |
3889 v38 = v3 - 15 < 0; | |
3890 } | |
3891 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3892 goto LABEL_121; | |
3893 } | |
3894 } | |
3895 LABEL_361: | |
3896 ++v65; | |
3897 if ( (signed int)v65 >= 16 ) | |
3898 return v5 + v62 + v61; | |
3899 } | |
3900 } | |
1040 | 3901 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 3902 { |
3903 if ( IsUnarmed() != 1 ) | |
3904 { | |
816 | 3905 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3906 { | |
3907 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3908 if ( v22 >= 0 ) |
3909 { | |
3910 if ( v22 <= 2 ) | |
3911 { | |
1040 | 3912 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 3913 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 3914 { |
3915 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
3916 v25 = pItemsTable->pItems[v23].uDamageDice; | |
3917 } | |
3918 else | |
3919 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3920 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3921 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 3922 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3923 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 3924 } |
3925 } | |
3926 } | |
1040 | 3927 |
3928 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
3929 { | |
3930 | |
3931 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
3932 if ((v28 < 0) || v28 > 2 ) | |
3933 return v5 + v62 + v61; | |
3934 } | |
1062 | 3935 v15 = pItemsTable->pItems[v23].uDamageMod; |
3936 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 3937 v5 += v15 + v14; |
1049 | 3938 return v5 + v62 + v61; |
0 | 3939 } |
3940 v59 = 3; | |
3941 LABEL_74: | |
3942 v5 = v59; | |
3943 return v5 + v62 + v61; | |
3944 } | |
3945 if ( (signed int)attr < 0 ) | |
3946 return v5 + v62 + v61; | |
1040 | 3947 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 3948 goto LABEL_95; |
1040 | 3949 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
3950 { | |
3951 if ( !Player::HasEnchantedItemEquipped(25) ) | |
3952 return v5 + v62 + v61; | |
3953 v5 = 5; | |
3954 return v5 + v62 + v61; | |
3955 } | |
3956 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 3957 return v5 + v62 + v61; |
1040 | 3958 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 3959 { |
3960 if ( IsUnarmed() == 1 ) | |
3961 { | |
3962 v5 = 0; | |
3963 return v5 + v62 + v61; | |
3964 } | |
816 | 3965 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3966 { | |
3967 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3968 if ( v17 >= 0 ) |
3969 { | |
3970 if ( v17 <= 2 ) | |
1040 | 3971 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 3972 } |
3973 } | |
865 | 3974 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 3975 return v5 + v62 + v61; |
1040 | 3976 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
3977 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3978 v5 += v56; | |
3979 return v5 + v62 + v61; | |
3980 } | |
3981 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 3982 { |
3983 if ( IsUnarmed() == 1 ) | |
3984 { | |
3985 v5 = 1; | |
3986 return v5 + v62 + v61; | |
3987 } | |
816 | 3988 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3989 { | |
3990 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3991 if ( v9 >= 0 ) |
3992 { | |
3993 if ( v9 <= 2 ) | |
3994 { | |
1040 | 3995 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
3996 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 3997 if ( !v6->pEquipment.uShield ) |
0 | 3998 { |
1040 | 3999 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4000 ++v5; |
4001 } | |
4002 } | |
4003 } | |
4004 } | |
1040 | 4005 |
4006 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4007 { | |
4008 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4009 if ((v12 < 0) || v12 > 2 ) | |
4010 return v5 + v62 + v61; | |
4011 } | |
4012 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4013 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4014 LABEL_88: |
4015 v5 += v15 + v14; | |
4016 } | |
4017 return v5 + v62 + v61; | |
4018 } | |
4019 | |
4020 //----- (0048F73C) -------------------------------------------------------- | |
4021 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4022 { | |
4023 int result; // eax@1 | |
4024 int v3; // eax@4 | |
4025 int v4; // ecx@5 | |
4026 | |
4027 switch (a2) | |
4028 { | |
4029 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4030 } | |
4031 | |
4032 result = 0; | |
4033 if ( (signed int)a2 > 10 ) | |
4034 { | |
4035 if ( (signed int)a2 <= 15 ) | |
4036 { | |
4037 switch ( a2 ) | |
4038 { | |
4039 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4040 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4041 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4042 break; |
4043 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4044 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4045 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4046 break; |
4047 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4048 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4049 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4050 break; |
4051 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4052 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4053 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4054 break; |
4055 default: | |
4056 if ( a2 != 14 ) | |
4057 return result; | |
4058 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4059 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4060 break; |
4061 } | |
4062 return v4 + v3; | |
4063 } | |
4064 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4065 { | |
4066 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4067 { | |
4068 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4069 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4070 return v4 + v3; |
4071 } | |
4072 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4073 return result; | |
4074 } | |
4075 return this->pPlayerBuffs[1].uPower; | |
4076 } | |
4077 if ( a2 == 10 ) | |
4078 { | |
4079 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4080 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4081 return v4 + v3; |
4082 } | |
4083 switch ( a2 ) | |
4084 { | |
4085 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4086 v3 = pPlayerBuffs[19].uPower; | |
4087 goto LABEL_5; | |
4088 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4089 v3 = pPlayerBuffs[17].uPower; | |
4090 goto LABEL_5; | |
4091 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4092 v3 = pPlayerBuffs[20].uPower; | |
4093 goto LABEL_5; | |
4094 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4095 v3 = pPlayerBuffs[16].uPower; | |
4096 goto LABEL_5; | |
4097 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4098 v3 = pPlayerBuffs[15].uPower; | |
4099 goto LABEL_5; | |
4100 case CHARACTER_ATTRIBUTE_SPEED: | |
4101 v3 = pPlayerBuffs[21].uPower; | |
4102 goto LABEL_5; | |
4103 case CHARACTER_ATTRIBUTE_LUCK: | |
4104 v3 = pPlayerBuffs[18].uPower; | |
4105 LABEL_5: | |
1167 | 4106 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4107 return v4 + v3; |
4108 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4109 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4110 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4111 return v4 + v3; |
4112 default: | |
4113 return result; | |
4114 } | |
4115 return result; | |
4116 } | |
4117 | |
4118 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4119 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4120 { | |
1064 | 4121 signed int bonus_value; // esi@1 |
4122 unsigned __int16 skill_value; // ax@126 | |
4123 int result; // al@127 | |
353 | 4124 |
1064 | 4125 bonus_value = 0; |
353 | 4126 switch (uSkillType) |
4127 { | |
4128 case PLAYER_SKILL_MONSTER_ID: | |
4129 { | |
652 | 4130 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4131 bonus_value = 6; |
652 | 4132 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4133 bonus_value += 6; |
4134 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4135 } |
4136 break; | |
4137 | |
4138 case PLAYER_SKILL_ARMSMASTER: | |
4139 { | |
652 | 4140 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4141 bonus_value = 2; |
652 | 4142 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4143 bonus_value += 3; |
4144 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4145 } |
4146 break; | |
4147 | |
4148 case PLAYER_SKILL_STEALING: | |
4149 { | |
652 | 4150 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4151 bonus_value = 8; |
4152 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4153 } |
4154 break; | |
4155 | |
4156 | |
4157 case PLAYER_SKILL_ALCHEMY: | |
4158 { | |
652 | 4159 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4160 bonus_value = 4; |
652 | 4161 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4162 bonus_value += 8; |
4163 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4164 } |
4165 break; | |
4166 | |
4167 case PLAYER_SKILL_LEARNING: | |
4168 { | |
652 | 4169 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4170 bonus_value = 10; |
652 | 4171 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4172 bonus_value += 15; |
652 | 4173 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4174 bonus_value += 5; |
4175 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4176 } |
4177 break; | |
4178 | |
4179 case PLAYER_SKILL_UNARMED: | |
4180 { | |
652 | 4181 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4182 bonus_value = 2; |
4183 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4184 } |
4185 break; | |
4186 | |
4187 case PLAYER_SKILL_DODGE: | |
4188 { | |
652 | 4189 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4190 bonus_value = 2; |
4191 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4192 } |
4193 break; | |
4194 | |
4195 case PLAYER_SKILL_BOW: | |
1064 | 4196 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4197 break; |
4198 case PLAYER_SKILL_SHIELD: | |
1064 | 4199 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4200 break; |
4201 | |
4202 case PLAYER_SKILL_EARTH: | |
652 | 4203 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4204 bonus_value = 2; |
652 | 4205 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4206 bonus_value += 3; |
652 | 4207 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4208 bonus_value += 4; |
353 | 4209 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4210 bonus_value += 3; |
4211 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4212 break; |
4213 case PLAYER_SKILL_FIRE: | |
652 | 4214 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4215 bonus_value = 2; |
652 | 4216 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4217 bonus_value += 3; |
652 | 4218 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4219 bonus_value += 4; |
353 | 4220 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4221 bonus_value += 3; |
4222 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4223 break; |
4224 case PLAYER_SKILL_AIR: | |
652 | 4225 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4226 bonus_value = 2; |
652 | 4227 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4228 bonus_value += 3; |
652 | 4229 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4230 bonus_value += 4; |
353 | 4231 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4232 bonus_value += 3; |
4233 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4234 break; |
4235 case PLAYER_SKILL_WATER: | |
652 | 4236 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4237 bonus_value = 2; |
652 | 4238 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4239 bonus_value += 3; |
652 | 4240 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4241 bonus_value += 4; |
353 | 4242 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4243 bonus_value += 3; |
4244 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4245 break; |
4246 case PLAYER_SKILL_SPIRIT: | |
652 | 4247 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4248 bonus_value = 2; |
652 | 4249 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4250 bonus_value += 3; |
652 | 4251 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4252 bonus_value += 4; |
4253 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4254 break; |
4255 case PLAYER_SKILL_MIND: | |
652 | 4256 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4257 bonus_value = 2; |
652 | 4258 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4259 bonus_value += 3; |
652 | 4260 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4261 bonus_value += 4; |
4262 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4263 break; |
4264 case PLAYER_SKILL_BODY: | |
652 | 4265 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4266 bonus_value = 2; |
652 | 4267 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4268 bonus_value += 3; |
652 | 4269 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4270 bonus_value += 4; |
4271 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4272 break; |
4273 case PLAYER_SKILL_LIGHT: | |
1064 | 4274 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4275 break; |
4276 case PLAYER_SKILL_DARK: | |
4277 { | |
1064 | 4278 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4279 } |
4280 break; | |
4281 | |
4282 case PLAYER_SKILL_MERCHANT: | |
4283 { | |
652 | 4284 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4285 bonus_value = 4; |
652 | 4286 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4287 bonus_value += 6; |
652 | 4288 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4289 bonus_value += 3; |
652 | 4290 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4291 bonus_value += 8; |
353 | 4292 } |
4293 break; | |
4294 | |
4295 case PLAYER_SKILL_PERCEPTION: | |
4296 { | |
652 | 4297 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4298 bonus_value = 6; |
652 | 4299 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4300 bonus_value += 5; |
353 | 4301 } |
4302 break; | |
4303 | |
0 | 4304 case PLAYER_SKILL_ITEM_ID: |
1064 | 4305 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4306 break; |
4307 case PLAYER_SKILL_MEDITATION: | |
1064 | 4308 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4309 break; |
0 | 4310 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4311 { |
652 | 4312 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4313 bonus_value = 4; |
652 | 4314 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4315 bonus_value += 6; |
652 | 4316 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4317 bonus_value += 8; |
4318 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4319 } |
4320 break; | |
4321 } | |
4322 | |
1064 | 4323 skill_value = pActiveSkills[uSkillType]; |
4324 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4325 result = bonus_value + skill_value; | |
0 | 4326 else |
1064 | 4327 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4328 return result; |
4329 } | |
4330 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4331 |
0 | 4332 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4333 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
|
4334 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4335 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4336 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4337 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4338 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
|
4339 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
|
4340 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4341 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4342 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
|
4343 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4344 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
|
4345 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4346 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
|
4347 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4348 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4349 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4350 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
|
4351 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4352 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4353 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4354 { |
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
|
4355 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
|
4356 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
|
4357 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4358 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4359 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
|
4360 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
|
4361 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4362 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
|
4363 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4364 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
|
4365 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4366 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
|
4367 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
|
4368 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
|
4369 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4370 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4371 case CHARACTER_ATTRIBUTE_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
|
4372 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4373 int base_value = 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
|
4374 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
|
4375 return base_value * attrib_modif; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4376 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4377 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4378 case CHARACTER_ATTRIBUTE_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
|
4379 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4380 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
|
4381 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
|
4382 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
|
4383 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4384 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
|
4385 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
4386 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].IsBroken())) |
1538 | 4387 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4388 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
|
4389 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
|
4390 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
|
4391 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
|
4392 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
|
4393 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4394 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4395 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
|
4396 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
|
4397 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
|
4398 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4399 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
|
4400 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
|
4401 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
|
4402 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4403 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
|
4404 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
|
4405 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
|
4406 wearingLeather = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4407 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
|
4408 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
|
4409 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
|
4410 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4411 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
|
4412 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
|
4413 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
|
4414 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4415 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
|
4416 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
|
4417 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4418 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4419 } |
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
|
4420 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4421 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4422 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
|
4423 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4424 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
|
4425 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
|
4426 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4427 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
|
4428 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4429 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
|
4430 } |
1538 | 4431 break; |
4432 case CHARACTER_ATTRIBUTE_ATTACK: | |
4433 if ( this->IsUnarmed() ) | |
4434 { | |
4435 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4436 if (!unarmedSkill) | |
4437 { | |
4438 return 0; | |
4439 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4440 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4441 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4442 } | |
4443 for (int i = 0; i < 16; ++i) | |
4444 { | |
4445 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4446 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4447 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4448 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4449 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4450 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4451 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4452 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4453 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4454 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4455 return multiplier * (currentItemSkillLevel & 0x3F); |
4456 } | |
4457 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4458 { | |
4459 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
|
4460 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4461 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4462 } | |
4463 else | |
4464 { | |
4465 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4466 } | |
4467 } | |
4468 } | |
4469 } | |
4470 return 0; | |
4471 break; | |
4472 | |
4473 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4474 for (int i = 0; i < 16; i++) | |
4475 { | |
4476 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4477 { | |
4478 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4479 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4480 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4481 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4482 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4483 return multiplier * (currentItemSkillLevel & 0x3F); |
4484 } | |
4485 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4486 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4487 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4488 return multiplier * (currentItemSkillLevel & 0x3F); |
4489 } | |
4490 } | |
4491 } | |
4492 return 0; | |
4493 break; | |
4494 | |
4495 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4496 if ( this->IsUnarmed() ) | |
4497 { | |
4498 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4499 if ( !unarmedSkillLevel ) | |
4500 { | |
4501 return 0; | |
4502 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4503 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4504 return multiplier * (unarmedSkillLevel & 0x3F); |
4505 } | |
4506 for (int i = 0; i < 16; i++) | |
4507 { | |
4508 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4509 { | |
4510 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4511 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4512 { | |
4513 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4514 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4515 int baseSkillBonus; | |
4516 int multiplier; | |
4517 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4518 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4519 case PLAYER_SKILL_STAFF: |
1538 | 4520 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
|
4521 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4522 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
|
4523 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4524 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
|
4525 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4526 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4527 { |
1538 | 4528 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4529 } |
1538 | 4530 break; |
4531 | |
4532 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4533 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4534 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4535 return armsMasterBonus + baseSkillBonus; | |
4536 break; | |
4537 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4538 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4539 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4540 return armsMasterBonus + baseSkillBonus; | |
4541 break; | |
4542 case PLAYER_SKILL_MACE: | |
4543 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4544 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4545 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4546 return armsMasterBonus + baseSkillBonus; | |
4547 break; | |
4548 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4549 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4550 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4551 return armsMasterBonus + baseSkillBonus; | |
4552 break; | |
1535 | 4553 } |
1533 | 4554 } |
1535 | 4555 } |
1538 | 4556 } |
4557 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4558 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4559 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4560 return 0; |
1533 | 4561 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4562 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4563 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4564 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
|
4565 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4566 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
|
4567 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4568 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4569 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
|
4570 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
|
4571 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
|
4572 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
|
4573 } |
1545 | 4574 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
|
4575 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4576 } |
0 | 4577 //----- (00490109) -------------------------------------------------------- |
4578 // faces are: 0 1 2 3 human males | |
4579 // 4 5 6 7 human females | |
4580 // 8 9 elf males | |
4581 // 10 11 elf females | |
4582 // 12 13 dwarf males | |
4583 // 14 15 dwarf females | |
4584 // 16 17 goblin males | |
4585 // 18 19 goblin females | |
4586 // 20 lich male | |
4587 // 21 lich female | |
4588 // 22 underwater suits (unused) | |
4589 // 23 zombie male | |
4590 // 24 zombie female | |
4591 enum CHARACTER_RACE Player::GetRace() | |
4592 { | |
1014 | 4593 if ( uCurrentFace > 15 ) |
4594 { | |
4595 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4596 return CHARACTER_RACE_GOBLIN; |
4597 } | |
4598 else | |
4599 { | |
1014 | 4600 if ( uCurrentFace >= 12 ) |
0 | 4601 { |
4602 return CHARACTER_RACE_DWARF; | |
4603 } | |
4604 else | |
4605 { | |
1014 | 4606 |
4607 if ( uCurrentFace <= 7 ) | |
0 | 4608 { |
4609 return CHARACTER_RACE_HUMAN; | |
4610 } | |
4611 else | |
4612 { | |
1014 | 4613 if ( uCurrentFace <= 11 ) |
0 | 4614 return CHARACTER_RACE_ELF; |
4615 } | |
4616 } | |
4617 } | |
4618 return CHARACTER_RACE_HUMAN; | |
4619 } | |
4620 | |
4621 //----- (00490141) -------------------------------------------------------- | |
187 | 4622 PLAYER_SEX Player::GetSexByVoice() |
0 | 4623 { |
4624 signed int result; // eax@1 | |
4625 | |
4626 result = 0; | |
4627 switch ( this->uVoiceID ) | |
4628 { | |
4629 case 0u: | |
4630 case 1u: | |
4631 case 2u: | |
4632 case 3u: | |
4633 case 8u: | |
4634 case 9u: | |
4635 case 0xCu: | |
4636 case 0xDu: | |
4637 case 0x10u: | |
4638 case 0x11u: | |
4639 case 0x14u: | |
4640 case 0x17u: | |
187 | 4641 return SEX_MALE; |
4642 | |
0 | 4643 case 4u: |
4644 case 5u: | |
4645 case 6u: | |
4646 case 7u: | |
4647 case 0xAu: | |
4648 case 0xBu: | |
4649 case 0xEu: | |
4650 case 0xFu: | |
4651 case 0x12u: | |
4652 case 0x13u: | |
4653 case 0x15u: | |
4654 case 0x18u: | |
187 | 4655 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4656 } |
1545 | 4657 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4658 return SEX_MALE; |
0 | 4659 } |
4660 | |
4661 //----- (00490188) -------------------------------------------------------- | |
4662 void Player::SetInitialStats() | |
4663 { | |
4664 auto v1 = GetRace(); | |
290 | 4665 uMight = StatTable[v1][0].uBaseValue; |
4666 uIntelligence = StatTable[v1][1].uBaseValue; | |
4667 uWillpower = StatTable[v1][2].uBaseValue; | |
4668 uEndurance = StatTable[v1][3].uBaseValue; | |
4669 uAccuracy = StatTable[v1][4].uBaseValue; | |
4670 uSpeed = StatTable[v1][5].uBaseValue; | |
4671 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4672 } |
4673 | |
4674 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4675 void Player::SetSexByVoice() |
4676 { | |
4677 switch ( this->uVoiceID) | |
0 | 4678 { |
4679 case 0: | |
4680 case 1: | |
4681 case 2: | |
4682 case 3: | |
4683 case 8: | |
4684 case 9: | |
4685 case 0xC: | |
4686 case 0xD: | |
4687 case 0x10: | |
4688 case 0x11: | |
4689 case 0x14: | |
4690 case 0x17: | |
1021 | 4691 this->uSex = SEX_MALE; |
0 | 4692 break; |
4693 case 4: | |
4694 case 5: | |
4695 case 6: | |
4696 case 7: | |
4697 case 0xA: | |
4698 case 0xB: | |
4699 case 0xE: | |
4700 case 0xF: | |
4701 case 0x12: | |
4702 case 0x13: | |
4703 case 0x15: | |
4704 case 0x18: | |
1021 | 4705 this->uSex = SEX_FEMALE; |
0 | 4706 break; |
4707 default: | |
4708 break; | |
4709 } | |
1021 | 4710 |
0 | 4711 } |
4712 | |
4713 //----- (0049024A) -------------------------------------------------------- | |
135 | 4714 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4715 { |
4716 sLevelModifier = 0; | |
4717 sAgeModifier = 0; | |
4718 | |
135 | 4719 classType = cls; |
0 | 4720 uLuckBonus = 0; |
4721 uSpeedBonus = 0; | |
4722 uAccuracyBonus = 0; | |
4723 uEnduranceBonus = 0; | |
4724 uWillpowerBonus = 0; | |
4725 uIntelligenceBonus = 0; | |
4726 uMightBonus = 0; | |
4727 uLevel = 1; | |
4728 uExperience = 251 + rand() % 100; | |
4729 uBirthYear = 1147 - rand() % 6; | |
4730 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4731 memset(_achieved_awards_bits, 0, 64); |
0 | 4732 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4733 | |
4734 for (uint i = 0; i < 37; ++i) | |
4735 { | |
135 | 4736 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4737 continue; |
4738 | |
4739 pActiveSkills[i] = 1; | |
4740 | |
4741 switch (i) | |
4742 { | |
886 | 4743 case PLAYER_SKILL_FIRE: |
4744 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4745 |
4746 extern bool all_magic; | |
4747 if ( all_magic == true ) | |
4748 { | |
4749 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4750 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4751 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4752 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4753 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4754 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4755 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4756 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4757 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4758 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4759 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4760 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4761 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4762 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4763 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4764 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4765 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4766 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4767 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4768 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4769 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4770 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4771 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4772 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4773 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4774 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4775 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4776 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4777 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4778 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4779 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4780 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4781 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4782 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4783 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4784 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4785 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4786 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4787 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4788 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4789 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4790 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4791 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4792 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4793 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4794 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4795 } | |
486 | 4796 break; |
886 | 4797 case PLAYER_SKILL_AIR: |
4798 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4799 break; | |
4800 case PLAYER_SKILL_WATER: | |
4801 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4802 break; | |
4803 case PLAYER_SKILL_EARTH: | |
4804 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4805 break; | |
4806 case PLAYER_SKILL_SPIRIT: | |
4807 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4808 break; | |
4809 case PLAYER_SKILL_MIND: | |
4810 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4811 break; | |
4812 case PLAYER_SKILL_BODY: | |
4813 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4814 |
4815 if ( all_magic == true ) | |
4816 { | |
4817 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4818 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4819 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4820 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4821 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4822 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4823 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4824 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4825 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4826 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4827 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4828 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4829 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4830 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4831 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4832 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4833 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4834 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4835 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4836 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4837 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4838 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4839 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4840 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4841 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4842 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4843 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4844 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4845 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4846 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4847 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4848 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4849 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4850 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4851 } | |
569 | 4852 break; |
886 | 4853 case PLAYER_SKILL_LIGHT: |
4854 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4855 break; | |
4856 case PLAYER_SKILL_DARK: | |
4857 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4858 break; | |
0 | 4859 } |
4860 } | |
4861 | |
4862 sHealth = GetMaxHealth(); | |
4863 sMana = GetMaxMana(); | |
4864 } | |
4865 | |
4866 //----- (004903C9) -------------------------------------------------------- | |
821 | 4867 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4868 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4869 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4870 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4871 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4872 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4873 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4874 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4875 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4876 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4877 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4878 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4879 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4880 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4881 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4882 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4883 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4884 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4885 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4886 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4887 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4888 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4889 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4890 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4891 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4892 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4893 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4894 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4895 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4896 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4897 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4898 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4899 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4900 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4901 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4902 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4903 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4904 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4905 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4906 |
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
|
4907 return (PLAYER_SKILL_TYPE)37; |
0 | 4908 } |
4909 | |
4910 | |
4911 | |
4912 //----- (0049048D) -------------------------------------------------------- | |
4913 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
4914 void Player::DecreaseAttribute(int eAttribute) | |
4915 { | |
4916 int v2; // eax@1 | |
4917 int pBaseValue; // ecx@1 | |
4918 int pDroppedStep; // ebx@1 | |
4919 int pStep; // esi@1 | |
4920 unsigned __int16 result; // ax@7 | |
4921 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
4922 | |
4923 v2 = eAttribute + 7 * GetRace(); | |
290 | 4924 pBaseValue = StatTable[0][v2].uBaseValue; |
4925 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 4926 uMinValue = pBaseValue - 2; |
290 | 4927 pStep = StatTable[0][v2].uBaseStep; |
1272 | 4928 unsigned short* AttrToChange = nullptr; |
4929 switch ( eAttribute ) | |
4930 { | |
4931 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4932 AttrToChange = &this->uMight; | |
4933 break; | |
4934 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4935 AttrToChange = &this->uIntelligence; | |
4936 break; | |
4937 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4938 AttrToChange = &this->uWillpower; | |
4939 break; | |
4940 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4941 AttrToChange = &this->uEndurance; | |
4942 break; | |
4943 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4944 AttrToChange = &this->uAccuracy; | |
4945 break; | |
4946 case CHARACTER_ATTRIBUTE_SPEED: | |
4947 AttrToChange = &this->uSpeed; | |
4948 break; | |
4949 case CHARACTER_ATTRIBUTE_LUCK: | |
4950 AttrToChange = &this->uLuck; | |
4951 break; | |
4952 } | |
4953 if ( *AttrToChange <= pBaseValue ) | |
4954 pStep = pDroppedStep; | |
4955 if ( *AttrToChange - pStep >= uMinValue ) | |
4956 *AttrToChange -= pStep; | |
0 | 4957 } |
4958 | |
4959 //----- (004905F5) -------------------------------------------------------- | |
1458 | 4960 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 4961 void Player::IncreaseAttribute( int eAttribute ) |
4962 { | |
4963 int raceId; // eax@1 | |
4964 int maxValue; // ebx@1 | |
4965 signed int baseStep; // edi@1 | |
4966 signed int tmp; // eax@17 | |
0 | 4967 signed int result; // eax@18 |
1273 | 4968 int baseValue; // [sp+Ch] [bp-8h]@1 |
4969 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
4970 unsigned short* statToChange; | |
4971 | |
4972 raceId = GetRace(); | |
4973 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
4974 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
4975 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
4976 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
4977 PlayerCreation_GetUnspentAttributePointCount(); | |
4978 switch ( eAttribute ) | |
4979 { | |
4980 case 0: | |
4981 statToChange = &this->uMight; | |
4982 break; | |
4983 case 1: | |
4984 statToChange = &this->uIntelligence; | |
4985 break; | |
4986 case 2: | |
4987 statToChange = &this->uWillpower; | |
4988 break; | |
4989 case 3: | |
4990 statToChange = &this->uEndurance; | |
4991 break; | |
4992 case 4: | |
4993 statToChange = &this->uAccuracy; | |
4994 break; | |
4995 case 5: | |
4996 statToChange = &this->uSpeed; | |
4997 break; | |
4998 case 6: | |
4999 statToChange = &this->uLuck; | |
5000 default: | |
1545 | 5001 Error("(%u)", eAttribute); |
1273 | 5002 } |
5003 if ( *statToChange < baseValue ) | |
5004 { | |
5005 tmp = baseStep; | |
5006 baseStep = droppedStep; | |
5007 droppedStep = tmp; | |
5008 } | |
5009 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5010 if ( result >= droppedStep ) | |
5011 { | |
5012 if ( baseStep + *statToChange <= maxValue ) | |
5013 *statToChange += baseStep; | |
5014 } | |
0 | 5015 } |
5016 | |
5017 //----- (0049070F) -------------------------------------------------------- | |
5018 void Player::Zero() | |
5019 { | |
5020 this->sLevelModifier = 0; | |
5021 this->sACModifier = 0; | |
5022 this->uLuckBonus = 0; | |
5023 this->uAccuracyBonus = 0; | |
5024 this->uSpeedBonus = 0; | |
5025 this->uEnduranceBonus = 0; | |
5026 this->uWillpowerBonus = 0; | |
5027 this->uIntelligenceBonus = 0; | |
5028 this->uMightBonus = 0; | |
5029 this->field_100 = 0; | |
5030 this->field_FC = 0; | |
5031 this->field_F8 = 0; | |
5032 this->field_F4 = 0; | |
5033 this->field_F0 = 0; | |
5034 this->field_EC = 0; | |
5035 this->field_E8 = 0; | |
5036 this->field_E4 = 0; | |
5037 this->field_E0 = 0; | |
766 | 5038 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5039 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5040 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5041 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5042 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5043 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5044 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5045 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5046 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5047 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5048 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5049 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5050 this->uFullHealthBonus = 0; |
0 | 5051 } |
5052 | |
5053 //----- (004907E7) -------------------------------------------------------- | |
299 | 5054 unsigned int Player::GetStatColor(int uStat) |
0 | 5055 { |
290 | 5056 int attribute_value; // edx@1 |
1393 | 5057 |
5058 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5059 switch (uStat) |
5060 { | |
5061 case 0: attribute_value = uMight; break; | |
5062 case 1: attribute_value = uIntelligence; break; | |
5063 case 2: attribute_value = uWillpower; break; | |
5064 case 3: attribute_value = uEndurance; break; | |
290 | 5065 case 4: attribute_value = uAccuracy; break; |
5066 case 5: attribute_value = uSpeed; break; | |
0 | 5067 case 6: attribute_value = uLuck; break; |
5068 }; | |
5069 | |
1393 | 5070 if (attribute_value == base_attribute_value) |
5071 return ui_character_stat_default_color; | |
5072 else if (attribute_value > base_attribute_value) | |
5073 return ui_character_stat_buffed_color; | |
0 | 5074 else |
1393 | 5075 return ui_character_stat_debuffed_color; |
0 | 5076 } |
5077 | |
5078 //----- (004908A8) -------------------------------------------------------- | |
5079 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5080 { | |
1014 | 5081 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5082 { | |
1393 | 5083 pConditions[uCondition] = 0i64; |
1014 | 5084 return true; |
0 | 5085 } |
5086 else | |
1014 | 5087 return false; |
0 | 5088 } |
5089 | |
5090 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5091 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5092 { |
5093 Player *v3; // esi@1 | |
5094 signed int v5; // eax@17 | |
5095 int v8; // edx@39 | |
5096 char *v13; // eax@45 | |
5097 signed int v15; // edi@68 | |
5098 int v16; // edx@73 | |
5099 unsigned __int16 v17; // edi@73 | |
5100 unsigned int v18; // eax@73 | |
5101 const char *v22; // eax@84 | |
5102 int scroll_id; // esi@96 | |
5103 int v25; // eax@109 | |
5104 int v26; // eax@113 | |
5105 int new_mana_val; // edi@114 | |
5106 signed __int64 v28; // qax@120 | |
5107 __int64 v30; // edi@137 | |
5108 __int64 v32; // ST3C_4@137 | |
5109 __int64 v34; // ST34_4@137 | |
5110 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5111 const char *v66; // [sp-4h] [bp-30h]@69 | |
5112 signed int v67; // [sp-4h] [bp-30h]@77 | |
5113 const char *v68; // [sp-4h] [bp-30h]@89 | |
5114 char v72; // [sp+20h] [bp-Ch]@68 | |
5115 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5116 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5117 Player *thisb; // [sp+28h] [bp-4h]@1 |
5118 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5119 | |
5120 thisb = this; | |
5121 v3 = &pParty->pPlayers[player_num-1]; | |
5122 v73 = 1; | |
1340 | 5123 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5124 return; |
5125 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5126 { |
1021 | 5127 if ( pParty->pPickedItem.uItemID == 160 ) |
5128 { | |
5129 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5130 } | |
5131 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5132 { |
1021 | 5133 new_mana_val = v3->sMana; |
5134 new_mana_val += 2; | |
5135 if ( new_mana_val > v3->GetMaxMana() ) | |
5136 new_mana_val = v3->GetMaxMana(); | |
5137 v3->PlaySound(SPEECH_36, 0); | |
5138 } | |
5139 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5140 { | |
5141 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5142 v3->PlaySound(SPEECH_36, 0); |
1021 | 5143 |
5144 } | |
5145 else | |
5146 { | |
5147 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5148 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
|
5149 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5150 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5151 return; | |
1019 | 5152 } |
1032 | 5153 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5154 | |
5155 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5156 { | |
5157 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5158 } | |
5159 if ( v73 ) | |
5160 { | |
5161 if ( pParty->bTurnBasedModeOn ) | |
5162 { | |
5163 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5164 thisb->SetRecoveryTime(100); | |
1448 | 5165 pTurnEngine->ApplyPlayerAction(); |
1032 | 5166 } |
5167 else | |
5168 { | |
5169 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5170 } | |
5171 } | |
5172 pMouse->RemoveHoldingItem(); | |
5173 return; | |
5174 | |
1021 | 5175 |
5176 } | |
5177 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5178 { |
1021 | 5179 switch ( pParty->pPickedItem.uItemID ) |
5180 { | |
5181 case 221: //Catalyst | |
5182 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5183 break; | |
5184 case 222: //Cure Wounds | |
5185 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5186 pParty->pPlayers[player_num-1].Heal(v25); | |
5187 v3->PlaySound(SPEECH_36, 0); | |
5188 break; | |
5189 case 223: //Magic Potion | |
5190 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5191 new_mana_val = v3->sMana; | |
5192 new_mana_val += v26; | |
5193 if ( new_mana_val > v3->GetMaxMana() ) | |
5194 new_mana_val = v3->GetMaxMana(); | |
5195 v3->PlaySound(SPEECH_36, 0); | |
5196 break; | |
5197 case 224: //Cure Weakness | |
5198 v3->pConditions[Condition_Weak] = 0i64; | |
5199 v3->PlaySound(SPEECH_36, 0); | |
5200 break; | |
5201 case 225: //Cure Disease | |
5202 v3->pConditions[Condition_Disease3] = 0i64; | |
5203 v3->pConditions[Condition_Disease2] = 0i64; | |
5204 v3->pConditions[Condition_Disease1] = 0i64; | |
5205 v3->PlaySound(SPEECH_36, 0); | |
5206 break; | |
5207 case 226: //Cure Poison | |
5208 v3->pConditions[Condition_Poison3] = 0i64; | |
5209 v3->pConditions[Condition_Poison2] = 0i64; | |
5210 v3->pConditions[Condition_Poison1] = 0i64; | |
5211 v3->PlaySound(SPEECH_36, 0); | |
5212 break; | |
5213 case 227: //Awaken | |
5214 v3->pConditions[Condition_Sleep] = 0i64; | |
5215 v3->PlaySound(SPEECH_36, 0); | |
5216 break; | |
5217 case 228: //Haste | |
5218 if ( !v3->pConditions[Condition_Weak] ) | |
5219 { | |
5220 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5221 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5222 v3->PlaySound(SPEECH_36, 0); | |
5223 } | |
5224 break; | |
5225 case 229: //Heroism | |
5226 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5227 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5228 v3->PlaySound(SPEECH_36, 0); | |
5229 break; | |
5230 case 230: //Bless | |
5231 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5232 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5233 v3->PlaySound(SPEECH_36, 0); | |
5234 break; | |
5235 case 231: //Preservation | |
1032 | 5236 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5237 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5238 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5239 v3->PlaySound(SPEECH_36, 0); | |
5240 break; | |
5241 case 232: //Shield | |
1032 | 5242 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5243 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5244 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5245 v3->PlaySound(SPEECH_36, 0); | |
5246 break; | |
5247 case 234: //Stoneskin | |
5248 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5249 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5250 v3->PlaySound(SPEECH_36, 0); | |
5251 break; | |
5252 case 235: //Water Breathing | |
5253 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5254 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5255 break; | |
5256 case 237: //Remove Fear | |
5257 v3->pConditions[Condition_Fear] = 0i64; | |
5258 v3->PlaySound(SPEECH_36, 0); | |
5259 break; | |
5260 case 238: //Remove Curse | |
5261 v3->pConditions[Condition_Cursed] = 0i64; | |
5262 v3->PlaySound(SPEECH_36, 0); | |
5263 break; | |
5264 case 239: //Cure Insanity | |
5265 v3->pConditions[Condition_Insane] = 0i64; | |
5266 v3->PlaySound(SPEECH_36, 0); | |
5267 break; | |
5268 case 240: //Might Boost | |
1032 | 5269 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5270 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5271 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5272 v3->PlaySound(SPEECH_36, 0); | |
5273 break; | |
5274 case 241: //Intellect Boost | |
1032 | 5275 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5276 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5277 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5278 v3->PlaySound(SPEECH_36, 0); | |
5279 break; | |
5280 case 242: //Personality Boost | |
1032 | 5281 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5282 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5283 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5284 v3->PlaySound(SPEECH_36, 0); | |
5285 break; | |
5286 case 243://Endurance Boost | |
1032 | 5287 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5288 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5289 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5290 v3->PlaySound(SPEECH_36, 0); | |
5291 break; | |
5292 case 244: //Speed Boost | |
1032 | 5293 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5294 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5295 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5296 v3->PlaySound(SPEECH_36, 0); | |
5297 break; | |
5298 case 245: //Accuracy Boost | |
1032 | 5299 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5300 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5301 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5302 v3->PlaySound(SPEECH_36, 0); | |
5303 break; | |
5304 case 251: //Cure Paralysis | |
5305 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5306 v3->PlaySound(SPEECH_36, 0); | |
5307 break; | |
5308 case 252://Divine Restoration | |
5309 v30 = v3->pConditions[Condition_Dead]; | |
5310 v32 = v3->pConditions[Condition_Pertified]; | |
5311 v34 = v3->pConditions[Condition_Eradicated]; | |
5312 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5313 v3->pConditions[Condition_Dead] = v30; | |
5314 v3->pConditions[Condition_Pertified] = v32; | |
5315 v3->pConditions[Condition_Eradicated] = v34; | |
5316 v3->PlaySound(SPEECH_36, 0); | |
5317 break; | |
5318 case 253: //Divine Cure | |
5319 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5320 pParty->pPlayers[player_num-1].Heal(v25); | |
5321 v3->PlaySound(SPEECH_36, 0); | |
5322 break; | |
5323 case 254: //Divine Power | |
5324 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5325 new_mana_val = v3->sMana; | |
5326 new_mana_val += v26; | |
5327 if ( new_mana_val > v3->GetMaxMana() ) | |
5328 new_mana_val = v3->GetMaxMana(); | |
5329 v3->PlaySound(SPEECH_36, 0); | |
5330 break; | |
5331 case 255: //Luck Boost | |
1032 | 5332 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5333 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5334 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5335 v3->PlaySound(SPEECH_36, 0); | |
5336 break; | |
5337 case 256: //Fire Resistance | |
1032 | 5338 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5339 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5340 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5341 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5342 break; |
1021 | 5343 case 257: //Air Resistance |
1032 | 5344 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5345 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5346 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5347 v3->PlaySound(SPEECH_36, 0); | |
5348 break; | |
5349 case 258: //Water Resistance | |
1032 | 5350 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5351 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5352 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5353 v3->PlaySound(SPEECH_36, 0); | |
5354 break; | |
5355 case 259: //Earth Resistance | |
1032 | 5356 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5357 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5358 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5359 v3->PlaySound(SPEECH_36, 0); | |
5360 break; | |
5361 case 260: //Mind Resistance | |
1032 | 5362 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5363 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5364 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5365 v3->PlaySound(SPEECH_36, 0); | |
5366 break; | |
5367 case 261: //Body Resistance | |
1032 | 5368 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5369 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5370 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5371 v3->PlaySound(SPEECH_36, 0); | |
5372 break; | |
5373 case 262: //Stone to Flesh | |
5374 v3->pConditions[Condition_Pertified] = 0i64; | |
5375 v3->PlaySound(SPEECH_36, 0); | |
5376 break; | |
5377 case 264: //Pure Luck | |
5378 if ( !v3->pure_luck_used ) | |
5379 { | |
5380 v3->uLuck += 50; | |
5381 v3->pure_luck_used = 1; | |
5382 } | |
5383 v3->PlaySound(SPEECH_36, 0); | |
5384 break; | |
5385 case 265: //Pure Speed | |
5386 if ( !v3->pure_speed_used ) | |
5387 { | |
5388 v3->uSpeed += 50; | |
5389 v3->pure_speed_used = 1; | |
5390 } | |
5391 v3->PlaySound(SPEECH_36, 0); | |
5392 break; | |
5393 case 266: //Pure Intellect | |
5394 if ( !v3->pure_intellect_used ) | |
5395 { | |
5396 v3->uIntelligence += 50; | |
5397 v3->pure_intellect_used = 1; | |
5398 } | |
5399 v3->PlaySound(SPEECH_36, 0); | |
5400 break; | |
5401 case 267: //Pure Endurance | |
5402 if ( !v3->pure_endurance_used ) | |
5403 { | |
5404 v3->uEndurance += 50; | |
5405 v3->pure_endurance_used = 1; | |
5406 } | |
5407 v3->PlaySound(SPEECH_36, 0); | |
5408 break; | |
5409 case 268: //Pure Personality | |
5410 if ( !v3->pure_willpower_used ) | |
5411 { | |
5412 v3->uWillpower += 50; | |
5413 v3->pure_willpower_used = 1; | |
5414 } | |
5415 v3->PlaySound(SPEECH_36, 0); | |
5416 break; | |
5417 case 269: //Pure Accuracy | |
5418 if ( !v3->pure_accuracy_used ) | |
5419 { | |
5420 v3->uAccuracy += 50; | |
5421 v3->pure_accuracy_used = 1; | |
5422 } | |
5423 v3->PlaySound(SPEECH_36, 0); | |
5424 break; | |
5425 case 270: //Pure Might | |
5426 if ( !v3->pure_might_used ) | |
5427 { | |
5428 v3->uMight += 50; | |
5429 v3->pure_might_used = 1; | |
5430 } | |
5431 v3->PlaySound(SPEECH_36, 0); | |
5432 break; | |
5433 case 271: //Rejuvenation | |
5434 v3->sAgeModifier = 0; | |
5435 v3->PlaySound(SPEECH_36, 0); | |
5436 break; | |
5437 | |
5438 default: | |
5439 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5440 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
|
5441 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5442 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5443 return; | |
1032 | 5444 } |
5445 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5446 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5447 { | |
5448 if ( !v73 ) | |
5449 { | |
5450 pMouse->RemoveHoldingItem(); | |
5451 return; | |
5452 } | |
5453 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5454 } |
1032 | 5455 if ( v73 ) |
5456 { | |
5457 if ( pParty->bTurnBasedModeOn ) | |
5458 { | |
5459 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5460 thisb->SetRecoveryTime(100); | |
1448 | 5461 pTurnEngine->ApplyPlayerAction(); |
1032 | 5462 } |
5463 else | |
5464 { | |
5465 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5466 } | |
5467 } | |
5468 pMouse->RemoveHoldingItem(); | |
5469 return; | |
5470 | |
1021 | 5471 } |
5472 | |
5473 | |
5474 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5475 { | |
5476 | |
5477 | |
5478 if ( pCurrentScreen == SCREEN_CASTING ) | |
5479 return; | |
5480 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5481 { | |
5482 | |
5483 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5484 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5485 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5486 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5487 return; |
5488 } | |
5489 if ( bUnderwater == 1 ) | |
5490 { | |
1032 | 5491 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5492 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5493 return; |
5494 } | |
5495 dword_50C9AC = 1; | |
5496 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5497 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5498 { | |
5499 pMouse->RemoveHoldingItem(); | |
5500 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5501 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5502 pCurrentScreen = SCREEN_GAME; |
5503 viewparams->bRedrawGameUI = 1; | |
5504 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5505 } | |
5506 else | |
5507 { | |
5508 _720984_unused = pParty->pPickedItem.uItemID; | |
5509 pMouse->RemoveHoldingItem(); | |
5510 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5511 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5512 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5513 { | |
5514 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5515 } | |
5516 } | |
5517 return; | |
5518 } | |
5519 | |
5520 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5521 | |
5522 { | |
5523 v15 = pParty->pPickedItem.uItemID - 400; | |
5524 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5525 if ( v72 ) | |
5526 { | |
5527 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5528 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
|
5529 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5530 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5531 return; |
5532 } | |
5533 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5534 { | |
5535 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5536 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
|
5537 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5538 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5539 return; |
5540 } | |
5541 v16 = v15 % 11 + 1; | |
5542 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5543 v18 = SkillToMastery(v17) - 1; | |
1032 | 5544 switch (v18) |
5545 { | |
5546 case 0: v67 = 4; break; | |
5547 case 1: v67 = 7; break; | |
5548 case 2: v67 = 10; break; | |
5549 case 3: v67 = 11; break; | |
5550 default: | |
5551 v67 = player_num; | |
5552 } | |
5553 | |
5554 if ( v16 > v67 || !v17 ) | |
1021 | 5555 { |
1032 | 5556 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5557 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
|
5558 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5559 v3->PlaySound((PlayerSpeech)20, 0); |
5560 return; | |
5561 } | |
5562 // v72 = 1; | |
5563 v3->PlaySound(SPEECH_21, 0); | |
5564 v73 = 0; | |
5565 | |
5566 | |
5567 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5568 { | |
5569 if ( !v73 ) | |
1021 | 5570 { |
1032 | 5571 pMouse->RemoveHoldingItem(); |
5572 return; | |
5573 } | |
5574 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5575 } | |
5576 if ( v73 ) | |
5577 { | |
5578 if ( pParty->bTurnBasedModeOn ) | |
5579 { | |
5580 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5581 thisb->SetRecoveryTime(100); | |
1448 | 5582 pTurnEngine->ApplyPlayerAction(); |
1021 | 5583 } |
5584 else | |
5585 { | |
1032 | 5586 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5587 } |
5588 } | |
1032 | 5589 pMouse->RemoveHoldingItem(); |
5590 return; | |
5591 | |
1021 | 5592 } |
5593 | |
5594 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5595 | |
5596 { | |
5597 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5598 { | |
5599 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5600 v3->PlaySound(SPEECH_37, 0); |
1021 | 5601 return; |
5602 } | |
5603 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5604 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5605 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5606 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5607 return; |
5608 } | |
5609 else | |
1459 | 5610 { |
5611 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5612 { | |
1021 | 5613 thisa = pParty->uCurrentMonthWeek + 1; |
5614 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5615 v74 = NULL; |
1021 | 5616 else |
5617 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5618 switch ( pParty->uCurrentMonth ) | |
5619 { | |
1019 | 5620 case 0: |
1021 | 5621 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5622 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5623 break; |
1019 | 5624 case 1: |
1021 | 5625 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5626 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5627 break; |
1019 | 5628 case 2: |
1021 | 5629 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5630 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5631 break; |
1019 | 5632 case 3: |
1021 | 5633 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5634 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5635 break; |
1019 | 5636 case 4: |
1021 | 5637 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5638 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5639 break; |
1019 | 5640 case 5: |
1021 | 5641 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5642 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5643 break; |
1019 | 5644 case 6: |
1021 | 5645 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5646 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5647 break; |
1019 | 5648 case 7: |
1021 | 5649 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5650 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5651 break; |
1019 | 5652 case 8: |
1021 | 5653 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5654 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5655 break; |
0 | 5656 case 9u: |
1021 | 5657 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5658 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5659 break; |
1019 | 5660 case 10: |
1021 | 5661 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5662 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5663 break; |
1019 | 5664 case 11: |
1021 | 5665 v8 = rand() % 6; |
5666 switch (v8) | |
5667 { | |
5668 case 0: | |
5669 v3->sResFireBase += thisa; | |
5670 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5671 break; | |
5672 case 1: | |
5673 v3->sResAirBase += thisa; | |
5674 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5675 break; | |
5676 case 2: | |
5677 v3->sResWaterBase += thisa; | |
5678 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5679 break; | |
5680 case 3: | |
5681 v3->sResEarthBase += thisa; | |
5682 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5683 break; | |
5684 case 4: | |
5685 v3->sResMindBase += thisa; | |
5686 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5687 break; | |
5688 case 5: | |
5689 v3->sResBodyBase += thisa; | |
5690 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5691 break; |
1021 | 5692 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5693 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5694 break; |
5695 | |
5696 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5697 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5698 pMouse->RemoveHoldingItem(); |
1459 | 5699 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5700 v3->PlaySound(SPEECH_93, 0); |
1032 | 5701 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5702 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5703 { |
1021 | 5704 v3->SetCondition(Condition_Eradicated, 0); |
5705 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5706 } |
1021 | 5707 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5708 { | |
5709 v3->SetCondition(Condition_Dead, 0); | |
5710 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5711 } | |
5712 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5713 { | |
5714 v3->SetCondition(Condition_Pertified, 0); | |
5715 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5716 } | |
1019 | 5717 return; |
1021 | 5718 } |
5719 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5720 { |
1021 | 5721 Party::GiveFood(1u); |
1459 | 5722 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5723 } | |
1021 | 5724 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5725 { | |
1459 | 5726 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5727 return; |
5728 } | |
5729 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5730 { | |
1459 | 5731 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5732 return; |
5733 } | |
5734 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5735 { | |
1459 | 5736 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5737 return; |
5738 } | |
1032 | 5739 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5740 { |
5741 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5742 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5743 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5744 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5745 } | |
5746 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5747 { | |
1459 | 5748 TeleportToNWCDungeon(); |
1021 | 5749 return; |
5750 } | |
0 | 5751 else |
1021 | 5752 { |
5753 | |
5754 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5755 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
|
5756 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5757 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5758 return; |
5759 } | |
1032 | 5760 |
0 | 5761 pMouse->RemoveHoldingItem(); |
5762 return; | |
5763 } | |
1021 | 5764 |
5765 } | |
0 | 5766 |
5767 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5768 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5769 { |
0 | 5770 Player *v3; // esi@1 |
5771 signed int v4; // edi@1 | |
5772 unsigned int v5; // eax@8 | |
5773 int v6; // eax@9 | |
5774 enum CHARACTER_RACE v7; // eax@11 | |
5775 signed int v8; // eax@17 | |
5776 unsigned __int8 v9; // sf@17 | |
5777 unsigned __int8 v10; // of@17 | |
5778 int v11; // eax@19 | |
5779 unsigned int v12; // eax@20 | |
484 | 5780 unsigned int test_bit_value; // eax@25 |
5781 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5782 signed int v15; // ecx@28 |
5783 ItemGen *v16; // eax@28 | |
5784 char v17; // zf@31 | |
5785 int v18; // edi@90 | |
5786 DDM_DLV_Header *v19; // eax@122 | |
5787 char v20; // cl@124 | |
5788 DDM_DLV_Header *v21; // eax@126 | |
5789 unsigned int v22; // edi@129 | |
100 | 5790 Player *v23; // esi@134 |
0 | 5791 ItemGen *v24; // ecx@135 |
5792 signed int v25; // edx@135 | |
5793 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5794 char *v27; // edi@155 | |
5795 int v28; // ebx@161 | |
5796 int v29; // eax@161 | |
5797 | |
469 | 5798 v6 = 0; |
0 | 5799 v3 = this; |
5800 v4 = -1; | |
469 | 5801 if ( VarNum > VAR_AutoNotes ) |
5802 { | |
5803 switch ( VarNum ) | |
0 | 5804 { |
5805 case VAR_Invisible: | |
1167 | 5806 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5807 return true; |
484 | 5808 return false; |
0 | 5809 case VAR_NumDeaths: |
5810 v4 = pParty->uNumDeaths; | |
469 | 5811 return v4 >= pValue; |
0 | 5812 case VAR_NumBounties: |
5813 v4 = pParty->uNumBountiesCollected; | |
469 | 5814 return v4 >= pValue; |
0 | 5815 case VAR_PrisonTerms: |
5816 v4 = pParty->uNumPrisonTerms; | |
469 | 5817 return v4 >= pValue; |
0 | 5818 case VAR_ArenaWinsPage: |
5819 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5820 return v4 >= pValue; |
0 | 5821 case VAR_ArenaWinsSquire: |
5822 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5823 return v4 >= pValue; |
0 | 5824 case VAR_ArenaWinsKnight: |
5825 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5826 return v4 >= pValue; |
0 | 5827 case VAR_ArenaWinsLord: |
5828 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5829 return v4 >= pValue; |
0 | 5830 case VAR_ReputationInCurrentLocation: |
5831 v19 = &pOutdoor->ddm; | |
5832 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5833 v19 = &pIndoor->dlv; | |
469 | 5834 v6 = v19->uReputation >= pValue; |
5835 return v6; | |
0 | 5836 case VAR_History_28|VAR_Sex: |
5837 v21 = &pOutdoor->ddm; | |
5838 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5839 v21 = &pIndoor->dlv; | |
469 | 5840 v6 = v21->field_C_alert == pValue; |
0 | 5841 return v6; |
5842 case VAR_MonthEquals2|VAR_Sex: | |
5843 case VAR_MonthEquals2|VAR_Class: | |
5844 case VAR_Counter1: | |
5845 case VAR_Counter2: | |
5846 case VAR_Counter3: | |
5847 case VAR_Counter4: | |
5848 case VAR_Counter5: | |
5849 case VAR_Counter6: | |
5850 case VAR_Counter7: | |
5851 case VAR_Counter8: | |
469 | 5852 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5853 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5854 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5855 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5856 return true; | |
5857 return false; | |
0 | 5858 case VAR_NumSkillPoints: |
5859 v4 = this->uSkillPoints; | |
469 | 5860 return v4 >= pValue; |
0 | 5861 case VAR_CircusPrises: |
5862 v4 = 0; | |
100 | 5863 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5864 do |
5865 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5866 v24 = v23->pInventoryItemList; |
0 | 5867 v25 = 138; |
5868 do | |
5869 { | |
5870 switch ( v24->uItemID ) | |
5871 { | |
5872 case 0x1D6u: | |
5873 ++v4; | |
5874 break; | |
5875 case 0x1D7u: | |
5876 v4 += 3; | |
5877 break; | |
5878 case 0x1DDu: | |
5879 v4 += 5; | |
5880 break; | |
5881 } | |
5882 ++v24; | |
5883 --v25; | |
5884 } | |
5885 while ( v25 ); | |
100 | 5886 ++v23; |
0 | 5887 } |
100 | 5888 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5889 return v4 >= pValue; |
0 | 5890 case VAR_MonthEquals2: |
469 | 5891 v6 = pParty->uCurrentMonth == pValue; |
5892 return v6; | |
0 | 5893 case VAR_IsFlying: |
5894 if ( pParty->bFlying | |
1167 | 5895 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5896 return true; |
5897 return false; | |
0 | 5898 case VAR_HiredNPCHasSpeciality: |
469 | 5899 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 5900 return v6; |
5901 case VAR_NPCs2: | |
469 | 5902 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 5903 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 5904 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5905 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 5906 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 5907 return v4 >= pValue; |
5908 v4 = pValue; | |
5909 return v4 >= pValue; | |
0 | 5910 case VAR_ItemEquipped: |
5911 v26 = (ITEM_EQUIP_TYPE)0; | |
5912 v27 = (char *)&this->pEquipment; | |
5913 break; | |
5914 case VAR_GoldInBank: | |
5915 v4 = pParty->uNumGoldInBank; | |
469 | 5916 return v4 >= pValue; |
0 | 5917 case VAR_ThieverySkill|0x80: |
5918 v28 = GetActualMight(); | |
5919 v29 = v3->GetBaseStrength(); | |
5920 goto LABEL_168; | |
5921 case VAR_DisarmTrapSkill|0x80: | |
5922 v28 = GetActualIntelligence(); | |
5923 v29 = v3->GetBaseIntelligence(); | |
5924 goto LABEL_168; | |
5925 case VAR_MonthEquals: | |
5926 v28 = GetActualWillpower(); | |
5927 v29 = v3->GetBaseWillpower(); | |
5928 goto LABEL_168; | |
5929 case VAR_MonthEquals|VAR_Sex: | |
5930 v28 = GetActualEndurance(); | |
5931 v29 = v3->GetBaseEndurance(); | |
5932 goto LABEL_168; | |
5933 case VAR_IdentifyMonsterSkill|0x80: | |
5934 v28 = GetActualSpeed(); | |
5935 v29 = v3->GetBaseSpeed(); | |
5936 goto LABEL_168; | |
5937 case VAR_ArmsmasterSkill|0x80: | |
5938 v28 = GetActualAccuracy(); | |
5939 v29 = v3->GetBaseAccuracy(); | |
5940 goto LABEL_168; | |
5941 case VAR_MonthEquals|VAR_MaxHP: | |
5942 v28 = GetActualLuck(); | |
5943 v29 = v3->GetBaseLuck(); | |
5944 LABEL_168: | |
5945 v10 = __OFSUB__(v28, v29); | |
5946 v9 = v28 - v29 < 0; | |
5947 LABEL_169: | |
5948 if ( v9 ^ v10 ) | |
469 | 5949 return v4 >= pValue; |
5950 return true; | |
0 | 5951 default: |
469 | 5952 return v4 >= pValue; |
0 | 5953 } |
5954 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5955 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 5956 { |
5957 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
5958 v27 += 4; | |
5959 if ( (signed int)v26 >= 16 ) | |
469 | 5960 return false; |
5961 } | |
5962 return true; | |
5963 } | |
5964 if ( VarNum == VAR_AutoNotes ) | |
0 | 5965 { |
1033 | 5966 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
5967 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 5968 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
5969 return false; | |
5970 return true; | |
469 | 5971 } |
5972 if ( VarNum <= VAR_BaseLuck ) | |
5973 { | |
5974 if ( VarNum != VAR_BaseLuck ) | |
5975 { | |
5976 switch ( VarNum ) | |
0 | 5977 { |
5978 case VAR_Hour: | |
469 | 5979 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
5980 return true; | |
5981 return false; | |
0 | 5982 case VAR_DayOfYear: |
469 | 5983 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
5984 v6 = v5 == pValue; | |
5985 return v6; | |
0 | 5986 case VAR_DayOfWeek: |
469 | 5987 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
5988 v6 = v5 == pValue; | |
0 | 5989 return v6; |
5990 case VAR_Sex: | |
469 | 5991 if ( pValue == (CHARACTER_RACE)this->uSex ) |
5992 return true; | |
5993 return v4 >= pValue; | |
0 | 5994 case VAR_Class: |
135 | 5995 v7 = (CHARACTER_RACE)this->classType; |
469 | 5996 if ( pValue == v7 ) |
5997 return true; | |
5998 return v4 >= pValue; | |
0 | 5999 case VAR_Race: |
6000 v7 = GetRace(); | |
469 | 6001 if ( pValue == v7 ) |
6002 return true; | |
6003 return v4 >= pValue; | |
0 | 6004 case VAR_CurrentHP: |
6005 v4 = this->sHealth; | |
469 | 6006 return v4 >= pValue; |
0 | 6007 case VAR_MaxHP: |
6008 v8 = GetMaxHealth(); | |
6009 v10 = __OFSUB__(v3->sHealth, v8); | |
6010 v9 = v3->sHealth - v8 < 0; | |
6011 goto LABEL_169; | |
6012 case VAR_CurrentSP: | |
6013 v4 = this->sMana; | |
469 | 6014 return v4 >= pValue; |
0 | 6015 case VAR_MaxSP: |
6016 v11 = GetMaxMana(); | |
6017 v10 = __OFSUB__(v3->sMana, v11); | |
6018 v9 = v3->sMana - v11 < 0; | |
6019 goto LABEL_169; | |
6020 case VAR_ActualAC: | |
6021 v12 = GetActualAC(); | |
6022 goto _j_cmp_against_arg; | |
6023 case VAR_ACModifier: | |
6024 v4 = this->sACModifier; | |
469 | 6025 return v4 >= pValue; |
0 | 6026 case VAR_BaseLevel: |
6027 v4 = this->uLevel; | |
469 | 6028 return v4 >= pValue; |
0 | 6029 case VAR_LevelModifier: |
6030 v4 = this->sLevelModifier; | |
469 | 6031 return v4 >= pValue; |
0 | 6032 case VAR_Age: |
6033 v12 = GetActualAge(); | |
6034 goto _j_cmp_against_arg; | |
6035 case VAR_Award: | |
1033 | 6036 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6037 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6038 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6039 return true; | |
6040 return false; | |
0 | 6041 case VAR_Experience: |
6042 v4 = LODWORD(this->uExperience); | |
469 | 6043 return v4 >= pValue; |
0 | 6044 case VAR_QBits_QuestsDone: |
484 | 6045 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6046 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6047 if ( test_bit_value & our_bit_value ) | |
478 | 6048 return true; |
6049 return false; | |
0 | 6050 case VAR_PlayerItemInHands: |
6051 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6052 v16 = v3->pInventoryItemList; |
0 | 6053 break; |
6054 case VAR_FixedGold: | |
6055 v4 = pParty->uNumGold; | |
469 | 6056 return v4 >= pValue; |
0 | 6057 case VAR_MightBonus: |
6058 v4 = this->uMightBonus; | |
469 | 6059 return v4 >= pValue; |
0 | 6060 case VAR_IntellectBonus: |
6061 v4 = this->uIntelligenceBonus; | |
469 | 6062 return v4 >= pValue; |
0 | 6063 case VAR_PersonalityBonus: |
6064 v4 = this->uWillpowerBonus; | |
469 | 6065 return v4 >= pValue; |
0 | 6066 case VAR_EnduranceBonus: |
6067 v4 = this->uEnduranceBonus; | |
469 | 6068 return v4 >= pValue; |
0 | 6069 case VAR_SpeedBonus: |
6070 v4 = this->uSpeedBonus; | |
469 | 6071 return v4 >= pValue; |
0 | 6072 case VAR_AccuracyBonus: |
6073 v4 = this->uAccuracyBonus; | |
469 | 6074 return v4 >= pValue; |
0 | 6075 case VAR_LuckBonus: |
6076 v4 = this->uLuckBonus; | |
469 | 6077 return v4 >= pValue; |
0 | 6078 case VAR_BaseMight: |
6079 v4 = this->uMight; | |
469 | 6080 return v4 >= pValue; |
0 | 6081 case VAR_BaseIntellect: |
6082 v4 = this->uIntelligence; | |
469 | 6083 return v4 >= pValue; |
0 | 6084 case VAR_BasePersonality: |
6085 v4 = this->uWillpower; | |
469 | 6086 return v4 >= pValue; |
0 | 6087 case VAR_BaseEndurance: |
6088 v4 = this->uEndurance; | |
469 | 6089 return v4 >= pValue; |
0 | 6090 case VAR_BaseSpeed: |
6091 v4 = this->uSpeed; | |
469 | 6092 return v4 >= pValue; |
0 | 6093 case VAR_BaseAccuracy: |
6094 v4 = this->uAccuracy; | |
469 | 6095 return v4 >= pValue; |
0 | 6096 case VAR_FixedFood: |
6097 v4 = pParty->uNumFoodRations; | |
469 | 6098 return v4 >= pValue; |
0 | 6099 default: |
469 | 6100 return v4 >= pValue; |
6101 } | |
6102 while ( v16->uItemID != pValue ) | |
0 | 6103 { |
6104 ++v15; | |
6105 ++v16; | |
6106 if ( v15 >= 138 ) | |
6107 { | |
469 | 6108 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6109 return v6; |
6110 } | |
6111 } | |
469 | 6112 return true; |
0 | 6113 } |
6114 v4 = this->uLuck; | |
469 | 6115 return v4 >= pValue; |
6116 } | |
6117 if ( VarNum <= VAR_MagicResistance ) | |
6118 { | |
6119 if ( VarNum == VAR_MagicResistance ) | |
0 | 6120 { |
6121 v4 = this->sResMagicBase; | |
6122 } | |
6123 else | |
6124 { | |
469 | 6125 switch ( VarNum ) |
0 | 6126 { |
6127 case VAR_FireResistance: | |
6128 v4 = this->sResFireBase; | |
469 | 6129 return v4 >= pValue; |
0 | 6130 case VAR_AirResistance: |
6131 v4 = this->sResAirBase; | |
469 | 6132 return v4 >= pValue; |
0 | 6133 case VAR_WaterResistance: |
6134 v4 = this->sResWaterBase; | |
469 | 6135 return v4 >= pValue; |
0 | 6136 case VAR_EarthResistance: |
6137 v4 = this->sResEarthBase; | |
469 | 6138 return v4 >= pValue; |
0 | 6139 case VAR_SpiritResistance: |
6140 v4 = this->sResSpiritBase; | |
469 | 6141 return v4 >= pValue; |
0 | 6142 case VAR_MindResistance: |
6143 v4 = this->sResMindBase; | |
469 | 6144 return v4 >= pValue; |
0 | 6145 case VAR_BodyResistance: |
6146 v4 = this->sResBodyBase; | |
469 | 6147 return v4 >= pValue; |
0 | 6148 case VAR_LightResistance: |
6149 v4 = this->sResLightBase; | |
469 | 6150 return v4 >= pValue; |
0 | 6151 case VAR_DarkResistance: |
6152 v4 = this->sResDarkBase; | |
469 | 6153 return v4 >= pValue; |
0 | 6154 case VAR_ActualMight: |
6155 v12 = GetActualMight(); | |
6156 goto _j_cmp_against_arg; | |
6157 case VAR_ActualIntellect: | |
6158 v12 = GetActualIntelligence(); | |
6159 goto _j_cmp_against_arg; | |
6160 case VAR_ActualPersonality: | |
6161 v12 = GetActualWillpower(); | |
6162 goto _j_cmp_against_arg; | |
6163 case VAR_ActualEndurance: | |
6164 v12 = GetActualEndurance(); | |
6165 goto _j_cmp_against_arg; | |
6166 case VAR_ActualSpeed: | |
6167 v12 = GetActualSpeed(); | |
6168 goto _j_cmp_against_arg; | |
6169 case VAR_ActualAccuracy: | |
6170 v12 = GetActualAccuracy(); | |
6171 goto _j_cmp_against_arg; | |
6172 case VAR_ActualLuck: | |
6173 v12 = GetActualLuck(); | |
6174 _j_cmp_against_arg: | |
6175 v4 = v12; | |
6176 break; | |
6177 default: | |
469 | 6178 return v4 >= pValue; |
6179 } | |
6180 } | |
6181 return v4 >= pValue; | |
6182 } | |
6183 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6184 { | |
6185 if ( VarNum != VAR_DisarmTrapSkill ) | |
6186 { | |
6187 if ( VarNum <= VAR_MindResistanceBonus ) | |
6188 { | |
6189 switch ( VarNum ) | |
0 | 6190 { |
6191 case VAR_MindResistanceBonus: | |
6192 v4 = this->sResMindBonus; | |
6193 break; | |
6194 case VAR_FireResistanceBonus: | |
6195 v4 = this->sResFireBonus; | |
6196 break; | |
6197 case VAR_AirResistanceBonus: | |
6198 v4 = this->sResAirBonus; | |
6199 break; | |
6200 case VAR_WaterResistanceBonus: | |
6201 v4 = this->sResWaterBonus; | |
6202 break; | |
6203 case VAR_EarthResistanceBonus: | |
6204 v4 = this->sResEarthBonus; | |
6205 break; | |
6206 case VAR_SpiritResistanceBonus: | |
6207 v4 = this->sResSpiritBonus; | |
6208 break; | |
6209 } | |
469 | 6210 return v4 >= pValue; |
6211 } | |
6212 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6213 { |
6214 v4 = this->sResBodyBonus; | |
469 | 6215 return v4 >= pValue; |
6216 } | |
6217 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6218 { |
6219 v4 = this->sResLightBonus; | |
469 | 6220 return v4 >= pValue; |
6221 } | |
6222 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6223 { |
6224 v4 = this->sResDarkBonus; | |
469 | 6225 return v4 >= pValue; |
6226 } | |
6227 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6228 { |
6229 v4 = this->sResMagicBonus; | |
469 | 6230 return v4 >= pValue; |
6231 } | |
6232 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6233 return v4 >= pValue; | |
0 | 6234 } |
6235 LABEL_90: | |
469 | 6236 v18 = *((short *)&this->pConditions[16] + VarNum); |
6237 if ( pValue <= 63 ) | |
0 | 6238 v4 = v18 & 0x3F; |
6239 else | |
469 | 6240 v4 = pValue & v18; |
6241 return v4 >= pValue; | |
6242 } | |
6243 if ( VarNum == 104 ) | |
0 | 6244 goto LABEL_90; |
469 | 6245 if ( (signed int)VarNum <= 104 ) |
6246 return v4 >= pValue; | |
6247 if ( (signed int)VarNum > 0x79 ) | |
6248 { | |
6249 if ( VarNum != 122 ) | |
6250 { | |
6251 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6252 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6253 return v4 >= pValue; | |
0 | 6254 } |
6255 v4 = GetMajorConditionIdx(); | |
6256 if ( v4 != 18 ) | |
6257 { | |
469 | 6258 return v4 >= pValue; |
6259 } | |
6260 v4 = pValue; | |
6261 return v4 >= pValue; | |
6262 } | |
1072 | 6263 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6264 } |
6265 | |
6266 | |
6267 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6268 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6269 { | |
6270 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
|
6271 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
|
6272 unsigned int v5_unused; // edi@1 |
0 | 6273 unsigned int v6; // esi@13 |
6274 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
|
6275 signed int v8_unused; // eax@17 |
0 | 6276 ItemGen *v9; // ecx@17 |
6277 int v10; // eax@21 | |
6278 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
|
6279 Player *unused12; // ecx@44 |
0 | 6280 char *v13; // ecx@45 |
6281 Player *v14; // ecx@49 | |
6282 int v15; // ecx@86 | |
6283 int v16; // esi@106 | |
6284 char v17; // al@106 | |
6285 int v18; // eax@107 | |
6286 Player *v19; // ecx@112 | |
6287 Player *v20; // ecx@127 | |
6288 int v21; // eax@127 | |
6289 int v22; // eax@145 | |
6290 char v23; // zf@146 | |
6291 DDM_DLV_Header *v24; // ecx@148 | |
6292 signed int v25; // eax@172 | |
6293 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
|
6294 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
|
6295 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6296 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
|
6297 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
|
6298 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
|
6299 |
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
|
6300 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
|
6301 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
|
6302 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6303 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
|
6304 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6305 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
|
6306 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
|
6307 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6308 } |
1545 | 6309 |
6310 Assert(currPlayerId != -1); | |
492 | 6311 if ( var_type > VAR_AutoNotes ) |
6312 { | |
6313 if ( var_type <= VAR_GoldInBank ) | |
6314 { | |
6315 if ( var_type == VAR_GoldInBank ) | |
6316 { | |
6317 pParty->uNumGoldInBank = var_value; | |
0 | 6318 return; |
6319 } | |
492 | 6320 if ( var_type <= VAR_Counter8 ) |
6321 { | |
6322 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6323 { |
492 | 6324 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6325 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6326 } |
6327 else | |
6328 { | |
492 | 6329 switch ( var_type ) |
0 | 6330 { |
6331 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6332 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6333 break; |
6334 case VAR_NPCs2: | |
6335 pParty->field_709 = 0; | |
492 | 6336 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6337 pParty->CountHirelings(); |
6338 viewparams->bRedrawGameUI = true; | |
0 | 6339 break; |
6340 case VAR_NumSkillPoints: | |
492 | 6341 this->uSkillPoints = var_value; |
0 | 6342 break; |
6343 } | |
6344 } | |
6345 return; | |
6346 } | |
492 | 6347 if ( var_type < VAR_Counter9 ) |
0 | 6348 return; |
492 | 6349 if ( (signed int)var_type <= 0x112 ) |
6350 { | |
6351 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6352 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6353 } |
6354 else | |
6355 { | |
492 | 6356 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6357 { |
6358 v24 = &pOutdoor->ddm; | |
6359 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6360 v24 = &pIndoor->dlv; | |
492 | 6361 v24->uReputation = var_value; |
6362 if ( var_value > 10000 ) | |
0 | 6363 v24->uReputation = 10000; |
6364 return; | |
6365 } | |
492 | 6366 if ( var_type <= VAR_ReputationInCurrentLocation |
6367 || var_type > VAR_History_28 | |
6368 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6369 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6370 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6371 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6372 v23) ) |
6373 return; | |
6374 bFlashHistoryBook = 1; | |
6375 } | |
492 | 6376 v25 = 8 * currPlayerId + 400; |
862 | 6377 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
|
6378 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6379 return; |
6380 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6381 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6382 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6383 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6384 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
|
6385 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6386 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6387 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6388 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6389 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6390 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6391 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6392 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6393 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6394 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6395 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6396 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6397 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6398 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6399 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6400 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6401 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6402 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6403 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6404 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6405 return; |
0 | 6406 } |
492 | 6407 if ( var_type == VAR_AutoNotes ) |
6408 { | |
6409 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
|
6410 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6411 && pAutonoteTxt[var_value].pText ) |
492 | 6412 { |
6413 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6414 v20->PlaySound(SPEECH_96, 0); |
1453 | 6415 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6416 bFlashAutonotesBook = 1; |
1453 | 6417 _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
|
6418 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6419 } |
1453 | 6420 _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
|
6421 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6422 return; |
0 | 6423 } |
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
|
6424 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
|
6425 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6426 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
|
6427 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6428 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
|
6429 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
|
6430 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
|
6431 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
|
6432 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
|
6433 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
|
6434 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6435 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6436 for (int i = 0; i < 138; i++) |
0 | 6437 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6438 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6439 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
|
6440 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
|
6441 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6442 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
|
6443 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6444 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
|
6445 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6446 *(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
|
6447 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6448 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
|
6449 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
|
6450 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
|
6451 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
|
6452 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
|
6453 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
|
6454 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
|
6455 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
|
6456 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
|
6457 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
|
6458 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
|
6459 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
|
6460 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
|
6461 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
|
6462 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6463 this->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
|
6464 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
|
6465 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6466 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
|
6467 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6468 this->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
|
6469 this->uVoiceID = 20; |
0 | 6470 } |
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
|
6471 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
|
6472 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6473 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
|
6474 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
|
6475 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
|
6476 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
|
6477 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
|
6478 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
|
6479 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
|
6480 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
|
6481 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
|
6482 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
|
6483 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
|
6484 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
|
6485 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
|
6486 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
|
6487 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
|
6488 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6489 case VAR_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
|
6490 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
|
6491 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6492 case VAR_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
|
6493 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
|
6494 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
|
6495 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
|
6496 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
|
6497 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
|
6498 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
|
6499 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
|
6500 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
|
6501 //&& 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
|
6502 && 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
|
6503 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6504 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
|
6505 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6506 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
|
6507 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6508 _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
|
6509 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
|
6510 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
|
6511 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
|
6512 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
|
6513 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
|
6514 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
|
6515 // && (&dword_722F10)[4 * a3] ) |
1310 | 6516 && pQuestTable[var_value] ) |
0 | 6517 { |
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
|
6518 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
|
6519 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
|
6520 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
|
6521 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6522 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
|
6523 } |
7ef8ae7ce42a
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 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
|
6525 _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
|
6526 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
|
6527 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
|
6528 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
|
6529 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
|
6530 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
|
6531 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
|
6532 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
|
6533 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
|
6534 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
|
6535 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
|
6536 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
|
6537 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
|
6538 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
|
6539 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
|
6540 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
|
6541 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
|
6542 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
|
6543 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
|
6544 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
|
6545 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6546 case VAR_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
|
6547 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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6556 case VAR_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
|
6557 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
|
6558 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
|
6559 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
|
6560 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
|
6561 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
|
6562 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
|
6563 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
|
6564 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
|
6565 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
|
6566 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
|
6567 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
|
6568 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
|
6569 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
|
6570 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
|
6571 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
|
6572 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6573 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
|
6574 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
|
6575 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
|
6576 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6577 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
|
6578 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
|
6579 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
|
6580 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6581 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
|
6582 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
|
6583 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
|
6584 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6585 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
|
6586 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
|
6587 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
|
6588 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6589 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
|
6590 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
|
6591 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
|
6592 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6593 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
|
6594 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
|
6595 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
|
6596 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6597 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
|
6598 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
|
6599 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
|
6600 } |
0 | 6601 LABEL_111: |
187 | 6602 v26 = SPEECH_91; |
0 | 6603 LABEL_112: |
492 | 6604 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6605 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
|
6606 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6607 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6608 return; |
0 | 6609 } |
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 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
|
6611 { |
492 | 6612 switch ( var_type ) |
0 | 6613 { |
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
|
6614 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
|
6615 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
|
6616 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
|
6617 goto LABEL_111; |
0 | 6618 case VAR_ActualIntellect: |
6619 LABEL_68: | |
492 | 6620 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6621 goto LABEL_111; |
6622 case VAR_ActualPersonality: | |
6623 LABEL_69: | |
492 | 6624 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6625 goto LABEL_111; |
6626 case VAR_ActualEndurance: | |
6627 LABEL_70: | |
492 | 6628 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6629 goto LABEL_111; |
6630 case VAR_ActualSpeed: | |
6631 LABEL_71: | |
492 | 6632 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6633 goto LABEL_111; |
6634 case VAR_ActualAccuracy: | |
6635 LABEL_72: | |
492 | 6636 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6637 goto LABEL_111; |
6638 case VAR_ActualLuck: | |
6639 LABEL_73: | |
492 | 6640 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6641 goto LABEL_111; |
6642 case VAR_FireResistance: | |
492 | 6643 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
|
6644 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6645 goto LABEL_112; |
0 | 6646 case VAR_AirResistance: |
492 | 6647 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
|
6648 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6649 goto LABEL_112; |
0 | 6650 case VAR_WaterResistance: |
492 | 6651 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
|
6652 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6653 goto LABEL_112; |
0 | 6654 case VAR_EarthResistance: |
492 | 6655 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
|
6656 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6657 goto LABEL_112; |
0 | 6658 case VAR_SpiritResistance: |
492 | 6659 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
|
6660 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6661 goto LABEL_112; |
0 | 6662 case VAR_MindResistance: |
492 | 6663 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
|
6664 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6665 goto LABEL_112; |
0 | 6666 case VAR_BodyResistance: |
492 | 6667 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
|
6668 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6669 goto LABEL_112; |
0 | 6670 case VAR_LightResistance: |
492 | 6671 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
|
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; |
0 | 6674 case VAR_DarkResistance: |
492 | 6675 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
|
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; |
0 | 6678 case VAR_MagicResistance: |
492 | 6679 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6680 v26 = 92; |
6681 goto LABEL_112; | |
6682 default: | |
6683 return; | |
6684 } | |
6685 return; | |
6686 } | |
6687 HIWORD(v15) = 0; | |
492 | 6688 if ( var_type > VAR_DisarmTrapSkill ) |
6689 { | |
6690 if ( var_type != VAR_LearningSkill ) | |
6691 { | |
6692 if ( var_type <= VAR_LearningSkill ) | |
0 | 6693 return; |
492 | 6694 if ( var_type <= VAR_Eradicated ) |
6695 { | |
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
|
6696 this->SetCondition(var_type - 105, 1); |
0 | 6697 } |
6698 else | |
6699 { | |
492 | 6700 if ( var_type != VAR_MajorCondition ) |
0 | 6701 { |
492 | 6702 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6703 byte_5E4C15[var_type] = var_value; | |
0 | 6704 return; |
6705 } | |
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
|
6706 memset(this, 0, 0xA0u); |
0 | 6707 } |
6708 } | |
6709 else | |
6710 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6711 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
|
6712 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6713 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6714 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6715 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6716 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6717 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6718 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6719 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6720 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
|
6721 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6722 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6723 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6724 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6725 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6726 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6727 return; |
0 | 6728 } |
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
|
6729 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6730 { |
6731 switch ( var_type ) | |
0 | 6732 { |
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
|
6733 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
|
6734 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6735 break; |
6736 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
|
6737 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6738 break; |
6739 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
|
6740 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6741 break; |
6742 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
|
6743 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6744 break; |
6745 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
|
6746 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
|
6747 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
|
6748 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
|
6749 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
|
6750 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
|
6751 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
|
6752 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
|
6753 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
|
6754 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
|
6755 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
|
6756 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
|
6757 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
|
6758 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
|
6759 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
|
6760 case VAR_PhysicalResistanceBonus: |
1545 | 6761 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
|
6762 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
|
6763 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6764 case VAR_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
|
6765 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6766 break; |
6767 default: | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
6768 Error("Unexpected var_type: %u", var_type); |
0 | 6769 return; |
6770 break; | |
6771 } | |
6772 goto LABEL_111; | |
6773 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6774 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
|
6775 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6776 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6777 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6778 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6779 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6780 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6781 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6782 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
|
6783 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6784 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
|
6785 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
|
6786 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
|
6787 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6788 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6789 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6790 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
|
6791 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6792 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
|
6793 } |
0 | 6794 |
6795 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6796 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6797 { |
6798 char v3; // bl@1 | |
6799 Player *v4; // esi@1 | |
6800 signed int uPlayerIdx; // edi@1 | |
6801 int v6; // eax@15 | |
6802 unsigned int v7; // esi@18 | |
6803 int *v8; // ebx@21 | |
6804 int v9; // eax@22 | |
6805 signed int v10; // eax@24 | |
6806 int v11; // eax@27 | |
6807 __int16 *v12; // esi@28 | |
6808 Player *v13; // ecx@34 | |
6809 Player *v14; // ecx@36 | |
6810 char *v15; // ecx@37 | |
6811 unsigned __int8 v16; // cf@38 | |
6812 Player *v17; // ecx@42 | |
6813 __int16 *v18; // esi@53 | |
6814 __int16 *v19; // esi@62 | |
6815 char *v20; // esi@107 | |
6816 __int16 v21; // dx@107 | |
6817 int v22; // ecx@107 | |
6818 Player *v23; // ecx@132 | |
6819 int v24; // eax@132 | |
6820 int v25; // eax@150 | |
6821 char v26; // zf@151 | |
6822 DDM_DLV_Header *v27; // eax@153 | |
6823 signed int v28; // eax@176 | |
6824 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6825 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6826 int v31; // [sp-4h] [bp-3Ch]@84 |
6827 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6828 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6829 char v34; // [sp+37h] [bp-1h]@1 | |
6830 | |
6831 auto Dst = this; | |
6832 v3 = 0; | |
6833 v34 = 0; | |
6834 v4 = Dst; | |
6835 uPlayerIdx = 0; | |
6836 if ( Dst == pPlayers[2] ) | |
6837 uPlayerIdx = 1; | |
310 | 6838 else if ( Dst == pPlayers[3] ) |
6839 uPlayerIdx = 2; | |
6840 else if ( Dst == pPlayers[4] ) | |
6841 uPlayerIdx = 3; | |
6842 | |
6843 if ( var_type <= VAR_AutoNotes ) | |
6844 { | |
6845 if ( var_type != VAR_AutoNotes ) | |
6846 { | |
6847 if ( var_type <= VAR_ActualMight ) | |
6848 { | |
6849 if ( var_type != VAR_ActualMight ) | |
0 | 6850 { |
310 | 6851 switch ( var_type ) |
0 | 6852 { |
6853 case VAR_RandomGold: | |
6854 if ( !val ) | |
6855 val = 1; | |
6856 v6 = rand(); | |
6857 party_finds_gold(v6 % val + 1, 1); | |
6858 GameUI_DrawFoodAndGold(); | |
6859 return; | |
6860 case VAR_RandomFood: | |
6861 if ( !val ) | |
6862 val = 1; | |
6863 v7 = rand() % val + 1; | |
6864 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6865 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
|
6866 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6867 GameUI_DrawFoodAndGold(); |
6868 goto _play_sound; | |
6869 case VAR_Sex: | |
6870 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6871 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6872 goto _play_sound; | |
0 | 6873 case VAR_Class: |
135 | 6874 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6875 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6876 goto _play_sound; | |
0 | 6877 case VAR_CurrentHP: |
6878 v8 = &Dst->sHealth; | |
6879 *v8 += val; | |
6880 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6881 { |
6882 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6883 goto _play_sound; | |
6884 } | |
0 | 6885 v9 = v4->GetMaxHealth(); |
6886 goto LABEL_23; | |
6887 case VAR_MaxHP: | |
6888 v10 = Dst->GetMaxHealth(); | |
6889 v4->_health_related = 0; | |
6890 v4->uFullHealthBonus = 0; | |
6891 v4->sHealth = v10; | |
6892 return; | |
6893 case VAR_CurrentSP: | |
6894 v8 = &Dst->sMana; | |
6895 *v8 += val; | |
6896 if ( Dst->sMana > GetMaxMana() ) | |
6897 { | |
6898 v9 = v4->GetMaxMana(); | |
6899 LABEL_23: | |
6900 *v8 = v9; | |
6901 } | |
1507 | 6902 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6903 goto _play_sound; | |
0 | 6904 case VAR_MaxSP: |
6905 v11 = GetMaxMana(); | |
6906 v4->_mana_related = 0; | |
6907 v4->uFullManaBonus = 0; | |
6908 v4->sMana = v11; | |
6909 return; | |
6910 case VAR_ACModifier: | |
6911 v12 = &Dst->sACModifier; | |
6912 goto LABEL_29; | |
6913 case VAR_BaseLevel: | |
6914 v12 = (__int16 *)&Dst->uLevel; | |
6915 goto LABEL_29; | |
6916 case VAR_LevelModifier: | |
6917 v12 = &Dst->sLevelModifier; | |
6918 LABEL_29: | |
6919 *v12 += val; | |
6920 if ( *v12 > 255 ) | |
6921 *v12 = 255; | |
1507 | 6922 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6923 goto _play_sound; | |
0 | 6924 case VAR_Age: |
6925 Dst->sAgeModifier += val; | |
6926 return; | |
6927 case VAR_Award: | |
6928 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6929 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 6930 |
492 | 6931 && pAwards[val].pText ) |
0 | 6932 { |
6933 v14 = pPlayers[uPlayerIdx + 1]; | |
6934 v34 = 1; | |
6935 v3 = 1; | |
187 | 6936 v14->PlaySound(SPEECH_96, 0); |
0 | 6937 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6938 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 6939 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6940 if ( v34 != 1 ) | |
6941 { | |
6942 if ( v3 != 1 ) | |
6943 return; | |
6944 goto _play_sound; | |
6945 } | |
6946 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6947 if ( v3 != 1 ) | |
6948 return; | |
6949 goto _play_sound; | |
0 | 6950 case VAR_Experience: |
6951 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
6952 LODWORD(Dst->uExperience) += val; | |
6953 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
6954 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
6955 Dst->uExperience = 4000000000i64; | |
1507 | 6956 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6957 goto _play_sound; | |
0 | 6958 case VAR_QBits_QuestsDone: |
484 | 6959 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
|
6960 //&& (&dword_722F10)[4 * val] ) |
1310 | 6961 && pQuestTable[val] ) |
0 | 6962 { |
501 | 6963 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 6964 bFlashQuestBook = 1; |
6965 v34 = 1; | |
6966 v3 = 1; | |
501 | 6967 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 6968 } |
484 | 6969 v15 = (char *)pParty->_quest_bits; |
1507 | 6970 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6971 if ( v34 != 1 ) | |
6972 { | |
6973 if ( v3 != 1 ) | |
6974 return; | |
6975 goto _play_sound; | |
6976 } | |
6977 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6978 if ( v3 != 1 ) | |
6979 return; | |
6980 goto _play_sound; | |
0 | 6981 case VAR_PlayerItemInHands: |
6982 item.Reset(); | |
6983 item.Reset(); | |
6984 item.uAttributes = 1; | |
6985 item.uItemID = val; | |
6986 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 6987 pParty->pIsArtifactFound[val-500] = 1; |
0 | 6988 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
6989 { | |
6990 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
6991 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
6992 } | |
6993 pParty->SetHoldingItem(&item); | |
6994 return; | |
6995 case VAR_FixedGold: | |
6996 party_finds_gold(val, 1); | |
6997 return; | |
6998 case VAR_BaseMight: | |
6999 v18 = (__int16 *)&Dst->uMight; | |
7000 goto LABEL_82; | |
7001 case VAR_BaseIntellect: | |
7002 v18 = (__int16 *)&Dst->uIntelligence; | |
7003 goto LABEL_82; | |
7004 case VAR_BasePersonality: | |
7005 v18 = (__int16 *)&Dst->uWillpower; | |
7006 goto LABEL_82; | |
7007 case VAR_BaseEndurance: | |
7008 v18 = (__int16 *)&Dst->uEndurance; | |
7009 goto LABEL_82; | |
7010 case VAR_BaseSpeed: | |
7011 v18 = (__int16 *)&Dst->uSpeed; | |
7012 goto LABEL_82; | |
7013 case VAR_BaseAccuracy: | |
7014 v18 = (__int16 *)&Dst->uAccuracy; | |
7015 goto LABEL_82; | |
7016 case VAR_BaseLuck: | |
7017 v18 = (__int16 *)&Dst->uLuck; | |
7018 goto LABEL_82; | |
7019 case VAR_FixedFood: | |
7020 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7021 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7022 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7023 if ( pParty->uNumFoodRations > 0xFFFF ) |
7024 Party::SetFood(0xFFFFu); | |
7025 goto _play_sound; | |
7026 case VAR_MightBonus: | |
7027 goto LABEL_62; | |
7028 case VAR_IntellectBonus: | |
7029 goto LABEL_66; | |
7030 case VAR_PersonalityBonus: | |
7031 goto LABEL_67; | |
7032 case VAR_EnduranceBonus: | |
7033 goto LABEL_68; | |
7034 case VAR_SpeedBonus: | |
7035 goto LABEL_69; | |
7036 case VAR_AccuracyBonus: | |
7037 goto LABEL_70; | |
7038 case VAR_LuckBonus: | |
7039 goto LABEL_71; | |
7040 default: | |
7041 return; | |
7042 } | |
7043 return; | |
7044 } | |
7045 LABEL_62: | |
7046 v19 = (__int16 *)&Dst->uMightBonus; | |
7047 goto LABEL_113; | |
7048 } | |
310 | 7049 if ( var_type <= VAR_FireResistanceBonus ) |
7050 { | |
7051 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7052 { |
310 | 7053 switch ( var_type ) |
0 | 7054 { |
7055 case VAR_ActualIntellect: | |
7056 LABEL_66: | |
7057 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7058 goto LABEL_113; | |
7059 case VAR_ActualPersonality: | |
7060 LABEL_67: | |
7061 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7062 goto LABEL_113; | |
7063 case VAR_ActualEndurance: | |
7064 LABEL_68: | |
7065 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7066 goto LABEL_113; | |
7067 case VAR_ActualSpeed: | |
7068 LABEL_69: | |
7069 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7070 goto LABEL_113; | |
7071 case VAR_ActualAccuracy: | |
7072 LABEL_70: | |
7073 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7074 goto LABEL_113; | |
7075 case VAR_ActualLuck: | |
7076 LABEL_71: | |
7077 v19 = (__int16 *)&Dst->uLuckBonus; | |
7078 goto LABEL_113; | |
7079 case VAR_FireResistance: | |
7080 v18 = &Dst->sResFireBase; | |
7081 goto LABEL_82; | |
7082 case VAR_AirResistance: | |
7083 v18 = &Dst->sResAirBase; | |
7084 goto LABEL_82; | |
7085 case VAR_WaterResistance: | |
7086 v18 = &Dst->sResWaterBase; | |
7087 goto LABEL_82; | |
7088 case VAR_EarthResistance: | |
7089 v18 = &Dst->sResEarthBase; | |
7090 goto LABEL_82; | |
7091 case VAR_SpiritResistance: | |
7092 v18 = &Dst->sResSpiritBase; | |
7093 goto LABEL_82; | |
7094 case VAR_MindResistance: | |
7095 v18 = &Dst->sResMindBase; | |
7096 goto LABEL_82; | |
7097 case VAR_BodyResistance: | |
7098 v18 = &Dst->sResBodyBase; | |
7099 goto LABEL_82; | |
7100 case VAR_LightResistance: | |
7101 v18 = &Dst->sResLightBase; | |
7102 goto LABEL_82; | |
7103 case VAR_DarkResistance: | |
7104 v18 = &Dst->sResDarkBase; | |
7105 goto LABEL_82; | |
7106 case VAR_MagicResistance: | |
7107 v18 = &Dst->sResMagicBase; | |
7108 LABEL_82: | |
7109 *v18 += val; | |
7110 if ( *v18 > 255 ) | |
7111 *v18 = 255; | |
1507 | 7112 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7113 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7114 goto _play_sound; | |
0 | 7115 default: |
7116 return; | |
7117 } | |
7118 return; | |
7119 } | |
7120 v19 = &Dst->sResFireBonus; | |
7121 LABEL_113: | |
7122 *v19 += val; | |
7123 if ( *v19 > 255 ) | |
7124 *v19 = 255; | |
7125 v31 = 0; | |
187 | 7126 v29 = SPEECH_91; |
7127 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7128 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7129 goto _play_sound; | |
0 | 7130 } |
310 | 7131 if ( var_type <= VAR_DisarmTrapSkill ) |
7132 { | |
7133 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7134 { |
310 | 7135 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7136 { |
310 | 7137 switch ( var_type ) |
0 | 7138 { |
7139 case VAR_BodyResistanceBonus: | |
7140 v19 = &Dst->sResBodyBonus; | |
7141 break; | |
7142 case VAR_AirResistanceBonus: | |
7143 v19 = &Dst->sResAirBonus; | |
7144 break; | |
7145 case VAR_WaterResistanceBonus: | |
7146 v19 = &Dst->sResWaterBonus; | |
7147 break; | |
7148 case VAR_EarthResistanceBonus: | |
7149 v19 = &Dst->sResEarthBonus; | |
7150 break; | |
7151 case VAR_SpiritResistanceBonus: | |
7152 v19 = &Dst->sResSpiritBonus; | |
7153 break; | |
7154 default: | |
310 | 7155 if ( var_type != 62 ) |
0 | 7156 return; |
7157 v19 = &Dst->sResMindBonus; | |
7158 break; | |
7159 } | |
7160 goto LABEL_113; | |
7161 } | |
310 | 7162 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7163 { |
7164 v19 = &Dst->sResLightBonus; | |
7165 goto LABEL_113; | |
7166 } | |
310 | 7167 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7168 { |
7169 v19 = &Dst->sResDarkBonus; | |
7170 goto LABEL_113; | |
7171 } | |
310 | 7172 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7173 { |
7174 v19 = &Dst->sResMagicBonus; | |
7175 goto LABEL_113; | |
7176 } | |
310 | 7177 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7178 return; |
7179 } | |
7180 goto LABEL_106; | |
7181 } | |
310 | 7182 if ( var_type == VAR_LearningSkill ) |
0 | 7183 { |
7184 LABEL_106: | |
7185 if ( val <= VAR_BodyResistanceBonus ) | |
7186 { | |
310 | 7187 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7188 } |
7189 else | |
7190 { | |
310 | 7191 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7192 v21 = *(short *)v20; |
7193 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7194 if ( v22 > 60 ) | |
7195 LOWORD(v22) = 60; | |
7196 LOBYTE(v21) = v21 & 0xC0; | |
7197 *(short *)v20 = v22 | v21; | |
7198 } | |
1507 | 7199 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7200 goto _play_sound; | |
0 | 7201 } |
310 | 7202 if ( var_type <= VAR_LearningSkill ) |
0 | 7203 return; |
310 | 7204 if ( var_type <= VAR_Eradicated ) |
7205 { | |
7206 Dst->SetCondition(var_type - 105, 0); | |
0 | 7207 } |
7208 else | |
7209 { | |
310 | 7210 if ( var_type != VAR_MajorCondition ) |
0 | 7211 { |
310 | 7212 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7213 { |
310 | 7214 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7215 byte_5E4C15[var_type] += val; | |
0 | 7216 else |
310 | 7217 byte_5E4C15[var_type] = -1; |
0 | 7218 } |
7219 return; | |
7220 } | |
7221 memset(Dst, 0, 0xA0u); | |
7222 } | |
7223 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7224 goto _play_sound; | |
7225 } | |
7226 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
|
7227 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7228 && pAutonoteTxt[val].pText ) |
0 | 7229 { |
7230 v23 = pPlayers[uPlayerIdx + 1]; | |
7231 v34 = 1; | |
187 | 7232 v23->PlaySound(SPEECH_96, 0); |
1453 | 7233 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7234 bFlashAutonotesBook = 1; |
1453 | 7235 _506568_autonote_type = pAutonoteTxt[val].eType; |
7236 } | |
7237 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7238 v3 = 1; |
7239 if ( v34 != 1 ) | |
1507 | 7240 { |
7241 if ( v3 != 1 ) | |
7242 return; | |
7243 goto _play_sound; | |
7244 } | |
7245 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7246 if ( v3 != 1 ) | |
7247 return; | |
7248 goto _play_sound; | |
0 | 7249 } |
310 | 7250 if ( var_type > VAR_GoldInBank ) |
7251 { | |
7252 if ( var_type == 307 ) | |
0 | 7253 { |
7254 pParty->uNumDeaths += val; | |
1507 | 7255 if ( v34 != 1 ) |
7256 { | |
7257 if ( v3 != 1 ) | |
7258 return; | |
7259 goto _play_sound; | |
7260 } | |
7261 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7262 if ( v3 != 1 ) | |
7263 return; | |
7264 goto _play_sound; | |
0 | 7265 } |
310 | 7266 switch ( var_type ) |
0 | 7267 { |
7268 case 308: | |
7269 pParty->uNumBountiesCollected += val; | |
7270 break; | |
7271 case 309: | |
7272 pParty->uNumPrisonTerms += val; | |
7273 break; | |
7274 case 310: | |
7275 pParty->uNumArenaPageWins += val; | |
7276 break; | |
7277 case 311: | |
7278 pParty->uNumArenaSquireWins += val; | |
7279 break; | |
7280 case 312: | |
7281 pParty->uNumArenaKnightWins += val; | |
7282 break; | |
7283 case 313: | |
7284 pParty->uNumArenaLordWins += val; | |
7285 break; | |
7286 } | |
7287 } | |
7288 else | |
7289 { | |
310 | 7290 if ( var_type == VAR_GoldInBank ) |
0 | 7291 { |
7292 pParty->uNumGoldInBank += val; | |
7293 return; | |
7294 } | |
310 | 7295 if ( var_type <= VAR_Counter8 ) |
7296 { | |
7297 if ( (signed int)var_type >= 245 ) | |
7298 { | |
7299 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7300 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7301 } |
7302 else | |
7303 { | |
310 | 7304 switch ( var_type ) |
0 | 7305 { |
7306 case VAR_MonthEquals|VAR_CurrentSP: | |
7307 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7308 break; | |
7309 case VAR_NPCs2: | |
7310 pParty->field_709 = 0; | |
7311 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7312 pParty->CountHirelings(); |
7313 viewparams->bRedrawGameUI = true; | |
0 | 7314 break; |
7315 case VAR_NumSkillPoints: | |
7316 Dst->uSkillPoints += val; | |
7317 break; | |
7318 } | |
7319 } | |
7320 return; | |
7321 } | |
310 | 7322 if ( var_type < VAR_Counter9 ) |
0 | 7323 return; |
310 | 7324 if ( (signed int)var_type <= 274 ) |
7325 { | |
7326 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7327 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7328 goto _play_sound; |
7329 } | |
310 | 7330 if ( var_type != VAR_ReputationInCurrentLocation ) |
7331 { | |
7332 if ( var_type <= VAR_ReputationInCurrentLocation | |
7333 || var_type > VAR_History_28 | |
7334 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7335 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7336 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7337 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7338 v26) ) |
7339 return; | |
7340 bFlashHistoryBook = 1; | |
7341 _play_sound: | |
7342 v28 = 8 * uPlayerIdx + 400; | |
862 | 7343 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7344 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7345 return; | |
7346 } | |
7347 v27 = &pOutdoor->ddm; | |
7348 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7349 v27 = &pIndoor->dlv; | |
7350 v27->uReputation += val; | |
7351 if ( v27->uReputation > 10000 ) | |
7352 v27->uReputation = 10000; | |
7353 } | |
7354 } | |
7355 | |
7356 | |
7357 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7358 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7359 { |
7360 unsigned int v3; // ebx@1 | |
7361 signed int v4; // esi@1 | |
501 | 7362 bool result; // eax@8 |
0 | 7363 int v6; // esi@11 |
7364 int v7; // edi@14 | |
7365 signed int v8; // eax@17 | |
7366 char *v9; // eax@20 | |
7367 char v10; // sf@20 | |
7368 char *v11; // ecx@26 | |
7369 char *v12; // ecx@27 | |
7370 __int64 v13; // qax@27 | |
7371 unsigned __int8 v14; // cf@27 | |
501 | 7372 int *v15; // edx@29 |
0 | 7373 char *v16; // eax@90 |
7374 char *v17; // ecx@94 | |
501 | 7375 int v18; // esi@97 |
0 | 7376 signed int v19; // edx@97 |
7377 char *v20; // ecx@98 | |
7378 int v21; // eax@100 | |
7379 __int16 v22; // dx@112 | |
7380 int v23; // [sp-8h] [bp-14h]@45 | |
7381 signed int v24; // [sp-4h] [bp-10h]@4 | |
7382 int v25; // [sp-4h] [bp-10h]@45 | |
7383 | |
7384 v3 = 0; | |
605 | 7385 v4 = uActiveCharacter - 1; |
501 | 7386 result = false; |
7387 if ( (signed int)VarNum > 222 ) | |
7388 { | |
7389 if ( (signed int)VarNum <= 307 ) | |
7390 { | |
7391 if ( VarNum == 307 ) | |
7392 { | |
7393 pParty->uNumDeaths -= (unsigned int)pValue; | |
7394 return pValue; | |
7395 } | |
7396 if ( VarNum == 223 ) | |
0 | 7397 { |
7398 v11 = (char *)pParty->_autonote_bits; | |
501 | 7399 v22 = (short)pValue - 1; |
0 | 7400 } |
7401 else | |
7402 { | |
501 | 7403 if ( VarNum != 231 ) |
0 | 7404 { |
501 | 7405 switch ( VarNum ) |
0 | 7406 { |
7407 case 232: | |
501 | 7408 VarNum = (VariableType)0; |
1094 | 7409 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7410 result = (bool) pValue; |
7411 dword_5B65CC = 0; | |
7412 if ( (int)VarNum == pValue ) | |
0 | 7413 { |
501 | 7414 dword_5B65CC = (int)pValue; |
0 | 7415 } |
7416 else | |
7417 { | |
7418 pParty->field_709 = 0; | |
501 | 7419 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7420 pParty->CountHirelings(); |
7421 viewparams->bRedrawGameUI = true; | |
0 | 7422 } |
7423 break; | |
7424 case 241: | |
7425 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7426 { | |
7427 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7428 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7429 { |
605 | 7430 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7431 { |
7432 v21 = *(int *)v20; | |
7433 if ( (char)*(int *)v20 < 0 ) | |
7434 { | |
7435 LOBYTE(v21) = v21 & 0x7F; | |
7436 *(int *)v20 = v21; | |
7437 } | |
7438 } | |
7439 v20 += 76; | |
7440 } | |
7441 } | |
605 | 7442 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7443 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7444 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7445 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7446 pParty->field_709 = 0; | |
1035 | 7447 pParty->CountHirelings(); |
0 | 7448 break; |
7449 case 243: | |
7450 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7451 result = *v17 != NULL; |
501 | 7452 if ( (unsigned int)pValue <= *(int *)v17 ) |
7453 { | |
7454 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7455 result = (v17 != NULL); |
501 | 7456 } |
0 | 7457 else |
7458 *(int *)v17 = 0; | |
7459 break; | |
7460 case 275: | |
7461 v16 = (char *)&pOutdoor->ddm; | |
7462 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7463 v16 = (char *)&pIndoor->dlv; | |
501 | 7464 *((int *)v16 + 2) -= (int)pValue; |
0 | 7465 if ( *((int *)v16 + 2) < -10000 ) |
7466 *((int *)v16 + 2) = -10000; | |
7467 break; | |
7468 case 306: | |
501 | 7469 result = VarNum - 306; |
7470 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7471 { | |
7472 result = (bool)pValue; | |
7473 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7474 } |
0 | 7475 else |
7476 LABEL_88: | |
7477 dword_5B65C4 = 1; | |
7478 break; | |
7479 } | |
501 | 7480 return result; |
0 | 7481 } |
7482 v11 = this->field_1A50; | |
501 | 7483 v22 = (signed __int16)pValue; |
0 | 7484 } |
7485 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7486 return result; |
7487 } | |
7488 switch ( VarNum ) | |
0 | 7489 { |
7490 case 308: | |
501 | 7491 result = (bool)pValue; |
7492 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7493 break; |
7494 case 309: | |
501 | 7495 result = (bool)pValue; |
7496 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7497 break; |
7498 case 310: | |
501 | 7499 result = (bool)pValue; |
7500 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7501 break; |
7502 case 311: | |
501 | 7503 result = (bool)pValue; |
7504 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7505 break; |
7506 case 312: | |
501 | 7507 result = (bool)pValue; |
7508 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7509 break; |
7510 case 313: | |
501 | 7511 result = (bool)pValue; |
7512 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7513 break; |
7514 } | |
1545 | 7515 Error("Function not returning any value! (%u)", VarNum); |
0 | 7516 } |
7517 else | |
7518 { | |
501 | 7519 if ( (signed int)VarNum >= 123 ) |
7520 { | |
7521 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7522 } |
7523 else | |
7524 { | |
501 | 7525 switch ( VarNum ) |
0 | 7526 { |
7527 case VAR_RandomGold: | |
501 | 7528 v6 = rand() % (signed int)pValue + 1; |
0 | 7529 if ( v6 > pParty->uNumGold ) |
7530 v6 = pParty->uNumGold; | |
7531 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7532 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7533 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7534 GameUI_DrawFoodAndGold(); |
501 | 7535 return result; |
0 | 7536 case VAR_RandomFood: |
501 | 7537 v7 = rand() % (signed int)pValue + 1; |
0 | 7538 if ( v7 > pParty->uNumFoodRations ) |
7539 v7 = pParty->uNumFoodRations; | |
7540 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7541 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7542 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7543 GameUI_DrawFoodAndGold(); |
605 | 7544 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7545 v8 = 8 * v4 + 400; | |
862 | 7546 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7547 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7548 return result; |
0 | 7549 case VAR_CurrentHP: |
1036 | 7550 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7551 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7552 v8 = 8 * v4 + 400; | |
862 | 7553 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7554 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7555 return result; | |
0 | 7556 case VAR_CurrentSP: |
7557 v9 = (char *)&this->sMana; | |
501 | 7558 v10 = this->sMana - (signed int)pValue < 0; |
7559 *(int *)v9 -= (int)pValue; | |
0 | 7560 if ( v10 ) |
7561 *(int *)v9 = 0; | |
605 | 7562 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7563 v8 = 8 * v4 + 400; | |
862 | 7564 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7565 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7566 return result; | |
0 | 7567 case VAR_ACModifier: |
501 | 7568 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7569 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7570 v8 = 8 * v4 + 400; | |
862 | 7571 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7572 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7573 return result; | |
0 | 7574 case VAR_BaseLevel: |
501 | 7575 this->uLevel -= (unsigned __int8)pValue; |
605 | 7576 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7577 v8 = 8 * v4 + 400; | |
862 | 7578 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7579 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7580 return result; | |
0 | 7581 case VAR_LevelModifier: |
501 | 7582 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7583 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7584 v8 = 8 * v4 + 400; | |
862 | 7585 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7586 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7587 return result; | |
0 | 7588 case VAR_Age: |
501 | 7589 this->sAgeModifier -= (signed __int16)pValue; |
7590 return result; | |
0 | 7591 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7592 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7593 return result; |
0 | 7594 case VAR_Experience: |
7595 v12 = (char *)&this->uExperience; | |
501 | 7596 v13 = (signed int)pValue; |
7597 v14 = *(int *)v12 < (unsigned int)pValue; | |
7598 *(int *)v12 -= (int)pValue; | |
0 | 7599 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7600 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7601 v8 = 8 * v4 + 400; | |
862 | 7602 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7603 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7604 return result; | |
0 | 7605 case VAR_QBits_QuestsDone: |
501 | 7606 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7607 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7608 return true; |
0 | 7609 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7610 v15 = this->pInventoryMatrix; |
0 | 7611 break; |
7612 case VAR_FixedGold: | |
501 | 7613 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7614 goto LABEL_88; |
501 | 7615 Party::TakeGold((unsigned int)pValue); |
7616 return result; | |
0 | 7617 case VAR_MightBonus: |
7618 case VAR_ActualMight: | |
501 | 7619 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7620 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7621 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7622 v8 = 8 * v4 + 400; | |
862 | 7623 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7624 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7625 return result; | |
0 | 7626 case VAR_IntellectBonus: |
7627 case VAR_ActualIntellect: | |
501 | 7628 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7629 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7630 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7631 v8 = 8 * v4 + 400; | |
862 | 7632 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7633 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7634 return result; | |
0 | 7635 case VAR_PersonalityBonus: |
7636 case VAR_ActualPersonality: | |
501 | 7637 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7638 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7639 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7640 v8 = 8 * v4 + 400; | |
862 | 7641 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7642 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7643 return result; | |
0 | 7644 case VAR_EnduranceBonus: |
7645 case VAR_ActualEndurance: | |
501 | 7646 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7647 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7648 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7649 v8 = 8 * v4 + 400; | |
862 | 7650 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7651 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7652 return result; | |
0 | 7653 case VAR_SpeedBonus: |
7654 case VAR_ActualSpeed: | |
501 | 7655 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7656 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7657 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7658 v8 = 8 * v4 + 400; | |
862 | 7659 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7660 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7661 return result; | |
0 | 7662 case VAR_AccuracyBonus: |
7663 case VAR_ActualAccuracy: | |
501 | 7664 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7665 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7666 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7667 v8 = 8 * v4 + 400; | |
862 | 7668 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7669 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7670 return result; | |
0 | 7671 case VAR_LuckBonus: |
7672 case VAR_ActualLuck: | |
501 | 7673 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7674 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7675 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7676 v8 = 8 * v4 + 400; | |
862 | 7677 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7678 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7679 return result; | |
0 | 7680 case VAR_BaseMight: |
501 | 7681 this->uMight -= (unsigned __int16)pValue; |
605 | 7682 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_BaseIntellect: |
501 | 7689 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 7690 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7691 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7692 v8 = 8 * v4 + 400; | |
862 | 7693 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7694 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7695 return result; | |
0 | 7696 case VAR_BasePersonality: |
501 | 7697 this->uWillpower -= (unsigned __int16)pValue; |
605 | 7698 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7699 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7700 v8 = 8 * v4 + 400; | |
862 | 7701 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7702 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7703 return result; | |
0 | 7704 case VAR_BaseEndurance: |
501 | 7705 this->uEndurance -= (unsigned __int16)pValue; |
605 | 7706 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7707 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7708 v8 = 8 * v4 + 400; | |
862 | 7709 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7710 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7711 return result; | |
0 | 7712 case VAR_BaseSpeed: |
501 | 7713 this->uSpeed -= (unsigned __int16)pValue; |
605 | 7714 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7715 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7716 v8 = 8 * v4 + 400; | |
862 | 7717 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7718 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7719 return result; | |
0 | 7720 case VAR_BaseAccuracy: |
501 | 7721 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 7722 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7723 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7724 v8 = 8 * v4 + 400; | |
862 | 7725 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7726 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7727 return result; | |
0 | 7728 case VAR_BaseLuck: |
501 | 7729 this->uLuck -= (unsigned __int16)pValue; |
605 | 7730 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7731 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7732 v8 = 8 * v4 + 400; | |
862 | 7733 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7734 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7735 return result; | |
0 | 7736 case VAR_FireResistance: |
501 | 7737 this->sResFireBase -= (signed __int16)pValue; |
605 | 7738 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 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_AirResistance: |
501 | 7745 this->sResAirBase -= (signed __int16)pValue; |
605 | 7746 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7747 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7748 v8 = 8 * v4 + 400; | |
862 | 7749 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7750 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7751 return result; | |
0 | 7752 case VAR_WaterResistance: |
501 | 7753 this->sResWaterBase -= (signed __int16)pValue; |
605 | 7754 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7755 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7756 v8 = 8 * v4 + 400; | |
862 | 7757 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7758 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7759 return result; | |
0 | 7760 case VAR_EarthResistance: |
501 | 7761 this->sResEarthBase -= (signed __int16)pValue; |
605 | 7762 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7763 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7764 v8 = 8 * v4 + 400; | |
862 | 7765 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7766 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7767 return result; | |
0 | 7768 case VAR_SpiritResistance: |
501 | 7769 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 7770 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7771 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7772 v8 = 8 * v4 + 400; | |
862 | 7773 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7774 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7775 return result; | |
0 | 7776 case VAR_MindResistance: |
501 | 7777 this->sResMindBase -= (signed __int16)pValue; |
605 | 7778 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7779 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7780 v8 = 8 * v4 + 400; | |
862 | 7781 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7782 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7783 return result; | |
0 | 7784 case VAR_BodyResistance: |
501 | 7785 this->sResBodyBase -= (signed __int16)pValue; |
605 | 7786 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7787 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7788 v8 = 8 * v4 + 400; | |
862 | 7789 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7790 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7791 return result; | |
0 | 7792 case VAR_LightResistance: |
501 | 7793 this->sResLightBase -= (signed __int16)pValue; |
605 | 7794 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7795 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7796 v8 = 8 * v4 + 400; | |
862 | 7797 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7798 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7799 return result; | |
0 | 7800 case VAR_DarkResistance: |
501 | 7801 this->sResDarkBase -= (signed __int16)pValue; |
605 | 7802 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7803 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7804 v8 = 8 * v4 + 400; | |
862 | 7805 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7806 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7807 return result; | |
0 | 7808 case VAR_MagicResistance: |
501 | 7809 this->sResMagicBase -= (signed __int16)pValue; |
605 | 7810 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7811 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7812 v8 = 8 * v4 + 400; | |
862 | 7813 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7814 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7815 return result; | |
0 | 7816 case VAR_FireResistanceBonus: |
501 | 7817 this->sResFireBonus -= (signed __int16)pValue; |
605 | 7818 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7819 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7820 v8 = 8 * v4 + 400; | |
862 | 7821 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7822 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7823 return result; | |
0 | 7824 case VAR_AirResistanceBonus: |
501 | 7825 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7826 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7827 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7828 v8 = 8 * v4 + 400; | |
862 | 7829 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7830 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7831 return result; | |
0 | 7832 case VAR_WaterResistanceBonus: |
501 | 7833 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 7834 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7835 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7836 v8 = 8 * v4 + 400; | |
862 | 7837 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7838 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7839 return result; | |
0 | 7840 case VAR_EarthResistanceBonus: |
501 | 7841 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 7842 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7843 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7844 v8 = 8 * v4 + 400; | |
862 | 7845 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7846 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7847 return result; | |
0 | 7848 case VAR_SpiritResistanceBonus: |
501 | 7849 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 7850 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7851 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7852 v8 = 8 * v4 + 400; | |
862 | 7853 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7854 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7855 return result; | |
0 | 7856 case VAR_MindResistanceBonus: |
501 | 7857 this->sResMindBonus -= (signed __int16)pValue; |
605 | 7858 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7859 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7860 v8 = 8 * v4 + 400; | |
862 | 7861 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7862 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7863 return result; | |
0 | 7864 case VAR_BodyResistanceBonus: |
501 | 7865 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 7866 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7867 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7868 v8 = 8 * v4 + 400; | |
862 | 7869 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7870 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7871 return result; | |
0 | 7872 case VAR_LightResistanceBonus: |
501 | 7873 this->sResLightBonus -= (signed __int16)pValue; |
605 | 7874 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7875 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7876 v8 = 8 * v4 + 400; | |
862 | 7877 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7878 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7879 return result; | |
0 | 7880 case VAR_DarkResistanceBonus: |
501 | 7881 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7882 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7883 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7884 v8 = 8 * v4 + 400; | |
862 | 7885 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7886 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7887 return result; | |
0 | 7888 case VAR_MagicResistanceBonus: |
501 | 7889 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7890 v25 = 0; |
187 | 7891 v23 = SPEECH_91; |
7892 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7893 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7894 v8 = 8 * v4 + 400; | |
862 | 7895 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7896 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7897 return result; | |
0 | 7898 case VAR_FixedFood: |
501 | 7899 Party::TakeFood((unsigned int)pValue); |
605 | 7900 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7901 v8 = 8 * v4 + 400; | |
862 | 7902 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7903 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7904 return result; | |
0 | 7905 case VAR_StaffSkill: |
7906 case VAR_SwordSkill: | |
7907 case VAR_DaggerSkill: | |
7908 case VAR_AxeSkill: | |
7909 case VAR_SpearSkill: | |
7910 case VAR_BowSkill: | |
7911 case VAR_MaceSkill: | |
7912 case VAR_BlasterSkill: | |
7913 case VAR_ShieldSkill: | |
7914 case VAR_LeatherSkill: | |
7915 case VAR_SkillChain: | |
7916 case VAR_PlateSkill: | |
7917 case VAR_FireSkill: | |
7918 case VAR_AirSkill: | |
7919 case VAR_WaterSkill: | |
7920 case VAR_EarthSkill: | |
7921 case VAR_SpiritSkill: | |
7922 case VAR_MindSkill: | |
7923 case VAR_BodySkill: | |
7924 case VAR_LightSkill: | |
7925 case VAR_DarkSkill: | |
7926 case VAR_IdentifyItemSkill: | |
7927 case VAR_MerchantSkill: | |
7928 case VAR_RepairSkill: | |
7929 case VAR_BodybuildingSkill: | |
7930 case VAR_MeditationSkill: | |
7931 case VAR_PerceptionSkill: | |
7932 case VAR_DiplomacySkill: | |
7933 case VAR_DisarmTrapSkill: | |
7934 case VAR_LearningSkill: | |
501 | 7935 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 7936 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7937 v8 = 8 * v4 + 400; | |
862 | 7938 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7939 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7940 return result; | |
0 | 7941 case VAR_Cursed: |
7942 case VAR_Weak: | |
7943 case VAR_Asleep: | |
7944 case VAR_Afraid: | |
7945 case VAR_Drunk: | |
7946 case VAR_Insane: | |
7947 case VAR_PoisonedGreen: | |
7948 case VAR_DiseasedGreen: | |
7949 case VAR_PoisonedYellow: | |
7950 case VAR_DiseasedYellow: | |
7951 case VAR_PoisonedRed: | |
7952 case VAR_DiseasedRed: | |
7953 case VAR_Paralyzed: | |
7954 case VAR_Unconsious: | |
7955 case VAR_Dead: | |
7956 case VAR_Stoned: | |
7957 case VAR_Eradicated: | |
1071 | 7958 //*((int *)this + 2 * VarNum - 210) = 0; |
7959 //*((int *)this + 2 * result - 209) = 0; | |
7960 this->pConditions[VarNum] = 0; | |
0 | 7961 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7962 v8 = 8 * v4 + 400; | |
862 | 7963 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 7964 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7965 return result; |
605 | 7966 default: |
7967 return result; | |
7968 } | |
7969 for (v3 = 1; v3 < 126; v3++) | |
7970 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7971 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 7972 { |
605 | 7973 RemoveItemAtInventoryIndex(v3); |
501 | 7974 return true; |
0 | 7975 } |
605 | 7976 } |
501 | 7977 if ( pParty->pPickedItem.uItemID == pValue ) |
7978 { | |
605 | 7979 pMouse->RemoveHoldingItem(); |
7980 return true; | |
7981 } | |
7982 return false; | |
0 | 7983 } |
7984 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7985 |
1430 | 7986 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7987 return false; |
0 | 7988 } |
7989 // 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
|
7990 // 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
|
7991 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7992 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7993 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7994 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
|
7995 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7996 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7997 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7998 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7999 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8000 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8001 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8002 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8003 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
|
8004 //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
|
8005 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
|
8006 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
|
8007 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8008 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8009 _this.Reset(); |
1374 | 8010 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8011 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8012 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8013 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8014 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8015 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8016 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8017 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8018 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
|
8019 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8020 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8021 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8022 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8023 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8024 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8025 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8026 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8027 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8028 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8029 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8030 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8031 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8032 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
|
8033 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8034 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8035 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8036 } |
1295 | 8037 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8038 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8039 |
1295 | 8040 //----- (0049387A) -------------------------------------------------------- |
1459 | 8041 int CycleCharacter(bool backwards) |
1295 | 8042 { |
8043 signed int result; // eax@1 | |
8044 signed int v2; // ecx@2 | |
8045 signed int v3; // ecx@8 | |
8046 | |
8047 result = uActiveCharacter; | |
1459 | 8048 if ( backwards ) |
1295 | 8049 { |
8050 v2 = 0; | |
8051 while ( 1 ) | |
8052 { | |
8053 --result; | |
8054 if ( result < 1 ) | |
8055 result = 4; | |
8056 if ( !pPlayers[result]->uTimeToRecovery ) | |
8057 break; | |
8058 ++v2; | |
8059 if ( v2 >= 4 ) | |
8060 return uActiveCharacter; | |
8061 } | |
8062 } | |
8063 else | |
8064 { | |
8065 v3 = 0; | |
8066 while ( 1 ) | |
8067 { | |
8068 ++result; | |
8069 if ( result > 4 ) | |
8070 result = 1; | |
8071 if ( !pPlayers[result]->uTimeToRecovery ) | |
8072 break; | |
8073 ++v3; | |
8074 if ( v3 >= 4 ) | |
8075 return uActiveCharacter; | |
8076 } | |
8077 } | |
8078 return result; | |
1297 | 8079 } |
8080 //----- (0043EE77) -------------------------------------------------------- | |
8081 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8082 { | |
8083 bool result; // eax@0 | |
8084 Player *v2; // edx@3 | |
8085 int v3; // ecx@3 | |
8086 Player **pPlayers; // esi@8 | |
1424 | 8087 //bool item_flag; |
1297 | 8088 Player *v6; // edx@9 |
8089 | |
1424 | 8090 //if ( a1 < 1 || a1 > 4 ) |
8091 //{ | |
8092 //if ( !a1 ) | |
8093 //{ | |
8094 //pPlayers = &::pPlayers[1]; | |
8095 //v5 = 604; | |
8096 //while ( 1 ) | |
1545 | 8097 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8098 for ( uint i = 1; i < 5; ++i ) |
1424 | 8099 { |
8100 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8101 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8102 return false; | |
8103 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8104 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8105 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8106 return false; | |
8107 //result *= 9; | |
1432 | 8108 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8109 return false; |
8110 //++pPlayers; | |
8111 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8112 //return true; | |
8113 } | |
8114 return true; | |
8115 } | |
1432 | 8116 |
1297 | 8117 //----- (0043EE15) -------------------------------------------------------- |
8118 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8119 { | |
8120 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8121 { | |
8122 for ( uint i = 0; i < 126; ++i ) | |
8123 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8124 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8125 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8126 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8127 return true; |
8128 } | |
8129 } | |
8130 for ( uint i = 0; i < 16; ++i ) | |
8131 { | |
8132 if ( pPlayer->pEquipment.pIndices[i] ) | |
8133 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8134 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8135 return true; |
8136 } | |
8137 } | |
8138 } | |
8139 return false; | |
8140 } | |
8141 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8142 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8143 { |
8144 unsigned int pNum; // ebp@1 | |
8145 Player **pPlayer; // ebx@1 | |
8146 Player *pPlayer2; // esi@2 | |
8147 enum CHARACTER_RACE pRace; // edi@2 | |
8148 bool pSex; // eax@2 | |
8149 char v6; // zf@7 | |
8150 | |
8151 //pPlayer = &pPlayers[1]; | |
8152 /*pNum = a1; | |
8153 | |
8154 while ( 1 ) | |
8155 { | |
8156 pPlayer2 = *pPlayer; | |
8157 pRace = pPlayer2->GetRace(); | |
8158 pSex = pPlayer2->GetSexByVoice(); | |
8159 if ( !pRace ) | |
8160 break; | |
8161 if ( pRace == 1 || pRace == 2 ) | |
8162 break; | |
8163 if ( !pSex && pNum == 2 )// | |
8164 //goto LABEL_15; | |
8165 { | |
8166 pSex = 1; | |
8167 return pSex; | |
8168 } | |
8169 v6 = pNum == 3;// | |
8170 LABEL_11: | |
8171 if ( v6 ) | |
8172 //goto LABEL_15; | |
8173 { | |
8174 pSex = 1; | |
8175 return pSex; | |
8176 } | |
8177 ++pPlayer; | |
8178 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8179 { | |
8180 pSex = 0; | |
8181 return pSex; | |
8182 } | |
8183 } | |
8184 if ( pSex || pNum ) | |
8185 { | |
8186 v6 = pNum == 1; | |
8187 goto LABEL_11; | |
8188 } | |
8189 //LABEL_15: | |
8190 pSex = 1; | |
8191 return pSex;*/ | |
8192 for (uint i = 1; i <= 4; ++i) | |
8193 { | |
8194 pRace = pPlayers[i]->GetRace(); | |
8195 pSex = pPlayers[i]->GetSexByVoice(); | |
8196 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8197 return 1; | |
8198 } | |
8199 return 0; | |
8200 } | |
8201 //----- (0043ED6F) -------------------------------------------------------- | |
8202 bool _43ED6F_check_party_races(bool a1) | |
8203 { | |
8204 bool v6; // zf@5 | |
8205 | |
8206 for (uint i = 0; i < 4; ++i) | |
8207 { | |
8208 auto player = pParty->pPlayers + i; | |
8209 auto race = player->GetRace(); | |
8210 | |
8211 if (race != CHARACTER_RACE_HUMAN && | |
8212 race != CHARACTER_RACE_ELF && | |
8213 race != CHARACTER_RACE_GOBLIN) | |
8214 v6 = a1 == 1; | |
8215 else | |
8216 v6 = !a1; | |
8217 | |
8218 if (v6) | |
8219 return true; | |
8220 } | |
8221 return false; | |
8222 } | |
8223 //----- (00439FCB) -------------------------------------------------------- | |
8224 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8225 { | |
8226 signed int v4; // esi@1 | |
8227 unsigned int v5; // ecx@1 | |
8228 Player *v6; // ebx@3 | |
8229 Actor *v7; // esi@3 | |
8230 unsigned int v8; // eax@4 | |
8231 char *v9; // eax@5 | |
8232 signed int v10; // eax@6 | |
8233 int v11; // edx@8 | |
8234 int v12; // edx@9 | |
8235 int v13; // edx@10 | |
8236 int v14; // edx@16 | |
8237 int v15; // edx@17 | |
8238 int v16; // edx@18 | |
8239 enum SoundID v17; // eax@24 | |
8240 int v18; // eax@26 | |
8241 unsigned __int8 v19; // zf@26 | |
8242 unsigned __int8 v20; // sf@26 | |
8243 unsigned __int16 v21; // ax@29 | |
8244 signed int v22; // edi@36 | |
8245 int v23; // eax@38 | |
8246 signed int v24; // eax@44 | |
8247 unsigned __int16 v25; // cx@47 | |
8248 signed int v26; // eax@49 | |
8249 int v27; // eax@54 | |
8250 float v28; // ST18_4@58 | |
8251 double v29; // st7@58 | |
8252 float v30; // ST08_4@58 | |
8253 double v31; // st7@58 | |
8254 float v32; // ST04_4@58 | |
8255 float v33; // ST00_4@58 | |
8256 int v34; // edi@61 | |
8257 int v35; // eax@70 | |
8258 double v36; // st7@70 | |
8259 SpriteObject *v37; // ebx@77 | |
8260 int v38; // edi@77 | |
8261 int v39; // esi@77 | |
8262 int v40; // eax@77 | |
8263 int v41; // eax@77 | |
8264 int v42; // eax@78 | |
8265 Player *v43; // eax@81 | |
8266 Actor *v44; // esi@82 | |
8267 Player *v45; // edi@84 | |
8268 unsigned __int16 v46; // ax@84 | |
8269 int v47; // ebx@105 | |
8270 int v48; // eax@107 | |
8271 unsigned __int16 v49; // ax@116 | |
8272 int v50; // ebx@123 | |
8273 unsigned __int16 v51; // ax@124 | |
8274 char v52; // bl@124 | |
8275 int v53; // eax@128 | |
8276 signed int v54; // eax@134 | |
8277 unsigned __int16 v55; // cx@137 | |
8278 signed int v56; // eax@139 | |
8279 int v57; // eax@144 | |
8280 float v58; // ST18_4@148 | |
8281 double v59; // st7@148 | |
8282 float v60; // ST08_4@148 | |
8283 double v61; // st7@148 | |
8284 float v62; // ST04_4@148 | |
8285 float v63; // ST00_4@148 | |
8286 int v64; // ebx@151 | |
8287 int v65; // eax@161 | |
8288 double v66; // st7@161 | |
8289 signed int v67; // ecx@164 | |
8290 signed int v68; // eax@170 | |
8291 int v69; // ecx@170 | |
8292 int v70; // eax@171 | |
8293 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8294 int v72; // [sp+30h] [bp-24h]@164 | |
8295 double v73; // [sp+40h] [bp-14h]@72 | |
8296 signed int v74; // [sp+44h] [bp-10h]@1 | |
8297 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8298 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8299 int v77; // [sp+50h] [bp-4h]@26 | |
8300 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8301 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8302 | |
8303 v4 = PID_ID(uObjID); | |
8304 v5 = PID_TYPE(uObjID) - 2; | |
8305 v74 = a2; | |
8306 uActorID = v4; | |
8307 if ( v5 ) | |
8308 { | |
8309 if ( v5 != 1 | |
8310 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8311 v75 = v6->sHealth, | |
8312 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8313 return; | |
8314 v8 = v6->pEquipment.uArmor; | |
8315 if ( !v8 | |
8316 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8317 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8318 || v10 > 11 ) | |
8319 { | |
8320 v14 = rand() % 4; | |
8321 if ( !v14 ) | |
8322 { | |
8323 v71 = (SoundID)108; | |
8324 goto LABEL_24; | |
8325 } | |
8326 v15 = v14 - 1; | |
8327 if ( !v15 ) | |
8328 { | |
8329 v71 = (SoundID)109; | |
8330 goto LABEL_24; | |
8331 } | |
8332 v16 = v15 - 1; | |
8333 if ( !v16 ) | |
8334 { | |
8335 v71 = (SoundID)110; | |
8336 goto LABEL_24; | |
8337 } | |
8338 if ( v16 == 1 ) | |
8339 { | |
8340 v71 = (SoundID)44; | |
8341 goto LABEL_24; | |
8342 } | |
8343 } | |
8344 else | |
8345 { | |
8346 v11 = rand() % 4; | |
8347 if ( !v11 ) | |
8348 { | |
8349 v71 = (SoundID)105; | |
8350 goto LABEL_24; | |
8351 } | |
8352 v12 = v11 - 1; | |
8353 if ( !v12 ) | |
8354 { | |
8355 v71 = (SoundID)106; | |
8356 goto LABEL_24; | |
8357 } | |
8358 v13 = v12 - 1; | |
8359 if ( !v13 ) | |
8360 { | |
8361 v71 = (SoundID)107; | |
8362 goto LABEL_24; | |
8363 } | |
8364 if ( v13 == 1 ) | |
8365 { | |
8366 v71 = (SoundID)45; | |
8367 LABEL_24: | |
8368 v17 = v71; | |
8369 goto LABEL_26; | |
8370 } | |
8371 } | |
8372 v17 = (SoundID)a4; | |
8373 LABEL_26: | |
8374 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8375 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8376 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8377 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8378 v77 = v18; | |
8379 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8380 { | |
8381 v21 = v7->pActorBuffs[3].uPower; | |
8382 if ( v21 ) | |
8383 v77 /= (signed int)v21; | |
8384 } | |
8385 if ( v74 ) | |
8386 { | |
8387 if ( v74 == 1 ) | |
8388 { | |
8389 v22 = v7->pMonsterInfo.uAttack2Type; | |
8390 } | |
8391 else | |
8392 { | |
8393 if ( v74 == 2 ) | |
8394 { | |
8395 v23 = v7->pMonsterInfo.uSpell1ID; | |
8396 } | |
8397 else | |
8398 { | |
8399 if ( v74 != 3 ) | |
8400 { | |
8401 if ( v74 == 4 ) | |
8402 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8403 else | |
8404 v22 = 4; | |
8405 goto LABEL_43; | |
8406 } | |
8407 v23 = v7->pMonsterInfo.uSpell2ID; | |
8408 } | |
8409 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8410 } | |
8411 } | |
8412 else | |
8413 { | |
8414 v22 = v7->pMonsterInfo.uAttack1Type; | |
8415 } | |
8416 LABEL_43: | |
8417 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8418 { | |
8419 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8420 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8421 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8422 { | |
8423 v25 = v7->uAIState; | |
8424 if ( v25 != 5 ) | |
8425 { | |
8426 if ( v25 != 4 ) | |
8427 { | |
8428 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8429 v7->sCurrentHP -= v26; | |
8430 if ( v26 ) | |
8431 { | |
8432 if ( v7->sCurrentHP >= 1 ) | |
8433 { | |
8434 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8435 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8436 } | |
8437 else | |
8438 { | |
8439 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8440 { | |
8441 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8442 v74 = v27; | |
8443 if ( pRenderer->pRenderD3D ) | |
8444 { | |
8445 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8446 { | |
8447 v28 = (double)v74; | |
8448 v74 = v7->vPosition.z; | |
8449 v29 = (double)v74; | |
8450 v74 = v7->vPosition.y; | |
8451 v30 = v29; | |
8452 v31 = (double)v74; | |
8453 v74 = v7->vPosition.x; | |
8454 v32 = v31; | |
8455 v33 = (double)v74; | |
8456 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8457 } | |
8458 } | |
8459 } | |
8460 Actor::Die(uActorID); | |
8461 Actor::ApplyFineForKillingPeasant(uActorID); | |
8462 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8463 if ( v7->pMonsterInfo.uExp ) | |
8464 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8465 v34 = SPEECH_51; | |
8466 if ( rand() % 100 < 20 ) | |
8467 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8468 v6->PlaySound((PlayerSpeech)v34, 0); | |
8469 } | |
8470 } | |
8471 } | |
8472 } | |
8473 } | |
8474 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8475 && v7->pMonsterInfo.uSpecialAttack | |
8476 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8477 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8478 } | |
8479 if ( !pParty->bTurnBasedModeOn ) | |
8480 { | |
8481 v35 = v6->GetActualEndurance(); | |
8482 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8483 v6->SetRecoveryTime((signed __int64)v36); | |
8484 } | |
8485 if ( v77 ) | |
8486 { | |
8487 v73 = (double)(signed int)v75; | |
8488 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8489 { | |
8490 if ( v6->sHealth > 0 ) | |
8491 { | |
8492 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8493 v6->PlaySound(SPEECH_48, 0); | |
8494 } | |
8495 } | |
8496 } | |
8497 viewparams->bRedrawGameUI = 1; | |
8498 return; | |
8499 } | |
8500 v37 = &pSpriteObjects[uActorID]; | |
8501 v38 = PID_TYPE(v37->spell_caster_pid); | |
8502 v39 = PID_ID(v37->spell_caster_pid); | |
8503 v40 = PID_TYPE(v37->spell_caster_pid); | |
8504 uActorID = PID_ID(v37->spell_caster_pid); | |
8505 v41 = v40 - 2; | |
8506 if ( !v41 ) | |
8507 goto LABEL_80; | |
8508 v42 = v41 - 1; | |
8509 if ( !v42 ) | |
8510 { | |
8511 v44 = &pActors[v39]; | |
8512 if ( a4 == -1 ) | |
8513 a4 = stru_50C198.which_player_would_attack(v44); | |
8514 v45 = &pParty->pPlayers[a4]; | |
8515 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8516 v46 = v37->uType; | |
8517 if ( v37->uType == 545 ) | |
8518 { | |
8519 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8520 v52 = v51; | |
8521 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8522 { | |
8523 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8524 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8525 v45->PlaySound(SPEECH_6, 0); | |
8526 return; | |
8527 } | |
8528 } | |
8529 else | |
8530 { | |
8531 if ( v46 != 555 | |
8532 && v46 != 510 | |
8533 && v46 != 500 | |
8534 && v46 != 515 | |
8535 && v46 != 505 | |
8536 && v46 != 530 | |
8537 && v46 != 525 | |
8538 && v46 != 520 | |
8539 && v46 != 535 | |
8540 && v46 != 540 ) | |
8541 goto LABEL_115; | |
8542 } | |
8543 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8544 return; | |
8545 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8546 v77 >>= 1; | |
8547 if ( v45->HasEnchantedItemEquipped(36) ) | |
8548 v77 >>= 1; | |
8549 if ( v45->HasEnchantedItemEquipped(69) ) | |
8550 v77 >>= 1; | |
8551 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8552 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8553 v77 >>= 1; |
8554 v75 = 0; | |
8555 v47 = (int)&v45->pEquipment; | |
8556 do | |
8557 { | |
8558 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8559 { | |
8560 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8561 if ( v48 == 520 ) | |
8562 v77 >>= 1; | |
8563 if ( v48 == 531 ) | |
8564 v77 >>= 1; | |
8565 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8566 v77 >>= 1; | |
8567 } | |
8568 ++v75; | |
8569 v47 += 4; | |
8570 } | |
8571 while ( (signed int)v75 <= 1 ); | |
8572 LABEL_115: | |
8573 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8574 { | |
8575 v49 = v44->pActorBuffs[3].uPower; | |
8576 if ( v49 ) | |
8577 v77 /= (signed int)v49; | |
8578 } | |
8579 if ( !v74 ) | |
8580 { | |
8581 v50 = v44->pMonsterInfo.uAttack1Type; | |
8582 goto LABEL_133; | |
8583 } | |
8584 if ( v74 == 1 ) | |
8585 { | |
8586 v50 = v44->pMonsterInfo.uAttack2Type; | |
8587 goto LABEL_133; | |
8588 } | |
8589 if ( v74 == 2 ) | |
8590 { | |
8591 v53 = v44->pMonsterInfo.uSpell1ID; | |
8592 } | |
8593 else | |
8594 { | |
8595 if ( v74 != 3 ) | |
8596 { | |
8597 if ( v74 == 4 ) | |
8598 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8599 else | |
8600 v50 = 4; | |
8601 LABEL_133: | |
8602 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8603 { | |
8604 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8605 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8606 { | |
8607 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8608 { | |
8609 v55 = v44->uAIState; | |
8610 if ( v55 != 5 ) | |
8611 { | |
8612 if ( v55 != 4 ) | |
8613 { | |
8614 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8615 v44->sCurrentHP -= v56; | |
8616 if ( v56 ) | |
8617 { | |
8618 if ( v44->sCurrentHP >= 1 ) | |
8619 { | |
8620 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8621 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8622 } | |
8623 else | |
8624 { | |
8625 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8626 { | |
8627 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8628 v75 = v57; | |
8629 if ( pRenderer->pRenderD3D ) | |
8630 { | |
8631 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8632 { | |
8633 v58 = (double)(signed int)v75; | |
8634 v75 = v44->vPosition.z; | |
8635 v59 = (double)(signed int)v75; | |
8636 v75 = v44->vPosition.y; | |
8637 v60 = v59; | |
8638 v61 = (double)(signed int)v75; | |
8639 v75 = v44->vPosition.x; | |
8640 v62 = v61; | |
8641 v63 = (double)(signed int)v75; | |
8642 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8643 } | |
8644 } | |
8645 } | |
8646 Actor::Die(uActorID); | |
8647 Actor::ApplyFineForKillingPeasant(uActorID); | |
8648 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8649 if ( v44->pMonsterInfo.uExp ) | |
8650 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8651 v64 = SPEECH_51; | |
8652 if ( rand() % 100 < 20 ) | |
8653 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8654 v45->PlaySound((PlayerSpeech)v64, 0); | |
8655 } | |
8656 } | |
8657 } | |
8658 } | |
8659 } | |
8660 } | |
8661 } | |
8662 if ( !v74 | |
8663 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8664 && v44->pMonsterInfo.uSpecialAttack | |
8665 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8666 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8667 if ( !pParty->bTurnBasedModeOn ) | |
8668 { | |
8669 v65 = v45->GetActualEndurance(); | |
8670 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8671 * flt_6BE3A4_debug_recmod1 | |
8672 * 2.133333333333333; | |
8673 v45->SetRecoveryTime((signed __int64)v66); | |
8674 } | |
8675 return; | |
8676 } | |
8677 v53 = v44->pMonsterInfo.uSpell2ID; | |
8678 } | |
8679 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8680 goto LABEL_133; | |
8681 } | |
8682 if ( v42 != 1 ) | |
8683 return; | |
8684 LABEL_80: | |
8685 if ( a4 != -1 ) | |
8686 { | |
8687 v43 = &pParty->pPlayers[a4]; | |
8688 LABEL_168: | |
8689 a4b = v43; | |
8690 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8691 { | |
8692 v70 = v43->GetMaxHealth(); | |
8693 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8694 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8695 } | |
8696 else | |
8697 { | |
8698 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8699 v69 = 0; | |
8700 } | |
8701 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8702 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8703 { | |
8704 qword_A750D8 = 256i64; | |
1406 | 8705 PlayerSpeechID = SPEECH_44; |
1407 | 8706 uSpeakingCharacter = uActorID + 1; |
1297 | 8707 } |
8708 return; | |
8709 } | |
8710 v74 = 0; | |
8711 a4a = 1; | |
8712 do | |
8713 { | |
8714 if ( pPlayers[a4a]->CanAct() ) | |
8715 { | |
8716 v67 = v74++; | |
8717 *(&v72 + v67) = a4a; | |
8718 } | |
8719 ++a4a; | |
8720 } | |
8721 while ( a4a <= 4 ); | |
8722 if ( v74 ) | |
8723 { | |
8724 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8725 goto LABEL_168; | |
8726 } | |
8727 } | |
8728 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8729 void OnInventoryLeftClick() |
1297 | 8730 { |
8731 Player *v0; // ebx@1 | |
8732 signed int v1; // eax@2 | |
8733 signed int v2; // ecx@2 | |
8734 int v3; // eax@2 | |
8735 char v4; // sf@2 | |
8736 int v5; // eax@2 | |
8737 unsigned int v6; // eax@7 | |
8738 unsigned int v7; // esi@12 | |
8739 unsigned int v8; // eax@12 | |
8740 unsigned int v9; // eax@16 | |
8741 unsigned int v10; // eax@18 | |
8742 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8743 POINT a2; // [sp+30h] [bp-18h]@4 | |
8744 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8745 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8746 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8747 int a4; // [sp+44h] [bp-4h]@2 | |
8748 | |
8749 v0 = pPlayers[uActiveCharacter]; | |
8750 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8751 { | |
8752 pMouse->GetClickPos(&pX, &pY); | |
8753 pY = pY - 17; | |
8754 v2 =pX - 14; | |
8755 pX = v2; | |
8756 v3 = 14 * (pY >> 5); | |
8757 v2 >>= 5; | |
8758 v4 = v2 + v3 < 0; | |
8759 v5 = v2 + v3; | |
8760 a4 = v5; | |
8761 if ( !v4 ) | |
8762 { | |
8763 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8764 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8765 { | |
8766 if ( unk_50C9A0 ) | |
8767 { | |
8768 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8769 if ( v6 ) | |
8770 { | |
8771 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8772 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8773 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8774 *((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
|
8775 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8776 unk_50C9A0 = 0; |
8777 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8778 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8779 pMouse->SetCursorBitmap("MICON1"); | |
8780 dword_50C9D0 = 113; | |
8781 dword_50C9D4 = 0; | |
8782 dword_50C9D8 = 256; | |
8783 } | |
8784 return; | |
8785 } | |
8786 if ( ptr_50C9A4 ) | |
8787 return; | |
8788 v7 = pParty->pPickedItem.uItemID; | |
8789 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8790 if ( !v7 ) | |
8791 { | |
8792 if ( !v8 ) | |
8793 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8794 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8795 v0->RemoveItemAtInventoryIndex(a4); |
8796 v9 = pParty->pPickedItem.uItemID; | |
8797 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8798 return; | |
8799 } | |
8800 v13 = v8; | |
8801 if ( v8 ) | |
8802 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8803 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8804 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8805 v0->RemoveItemAtInventoryIndex(a4); | |
8806 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8807 if ( !pX ) | |
8808 { | |
8809 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8810 if ( !pX ) | |
8811 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8812 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8813 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8814 return; | |
8815 } | |
8816 } | |
8817 v9 = this_.uItemID; | |
8818 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8819 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8820 return; | |
8821 } | |
8822 v10 = v0->AddItem(a4, v7); | |
8823 pX = v10; | |
8824 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8825 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8826 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8827 pMouse->RemoveHoldingItem(); |
8828 } | |
8829 } | |
8830 } | |
8831 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8832 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8833 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8834 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8835 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8836 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8837 return pConditions[Condition_Weak] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8838 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8839 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8840 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8841 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8842 return pConditions[Condition_Dead] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8843 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8844 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8845 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8846 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8847 return pConditions[Condition_Eradicated] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8848 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8849 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8850 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8851 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8852 return pConditions[Condition_Zombie] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8853 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8854 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8855 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8856 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8857 return pConditions[Condition_Cursed] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8858 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8859 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8860 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8861 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8862 return pConditions[Condition_Pertified] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8863 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8864 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8865 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8866 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8867 return pConditions[Condition_Unconcious] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8868 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8869 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8870 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8871 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8872 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8873 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8874 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8875 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8876 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8877 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8878 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8879 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8880 void Player::SetCursed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8881 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8882 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8883 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8884 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8885 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8886 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8887 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8888 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8889 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8890 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8891 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8892 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8893 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8894 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8895 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8896 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8897 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8898 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8899 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8900 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8901 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8902 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8903 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8904 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8905 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8906 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8907 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8908 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8909 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8910 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8911 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8912 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8913 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8914 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8915 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8916 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8917 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8918 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8919 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8920 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8921 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8922 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8923 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8924 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8925 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8926 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8927 pConditions[Condition_Disease2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8928 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8929 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8930 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8931 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8932 pConditions[Condition_Poison3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8933 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8934 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8935 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8936 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8937 pConditions[Condition_Disease3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8938 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8939 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8940 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8941 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8942 pConditions[Condition_Paralyzed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8943 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8944 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8945 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8946 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8947 pConditions[Condition_Unconcious] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8948 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8949 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8950 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8951 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8952 pConditions[Condition_Dead] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8953 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8954 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8955 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8956 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8957 pConditions[Condition_Pertified] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8958 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8959 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8960 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8961 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8962 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8963 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8964 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8965 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8966 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8967 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8968 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8969 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8970 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8971 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8972 SetCondition(Condition_Weak, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8973 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8974 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8975 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8976 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8977 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8978 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8979 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8980 void Player::SetCondDeadWithBlockCheck( int blockable ) |
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 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8983 } |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8984 |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8985 void Player::SetCondUnconsciousWithBlockCheck( int blockable ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8986 { |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8987 SetCondition(Condition_Dead, blockable); |
1593
5658d0f3b5ee
Player::GetAttackRecoveryTime removing label, fixing shield skill being ignored, fixing haste being ignored
Grumpy7
parents:
1568
diff
changeset
|
8988 } |