Mercurial > mm7
annotate Player.cpp @ 1555:9c4cf5b07e98
Minor assert fixes in players.cpp
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 21:17:47 +0200 |
parents | e303d8a9bcdc |
children | 30db6d265ceb |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
4 |
1016 | 5 #include "stru6.h" |
6 | |
0 | 7 #include "Player.h" |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
1297 | 29 #include "SpriteObject.h" |
30 #include "DecalBuilder.h" | |
0 | 31 |
32 | |
33 | |
34 | |
35 | |
36 /* 381 */ | |
37 #pragma pack(push, 1) | |
290 | 38 struct PlayerCreation_AttributeProps |
0 | 39 { |
40 unsigned __int8 uBaseValue; | |
41 char uMaxValue; | |
42 char uDroppedStep; | |
43 char uBaseStep; | |
44 }; | |
45 #pragma pack(pop) | |
46 | |
47 | |
48 #pragma pack(push, 1) | |
290 | 49 |
50 | |
51 | |
0 | 52 #pragma pack(pop) |
290 | 53 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
54 { | |
55 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
56 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
57 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
58 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 59 }; |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 // available skills per class ( 9 classes X 37 skills ) | |
67 // 0 - not available | |
68 // 1 - available | |
69 // 2 - primary skill | |
70 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
71 { | |
72 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
73 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
74 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
75 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
76 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
77 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
78 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
79 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
80 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
81 }; | |
82 | |
83 | |
1374 | 84 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398 |
85 { | |
86 1, // EQUIP_OFF_HAND | |
87 1, // EQUIP_MAIN_HAND | |
88 2, // EQUIP_BOW | |
89 3, // EQUIP_ARMOUR | |
90 0, // EQUIP_SHIELD | |
91 4, // EQUIP_HELMET | |
92 5, // EQUIP_BELT | |
93 6, // EQUIP_CLOAK | |
94 7, // EQUIP_GAUNTLETS | |
95 8, // EQUIP_BOOTS | |
96 10, // EQUIP_RING | |
97 9, // EQUIP_AMULET | |
98 1, // EQUIP_WAND | |
99 0, // EQUIP_REAGENT | |
100 0, // EQUIP_POTION | |
101 0, // EQUIP_SPELL_SCROLL | |
102 0, // EQUIP_BOOK | |
103 0, // EQUIP_MESSAGE_SCROLL | |
104 0, // EQUIP_GOLD | |
105 0, // EQUIP_GEM | |
106 0 // EQUIP_NONE | |
107 }; | |
0 | 108 |
109 | |
110 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
111 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
112 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
113 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
114 | |
1325 | 115 unsigned char pConditionAttributeModifier[7][19] = |
116 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might | |
117 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence | |
118 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower | |
119 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance | |
120 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy | |
121 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed | |
122 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck | |
123 | |
124 unsigned char pAgingAttributeModifier[7][4] = | |
125 {{100, 75, 40, 10}, //Might | |
126 {100, 150, 100, 10}, //Intelligence | |
127 {100, 150, 100, 10}, //Willpower | |
128 {100, 75, 40, 10}, //Endurance | |
129 {100, 100, 40, 10}, //Accuracy | |
130 {100, 100, 40, 10}, //Speed | |
131 {100, 100, 100, 100}}; //Luck | |
0 | 132 |
1036 | 133 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 134 |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
135 std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}}; |
0 | 136 |
1036 | 137 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 138 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 139 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
140 signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6}; | |
0 | 141 |
142 | |
816 | 143 unsigned short base_recovery_times_per_weapon_type[12] = |
144 { | |
145 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
146 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
147 60, // PLAYER_SKILL_DAGGER | |
148 100, // PLAYER_SKILL_AXE | |
149 80, // PLAYER_SKILL_SPEAR | |
150 100, // PLAYER_SKILL_BOW | |
151 80, // PLAYER_SKILL_MACE | |
152 30, // PLAYER_SKILL_BLASTER | |
153 10, // PLAYER_SKILL_SHIELD | |
154 10, // PLAYER_SKILL_LEATHER | |
155 20, // PLAYER_SKILL_CHAIN | |
156 30 // PLAYER_SKILL_PLATE | |
157 }; | |
158 | |
159 | |
0 | 160 |
161 //----- (00490913) -------------------------------------------------------- | |
1459 | 162 int PlayerCreation_GetUnspentAttributePointCount() |
0 | 163 { |
164 signed int v0; // edi@1 | |
1273 | 165 int raceId; // ebx@2 |
0 | 166 signed int v4; // eax@17 |
167 int v5; // edx@18 | |
168 signed int v6; // ecx@18 | |
1273 | 169 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 |
170 | |
171 remainingStatPoints = 50; | |
0 | 172 v0 = 50; |
1273 | 173 for (int playerNum = 0; playerNum < 4; playerNum++) |
174 { | |
175 raceId = pParty->pPlayers[playerNum].GetRace(); | |
176 for (int statNum = 0; statNum <= 6; statNum++) | |
177 { | |
178 switch ( statNum ) | |
0 | 179 { |
1273 | 180 case 0: |
181 v0 = pParty->pPlayers[playerNum].uMight; | |
182 break; | |
183 case 1: | |
184 v0 = pParty->pPlayers[playerNum].uIntelligence; | |
185 break; | |
186 case 2: | |
187 v0 = pParty->pPlayers[playerNum].uWillpower; | |
188 break; | |
189 case 3: | |
190 v0 = pParty->pPlayers[playerNum].uEndurance; | |
191 break; | |
192 case 4: | |
193 v0 = pParty->pPlayers[playerNum].uAccuracy; | |
194 break; | |
195 case 5: | |
196 v0 = pParty->pPlayers[playerNum].uSpeed; | |
197 break; | |
198 case 6: | |
199 v0 = pParty->pPlayers[playerNum].uLuck; | |
200 break; | |
201 } | |
202 v4 = StatTable[raceId][statNum].uBaseValue; | |
203 if ( v0 >= v4 ) | |
204 { | |
205 v5 = StatTable[raceId][statNum].uDroppedStep; | |
206 v6 = StatTable[raceId][statNum].uBaseStep; | |
0 | 207 } |
208 else | |
209 { | |
1273 | 210 v5 = StatTable[raceId][statNum].uBaseStep; |
211 v6 = StatTable[raceId][statNum].uDroppedStep; | |
0 | 212 } |
1273 | 213 remainingStatPoints += v5 * (v4 - v0) / v6; |
214 } | |
215 } | |
216 return remainingStatPoints; | |
0 | 217 } |
218 | |
219 | |
220 | |
221 //----- (00427730) -------------------------------------------------------- | |
222 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
223 { | |
1275 | 224 if (sMana >= (signed int)uRequiredMana) |
225 { | |
226 sMana -= (signed int)uRequiredMana; | |
488 | 227 return true; |
228 } | |
229 | |
230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
231 return false; | |
0 | 232 } |
233 | |
234 | |
235 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 236 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
237 { | |
0 | 238 float v6; // ST04_4@1 |
1014 | 239 signed int item_value; // eax@1 |
240 signed int sell_price; // ebx@1 | |
241 | |
242 item_value =pOwnItems[item_index].GetValue(); | |
243 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
244 sell_price = GetPriceSell(item_value, v6); | |
245 if ( pOwnItems[item_index].Broken() ) | |
246 sell_price = 1; | |
247 if ( sell_price < 1 ) | |
248 sell_price = 1; | |
249 RemoveItemAtInventoryIndex(inventory_idnx); | |
250 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 251 } |
252 | |
253 | |
254 | |
255 //----- (0043EEF3) -------------------------------------------------------- | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
256 bool Player::NothingOrJustBlastersEquipped() |
0 | 257 { |
1014 | 258 signed int item_idx; // esi@1 |
259 signed int item_id; // esi@1 | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
260 for (int i = 0; i < 16; ++i) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
261 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
262 item_idx = pEquipment.pIndices[i]; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
263 if (item_idx) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
264 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
265 item_id = pOwnItems[item_idx - 1].uItemID; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
266 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
267 return false; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
268 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
269 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
270 return true; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
271 } |
1014 | 272 |
0 | 273 |
274 | |
275 | |
276 //----- (004B8040) -------------------------------------------------------- | |
1036 | 277 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
278 { | |
279 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 280 } |
281 | |
282 //----- (004B807C) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
283 int Player::GetTempleHealCostModifier(float a2) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
284 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
285 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 int conditionTimeMultiplier; // esi@1 |
0 | 287 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 290 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 conditionIdx = GetMajorConditionIdx(); |
1275 | 292 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
293 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
295 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
296 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
297 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
298 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
299 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
300 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 } |
1350 | 304 else |
305 { | |
1275 | 306 conditionTimeMultiplier = 1; |
307 baseConditionMultiplier = 1; | |
1350 | 308 if (conditionIdx < 14) |
309 { | |
310 for (int i = 0; i <= 13; i++) | |
311 { | |
312 v6 = GetConditionDayOfWeek(i); | |
313 if ( v6 > conditionTimeMultiplier ) | |
314 conditionTimeMultiplier = v6; | |
315 } | |
316 } | |
1275 | 317 } |
318 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
319 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
320 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
321 return result; |
0 | 322 } |
323 | |
324 //----- (004B8102) -------------------------------------------------------- | |
917 | 325 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 326 { |
327 signed int v3; // esi@1 | |
328 signed int result; // eax@3 | |
329 | |
1275 | 330 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 331 if ( v3 > uRealValue ) |
332 v3 = uRealValue; | |
0 | 333 result = 1; |
334 if ( v3 >= 1 ) | |
335 result = v3; | |
336 return result; | |
337 } | |
338 | |
339 //----- (004B8142) -------------------------------------------------------- | |
749 | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
341 { | |
1275 | 342 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 343 |
344 if (price < uRealValue) | |
345 price = uRealValue; | |
346 return price; | |
0 | 347 } |
348 | |
349 //----- (004B8179) -------------------------------------------------------- | |
916 | 350 int Player::GetPriceIdentification(float a2) |
0 | 351 { |
352 signed int v2; // esi@1 | |
353 int v3; // ecx@1 | |
354 signed int result; // eax@3 | |
355 | |
1275 | 356 v2 = (signed int)(a2 * 50.0); |
0 | 357 v3 = v2 * (100 - GetMerchant()) / 100; |
358 if ( v3 < v2 / 3 ) | |
359 v3 = v2 / 3; | |
360 result = 1; | |
361 if ( v3 >= 1 ) | |
362 result = v3; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B81C3) -------------------------------------------------------- | |
916 | 367 int Player::GetPriceRepair(int a2, float a3) |
0 | 368 { |
369 signed int v3; // esi@1 | |
370 int v4; // ecx@1 | |
371 signed int result; // eax@3 | |
372 | |
1275 | 373 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 374 v4 = v3 * (100 - GetMerchant()) / 100; |
375 if ( v4 < v3 / 3 ) | |
376 v4 = v3 / 3; | |
377 result = 1; | |
378 if ( v4 >= 1 ) | |
379 result = v4; | |
380 return result; | |
381 } | |
382 | |
383 //----- (004B8213) -------------------------------------------------------- | |
1275 | 384 int Player::GetBaseSellingPrice(int a2, float a3) |
385 { | |
386 signed int v3; // qax@1 | |
387 | |
388 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
389 if ( v3 < 1 ) | |
390 v3 = 1; | |
0 | 391 return v3; |
392 } | |
393 | |
394 //----- (004B8233) -------------------------------------------------------- | |
1275 | 395 int Player::GetBaseBuyingPrice(int a2, float a3) |
396 { | |
397 signed int v3; // qax@1 | |
398 | |
399 v3 = (signed int)((double)a2 * a3); | |
400 if ( v3 < 1 ) | |
401 v3 = 1; | |
0 | 402 return v3; |
403 } | |
404 | |
405 //----- (004B824B) -------------------------------------------------------- | |
1275 | 406 int Player::GetBaseIdentifyPrice(float a2) |
407 { | |
408 signed int v2; // qax@1 | |
409 | |
410 v2 = (signed int)(a2 * 50.0); | |
411 if ( v2 < 1 ) | |
412 v2 = 1; | |
0 | 413 return v2; |
414 } | |
415 | |
416 //----- (004B8265) -------------------------------------------------------- | |
1275 | 417 int Player::GetBaseRepairPrice(int a2, float a3) |
418 { | |
419 signed int v3; // qax@1 | |
420 | |
421 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
422 if ( v3 < 1 ) | |
423 v3 = 1; | |
0 | 424 return v3; |
425 } | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 432 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
433 { |
0 | 434 signed int v2; // eax@1 |
336 | 435 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 436 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
437 { | |
438 return false; | |
439 } | |
440 else | |
441 { | |
442 if (GetMajorConditionIdx() == Condition_Zombie) | |
443 { | |
444 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
445 { | |
446 return false; | |
447 } | |
448 else | |
449 { | |
450 return true; | |
451 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
452 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
453 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
454 { |
1348 | 455 return true; |
456 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
457 } |
0 | 458 } |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
1351 | 468 |
1012 | 469 item_idx = *pitem_index; |
470 if ( item_idx >125 || item_idx < 0 ) | |
471 { | |
472 return 0; | |
473 } | |
474 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
475 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 476 if ( inv_index < 0 ) |
477 { | |
478 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
479 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 480 } |
481 | |
482 return inv_index; | |
0 | 483 } |
484 | |
485 | |
486 | |
487 //----- (004160CA) -------------------------------------------------------- | |
1012 | 488 void Player::ItemsEnchant( int enchant_count ) |
489 { | |
490 int avalible_items; // ebx@1 | |
491 int i; // edx@8 | |
492 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
493 | |
494 avalible_items = 0; | |
495 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
496 | |
1349 | 497 for (i = 0; i < 138; ++i) |
498 { | |
499 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
500 item_index_tabl[avalible_items++] = i; | |
501 } | |
1012 | 502 |
503 if ( avalible_items ) | |
504 { | |
505 if ( enchant_count ) | |
506 { | |
1349 | 507 for ( i = 0; i < enchant_count; ++i ) |
508 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
509 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
510 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 511 } |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
517 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 518 } |
519 } | |
520 } | |
0 | 521 } |
522 | |
523 //----- (004948B1) -------------------------------------------------------- | |
187 | 524 void Player::PlaySound(PlayerSpeech speech, int a3) |
525 { | |
1351 | 526 signed int speechCount = 0; // esi@4 |
527 signed int expressionCount = 0; // esi@4 | |
528 int pickedVariant; // esi@10 | |
248 | 529 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 530 signed int pSoundID; // ecx@19 |
1351 | 531 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
532 int expressionVariantArray[5]; | |
533 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
534 unsigned int expressionDuration = 0; | |
187 | 535 |
1351 | 536 pickedSoundID = 0; |
203 | 537 if (uVoicesVolumeMultiplier) |
0 | 538 { |
1351 | 539 for (int i = 0; i < 2; i++) |
540 { | |
1406 | 541 if ( SoundSetAction[speech][i] ) |
542 { | |
543 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 544 speechCount++; |
545 } | |
546 } | |
547 if ( speechCount ) | |
548 { | |
549 pickedVariant = speechVariantArray[rand() % speechCount]; | |
550 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
551 if (numberOfSubvariants > 0) | |
552 { | |
553 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 554 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 555 } |
556 } | |
557 } | |
558 | |
559 for (int i = 0; i < 5; i++) | |
560 { | |
1406 | 561 if ( SoundSetAction[speech][i + 3] ) |
562 { | |
563 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 564 expressionCount++; |
565 } | |
566 } | |
567 if ( expressionCount ) | |
568 { | |
569 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
570 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
571 { | |
1406 | 572 pSoundID = 0; |
573 if ( pSoundList->sNumSounds ) | |
574 { | |
1351 | 575 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 576 { |
1406 | 577 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
578 pSoundID = i; | |
0 | 579 } |
580 } | |
1406 | 581 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 582 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
583 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
584 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
585 } |
0 | 586 } |
587 // 4948B1: using guessed type int var_1C[5]; | |
588 | |
589 //----- (00494A25) -------------------------------------------------------- | |
187 | 590 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
591 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
592 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
593 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
594 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
595 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
598 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
599 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
600 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
601 else |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
602 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
604 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
605 if (v3 >= 2 && v3 <= 11 && v3 != 8 && !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR)) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
606 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
607 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
608 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
609 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
610 } |
0 | 611 this->uExpressionTimePassed = 0; |
612 if ( !a3 ) | |
613 { | |
187 | 614 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
615 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
616 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
617 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
618 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
619 } |
187 | 620 expression = new_expression; |
0 | 621 viewparams->bRedrawGameUI = 1; |
622 } | |
623 | |
624 //----- (0049327B) -------------------------------------------------------- | |
1355 | 625 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 ) |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
626 { |
135 | 627 if ( this->classType == uClass ) |
0 | 628 { |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
629 return true; |
0 | 630 } |
631 else | |
632 { | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
633 if (!a3) |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
634 { |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
635 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
636 } |
0 | 637 switch ( uClass ) |
638 { | |
639 case 0x1Au: | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
640 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); |
0 | 641 case 0x1Bu: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
642 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); |
0 | 643 case 0x22u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
644 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
0 | 645 case 0x23u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
646 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
0 | 647 break; |
648 default: | |
1545 | 649 Error("Should not be able to get here (%u)", uClass); |
0 | 650 break; |
651 } | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
652 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
653 } |
0 | 654 } |
655 | |
656 | |
657 //----- (00492C0B) -------------------------------------------------------- | |
658 bool Player::CanAct() | |
659 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
660 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
661 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
662 this->IsPertified() || this->IsEradicated() ) |
1355 | 663 return false; |
0 | 664 else |
1355 | 665 return true; |
0 | 666 } |
667 | |
668 //----- (00492C40) -------------------------------------------------------- | |
669 bool Player::CanSteal() | |
670 { | |
1355 | 671 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 672 } |
673 | |
674 //----- (00492C4E) -------------------------------------------------------- | |
675 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
676 { | |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
677 switch (uItemID) |
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
678 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
679 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
680 case ITEM_RELIC_OLD_NICK: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
681 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
682 case ITEM_RELIC_TALEDONS_HELM: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
683 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
684 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
685 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
686 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
687 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
688 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
689 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
690 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break; |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
691 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
692 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
693 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
694 |
0 | 695 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
696 void Player::SetCondition( unsigned int uConditionIdx, int a3 ) |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
697 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
698 signed int player_sex; // ecx@77 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
699 signed int remainig_player; // ebx@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
700 int players_before; // [sp+10h] [bp-4h]@2 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
701 int players_after; // [sp+20h] [bp+Ch]@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
702 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
703 if ( pConditions[uConditionIdx] ) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
704 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
705 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
706 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
707 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
708 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
709 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
710 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
711 switch ( uConditionIdx ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
712 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
713 case Condition_Cursed: PlaySound(SPEECH_30, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
714 case Condition_Weak: PlaySound(SPEECH_25, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
715 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
716 case Condition_Fear: PlaySound(SPEECH_26, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 case Condition_Drunk: PlaySound(SPEECH_31, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
718 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 719 case Condition_Poison1: |
720 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
721 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 722 case Condition_Disease1: |
723 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
724 case Condition_Disease3: PlaySound(SPEECH_28, 0);break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 case Condition_Paralyzed: break; //nosound |
1014 | 726 case Condition_Unconcious: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
727 PlaySound(SPEECH_32, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
728 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
729 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
730 break; |
1014 | 731 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
732 PlaySound(SPEECH_33, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
733 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
734 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
735 if ( sMana > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
736 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
737 break; |
1014 | 738 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
739 PlaySound(SPEECH_34, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
740 break; |
1014 | 741 case Condition_Eradicated: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
742 PlaySound(SPEECH_35, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
743 if (sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
744 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
745 if ( sMana > 0 ) |
1014 | 746 sMana = 0; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
747 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
748 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
749 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
750 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
751 memset(&pConditions[0], 0, sizeof(pConditions)); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
752 sHealth = GetMaxHealth(); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
753 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
754 player_sex = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
755 uPrevFace = uCurrentFace; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
756 uPrevVoiceID = uVoiceID; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
757 if (IsMale()) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
758 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
759 uCurrentFace = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
760 uVoiceID = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
761 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
762 else |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
763 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
764 uCurrentFace = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
765 uVoiceID = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
766 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
767 PlaySound(SPEECH_99, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
768 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
769 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
770 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
771 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
772 for (int i = 1; i < 5; ++i) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
773 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
774 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 ++players_before; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
777 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
778 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
780 remainig_player = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
781 players_after = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
782 for (int i = 1; i < 5; ++i) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
783 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
784 if ( pPlayers[i]->CanAct() ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
785 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
786 remainig_player = i; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
787 ++players_after; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
788 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
789 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
790 if (( players_before == 2 ) && ( players_after == 1 )) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
791 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
792 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
793 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
794 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
795 } |
0 | 796 |
797 //----- (00492528) -------------------------------------------------------- | |
798 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
799 { | |
1363 | 800 Texture *texture; // esi@1 |
801 unsigned int slotWidth; // ebx@1 | |
802 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
803 | |
804 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
805 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
806 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 807 if ( !areWeLoadingTexture ) |
808 { | |
1363 | 809 texture->Release(); |
1006 | 810 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 811 } |
1555 | 812 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions"); |
1363 | 813 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
814 { | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
815 for (unsigned int x = 0; x < slotWidth; x++) |
1363 | 816 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
817 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 818 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
819 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
820 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
821 return false; |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
822 } |
1363 | 823 } |
824 } | |
825 return true; | |
826 } | |
827 return false; | |
0 | 828 } |
829 // 506128: using guessed type int areWeLoadingTexture; | |
830 | |
831 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
832 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
833 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
834 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
835 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
836 if (pInventoryItemList[i].uItemID == 0) |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
837 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
838 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
839 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
840 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
841 return -1; |
0 | 842 } |
843 | |
844 //----- (00492600) -------------------------------------------------------- | |
845 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
846 { | |
847 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
848 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
849 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
850 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 if ( freeSlot == -1 ) |
0 | 852 { |
853 if ( uActiveCharacter ) | |
201 | 854 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
855 return 0; |
0 | 856 } |
857 else | |
858 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
859 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
860 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
861 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 862 } |
863 return result; | |
864 } | |
865 // 506128: using guessed type int areWeLoadingTexture; | |
866 | |
867 //----- (00492700) -------------------------------------------------------- | |
868 int Player::HasSkill(unsigned int uSkillType) | |
869 { | |
1374 | 870 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
871 { | |
872 return 1; | |
0 | 873 } |
874 else | |
875 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
876 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
877 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 878 return 0; |
879 } | |
0 | 880 } |
881 | |
882 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
883 void Player::WearItem( unsigned int uItemID ) |
0 | 884 { |
1010 | 885 int item_body_anch; // edi@6 |
886 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
887 item_indx = FindFreeInventoryListSlot(); |
1010 | 888 |
889 if ( item_indx != -1 ) | |
890 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
891 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 892 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
893 pEquipment.pIndices[item_body_anch] = item_indx + 1; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
894 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 895 } |
896 } | |
897 | |
898 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
899 int Player::AddItem(int index, unsigned int uItemID) |
0 | 900 { |
1374 | 901 int xStartValue = 0; |
902 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
903 if ( index == -1 ) |
0 | 904 { |
1385 | 905 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
906 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
907 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
0 | 908 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
909 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
910 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
911 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID); |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
912 } |
0 | 913 } |
1385 | 914 } |
0 | 915 return 0; |
916 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
917 if ( !CanFitItem(index, uItemID) ) |
0 | 918 { |
919 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
920 return 0; | |
921 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
922 return CreateItemInInventory(index, uItemID); |
0 | 923 } |
924 | |
925 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
926 int Player::AddItem2(int index, ItemGen *Src) |
0 | 927 { |
928 pItemsTable->SetSpecialBonus(Src); | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
929 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
930 if ( index == -1 ) |
0 | 931 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
932 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
933 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
934 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
1385 | 935 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
936 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) ) |
0 | 937 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
938 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src); |
0 | 939 } |
1385 | 940 } |
0 | 941 } |
942 return 0; | |
943 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
944 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 945 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
946 return CreateItemInInventory2(index, Src); |
0 | 947 } |
948 | |
949 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
950 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 951 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
952 signed int freeSlot; // ebx@1 |
0 | 953 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
954 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
955 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
956 if ( freeSlot == -1 ) |
0 | 957 { |
958 result = 0; | |
959 } | |
960 else | |
961 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
962 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
963 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
964 result = freeSlot + 1; |
0 | 965 } |
966 return result; | |
967 } | |
968 // 506128: using guessed type int areWeLoadingTexture; | |
969 | |
970 //----- (0049298B) -------------------------------------------------------- | |
1385 | 971 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
972 { |
1014 | 973 Texture *item_texture; // esi@1 |
974 int *pInvPos; // esi@4 | |
975 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
976 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
977 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
978 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 979 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
980 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 981 if ( !areWeLoadingTexture ) |
982 { | |
1014 | 983 item_texture->Release(); |
1006 | 984 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 985 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
986 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
987 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
988 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
989 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
990 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
991 memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
992 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
993 } |
1014 | 994 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
995 pInventoryMatrix[index] = itemListPos + 1; |
0 | 996 } |
278 | 997 |
0 | 998 // 506128: using guessed type int areWeLoadingTexture; |
999 | |
1000 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1001 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1002 { |
1014 | 1003 ItemGen *item_in_slot; // ecx@1 |
1004 Texture *item_texture; // esi@1 | |
1005 unsigned int slot_height; // ebp@1 | |
1006 int *pInvPos; // edx@4 | |
1007 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1008 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1009 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1010 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1011 item_in_slot->Reset(); | |
1012 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1013 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1014 if ( !areWeLoadingTexture ) |
1015 { | |
1014 | 1016 item_texture->Release(); |
1006 | 1017 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1018 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1019 if ( slot_width > 0 ) |
1014 | 1020 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1021 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1022 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1023 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1024 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1025 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1026 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1027 } |
0 | 1028 } |
1029 // 506128: using guessed type int areWeLoadingTexture; | |
1030 | |
1031 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1032 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1033 { | |
1034 unsigned int idemId; // edx@1 | |
1035 signed int equipType; // esi@1 | |
1036 float multiplier; // ST04_4@26 | |
1037 int price; // edi@26 | |
1038 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1039 int itemValue; | |
1040 | |
1041 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1042 idemId = pItem->uItemID; | |
1043 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1044 itemValue = pItem->GetValue(); | |
1045 | |
1046 switch (building_type) | |
1047 { | |
1411 | 1048 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1049 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1050 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1051 if (equipType > EQUIP_BOW) |
1386 | 1052 return 4; |
1053 break; | |
1411 | 1054 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1055 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1056 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1057 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1058 return 4; |
1059 break; | |
1411 | 1060 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1061 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1062 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1063 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1064 return 4; |
1065 break; | |
1411 | 1066 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1067 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1068 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1069 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1070 return 4; |
1071 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1072 default: |
1545 | 1073 Error("(%u)", building_type); |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1074 break; |
1386 | 1075 } |
1076 if (pItem->Stolen()) | |
1077 return 6; | |
1078 | |
1079 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1080 switch (ShopMenuType) | |
1081 { | |
1082 case 2: | |
1083 price = GetBuyingPrice(itemValue, multiplier); | |
1084 break; | |
1085 case 3: | |
917 | 1086 if (pItem->Broken()) |
1386 | 1087 price = 1; |
917 | 1088 else |
1386 | 1089 price = this->GetPriceSell(itemValue, multiplier); |
1090 break; | |
1091 case 4: | |
1092 price = this->GetPriceIdentification(multiplier); | |
1093 break; | |
1094 case 5: | |
1095 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1096 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1097 default: |
1545 | 1098 Assert("(%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) -------------------------------------------------------- | |
1352 bool Party::AddItem(ItemGen *pItem) | |
1353 { | |
1354 unsigned int v2; // eax@1 | |
1355 unsigned int v3; // ecx@4 | |
1356 signed int v4; // edx@4 | |
1357 char *v5; // eax@8 | |
973 | 1358 //unsigned int v6; // eax@10 |
0 | 1359 Texture *v7; // ebx@10 |
1360 signed int v8; // esi@10 | |
1361 Player *v9; // edi@11 | |
1362 int v10; // eax@11 | |
1363 bool result; // eax@15 | |
1364 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 1365 |
1366 | |
188 | 1367 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
1368 //int v16; // [sp+10h] [bp-18h]@3 | |
1369 //int v17; // [sp+14h] [bp-14h]@3 | |
1370 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 1371 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
1372 Party *v20; // [sp+20h] [bp-8h]@1 | |
1373 int v21; // [sp+24h] [bp-4h]@10 | |
1374 | |
1375 auto thos = this; | |
1376 | |
1377 v20 = thos; | |
1378 v2 = pItem->uItemID; | |
222 | 1379 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1380 pItem->SetIdentified(); |
188 | 1381 ///v15 = 0; |
1382 //v16 = 1; | |
1383 //v18 = 3; | |
1384 //v17 = 2; | |
0 | 1385 if ( uActiveCharacter ) |
1386 { | |
1387 v3 = uActiveCharacter - 1; | |
1388 v4 = 0; | |
1389 do | |
1390 { | |
188 | 1391 v15[v4++] = v3++; |
0 | 1392 if ( (signed int)v3 >= 4 ) |
1393 v3 = 0; | |
1394 } | |
1395 while ( v4 < 4 ); | |
1396 } | |
1397 v5 = pItemsTable->pItems[v2].pIconName; | |
1398 if ( v5 ) | |
1399 { | |
973 | 1400 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1401 v21 = areWeLoadingTexture; |
1402 v8 = 0; | |
1403 while ( 1 ) | |
1404 { | |
188 | 1405 v9 = &v20->pPlayers[v15[v8]]; |
1406 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 1407 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 1408 if ( v10 ) |
1409 break; | |
1410 ++v8; | |
1411 if ( v8 >= 4 ) | |
1412 { | |
1413 if ( !v21 ) | |
1414 { | |
1415 v7->Release(); | |
1006 | 1416 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1417 } |
1418 goto LABEL_15; | |
1419 } | |
1420 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1421 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
0 | 1422 pItem->Reset(); |
1423 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 1424 v19->PlaySound(SPEECH_60, 0); |
0 | 1425 if ( !v21 ) |
1426 { | |
1427 v7->Release(); | |
1006 | 1428 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1429 } |
1430 result = 1; | |
1431 } | |
1432 else | |
1433 { | |
1434 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1435 LABEL_15: | |
1436 result = 0; | |
1437 } | |
1438 return result; | |
1439 } | |
1440 // 506128: using guessed type int areWeLoadingTexture; | |
1441 | |
1442 //----- (0048C855) -------------------------------------------------------- | |
1443 int Player::GetBaseStrength() | |
1444 { | |
1445 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1446 } | |
1447 | |
1448 //----- (0048C86C) -------------------------------------------------------- | |
1449 int Player::GetBaseIntelligence() | |
1450 { | |
1451 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1452 } | |
1453 | |
1454 //----- (0048C883) -------------------------------------------------------- | |
1455 int Player::GetBaseWillpower() | |
1456 { | |
1457 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1458 } | |
1459 | |
1460 //----- (0048C89A) -------------------------------------------------------- | |
1461 int Player::GetBaseEndurance() | |
1462 { | |
1463 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1464 } | |
1465 | |
1466 //----- (0048C8B1) -------------------------------------------------------- | |
1467 int Player::GetBaseAccuracy() | |
1468 { | |
1469 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1470 } | |
1471 | |
1472 //----- (0048C8C8) -------------------------------------------------------- | |
1473 int Player::GetBaseSpeed() | |
1474 { | |
1475 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1476 } | |
1477 | |
1478 //----- (0048C8DF) -------------------------------------------------------- | |
1479 int Player::GetBaseLuck() | |
1480 { | |
1481 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1482 } | |
1483 | |
1484 //----- (0048C8F6) -------------------------------------------------------- | |
1485 int Player::GetBaseLevel() | |
1486 { | |
1487 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1488 } | |
1489 | |
1490 //----- (0048C90D) -------------------------------------------------------- | |
1491 int Player::GetActualLevel() | |
1492 { | |
1493 return uLevel + sLevelModifier + | |
1494 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1495 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1496 } | |
1497 | |
1498 //----- (0048C93C) -------------------------------------------------------- | |
1499 int Player::GetActualMight() | |
1500 { | |
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
|
1501 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus); |
0 | 1502 } |
1503 | |
1504 //----- (0048C9C2) -------------------------------------------------------- | |
1505 int Player::GetActualIntelligence() | |
1506 { | |
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
|
1507 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus); |
0 | 1508 } |
1509 | |
1510 //----- (0048CA3F) -------------------------------------------------------- | |
1511 int Player::GetActualWillpower() | |
1512 { | |
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
|
1513 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus); |
0 | 1514 } |
1515 | |
1516 //----- (0048CABC) -------------------------------------------------------- | |
1517 int Player::GetActualEndurance() | |
1518 { | |
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
|
1519 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus); |
0 | 1520 } |
1521 | |
1522 //----- (0048CB39) -------------------------------------------------------- | |
1523 int Player::GetActualAccuracy() | |
1524 { | |
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
|
1525 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus); |
0 | 1526 } |
1527 | |
1528 //----- (0048CBB6) -------------------------------------------------------- | |
1529 int Player::GetActualSpeed() | |
1530 { | |
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 GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus); |
0 | 1532 } |
1533 | |
1534 //----- (0048CC33) -------------------------------------------------------- | |
1535 int Player::GetActualLuck() | |
1536 { | |
1036 | 1537 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1538 | |
1539 npc_luck_bonus = 0; | |
652 | 1540 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1541 npc_luck_bonus = 5; |
652 | 1542 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1543 npc_luck_bonus += 20; |
652 | 1544 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1545 npc_luck_bonus += 10; |
1324 | 1546 |
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
|
1547 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus) |
1325 | 1548 + npc_luck_bonus; |
1549 } | |
1550 | |
1551 //----- (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
|
1552 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
|
1553 { |
1324 | 1554 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1555 uint uAgeingMultiplier = 100; | |
1556 for (uint i = 0; i < 4; ++i) | |
1325 | 1557 { |
1324 | 1558 if (uActualAge >= pAgeingTable[i]) |
1325 | 1559 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1560 else | |
1561 break; | |
1562 } | |
1563 | |
1564 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1565 int magicBonus = GetMagicalBonus(attrId); | |
1566 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
|
1567 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 |
1325 | 1568 + 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
|
1569 + 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
|
1570 + this->*attrBonus; |
0 | 1571 } |
1572 | |
1573 //----- (0048CCF5) -------------------------------------------------------- | |
1574 int Player::GetActualAttack(int a2) | |
1575 { | |
1576 Player *v2; // esi@1 | |
1577 int v3; // eax@1 | |
1578 int v4; // edi@1 | |
1579 int v5; // ebx@1 | |
1580 int v6; // ebp@1 | |
1581 | |
1582 v2 = this; | |
1583 v3 = GetActualAccuracy(); | |
1036 | 1584 v4 = GetParameterBonus(v3); |
0 | 1585 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1586 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1587 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
1588 } | |
1589 | |
1590 //----- (0048CD45) -------------------------------------------------------- | |
1591 int Player::GetMeleeDamageMinimal() | |
1592 { | |
1593 Player *v1; // edi@1 | |
1594 int v2; // eax@1 | |
1595 int v3; // esi@1 | |
1596 int v4; // esi@1 | |
1597 int v5; // esi@1 | |
1598 int v6; // esi@1 | |
1599 signed int result; // eax@1 | |
1600 | |
1036 | 1601 |
0 | 1602 v2 = GetActualMight(); |
1036 | 1603 v3 = GetParameterBonus(v2); |
0 | 1604 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1605 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1606 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1607 if ( result < 1 ) | |
1608 result = 1; | |
0 | 1609 return result; |
1610 } | |
1611 | |
1612 //----- (0048CD90) -------------------------------------------------------- | |
1613 int Player::GetMeleeDamageMaximal() | |
1614 { | |
1615 Player *v1; // edi@1 | |
1616 int v2; // eax@1 | |
1617 int v3; // esi@1 | |
1618 int v4; // esi@1 | |
1619 int v5; // esi@1 | |
1620 int v6; // esi@1 | |
1621 signed int result; // eax@1 | |
1622 | |
1623 v1 = this; | |
1624 v2 = GetActualMight(); | |
1036 | 1625 v3 = GetParameterBonus(v2); |
0 | 1626 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1627 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1628 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
1629 result = 1; | |
1630 if ( v6 >= 1 ) | |
1631 result = v6; | |
1632 return result; | |
1633 } | |
1634 | |
1635 //----- (0048CDDB) -------------------------------------------------------- | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1636 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
|
1637 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1638 int dmgSum; // esi@62 |
0 | 1639 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
|
1640 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
|
1641 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
|
1642 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1643 offHndWpnDmg = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1644 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
|
1645 if ( IsUnarmed() ) |
0 | 1646 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1647 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
|
1648 } |
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
|
1649 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
|
1650 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1651 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
|
1652 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1653 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
|
1654 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
|
1655 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
|
1656 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
|
1657 addOneDice = true; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1658 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
|
1659 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1660 if ( !ignoreOffhand ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1661 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1662 if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) |
0 | 1663 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1664 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
|
1665 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
|
1666 if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) |
0 | 1667 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1668 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); |
0 | 1669 } |
1670 } | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1671 } |
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 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
|
1674 if ( !ignoreSkillBonus ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1675 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1676 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
|
1677 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
|
1678 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
|
1679 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus; |
0 | 1680 } |
1681 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
|
1682 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
|
1683 result = dmgSum; |
0 | 1684 return result; |
1685 } | |
1686 | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1687 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1688 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
|
1689 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1690 int 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
|
1691 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
|
1692 if (addOneDice) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1693 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1694 diceCount++; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1695 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1696 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
|
1697 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
|
1698 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
|
1699 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1700 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
|
1701 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1702 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
|
1703 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
|
1704 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1705 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
|
1706 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
|
1707 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1708 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1709 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1710 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
|
1711 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1712 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1713 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1714 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
|
1715 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1716 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1717 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1718 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
|
1719 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1720 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1721 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1722 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1723 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
|
1724 && 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
|
1725 && 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
|
1726 totalDmg *= 3; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1727 return totalDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1728 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1729 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1730 |
0 | 1731 //----- (0048D0B9) -------------------------------------------------------- |
1732 int Player::GetRangedAttack() | |
1733 { | |
1734 Player *v1; // esi@1 | |
1735 int v2; // eax@1 | |
1736 int v3; // edi@3 | |
1737 int v4; // eax@4 | |
1738 int v5; // edi@4 | |
1739 int v6; // edi@4 | |
1740 int v7; // edi@4 | |
1741 | |
1742 v1 = this; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1743 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1744 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) |
0 | 1745 { |
1746 v4 = GetActualAccuracy(); | |
1036 | 1747 v5 = GetParameterBonus(v4); |
0 | 1748 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
1749 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
1750 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
1751 } | |
1752 else | |
1753 { | |
1754 v3 = GetActualAttack(1); | |
1755 } | |
1756 return v3; | |
1757 } | |
1758 | |
1759 //----- (0048D124) -------------------------------------------------------- | |
1760 int Player::GetRangedDamageMin() | |
1761 { | |
1762 Player *v1; // esi@1 | |
1763 int v2; // edi@1 | |
1764 int v3; // edi@1 | |
1765 int v4; // edi@1 | |
1766 unsigned __int16 v5; // ax@1 | |
1767 int result; // eax@6 | |
1768 | |
1769 v1 = this; | |
1040 | 1770 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
1771 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1772 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 1773 if ( v4 >= 1 ) |
1774 result = v4; | |
1775 else | |
1776 result = 0; | |
1777 return result; | |
1778 } | |
1779 | |
1780 //----- (0048D191) -------------------------------------------------------- | |
1781 int Player::GetRangedDamageMax() | |
1782 { | |
1783 Player *v1; // esi@1 | |
1784 int v2; // edi@1 | |
1785 int v3; // edi@1 | |
1786 int v4; // edi@1 | |
1787 unsigned __int16 v5; // ax@1 | |
1788 int result; // eax@6 | |
1789 | |
1790 v1 = this; | |
1040 | 1791 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
1792 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1793 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 1794 if ( v4 >= 1 ) |
1795 result = v4; | |
1796 else | |
1797 result = 0; | |
1798 return result; | |
1799 } | |
1800 | |
1801 //----- (0048D1FE) -------------------------------------------------------- | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1802 int Player::CalculateRangedDamageTo( int a2 ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1803 { |
0 | 1804 bool result; // eax@1 |
1805 ItemGen *v4; // ebx@2 | |
1806 unsigned int v5; // edi@2 | |
1807 int v7; // edx@4 | |
1808 char v8; // zf@4 | |
1809 int v9; // esi@5 | |
1810 int v10; // ebx@6 | |
1811 signed int v15; // [sp+8h] [bp-Ch]@2 | |
1812 int v17; // [sp+10h] [bp-4h]@1 | |
1813 | |
1814 v17 = 0; | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1815 if ( !HasItemEquipped(EQUIP_BOW) ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1816 return 0; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1817 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
0 | 1818 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
|
1819 v15 = pItemsTable->pItems[v5].uDamageRoll; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1820 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
|
1821 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1822 int v7 = rand() % v15; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1823 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
|
1824 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1825 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
0 | 1826 if ( a2 ) |
1827 { | |
377 | 1828 v10 = v4->uSpecEnchantmentType; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1829 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1830 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1831 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1832 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1833 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
|
1834 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1835 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1836 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1837 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
|
1838 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1839 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1840 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1841 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
|
1842 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1843 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1844 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1845 } |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1846 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
0 | 1847 } |
1848 | |
1849 //----- (0048D2EA) -------------------------------------------------------- | |
1850 char *Player::GetMeleeDamageString() | |
1851 { | |
1036 | 1852 signed int itemid; // eax@1 |
1853 int min_damage; // edi@3 | |
1854 int max_damage; // eax@3 | |
0 | 1855 |
1856 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1857 | |
1036 | 1858 if ( pEquipment.uMainHand) |
1859 { | |
1860 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1861 if ( itemid < ITEM_BLASTER || itemid > ITEM_LASER_RIFLE ) //blasters |
1036 | 1862 { |
1863 min_damage = GetMeleeDamageMinimal(); | |
1864 max_damage = GetMeleeDamageMaximal(); | |
1865 } | |
1866 else | |
1867 { //for blasters | |
1868 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
1869 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
1870 } | |
1871 if ( max_damage ) | |
1872 { | |
1873 if ( min_damage == max_damage ) | |
1874 { | |
1875 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
1876 } | |
1877 else | |
1878 { | |
1879 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
1880 } | |
1881 } | |
1882 else | |
1883 { | |
1884 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
1885 } | |
1886 | |
1887 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
1888 { | |
1889 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
1890 } | |
1891 } | |
0 | 1892 else |
1036 | 1893 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
1894 return player__getmeleedamagestring_static_buff; | |
0 | 1895 } |
1896 | |
1897 //----- (0048D396) -------------------------------------------------------- | |
1898 char *Player::GetRangedDamageString() | |
1036 | 1899 { |
1900 signed int itemid; // eax@1 | |
1901 int min_damage; // edi@3 | |
1902 int max_damage; // eax@3 | |
1903 | |
1904 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1905 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1906 if (pEquipment.uMainHand >= 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1907 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1908 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1909 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1910 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1911 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1912 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1913 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1914 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1915 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1916 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1917 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1918 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1919 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1920 } |
0 | 1921 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1922 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1923 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1924 max_damage = GetRangedDamageMax(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1925 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1926 if ( max_damage > 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1927 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1928 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1929 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1930 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1931 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1932 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1933 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1934 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1935 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1936 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1937 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1938 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1939 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1940 } |
1036 | 1941 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1942 } |
0 | 1943 |
1944 //----- (0048D45A) -------------------------------------------------------- | |
1945 bool Player::CanTrainToNextLevel() | |
1946 { | |
1947 int v1; // edx@1 | |
1948 int v2; // eax@1 | |
1949 int i; // esi@1 | |
1950 | |
1951 v1 = this->uLevel; | |
1952 v2 = 0; | |
1953 for ( i = 0; i < v1; ++i ) | |
1954 v2 += i + 1; | |
1955 return (signed __int64)this->uExperience >= 1000 * v2; | |
1956 } | |
1957 | |
1958 //----- (0048D498) -------------------------------------------------------- | |
1959 unsigned int Player::GetExperienceDisplayColor() | |
1960 { | |
1961 unsigned int result; // eax@2 | |
1962 | |
1963 if ( CanTrainToNextLevel() ) | |
995 | 1964 result = ui_character_bonus_text_color; |
0 | 1965 else |
995 | 1966 result = ui_character_default_text_color; |
0 | 1967 return result; |
1968 } | |
1969 | |
1970 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 1971 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
1972 { | |
1973 | |
1974 int resist_value; // edi@8 | |
1975 int player_luck; // eax@21 | |
1976 signed int res_rand_divider; // ebx@2 | |
1977 int armor_skill; // eax@29 | |
1978 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
1979 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
1980 | |
1981 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
1982 switch(dmg_type) | |
1983 { | |
1984 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
1985 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
1986 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
1987 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
1988 | |
1989 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
1990 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
1991 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
1992 } | |
1993 if (player_resist) | |
1994 resist_value = GetActualResistance(player_resist); | |
1995 else | |
1996 resist_value = 0; | |
1997 | |
1998 result_amount_dmg = amount; | |
1999 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 2000 return 0; |
1036 | 2001 player_luck = GetActualLuck(); |
2002 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
2003 | |
2004 if ( resist_value ) | |
2005 { | |
2006 if ( rand() % res_rand_divider >= 30 ) | |
2007 { | |
2008 result_amount_dmg = amount >> 1; | |
2009 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2010 { |
1036 | 2011 result_amount_dmg = amount >> 2; |
2012 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2013 { |
1036 | 2014 result_amount_dmg = amount >> 3; |
2015 if ( rand() % res_rand_divider >= 30 ) | |
2016 result_amount_dmg = amount >> 4; | |
0 | 2017 } |
2018 } | |
2019 } | |
2020 } | |
1036 | 2021 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
2022 { | |
2023 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 2024 { |
1036 | 2025 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
2026 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 2027 { |
1036 | 2028 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
2029 return (int)(double)result_amount_dmg * 0.5; | |
0 | 2030 } |
1036 | 2031 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 2032 { |
1036 | 2033 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
2034 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 2035 } |
2036 } | |
1036 | 2037 } |
2038 return result_amount_dmg; | |
0 | 2039 } |
2040 | |
2041 //----- (0048D62C) -------------------------------------------------------- | |
816 | 2042 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
2043 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2044 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 2045 } |
2046 | |
2047 //----- (0048D651) -------------------------------------------------------- | |
816 | 2048 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
2049 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2050 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 2051 } |
2052 | |
2053 //----- (0048D676) -------------------------------------------------------- | |
2054 bool Player::IsUnarmed() | |
2055 { | |
1091 | 2056 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
2057 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 2058 } |
2059 | |
2060 //----- (0048D6AA) -------------------------------------------------------- | |
2061 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
2062 { | |
2063 auto i = pEquipment.pIndices[uEquipIndex]; | |
2064 if (i) | |
1080 | 2065 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 2066 else |
2067 return false; | |
0 | 2068 } |
2069 | |
2070 //----- (0048D6D0) -------------------------------------------------------- | |
2071 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
2072 { | |
2073 for (uint i = 0; i < 16; ++i) | |
2074 { | |
2075 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 2076 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 2077 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
2078 return true; | |
2079 } | |
2080 return false; | |
2081 } | |
2082 | |
2083 //----- (0048D709) -------------------------------------------------------- | |
1080 | 2084 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
2085 { | |
1010 | 2086 |
0 | 2087 int v6; // esi@5 |
2088 | |
1080 | 2089 if ( equip_type >= 16 ) |
0 | 2090 { |
2091 v6 = 0; | |
2092 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2093 || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 2094 { |
2095 ++v6; | |
2096 if ( (signed int)v6 >= 16 ) | |
2097 return 0; | |
2098 } | |
2099 return 1; | |
2100 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2101 if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 2102 return 1; |
2103 return 0; | |
2104 } | |
2105 | |
2106 //----- (0048D76C) -------------------------------------------------------- | |
2107 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
2108 { | |
2109 unsigned __int16 v6; // cx@8 | |
2110 int v7; // edi@8 | |
2111 unsigned int v8; // ebx@8 | |
2112 unsigned int v9; // esi@8 | |
2113 int v10; // eax@8 | |
2114 int v11; // edi@12 | |
2115 bool result; // eax@13 | |
2116 | |
2117 if ( !a2 | |
2118 || this->pConditions[16] | |
2119 || this->pConditions[14] | |
2120 || this->pConditions[15] | |
2121 || this->pConditions[4] | |
2122 || this->pConditions[13] | |
2123 || this->pConditions[2] ) | |
2124 { | |
2125 result = 0; | |
2126 } | |
2127 else | |
2128 { | |
2129 v6 = this->pActiveSkills[34]; | |
2130 v7 = v6 & 0x3F; | |
2131 v8 = SkillToMastery(v6); | |
2132 v9 = a2->GetValue(); | |
2133 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
2134 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
2135 v9 *= 3; | |
2136 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
2137 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
2138 if ( rand() % 100 >= 5 ) | |
2139 { | |
2140 if ( *a6 > v11 ) | |
2141 result = *a6 - v11 < 500; | |
2142 else | |
2143 result = 2; | |
2144 } | |
2145 else | |
2146 { | |
2147 result = 0; | |
2148 } | |
2149 } | |
2150 return result; | |
2151 } | |
2152 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2153 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2154 | |
2155 //----- (0048D88B) -------------------------------------------------------- | |
2156 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2157 { | |
2158 Player *v4; // esi@1 | |
2159 Actor *v5; // edi@1 | |
2160 unsigned __int16 v6; // cx@10 | |
2161 int v7; // ebx@10 | |
2162 unsigned int v8; // esi@10 | |
2163 int v9; // eax@10 | |
2164 int v10; // esi@10 | |
2165 int v11; // eax@13 | |
2166 signed int v12; // ebx@15 | |
2167 signed int v13; // edx@15 | |
2168 int v14; // ecx@15 | |
2169 unsigned __int16 v15; // si@21 | |
2170 unsigned int v16; // ebx@24 | |
2171 int v17; // esi@24 | |
2172 const void *v18; // eax@29 | |
2173 unsigned int v19; // esi@31 | |
2174 int v20; // eax@34 | |
2175 char v21; // zf@36 | |
2176 unsigned int v22; // ST0C_4@39 | |
2177 char *v23; // esi@39 | |
2178 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2179 int v26; // [sp-8h] [bp-44h]@40 | |
2180 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2181 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2182 int v29; // [sp+30h] [bp-Ch]@10 | |
2183 int v30; // [sp+34h] [bp-8h]@10 | |
2184 Player *v31; // [sp+38h] [bp-4h]@1 | |
2185 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2186 | |
2187 v4 = this; | |
2188 v5 = &pActors[uActorID]; | |
2189 v31 = this; | |
2190 if ( &pActors[uActorID] | |
2191 && !this->pConditions[16] | |
2192 && !this->pConditions[14] | |
2193 && !this->pConditions[15] | |
2194 && !this->pConditions[4] | |
2195 && !this->pConditions[13] | |
2196 && !this->pConditions[2] ) | |
2197 { | |
2198 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2199 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2200 v6 = v4->pActiveSkills[34]; | |
2201 v7 = v6 & 0x3F; | |
2202 v8 = SkillToMastery(v6); | |
2203 v9 = rand(); | |
2204 v28 = 4 * v8; | |
2205 v30 = dword_4EDEA0[v8]; | |
2206 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2207 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2208 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2209 { | |
322 | 2210 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2211 _steal_perma = 0; |
2212 v26 = (int)v31->pName; | |
2213 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2214 } | |
2215 else | |
2216 { | |
2217 v11 = rand(); | |
2218 if ( v11 % 100 >= 40 ) | |
2219 { | |
2220 if ( v11 % 100 >= 70 ) | |
2221 { | |
2222 v19 = 0; | |
2223 if ( v7 > 0 ) | |
2224 { | |
2225 do | |
2226 { | |
2227 --v7; | |
2228 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2229 } | |
2230 while ( v7 ); | |
2231 } | |
2232 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2233 return _steal_perma; | |
377 | 2234 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2235 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2236 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2237 v21 = *(int *)v20 == v19; |
2238 *(int *)v20 -= v19; | |
2239 if ( v21 ) | |
2240 v5->array_000234[3].uItemID = 0; | |
2241 if ( v19 ) | |
2242 { | |
2243 party_finds_gold(v19, 2); | |
2244 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2245 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2246 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2247 LABEL_43: |
2248 ShowStatusBarString(v23, 2u); | |
2249 return _steal_perma; | |
2250 } | |
2251 } | |
2252 else | |
2253 { | |
2254 v27.Reset(); | |
2255 v12 = 0; | |
2256 v13 = 0; | |
2257 v14 = (int)v5->array_000234; | |
2258 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2259 { | |
2260 ++v13; | |
2261 v14 += 36; | |
2262 if ( v13 >= 4 ) | |
2263 goto LABEL_21; | |
2264 } | |
2265 v12 = 1; | |
2266 LABEL_21: | |
2267 v15 = v5->uCarriedItemID; | |
2268 if ( v15 || v12 ) | |
2269 { | |
2270 v27.Reset(); | |
2271 if ( v15 ) | |
2272 { | |
2273 v16 = (signed __int16)v15; | |
2274 v5->uCarriedItemID = 0; | |
2275 v27.uItemID = (signed __int16)v15; | |
2276 v17 = (signed __int16)v15; | |
2277 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2278 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2279 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2280 { | |
2281 if ( v16 != 220 ) | |
570 | 2282 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2283 } |
2284 } | |
2285 else | |
2286 { | |
2287 v18 = &v5->array_000234[rand() % 4]; | |
2288 memcpy(&v27, v18, sizeof(v27)); | |
2289 ((ItemGen *)v18)->Reset(); | |
2290 v16 = v27.uItemID; | |
2291 } | |
2292 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2293 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2294 pTmpBuf2.data(), |
0 | 2295 pGlobalTXT_LocalizationStrings[304], |
2296 v31->pName, | |
2297 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2298 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2299 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2300 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2301 pMouse->SetCursorBitmapFromItemID(v16); | |
2302 return _steal_perma; | |
2303 } | |
2304 } | |
2305 } | |
2306 v26 = (int)v31->pName; | |
2307 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2308 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2309 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2310 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2311 goto LABEL_43; |
2312 } | |
2313 return 0; | |
2314 } | |
2315 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2316 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2317 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2318 | |
2319 //----- (0048DBB9) -------------------------------------------------------- | |
2320 void Player::Heal(int amount) | |
2321 { | |
1010 | 2322 signed int max_health; // eax@3 |
2323 | |
2324 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
2325 { | |
2326 max_health = GetMaxHealth(); | |
2327 if ( pConditions[Condition_Zombie] ) | |
2328 max_health /= 2; | |
2329 sHealth += amount; | |
2330 if ( sHealth > max_health ) | |
2331 sHealth = max_health; | |
2332 if ( pConditions[Condition_Unconcious] ) | |
2333 { | |
2334 if ( sHealth > 0 ) | |
2335 { | |
2336 pConditions[Condition_Unconcious] = 0i64; | |
0 | 2337 } |
2338 } | |
2339 } | |
2340 } | |
2341 | |
2342 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2343 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2344 { | |
2345 signed int recieved_dmg; // eax@1 | |
2346 unsigned int armor_indx; // eax@8 | |
2347 bool broke_armor; | |
2348 | |
2349 pConditions[Condition_Sleep] = 0i64; | |
2350 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
2351 sHealth -= recieved_dmg; | |
2352 broke_armor = sHealth <= -10; | |
2353 if ( sHealth < 1 ) // | |
2354 { | |
2355 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
2356 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 2357 { |
1019 | 2358 SetCondition(Condition_Unconcious, 0); |
0 | 2359 } |
2360 else | |
2361 { | |
1019 | 2362 SetCondition(Condition_Dead, 0); |
1036 | 2363 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
2364 if ( sHealth > 0 ) | |
2365 sHealth = 0; | |
2366 } | |
2367 if (broke_armor ) | |
2368 { | |
2369 armor_indx = pEquipment.uArmor; | |
2370 if ( armor_indx ) | |
0 | 2371 { |
1036 | 2372 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 2373 { |
1036 | 2374 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 2375 } |
2376 } | |
2377 } | |
2378 } | |
1036 | 2379 if ( recieved_dmg && CanAct() ) |
187 | 2380 PlaySound(SPEECH_24, 0); |
1036 | 2381 return recieved_dmg; |
0 | 2382 } |
2383 | |
2384 //----- (0048DCF6) -------------------------------------------------------- | |
2385 int Player::_48DCF6(int a2, Actor *pActor) | |
2386 { | |
2387 signed int v3; // edi@1 | |
2388 signed int v4; // ebx@1 | |
2389 Player *v5; // esi@1 | |
2390 int v6; // eax@2 | |
2391 int v7; // eax@5 | |
2392 int v8; // eax@8 | |
2393 int v9; // ebx@8 | |
2394 int v10; // eax@8 | |
2395 int v11; // ebx@8 | |
2396 signed int v12; // edx@9 | |
2397 ItemGen *v13; // eax@9 | |
2398 int v14; // edx@16 | |
2399 unsigned int v15; // edx@17 | |
2400 int v16; // edx@26 | |
2401 unsigned int v17; // edx@27 | |
2402 signed int v19; // edx@38 | |
2403 int *v20; // ecx@38 | |
2404 signed int v21; // eax@40 | |
2405 int v22; // eax@49 | |
2406 signed int v23; // ebx@49 | |
2407 unsigned int v24; // eax@60 | |
2408 int v25; // ecx@61 | |
2409 int v26; // ebx@74 | |
2410 void *v27; // ecx@76 | |
2411 unsigned int v28; // ebx@78 | |
2412 signed int result; // eax@86 | |
2413 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2414 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2415 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2416 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2417 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2418 int v35; // [sp-Ch] [bp-ACh]@56 | |
2419 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2420 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2421 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2422 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2423 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2424 int v41; // [sp-4h] [bp-A4h]@51 | |
2425 int v42; // [sp-4h] [bp-A4h]@56 | |
2426 int v43; // [sp-4h] [bp-A4h]@57 | |
2427 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2428 int v45; // [sp-4h] [bp-A4h]@68 | |
2429 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2430 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2431 int v48; // [sp+9Ch] [bp-4h]@1 | |
2432 | |
2433 v3 = 0; | |
2434 v4 = 0; | |
2435 v5 = this; | |
2436 v47 = 0; | |
2437 v48 = 0; | |
2438 switch ( a2 ) | |
2439 { | |
2440 case 1: | |
2441 v6 = GetActualWillpower(); | |
2442 goto LABEL_46; | |
2443 case 2: | |
2444 case 3: | |
2445 case 4: | |
2446 case 9: | |
2447 case 10: | |
2448 case 11: | |
2449 case 13: | |
2450 case 21: | |
2451 v6 = GetActualEndurance(); | |
2452 goto LABEL_46; | |
2453 case 5: | |
2454 case 12: | |
2455 case 23: | |
2456 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2457 goto LABEL_5; | |
2458 case 15: | |
2459 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2460 goto LABEL_5; | |
2461 case 6: | |
2462 case 7: | |
2463 case 8: | |
2464 case 14: | |
2465 case 16: | |
2466 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2467 LABEL_5: | |
2468 v7 = GetActualResistance(v40); | |
2469 goto LABEL_47; | |
2470 case 22: | |
2471 v8 = GetActualWillpower(); | |
1036 | 2472 v9 = GetParameterBonus(v8); |
0 | 2473 v10 = GetActualIntelligence(); |
1036 | 2474 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2475 break; |
2476 case 17: | |
2477 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2478 v13 = this->pInventoryItemList; |
0 | 2479 do |
2480 { | |
315 | 2481 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 2482 v46[v4++] = v12; |
2483 ++v12; | |
2484 ++v13; | |
2485 } | |
2486 while ( v12 < 138 ); | |
2487 goto LABEL_36; | |
2488 case 18: | |
2489 v14 = 0; | |
2490 do | |
2491 { | |
2492 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2493 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2494 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2495 if ( v15 == EQUIP_ARMOUR ) |
898 | 2496 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2497 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2498 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2499 } |
2500 v14 = v15 + 1; | |
2501 } | |
2502 while ( v14 < 16 ); | |
2503 goto LABEL_36; | |
2504 case 19: | |
2505 v16 = 0; | |
2506 do | |
2507 { | |
2508 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2509 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2510 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2511 if ( v17 == 2 ) |
2512 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2513 if ( (!v17 || v17 == 1) | |
816 | 2514 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2515 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2516 } |
2517 v16 = v17 + 1; | |
2518 } | |
2519 while ( v16 < 16 ); | |
2520 LABEL_36: | |
2521 if ( !v4 ) | |
2522 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2523 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2524 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2525 break; | |
2526 case 20: | |
2527 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2528 v20 = this->pInventoryMatrix; |
0 | 2529 do |
2530 { | |
2531 if ( *v20 > 0 ) | |
2532 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2533 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2534 if ( v21 > 0 ) |
2535 { | |
2536 if ( v21 <= 134 ) | |
2537 v46[v4++] = v19; | |
2538 } | |
2539 } | |
2540 ++v19; | |
2541 ++v20; | |
2542 } | |
2543 while ( v19 < 126 ); | |
2544 if ( !v4 ) | |
2545 goto LABEL_87; | |
2546 v47 = (unsigned __int8)v46[rand() % v4]; | |
2547 v6 = GetActualAccuracy(); | |
2548 LABEL_46: | |
1036 | 2549 v7 = GetParameterBonus(v6); |
0 | 2550 LABEL_47: |
2551 v11 = v7; | |
2552 break; | |
2553 default: | |
2554 v11 = 0; | |
2555 break; | |
2556 } | |
2557 v22 = GetActualLuck(); | |
1036 | 2558 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2559 if ( rand() % v23 >= 30 ) |
2560 { | |
2561 LABEL_87: | |
2562 result = 0; | |
2563 } | |
2564 else | |
2565 { | |
2566 switch ( a2 ) | |
2567 { | |
2568 case 1: | |
2569 v41 = 1; | |
2570 v36 = 0; | |
2571 goto LABEL_56; | |
2572 case 2: | |
2573 v41 = 1; | |
2574 v36 = 1; | |
2575 goto LABEL_56; | |
2576 case 3: | |
2577 v41 = 1; | |
2578 v36 = 2; | |
2579 goto LABEL_56; | |
2580 case 23: | |
2581 v41 = 1; | |
2582 v36 = 3; | |
2583 goto LABEL_56; | |
2584 case 4: | |
2585 v41 = 1; | |
2586 v36 = 4; | |
2587 LABEL_56: | |
2588 SetCondition(v36, v41); | |
2589 v42 = 0; | |
2590 v37 = 0; | |
2591 v35 = 0; | |
2592 v34 = 0; | |
2593 v33 = -1; | |
2594 v32 = 0; | |
2595 v31 = 0; | |
2596 v30 = (SoundID)221; | |
2597 goto LABEL_83; | |
2598 case 5: | |
2599 v43 = 1; | |
2600 v38 = 5; | |
2601 goto LABEL_70; | |
2602 case 6: | |
2603 case 7: | |
2604 case 8: | |
2605 if ( a2 == 6 ) | |
2606 { | |
2607 v44 = 6; | |
2608 goto LABEL_60; | |
2609 } | |
2610 v25 = 2 * (a2 != 8) + 8; | |
2611 goto LABEL_65; | |
2612 case 9: | |
2613 if ( a2 == 6 ) | |
2614 { | |
2615 v44 = 7; | |
2616 LABEL_60: | |
2617 v24 = v44; | |
2618 } | |
2619 else | |
2620 { | |
2621 v25 = 2 * (a2 != 8) + 9; | |
2622 LABEL_65: | |
2623 v24 = v25; | |
2624 } | |
2625 SetCondition(v24, 1); | |
2626 v42 = 0; | |
2627 v37 = 0; | |
2628 v35 = 0; | |
2629 v34 = 0; | |
2630 v33 = -1; | |
2631 v32 = 0; | |
2632 v31 = 0; | |
2633 v30 = (SoundID)222; | |
2634 LABEL_83: | |
2635 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2636 do | |
2637 { | |
2638 LABEL_84: | |
2639 if ( v5 == pPlayers[v3 + 1] ) | |
2640 break; | |
2641 ++v3; | |
2642 } | |
2643 while ( v3 < 4 ); | |
2644 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2645 result = 1; | |
2646 break; | |
2647 case 12: | |
2648 v43 = 1; | |
2649 v38 = 12; | |
2650 goto LABEL_70; | |
2651 case 15: | |
2652 v45 = 1; | |
2653 v39 = 15; | |
2654 goto LABEL_73; | |
2655 case 13: | |
2656 v43 = 1; | |
2657 v38 = 13; | |
2658 LABEL_70: | |
2659 SetCondition(v38, v43); | |
2660 v42 = 0; | |
2661 v37 = 0; | |
2662 v35 = 0; | |
2663 v34 = 0; | |
2664 v33 = -1; | |
2665 v32 = 0; | |
2666 v31 = 0; | |
2667 v30 = (SoundID)224; | |
2668 goto LABEL_83; | |
2669 case 14: | |
2670 v45 = 1; | |
2671 v39 = 14; | |
2672 goto LABEL_73; | |
2673 case 16: | |
2674 v45 = 1; | |
2675 v39 = 16; | |
2676 LABEL_73: | |
2677 SetCondition(v39, v45); | |
2678 v42 = 0; | |
2679 v37 = 0; | |
2680 v35 = 0; | |
2681 v34 = 0; | |
2682 v33 = -1; | |
2683 v32 = 0; | |
2684 v31 = 0; | |
2685 v30 = (SoundID)225; | |
2686 goto LABEL_83; | |
2687 case 17: | |
2688 case 18: | |
2689 case 19: | |
2690 v26 = v48; | |
2691 if ( *(char *)(v48 + 21) & 2 ) | |
2692 goto LABEL_84; | |
187 | 2693 PlaySound(SPEECH_40, 0); |
0 | 2694 *(int *)(v26 + 20) |= 2u; |
2695 goto LABEL_79; | |
2696 case 20: | |
187 | 2697 PlaySound(SPEECH_40, 0); |
0 | 2698 v27 = pActor->array_000234; |
2699 if ( pActor->array_000234[0].uItemID ) | |
2700 { | |
2701 v27 = &pActor->array_000234[1]; | |
2702 if ( pActor->array_000234[1].uItemID ) | |
2703 goto LABEL_84; | |
2704 } | |
2705 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2706 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2707 RemoveItemAtInventoryIndex(v28); |
2708 LABEL_79: | |
2709 v42 = 0; | |
2710 v37 = 0; | |
2711 v35 = 0; | |
2712 v34 = 0; | |
2713 v33 = -1; | |
2714 v32 = 0; | |
2715 v31 = 0; | |
2716 v30 = (SoundID)47; | |
2717 goto LABEL_83; | |
2718 case 21: | |
187 | 2719 PlaySound(SPEECH_42, 0); |
0 | 2720 ++v5->sAgeModifier; |
2721 goto LABEL_82; | |
2722 case 22: | |
187 | 2723 PlaySound(SPEECH_41, 0); |
0 | 2724 v5->sMana = 0; |
2725 LABEL_82: | |
2726 v42 = 0; | |
2727 v37 = 0; | |
2728 v35 = 0; | |
2729 v34 = 0; | |
2730 v33 = -1; | |
2731 v32 = 0; | |
2732 v31 = 0; | |
2733 v30 = (SoundID)226; | |
2734 goto LABEL_83; | |
2735 default: | |
2736 goto LABEL_87; | |
2737 } | |
2738 } | |
2739 return result; | |
2740 } | |
324 | 2741 |
0 | 2742 // 48DCF6: using guessed type char var_94[140]; |
2743 | |
2744 //----- (0048E1A3) -------------------------------------------------------- | |
2745 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2746 { | |
1091 | 2747 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2748 } |
2749 | |
2750 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2751 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2752 { | |
2753 ItemGen *weapon = nullptr; | |
2754 ItemDesc *weapon_desc = nullptr; | |
2755 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2756 if (bRangedAttack) | |
0 | 2757 { |
2758 if ( !HasItemEquipped(EQUIP_BOW) ) | |
2759 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2760 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 2761 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2762 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
2763 goto LABEL_17; | |
2764 } | |
2765 else if ( IsUnarmed() == 1 ) | |
2766 { | |
2767 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
2768 { | |
2769 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 2770 goto LABEL_17; |
2771 } | |
2772 } | |
816 | 2773 |
2774 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
2775 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2776 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2777 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2778 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2779 { | |
2780 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2781 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2782 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2783 } | |
0 | 2784 else |
816 | 2785 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2786 } | |
1010 | 2787 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2788 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2789 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2790 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2791 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2792 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2793 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2794 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2795 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2796 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2797 } | |
2798 } | |
2799 | |
0 | 2800 LABEL_17: |
816 | 2801 uint armour_recovery = 0; |
0 | 2802 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2803 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2804 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2805 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
2806 | |
2807 float armour_recovery_multipliers[4]; | |
2808 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
2809 { | |
2810 armour_recovery_multipliers[0] = 1.0f; | |
2811 armour_recovery_multipliers[1] = 0; | |
2812 armour_recovery_multipliers[2] = 0; | |
2813 armour_recovery_multipliers[3] = 0; | |
2814 } | |
2815 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2816 { | |
2817 armour_recovery_multipliers[0] = 1.0f; | |
2818 armour_recovery_multipliers[1] = 0.5f; | |
2819 armour_recovery_multipliers[2] = 0; | |
2820 armour_recovery_multipliers[3] = 0; | |
2821 } | |
2822 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2823 { | |
2824 armour_recovery_multipliers[0] = 1.0f; | |
2825 armour_recovery_multipliers[1] = 0.5f; | |
2826 armour_recovery_multipliers[2] = 0.5f; | |
2827 armour_recovery_multipliers[3] = 0; | |
0 | 2828 } |
2829 else | |
2830 { | |
1545 | 2831 Error("Unknown armour type"); // what kind of armour is that? |
816 | 2832 armour_recovery_multipliers[0] = 1.0f; |
2833 armour_recovery_multipliers[1] = 1.0f; | |
2834 armour_recovery_multipliers[2] = 1.0f; | |
2835 armour_recovery_multipliers[3] = 1.0f; | |
2836 } | |
2837 | |
2838 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
2839 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
2840 } | |
2841 | |
2842 uint shield_recovery = 0; | |
2843 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2844 { | |
2845 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
2846 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2847 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2848 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2849 | |
2850 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
2851 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
2852 } | |
2853 | |
1036 | 2854 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2855 sword_axe_bow_recovery_reduction = 0; |
2856 bool shooting_laser = false; | |
2857 if (weapon_desc) | |
2858 { | |
2859 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2860 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2861 { | |
2862 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2863 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2864 } | |
2865 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2866 shooting_laser = true; | |
2867 } | |
2868 | |
2869 uint armsmaster_recovery_reduction = 0; | |
2870 if (!bRangedAttack && !shooting_laser) | |
2871 { | |
2872 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2873 { | |
2874 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2875 if (SkillToMastery(armsmaster_level) >= 4) | |
2876 armsmaster_recovery_reduction *= 2; | |
2877 } | |
2878 } | |
2879 | |
2880 uint v41 = 0; | |
2881 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 2882 v41 = 25; |
816 | 2883 |
2884 uint weapon_enchantment_recovery_reduction = 0; | |
2885 if ( weapon ) | |
2886 { | |
2887 if (weapon->uSpecEnchantmentType == 59 || | |
2888 weapon->uSpecEnchantmentType == 41 || | |
2889 weapon->uSpecEnchantmentType == 500) | |
2890 weapon_enchantment_recovery_reduction = 20; | |
2891 } | |
2892 | |
2893 | |
2894 int recovery = weapon_recovery + | |
2895 armour_recovery + | |
2896 shield_recovery | |
2897 - armsmaster_recovery_reduction | |
2898 - weapon_enchantment_recovery_reduction | |
2899 - v41 | |
2900 - sword_axe_bow_recovery_reduction | |
2901 - player_speed_recovery_reduction; | |
2902 | |
2903 if (recovery < 0) | |
2904 recovery = 0; | |
2905 return recovery; | |
0 | 2906 } |
2907 | |
2908 //----- (0048E4F8) -------------------------------------------------------- | |
2909 int Player::GetMaxHealth() | |
2910 { | |
2911 int v3; // esi@1 | |
2912 int v4; // esi@1 | |
2913 int v6; // esi@1 | |
2914 | |
1036 | 2915 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2916 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2917 v6 = uFullHealthBonus |
135 | 2918 + pBaseHealthByClass[classType / 4] |
0 | 2919 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2920 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2921 if (v6 <= 0) | |
2922 return 1; | |
2923 return v6; | |
2924 } | |
2925 | |
2926 //----- (0048E565) -------------------------------------------------------- | |
2927 int Player::GetMaxMana() | |
2928 { | |
2929 int v2; // eax@2 | |
2930 int v3; // esi@4 | |
2931 int v4; // eax@5 | |
2932 int v5; // esi@5 | |
2933 int v6; // eax@5 | |
2934 int v7; // esi@6 | |
2935 int v8; // esi@6 | |
2936 int v9; // esi@6 | |
2937 int result; // eax@7 | |
1116 | 2938 |
135 | 2939 switch (classType) |
0 | 2940 { |
1116 | 2941 case PLAYER_CLASS_ROGUE: |
2942 case PLAYER_CLASS_SPY: | |
2943 case PLAYER_CLASS_ASSASSIN: | |
2944 case PLAYER_CLASS_ARCHER: | |
2945 case PLAYER_CLASS_WARRIOR_MAGE: | |
2946 case PLAYER_CLASS_MASTER_ARCHER: | |
2947 case PLAYER_CLASS_SNIPER: | |
2948 case PLAYER_CLASS_SORCERER: | |
2949 case PLAYER_CLASS_WIZARD: | |
2950 case PLAYER_CLASS_ARCHMAGE: | |
2951 case PLAYER_CLASS_LICH: | |
0 | 2952 v2 = GetActualIntelligence(); |
1036 | 2953 v3 = GetParameterBonus(v2); |
1116 | 2954 break; |
2955 case PLAYER_CLASS_INITIATE: | |
2956 case PLAYER_CLASS_MASTER: | |
2957 case PLAYER_CLASS_NINJA: | |
2958 case PLAYER_CLASS_PALADIN: | |
2959 case PLAYER_CLASS_CRUSADER: | |
2960 case PLAYER_CLASS_HERO: | |
2961 case PLAYER_CLASS_VILLIAN: | |
2962 case PLAYER_CLASS_CLERIC: | |
2963 case PLAYER_CLASS_PRIEST: | |
2964 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2965 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2966 v2 = GetActualWillpower(); |
1036 | 2967 v3 = GetParameterBonus(v2); |
1116 | 2968 break; |
2969 case PLAYER_CLASS_HUNTER: | |
2970 case PLAYER_CLASS_RANGER_LORD: | |
2971 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2972 case PLAYER_CLASS_DRUID: | |
2973 case PLAYER_CLASS_GREAT_DRUID: | |
2974 case PLAYER_CLASS_ARCH_DRUID: | |
2975 case PLAYER_CLASS_WARLOCK: | |
0 | 2976 v4 = GetActualWillpower(); |
1036 | 2977 v5 = GetParameterBonus(v4); |
0 | 2978 v6 = GetActualIntelligence(); |
1036 | 2979 v3 = GetParameterBonus(v6) + v5; |
0 | 2980 break; |
2981 default: | |
1116 | 2982 return 0; |
0 | 2983 break; |
2984 } | |
1116 | 2985 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2986 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2987 v9 = uFullManaBonus | |
2988 + pBaseManaByClass[classType / 4] | |
2989 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2990 + v8; | |
2991 return max(0,v9); | |
0 | 2992 } |
2993 | |
2994 //----- (0048E656) -------------------------------------------------------- | |
2995 int Player::GetBaseAC() | |
2996 { | |
2997 Player *v1; // edi@1 | |
2998 int v2; // eax@1 | |
2999 int v3; // esi@1 | |
3000 int v4; // esi@1 | |
3001 int v5; // esi@1 | |
3002 int result; // eax@2 | |
3003 | |
3004 v1 = this; | |
3005 v2 = GetActualSpeed(); | |
1036 | 3006 v3 = GetParameterBonus(v2); |
0 | 3007 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3008 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3009 if ( v5 >= 1 ) | |
3010 result = v5; | |
3011 else | |
3012 result = 0; | |
3013 return result; | |
3014 } | |
3015 | |
3016 //----- (0048E68F) -------------------------------------------------------- | |
3017 int Player::GetActualAC() | |
3018 { | |
3019 Player *v1; // edi@1 | |
3020 int v2; // eax@1 | |
3021 int v3; // esi@1 | |
3022 int v4; // esi@1 | |
3023 int v5; // esi@1 | |
3024 int v6; // esi@1 | |
3025 int result; // eax@2 | |
3026 | |
3027 v1 = this; | |
3028 v2 = GetActualSpeed(); | |
1036 | 3029 v3 = GetParameterBonus(v2); |
0 | 3030 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3031 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3032 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
3033 if ( v6 >= 1 ) | |
3034 result = v6; | |
3035 else | |
3036 result = 0; | |
3037 return result; | |
3038 } | |
3039 | |
3040 //----- (0048E6DC) -------------------------------------------------------- | |
3041 unsigned int Player::GetBaseAge() | |
3042 { | |
352 | 3043 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 3044 } |
3045 | |
3046 //----- (0048E72C) -------------------------------------------------------- | |
3047 unsigned int Player::GetActualAge() | |
3048 { | |
3049 return this->sAgeModifier + GetBaseAge(); | |
3050 } | |
3051 | |
3052 //----- (0048E73F) -------------------------------------------------------- | |
3053 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3054 { | |
3055 Player *v2; // ebx@1 | |
3056 signed int v3; // esi@1 | |
3057 enum CHARACTER_RACE v4; // eax@1 | |
3058 signed int v5; // edi@8 | |
3059 char v6; // zf@9 | |
3060 int v7; // esi@20 | |
3061 int result; // eax@21 | |
3062 signed int v9; // [sp-4h] [bp-10h]@11 | |
3063 | |
3064 v2 = this; | |
3065 v3 = 0; | |
3066 v4 = GetRace(); | |
3067 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3068 { | |
3069 v5 = 0; | |
3070 goto LABEL_16; | |
3071 } | |
3072 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3073 { | |
3074 v5 = 1; | |
3075 LABEL_16: | |
3076 v6 = v4 == 2; | |
3077 goto LABEL_17; | |
3078 } | |
3079 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3080 { | |
3081 v6 = v4 == 3; | |
3082 v5 = 2; | |
3083 goto LABEL_17; | |
3084 } | |
3085 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3086 { | |
3087 v5 = 3; | |
3088 v6 = v4 == 3; | |
3089 goto LABEL_17; | |
3090 } | |
3091 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3092 { | |
3093 v5 = 7; | |
3094 if ( v4 != 1 ) | |
3095 goto LABEL_20; | |
3096 v9 = 10; | |
3097 LABEL_19: | |
3098 v3 = v9; | |
3099 goto LABEL_20; | |
3100 } | |
3101 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3102 { | |
3103 v5 = 8; | |
3104 v6 = v4 == 0; | |
3105 LABEL_17: | |
3106 if ( !v6 ) | |
3107 goto LABEL_20; | |
3108 v9 = 5; | |
3109 goto LABEL_19; | |
3110 } | |
3111 v5 = 0; | |
3112 LABEL_20: | |
3113 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3114 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3115 result = v7 + *(&v2->sResFireBase + v5); |
3116 return result; | |
3117 } | |
3118 | |
3119 //----- (0048E7D0) -------------------------------------------------------- | |
3120 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3121 { | |
3122 signed int v2; // edi@1 | |
3123 Player *v3; // esi@1 | |
3124 enum CHARACTER_RACE v4; // ebx@1 | |
3125 char v6; // zf@18 | |
3126 int v7; // ebx@28 | |
3127 int result; // eax@28 | |
3128 signed int v9; // [sp+10h] [bp-8h]@1 | |
3129 signed int v10; // [sp+14h] [bp-4h]@1 | |
3130 | |
3131 v2 = 0; | |
3132 v3 = this; | |
3133 v10 = 0; | |
3134 v9 = 0; | |
3135 v4 = GetRace(); | |
652 | 3136 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3137 v10 = 20; |
3138 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3139 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3140 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3141 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3142 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3143 && HasItemEquipped(EQUIP_ARMOUR) | |
3144 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3145 v10 += v3->pActiveSkills[9] & 0x3F; | |
3146 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3147 goto LABEL_25; | |
3148 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3149 { | |
3150 v2 = 1; | |
3151 LABEL_25: | |
3152 v6 = v4 == 2; | |
3153 LABEL_26: | |
3154 if ( v6 ) | |
3155 v9 = 5; | |
3156 goto LABEL_28; | |
3157 } | |
3158 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3159 { | |
3160 v6 = v4 == 3; | |
3161 v2 = 2; | |
3162 goto LABEL_26; | |
3163 } | |
3164 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3165 { | |
3166 v2 = 3; | |
3167 if ( v4 == 3 ) | |
3168 v10 += 5; | |
3169 } | |
3170 else | |
3171 { | |
3172 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3173 { | |
3174 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3175 goto LABEL_28; | |
3176 v2 = 8; | |
3177 v6 = v4 == 0; | |
3178 goto LABEL_26; | |
3179 } | |
3180 v2 = 7; | |
3181 if ( v4 == 1 ) | |
3182 v9 = 10; | |
3183 } | |
3184 LABEL_28: | |
3185 v7 = GetItemsBonus(a2, 0); | |
3186 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3187 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3188 { |
3189 if ( result > 200 ) | |
3190 result = 200; | |
3191 } | |
3192 return result; | |
3193 } | |
3194 | |
3195 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3196 bool Player::Recover(int dt) |
3197 { | |
3198 //Player *v2; // esi@1 | |
0 | 3199 signed __int64 v3; // qax@1 |
816 | 3200 //bool result; // eax@4 |
3201 | |
3202 //v2 = this; | |
3203 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3204 | |
3205 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3206 | |
3207 if (uTimeToRecovery > v3) | |
3208 { | |
3209 uTimeToRecovery -= v3; | |
3210 return true; | |
0 | 3211 } |
3212 else | |
3213 { | |
816 | 3214 uTimeToRecovery = 0; |
3215 viewparams->bRedrawGameUI = true; | |
3216 if (!uActiveCharacter) | |
0 | 3217 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3218 return false; |
3219 } | |
0 | 3220 } |
3221 | |
3222 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3223 void Player::SetRecoveryTime(signed int rec) |
3224 { | |
1545 | 3225 Assert(rec >= 0); |
816 | 3226 |
3227 if (rec > uTimeToRecovery) | |
3228 uTimeToRecovery = rec; | |
3229 | |
3230 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3231 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3232 |
3233 viewparams->bRedrawGameUI = true; | |
0 | 3234 } |
3235 // 50C0C4: using guessed type int some_active_character; | |
3236 | |
3237 //----- (0048E9B7) -------------------------------------------------------- | |
3238 void Player::RandomizeName() | |
3239 { | |
3240 if (!uExpressionTimePassed) | |
3241 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3242 } | |
3243 | |
3244 //----- (0048E9F4) -------------------------------------------------------- | |
3245 unsigned int Player::GetMajorConditionIdx() | |
3246 { | |
3247 for (uint i = 0; i < 18; ++i) | |
3248 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3249 return pConditionImportancyTable[i]; | |
3250 | |
3251 return 18; | |
3252 } | |
3253 | |
3254 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3255 int Player::GetParameterBonus( int player_parameter ) |
3256 { | |
3257 int i; // eax@1 | |
3258 i = 0; | |
3259 while (param_to_bonus_table[i]) | |
3260 { | |
3261 if (player_parameter >= param_to_bonus_table[i]) | |
3262 break; | |
3263 ++i; | |
3264 } | |
3265 return parameter_to_bonus_value[i]; | |
0 | 3266 } |
3267 | |
3268 //----- (0048EA46) -------------------------------------------------------- | |
3269 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3270 { | |
1032 | 3271 int inv_indx; // eax@3 |
3272 | |
3273 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3274 { | |
3275 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3276 continue; | |
3277 inv_indx = pEquipment.pIndices[i] - 1; | |
3278 if (a2==17) | |
3279 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3280 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3281 return 50; |
3282 } | |
3283 if (a2==24) | |
3284 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3285 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3286 return 5; |
3287 } | |
3288 } | |
3289 return 0; | |
0 | 3290 } |
3291 | |
3292 //----- (0048EAAE) -------------------------------------------------------- | |
3293 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3294 { | |
3295 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3296 // signed int v4; // eax@1 |
0 | 3297 int v5; // edi@1 |
3298 Player *v6; // ebx@1 | |
3299 Player *v8; // ecx@48 | |
3300 int v9; // eax@49 | |
3301 int v10; // edx@49 | |
3302 Player *v11; // ecx@55 | |
3303 int v12; // eax@56 | |
3304 int v13; // edx@56 | |
3305 int v14; // ecx@58 | |
3306 int v15; // eax@58 | |
3307 Player *v16; // ecx@61 | |
3308 int v17; // eax@62 | |
3309 Player *v18; // ecx@66 | |
3310 int v19; // eax@67 | |
3311 int v20; // eax@69 | |
3312 Player *v21; // ecx@75 | |
3313 int v22; // eax@76 | |
3314 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3315 //int v24; // eax@79 |
0 | 3316 int v25; // ecx@80 |
3317 int v26; // edi@80 | |
3318 Player *v27; // ecx@84 | |
3319 int v28; // eax@85 | |
3320 int v29; // edx@85 | |
3321 Player *v30; // ecx@96 | |
3322 int v31; // ebp@97 | |
3323 int v32; // eax@98 | |
3324 unsigned int v33; // eax@100 | |
3325 int v34; // eax@103 | |
3326 char v35; // zf@104 | |
3327 char v36; // zf@107 | |
3328 unsigned __int8 v37; // zf@119 | |
3329 char v38; // sf@119 | |
3330 unsigned __int8 v39; // of@119 | |
3331 char v40; // zf@122 | |
3332 char v41; // zf@145 | |
3333 char v42; // zf@164 | |
3334 char v43; // zf@173 | |
3335 char v44; // zf@189 | |
3336 char v45; // zf@198 | |
3337 char v46; // zf@239 | |
3338 int v47; // eax@268 | |
3339 int v48; // eax@269 | |
3340 int v49; // eax@291 | |
3341 char v50; // zf@295 | |
3342 int v51; // eax@306 | |
3343 int v52; // eax@307 | |
3344 char v53; // zf@312 | |
3345 char v54; // zf@336 | |
3346 char v55; // zf@348 | |
3347 int v56; // eax@365 | |
3348 int v57; // ebx@368 | |
3349 signed int v58; // [sp-4h] [bp-20h]@10 | |
3350 signed int v59; // [sp-4h] [bp-20h]@71 | |
3351 signed int v60; // [sp-4h] [bp-20h]@347 | |
3352 int v61; // [sp+10h] [bp-Ch]@1 | |
3353 int v62; // [sp+14h] [bp-8h]@1 | |
3354 int v63; // [sp+18h] [bp-4h]@101 | |
3355 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3356 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3357 bool no_skills; |
0 | 3358 |
3359 v3 = attr; | |
3360 v5 = 0; | |
3361 v6 = this; | |
3362 v62 = 0; | |
3363 v61 = 0; | |
3364 | |
1040 | 3365 |
3366 no_skills=false; | |
0 | 3367 switch (attr) |
3368 { | |
1040 | 3369 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3370 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3371 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3372 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3373 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3374 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3375 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3376 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3377 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3378 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3379 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3380 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3381 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3382 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3383 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3384 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3385 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3386 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3387 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3388 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3389 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3390 default: | |
3391 no_skills=true; | |
0 | 3392 } |
1040 | 3393 if (!no_skills) |
0 | 3394 { |
1040 | 3395 if ( !this->pActiveSkills[v58] ) |
3396 return 0; | |
0 | 3397 } |
1040 | 3398 |
0 | 3399 if ( (signed int)attr > 28 ) |
3400 { | |
3401 if ( (signed int)attr < 29 ) | |
3402 return v5 + v62 + v61; | |
1040 | 3403 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3404 { |
3405 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3406 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3407 return v5 + v62 + v61; |
3408 } | |
1040 | 3409 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3410 { |
3411 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3412 return v5 + v62 + v61; | |
1040 | 3413 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3414 v5 = pItemsTable->pItems[v57].uDamageMod; |
3415 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3416 v5 += v56; |
3417 return v5 + v62 + v61; | |
3418 } | |
3419 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3420 { |
3421 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3422 return v5 + v62 + v61; | |
1040 | 3423 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3424 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3425 LABEL_365: | |
3426 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3427 LABEL_366: | |
3428 v5 += v56; | |
3429 return v5 + v62 + v61; | |
3430 } | |
3431 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3432 return v5 + v62 + v61; | |
3433 LABEL_95: | |
3434 v65 = 0; | |
3435 while ( 1 ) | |
3436 { | |
3437 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3438 goto LABEL_361; | |
898 | 3439 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3440 if ( v3 == 9 ) |
3441 { | |
816 | 3442 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3443 if ( v32 >= 3 ) |
3444 { | |
3445 if ( v32 <= 11 ) | |
3446 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3447 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3448 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3449 } | |
3450 } | |
3451 } | |
3452 v63 = (int)((char *)v6 + 36 * v31); | |
3453 attra = (ItemGen *)(v63 + 532); | |
377 | 3454 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3455 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3456 { |
3457 v34 = attra->uItemID; | |
3458 switch ( attra->uItemID ) | |
3459 { | |
3460 case 0x1F4u: | |
3461 v35 = v3 == 5; | |
3462 goto LABEL_105; | |
3463 case 0x1F5u: | |
3464 v36 = v3 == 0; | |
3465 goto LABEL_108; | |
3466 case 0x1F6u: | |
3467 if ( v3 == 21 ) | |
3468 v61 += 10; | |
3469 v36 = v3 == 2; | |
3470 goto LABEL_108; | |
3471 case 0x1F7u: | |
3472 if ( v3 == 17 ) | |
3473 v61 += 5; | |
3474 if ( v3 == 18 ) | |
3475 v61 += 5; | |
3476 v36 = v3 == 6; | |
3477 goto LABEL_108; | |
3478 case 0x1F8u: | |
3479 goto LABEL_118; | |
3480 case 0x1F9u: | |
3481 v40 = v3 == 3; | |
3482 goto LABEL_123; | |
3483 case 0x1FAu: | |
3484 v35 = v3 == 10; | |
3485 goto LABEL_105; | |
3486 case 0x1FEu: | |
3487 v35 = v3 == 4; | |
3488 goto LABEL_105; | |
3489 case 0x1FFu: | |
3490 if ( v3 == 23 ) | |
3491 v61 += 10; | |
3492 if ( v3 == 22 ) | |
3493 v61 += 10; | |
3494 goto LABEL_361; | |
3495 case 0x200u: | |
3496 if ( v3 == 36 ) | |
3497 { | |
3498 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3499 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3500 } | |
3501 v36 = v3 == 5; | |
3502 LABEL_108: | |
3503 if ( v36 ) | |
3504 v5 += 40; | |
3505 goto LABEL_361; | |
3506 case 0x201u: | |
3507 if ( v3 == 39 ) | |
3508 { | |
3509 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3510 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3511 v62 = v34; | |
3512 } | |
3513 goto LABEL_136; | |
3514 case 0x202u: | |
3515 if ( !v3 ) | |
3516 v5 += 150; | |
3517 if ( v3 == 1 ) | |
3518 v5 -= 40; | |
3519 if ( v3 == 2 ) | |
3520 v5 -= 40; | |
3521 goto LABEL_145; | |
3522 case 0x203u: | |
3523 if ( v3 == 42 ) | |
3524 { | |
3525 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3526 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3527 } | |
3528 if ( v3 == 43 ) | |
3529 v61 += 15; | |
3530 goto LABEL_361; | |
3531 case 0x204u: | |
3532 if ( v3 == 17 ) | |
3533 v61 += 5; | |
3534 if ( v3 == 18 ) | |
3535 v61 += 5; | |
3536 if ( v3 == 6 ) | |
3537 v5 += 50; | |
3538 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3539 goto LABEL_166; | |
3540 v42 = v3 == 15; | |
3541 goto LABEL_165; | |
3542 case 0x205u: | |
3543 if ( v3 == 18 ) | |
3544 v61 += 5; | |
3545 goto LABEL_361; | |
3546 case 0x206u: | |
3547 if ( !v3 ) | |
3548 v5 += 100; | |
3549 if ( v3 == 3 ) | |
3550 v5 += 100; | |
3551 v43 = v3 == 9; | |
3552 goto LABEL_174; | |
3553 case 0x207u: | |
3554 if ( v3 == 45 ) | |
3555 v61 += 5; | |
3556 if ( v3 == 15 ) | |
3557 v5 -= 10; | |
3558 v42 = v3 == 14; | |
3559 LABEL_165: | |
3560 if ( v42 ) | |
3561 LABEL_166: | |
3562 v5 -= 10; | |
3563 goto LABEL_361; | |
3564 case 0x208u: | |
3565 v35 = v3 == 3; | |
3566 goto LABEL_105; | |
3567 case 0x209u: | |
3568 if ( v3 == 2 ) | |
3569 v5 += 15; | |
3570 if ( !v3 ) | |
3571 v5 += 15; | |
3572 v41 = v3 == 6; | |
3573 goto LABEL_146; | |
3574 case 0x20Au: | |
3575 if ( v3 == 46 ) | |
3576 v61 += 15; | |
3577 v44 = v3 == 3; | |
3578 goto LABEL_190; | |
3579 case 0x20Bu: | |
3580 if ( v3 == 34 ) | |
3581 { | |
3582 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3583 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3584 } | |
3585 if ( v3 == 12 ) | |
3586 v5 += 50; | |
3587 if ( v3 == 2 ) | |
3588 v5 += 30; | |
3589 v45 = v3 == 9; | |
3590 goto LABEL_199; | |
3591 case 0x20Cu: | |
3592 if ( !v3 ) | |
3593 v5 += 75; | |
3594 goto LABEL_145; | |
3595 case 0x20Du: | |
3596 if ( v3 == 5 ) | |
3597 v5 += 50; | |
3598 if ( v3 == 6 ) | |
3599 v5 += 50; | |
3600 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3601 goto LABEL_374; | |
3602 v43 = v3 == 15; | |
3603 LABEL_174: | |
3604 if ( v43 ) | |
3605 LABEL_374: | |
3606 v5 -= 15; | |
3607 goto LABEL_361; | |
3608 case 0x20Eu: | |
3609 if ( v3 == 4 ) | |
3610 v5 += 150; | |
3611 if ( v3 == 44 ) | |
3612 v61 += 5; | |
3613 if ( v3 == 9 ) | |
3614 v5 -= 25; | |
3615 goto LABEL_361; | |
3616 case 0x20Fu: | |
3617 if ( v3 == 39 ) | |
3618 { | |
3619 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3620 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3621 v62 = v34; | |
3622 } | |
3623 if ( v3 == 40 ) | |
3624 { | |
3625 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3626 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3627 } | |
3628 LABEL_145: | |
3629 v41 = v3 == 5; | |
3630 LABEL_146: | |
3631 if ( v41 ) | |
3632 v5 -= 40; | |
3633 goto LABEL_361; | |
3634 case 0x210u: | |
3635 if ( v3 == 38 ) | |
3636 { | |
3637 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3638 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3639 } | |
3640 if ( !v3 ) | |
3641 v5 += 75; | |
3642 v44 = v3 == 11; | |
3643 LABEL_190: | |
3644 if ( v44 ) | |
3645 v5 -= 50; | |
3646 goto LABEL_361; | |
3647 case 0x211u: | |
3648 if ( v3 == 5 ) | |
3649 v5 += 100; | |
3650 if ( v3 == 4 ) | |
3651 v5 += 50; | |
3652 v35 = v3 == 11; | |
3653 LABEL_105: | |
3654 if ( v35 ) | |
3655 v5 += 50; | |
3656 goto LABEL_361; | |
3657 case 0x212u: | |
3658 if ( v3 == 1 ) | |
3659 v5 -= 20; | |
3660 v45 = v3 == 2; | |
3661 LABEL_199: | |
3662 if ( v45 ) | |
3663 v5 -= 20; | |
3664 goto LABEL_361; | |
3665 case 0x214u: | |
3666 if ( v3 == 1 ) | |
3667 v5 += 15; | |
3668 v46 = v3 == 2; | |
3669 goto LABEL_240; | |
3670 case 0x215u: | |
3671 if ( v3 == 5 ) | |
3672 v5 += 15; | |
3673 v46 = v3 == 4; | |
3674 goto LABEL_240; | |
3675 case 0x216u: | |
3676 if ( v3 == 10 ) | |
3677 v5 += 30; | |
3678 if ( !v3 ) | |
3679 v5 += 15; | |
3680 goto LABEL_315; | |
3681 case 0x217u: | |
3682 if ( v3 == 21 ) | |
3683 v61 += 5; | |
3684 if ( !v3 ) | |
3685 v5 += 15; | |
3686 goto LABEL_253; | |
3687 case 0x218u: | |
3688 goto LABEL_253; | |
3689 default: | |
3690 goto LABEL_361; | |
3691 } | |
3692 goto LABEL_361; | |
3693 } | |
3694 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3695 { | |
3696 if ( (signed int)v3 >= 0 ) | |
3697 { | |
3698 if ( (signed int)v3 <= 15 ) | |
3699 { | |
3700 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3701 } | |
3702 else | |
3703 { | |
3704 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3705 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3706 } | |
3707 } | |
3708 goto LABEL_361; | |
3709 } | |
3710 v34 = *(int *)(v63 + 544); | |
3711 if ( v34 > 48 ) | |
3712 { | |
3713 switch ( v34 ) | |
3714 { | |
3715 case 54: | |
3716 goto LABEL_315; | |
3717 case 49: | |
3718 if ( v3 == 6 ) | |
3719 goto LABEL_121; | |
3720 v50 = v3 == 1; | |
3721 goto LABEL_296; | |
3722 case 51: | |
3723 if ( v3 != 5 && v3 != 1 ) | |
3724 goto LABEL_309; | |
3725 goto LABEL_121; | |
3726 case 52: | |
3727 if ( v3 == 3 ) | |
3728 goto LABEL_121; | |
3729 v50 = v3 == 4; | |
3730 goto LABEL_296; | |
3731 case 53: | |
3732 if ( !v3 ) | |
3733 goto LABEL_121; | |
3734 v50 = v3 == 2; | |
3735 goto LABEL_296; | |
3736 case 55: | |
3737 v46 = v3 == 6; | |
3738 goto LABEL_240; | |
3739 case 56: | |
3740 if ( !v3 ) | |
3741 goto LABEL_351; | |
3742 v53 = v3 == 3; | |
3743 goto LABEL_350; | |
3744 case 57: | |
3745 if ( v3 == 1 ) | |
3746 goto LABEL_351; | |
3747 v53 = v3 == 2; | |
3748 goto LABEL_350; | |
3749 case 50: | |
3750 if ( v3 == 10 ) | |
3751 v5 += 30; | |
3752 goto LABEL_361; | |
3753 case 60: | |
3754 if ( v3 != 23 ) | |
3755 goto LABEL_336; | |
3756 if ( v5 >= 3 ) | |
3757 goto LABEL_361; | |
3758 v5 = 3; | |
3759 LABEL_336: | |
3760 v54 = v3 == 22; | |
3761 goto LABEL_345; | |
3762 case 61: | |
3763 if ( v3 != 17 ) | |
3764 goto LABEL_340; | |
3765 if ( v5 >= 3 ) | |
3766 goto LABEL_361; | |
3767 v5 = 3; | |
3768 LABEL_340: | |
3769 v54 = v3 == 18; | |
3770 goto LABEL_345; | |
3771 case 62: | |
3772 if ( v3 != 19 ) | |
3773 goto LABEL_344; | |
3774 if ( v5 >= 3 ) | |
3775 goto LABEL_361; | |
3776 v5 = 3; | |
3777 LABEL_344: | |
3778 v54 = v3 == 20; | |
3779 LABEL_345: | |
3780 if ( !v54 ) | |
3781 goto LABEL_361; | |
3782 if ( v5 >= 3 ) | |
3783 goto LABEL_361; | |
3784 v60 = 3; | |
3785 goto LABEL_360; | |
3786 case 67: | |
3787 v55 = v3 == 18; | |
3788 goto LABEL_357; | |
3789 case 68: | |
3790 v53 = v3 == 9; | |
3791 goto LABEL_350; | |
3792 case 69: | |
3793 if ( v3 == 11 ) | |
3794 v5 += 20; | |
3795 break; | |
3796 case 70: | |
3797 if ( v3 == 12 ) | |
3798 v5 += 10; | |
3799 v55 = v3 == 16; | |
3800 LABEL_357: | |
3801 if ( v55 && v5 < 2 ) | |
3802 { | |
3803 v60 = 2; | |
3804 LABEL_360: | |
3805 v5 = v60; | |
3806 } | |
3807 break; | |
3808 default: | |
3809 goto LABEL_361; | |
3810 } | |
3811 goto LABEL_361; | |
3812 } | |
3813 if ( v34 == 48 ) | |
3814 { | |
3815 if ( v3 == 9 ) | |
3816 v5 += 5; | |
3817 LABEL_315: | |
3818 v46 = v3 == 3; | |
3819 LABEL_240: | |
3820 if ( v46 ) | |
3821 v5 += 15; | |
3822 goto LABEL_361; | |
3823 } | |
3824 if ( v34 > 32 ) | |
3825 { | |
3826 if ( v34 > 44 ) | |
3827 { | |
3828 v51 = v34 - 45; | |
3829 if ( !v51 ) | |
3830 { | |
3831 if ( v3 == 5 ) | |
3832 goto LABEL_351; | |
3833 v53 = v3 == 4; | |
3834 LABEL_350: | |
3835 if ( v53 ) | |
3836 LABEL_351: | |
3837 v5 += 5; | |
3838 goto LABEL_361; | |
3839 } | |
3840 v52 = v51 - 1; | |
3841 if ( !v52 ) | |
3842 { | |
3843 v40 = v3 == 0; | |
3844 LABEL_123: | |
3845 if ( v40 ) | |
3846 v5 += 25; | |
3847 goto LABEL_361; | |
3848 } | |
3849 if ( v52 == 1 ) | |
3850 { | |
3851 LABEL_309: | |
3852 v50 = v3 == 8; | |
3853 goto LABEL_296; | |
3854 } | |
3855 } | |
3856 else | |
3857 { | |
3858 if ( v34 == 44 ) | |
3859 { | |
3860 v50 = v3 == 7; | |
3861 goto LABEL_296; | |
3862 } | |
3863 v34 -= 33; | |
3864 if ( !v34 ) | |
3865 { | |
3866 if ( v3 != 38 ) | |
3867 goto LABEL_361; | |
3868 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3869 goto LABEL_138; | |
3870 } | |
3871 --v34; | |
3872 if ( !v34 ) | |
3873 { | |
3874 if ( v3 != 36 ) | |
3875 goto LABEL_361; | |
3876 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3877 goto LABEL_138; | |
3878 } | |
3879 v49 = v34 - 8; | |
3880 if ( !v49 ) | |
3881 { | |
3882 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3883 ++v5; | |
3884 goto LABEL_361; | |
3885 } | |
3886 if ( v49 == 1 ) | |
3887 { | |
3888 if ( v3 != 3 && v3 != 7 ) | |
3889 { | |
3890 v50 = v3 == 9; | |
3891 LABEL_296: | |
3892 if ( !v50 ) | |
3893 goto LABEL_361; | |
3894 } | |
3895 LABEL_121: | |
3896 v5 += 10; | |
3897 goto LABEL_361; | |
3898 } | |
3899 } | |
3900 } | |
3901 else | |
3902 { | |
3903 if ( v34 == 32 ) | |
3904 { | |
3905 if ( v3 != 39 ) | |
3906 goto LABEL_361; | |
3907 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3908 goto LABEL_138; | |
3909 } | |
3910 if ( v34 > 28 ) | |
3911 { | |
3912 v34 -= 29; | |
3913 if ( v34 ) | |
3914 { | |
3915 --v34; | |
3916 if ( v34 ) | |
3917 { | |
3918 --v34; | |
3919 if ( v34 || v3 != 41 ) | |
3920 goto LABEL_361; | |
3921 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3922 } | |
3923 else | |
3924 { | |
3925 if ( v3 != 34 ) | |
3926 goto LABEL_361; | |
3927 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3928 } | |
3929 } | |
3930 else | |
3931 { | |
3932 if ( v3 != 37 ) | |
3933 goto LABEL_361; | |
3934 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3935 } | |
3936 goto LABEL_138; | |
3937 } | |
3938 if ( v34 == 28 ) | |
3939 { | |
3940 LABEL_136: | |
3941 if ( v3 == 42 ) | |
3942 { | |
3943 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3944 LABEL_138: | |
3945 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3946 goto LABEL_361; | |
3947 } | |
3948 } | |
3949 else | |
3950 { | |
3951 v47 = v34 - 1; | |
3952 if ( v47 ) | |
3953 { | |
3954 v48 = v47 - 1; | |
3955 if ( v48 ) | |
3956 { | |
3957 v34 = v48 - 24; | |
3958 if ( v34 ) | |
3959 { | |
3960 --v34; | |
3961 if ( v34 || v3 != 40 ) | |
3962 goto LABEL_361; | |
3963 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3964 } | |
3965 else | |
3966 { | |
3967 if ( v3 != 35 ) | |
3968 goto LABEL_361; | |
3969 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3970 } | |
3971 goto LABEL_138; | |
3972 } | |
3973 LABEL_118: | |
3974 if ( (signed int)v3 < 0 ) | |
3975 goto LABEL_361; | |
3976 v39 = __OFSUB__((int)v3, 6); | |
3977 v37 = v3 == 6; | |
3978 v38 = v3 - 6 < 0; | |
3979 } | |
3980 else | |
3981 { | |
3982 LABEL_253: | |
3983 if ( (signed int)v3 < 10 ) | |
3984 goto LABEL_361; | |
3985 v39 = __OFSUB__((int)v3, 15); | |
3986 v37 = v3 == 15; | |
3987 v38 = v3 - 15 < 0; | |
3988 } | |
3989 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3990 goto LABEL_121; | |
3991 } | |
3992 } | |
3993 LABEL_361: | |
3994 ++v65; | |
3995 if ( (signed int)v65 >= 16 ) | |
3996 return v5 + v62 + v61; | |
3997 } | |
3998 } | |
1040 | 3999 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 4000 { |
4001 if ( IsUnarmed() != 1 ) | |
4002 { | |
816 | 4003 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4004 { | |
4005 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4006 if ( v22 >= 0 ) |
4007 { | |
4008 if ( v22 <= 2 ) | |
4009 { | |
1040 | 4010 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 4011 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 4012 { |
4013 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
4014 v25 = pItemsTable->pItems[v23].uDamageDice; | |
4015 } | |
4016 else | |
4017 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4018 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4019 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 4020 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4021 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 4022 } |
4023 } | |
4024 } | |
1040 | 4025 |
4026 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
4027 { | |
4028 | |
4029 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4030 if ((v28 < 0) || v28 > 2 ) | |
4031 return v5 + v62 + v61; | |
4032 } | |
1062 | 4033 v15 = pItemsTable->pItems[v23].uDamageMod; |
4034 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 4035 v5 += v15 + v14; |
1049 | 4036 return v5 + v62 + v61; |
0 | 4037 } |
4038 v59 = 3; | |
4039 LABEL_74: | |
4040 v5 = v59; | |
4041 return v5 + v62 + v61; | |
4042 } | |
4043 if ( (signed int)attr < 0 ) | |
4044 return v5 + v62 + v61; | |
1040 | 4045 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 4046 goto LABEL_95; |
1040 | 4047 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
4048 { | |
4049 if ( !Player::HasEnchantedItemEquipped(25) ) | |
4050 return v5 + v62 + v61; | |
4051 v5 = 5; | |
4052 return v5 + v62 + v61; | |
4053 } | |
4054 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 4055 return v5 + v62 + v61; |
1040 | 4056 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 4057 { |
4058 if ( IsUnarmed() == 1 ) | |
4059 { | |
4060 v5 = 0; | |
4061 return v5 + v62 + v61; | |
4062 } | |
816 | 4063 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4064 { | |
4065 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4066 if ( v17 >= 0 ) |
4067 { | |
4068 if ( v17 <= 2 ) | |
1040 | 4069 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 4070 } |
4071 } | |
865 | 4072 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 4073 return v5 + v62 + v61; |
1040 | 4074 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
4075 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4076 v5 += v56; | |
4077 return v5 + v62 + v61; | |
4078 } | |
4079 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 4080 { |
4081 if ( IsUnarmed() == 1 ) | |
4082 { | |
4083 v5 = 1; | |
4084 return v5 + v62 + v61; | |
4085 } | |
816 | 4086 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4087 { | |
4088 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4089 if ( v9 >= 0 ) |
4090 { | |
4091 if ( v9 <= 2 ) | |
4092 { | |
1040 | 4093 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4094 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4095 if ( !v6->pEquipment.uShield ) |
0 | 4096 { |
1040 | 4097 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4098 ++v5; |
4099 } | |
4100 } | |
4101 } | |
4102 } | |
1040 | 4103 |
4104 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4105 { | |
4106 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4107 if ((v12 < 0) || v12 > 2 ) | |
4108 return v5 + v62 + v61; | |
4109 } | |
4110 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4111 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4112 LABEL_88: |
4113 v5 += v15 + v14; | |
4114 } | |
4115 return v5 + v62 + v61; | |
4116 } | |
4117 | |
4118 //----- (0048F73C) -------------------------------------------------------- | |
4119 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4120 { | |
4121 int result; // eax@1 | |
4122 int v3; // eax@4 | |
4123 int v4; // ecx@5 | |
4124 | |
4125 switch (a2) | |
4126 { | |
4127 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4128 } | |
4129 | |
4130 result = 0; | |
4131 if ( (signed int)a2 > 10 ) | |
4132 { | |
4133 if ( (signed int)a2 <= 15 ) | |
4134 { | |
4135 switch ( a2 ) | |
4136 { | |
4137 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4138 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4139 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4140 break; |
4141 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4142 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4143 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4144 break; |
4145 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4146 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4147 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4148 break; |
4149 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4150 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4151 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4152 break; |
4153 default: | |
4154 if ( a2 != 14 ) | |
4155 return result; | |
4156 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4157 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4158 break; |
4159 } | |
4160 return v4 + v3; | |
4161 } | |
4162 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4163 { | |
4164 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4165 { | |
4166 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4167 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4168 return v4 + v3; |
4169 } | |
4170 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4171 return result; | |
4172 } | |
4173 return this->pPlayerBuffs[1].uPower; | |
4174 } | |
4175 if ( a2 == 10 ) | |
4176 { | |
4177 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4178 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4179 return v4 + v3; |
4180 } | |
4181 switch ( a2 ) | |
4182 { | |
4183 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4184 v3 = pPlayerBuffs[19].uPower; | |
4185 goto LABEL_5; | |
4186 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4187 v3 = pPlayerBuffs[17].uPower; | |
4188 goto LABEL_5; | |
4189 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4190 v3 = pPlayerBuffs[20].uPower; | |
4191 goto LABEL_5; | |
4192 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4193 v3 = pPlayerBuffs[16].uPower; | |
4194 goto LABEL_5; | |
4195 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4196 v3 = pPlayerBuffs[15].uPower; | |
4197 goto LABEL_5; | |
4198 case CHARACTER_ATTRIBUTE_SPEED: | |
4199 v3 = pPlayerBuffs[21].uPower; | |
4200 goto LABEL_5; | |
4201 case CHARACTER_ATTRIBUTE_LUCK: | |
4202 v3 = pPlayerBuffs[18].uPower; | |
4203 LABEL_5: | |
1167 | 4204 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4205 return v4 + v3; |
4206 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4207 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4208 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4209 return v4 + v3; |
4210 default: | |
4211 return result; | |
4212 } | |
4213 return result; | |
4214 } | |
4215 | |
4216 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4217 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4218 { | |
1064 | 4219 signed int bonus_value; // esi@1 |
4220 unsigned __int16 skill_value; // ax@126 | |
4221 int result; // al@127 | |
353 | 4222 |
1064 | 4223 bonus_value = 0; |
353 | 4224 switch (uSkillType) |
4225 { | |
4226 case PLAYER_SKILL_MONSTER_ID: | |
4227 { | |
652 | 4228 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4229 bonus_value = 6; |
652 | 4230 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4231 bonus_value += 6; |
4232 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4233 } |
4234 break; | |
4235 | |
4236 case PLAYER_SKILL_ARMSMASTER: | |
4237 { | |
652 | 4238 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4239 bonus_value = 2; |
652 | 4240 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4241 bonus_value += 3; |
4242 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4243 } |
4244 break; | |
4245 | |
4246 case PLAYER_SKILL_STEALING: | |
4247 { | |
652 | 4248 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4249 bonus_value = 8; |
4250 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4251 } |
4252 break; | |
4253 | |
4254 | |
4255 case PLAYER_SKILL_ALCHEMY: | |
4256 { | |
652 | 4257 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4258 bonus_value = 4; |
652 | 4259 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4260 bonus_value += 8; |
4261 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4262 } |
4263 break; | |
4264 | |
4265 case PLAYER_SKILL_LEARNING: | |
4266 { | |
652 | 4267 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4268 bonus_value = 10; |
652 | 4269 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4270 bonus_value += 15; |
652 | 4271 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4272 bonus_value += 5; |
4273 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4274 } |
4275 break; | |
4276 | |
4277 case PLAYER_SKILL_UNARMED: | |
4278 { | |
652 | 4279 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4280 bonus_value = 2; |
4281 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4282 } |
4283 break; | |
4284 | |
4285 case PLAYER_SKILL_DODGE: | |
4286 { | |
652 | 4287 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4288 bonus_value = 2; |
4289 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4290 } |
4291 break; | |
4292 | |
4293 case PLAYER_SKILL_BOW: | |
1064 | 4294 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4295 break; |
4296 case PLAYER_SKILL_SHIELD: | |
1064 | 4297 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4298 break; |
4299 | |
4300 case PLAYER_SKILL_EARTH: | |
652 | 4301 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4302 bonus_value = 2; |
652 | 4303 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4304 bonus_value += 3; |
652 | 4305 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4306 bonus_value += 4; |
353 | 4307 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4308 bonus_value += 3; |
4309 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4310 break; |
4311 case PLAYER_SKILL_FIRE: | |
652 | 4312 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4313 bonus_value = 2; |
652 | 4314 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4315 bonus_value += 3; |
652 | 4316 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4317 bonus_value += 4; |
353 | 4318 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4319 bonus_value += 3; |
4320 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4321 break; |
4322 case PLAYER_SKILL_AIR: | |
652 | 4323 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4324 bonus_value = 2; |
652 | 4325 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4326 bonus_value += 3; |
652 | 4327 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4328 bonus_value += 4; |
353 | 4329 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4330 bonus_value += 3; |
4331 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4332 break; |
4333 case PLAYER_SKILL_WATER: | |
652 | 4334 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4335 bonus_value = 2; |
652 | 4336 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4337 bonus_value += 3; |
652 | 4338 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4339 bonus_value += 4; |
353 | 4340 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4341 bonus_value += 3; |
4342 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4343 break; |
4344 case PLAYER_SKILL_SPIRIT: | |
652 | 4345 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4346 bonus_value = 2; |
652 | 4347 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4348 bonus_value += 3; |
652 | 4349 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4350 bonus_value += 4; |
4351 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4352 break; |
4353 case PLAYER_SKILL_MIND: | |
652 | 4354 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4355 bonus_value = 2; |
652 | 4356 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4357 bonus_value += 3; |
652 | 4358 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4359 bonus_value += 4; |
4360 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4361 break; |
4362 case PLAYER_SKILL_BODY: | |
652 | 4363 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4364 bonus_value = 2; |
652 | 4365 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4366 bonus_value += 3; |
652 | 4367 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4368 bonus_value += 4; |
4369 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4370 break; |
4371 case PLAYER_SKILL_LIGHT: | |
1064 | 4372 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4373 break; |
4374 case PLAYER_SKILL_DARK: | |
4375 { | |
1064 | 4376 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4377 } |
4378 break; | |
4379 | |
4380 case PLAYER_SKILL_MERCHANT: | |
4381 { | |
652 | 4382 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4383 bonus_value = 4; |
652 | 4384 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4385 bonus_value += 6; |
652 | 4386 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4387 bonus_value += 3; |
652 | 4388 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4389 bonus_value += 8; |
353 | 4390 } |
4391 break; | |
4392 | |
4393 case PLAYER_SKILL_PERCEPTION: | |
4394 { | |
652 | 4395 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4396 bonus_value = 6; |
652 | 4397 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4398 bonus_value += 5; |
353 | 4399 } |
4400 break; | |
4401 | |
0 | 4402 case PLAYER_SKILL_ITEM_ID: |
1064 | 4403 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4404 break; |
4405 case PLAYER_SKILL_MEDITATION: | |
1064 | 4406 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4407 break; |
0 | 4408 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4409 { |
652 | 4410 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4411 bonus_value = 4; |
652 | 4412 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4413 bonus_value += 6; |
652 | 4414 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4415 bonus_value += 8; |
4416 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4417 } |
4418 break; | |
4419 } | |
4420 | |
1064 | 4421 skill_value = pActiveSkills[uSkillType]; |
4422 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4423 result = bonus_value + skill_value; | |
0 | 4424 else |
1064 | 4425 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4426 return result; |
4427 } | |
4428 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4429 |
0 | 4430 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4431 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
|
4432 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4433 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4434 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4435 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4436 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
|
4437 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
|
4438 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4439 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4440 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
|
4441 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4442 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
|
4443 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4444 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
|
4445 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4446 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4447 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4448 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
|
4449 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4450 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4451 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4452 { |
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
|
4453 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
|
4454 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
|
4455 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4456 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4457 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
|
4458 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
|
4459 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4460 return 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
|
4461 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4462 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
|
4463 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4464 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
|
4465 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
|
4466 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
|
4467 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4468 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4469 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
|
4470 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4471 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
|
4472 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
|
4473 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
|
4474 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4475 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4476 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
|
4477 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4478 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
|
4479 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
|
4480 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
|
4481 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4482 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
|
4483 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4484 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].Broken())) |
1538 | 4485 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4486 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
|
4487 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
|
4488 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
|
4489 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
|
4490 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
|
4491 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4492 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4493 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
|
4494 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
|
4495 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
|
4496 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4497 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
|
4498 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
|
4499 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
|
4500 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4501 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
|
4502 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
|
4503 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
|
4504 wearingLeather = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4505 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
|
4506 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
|
4507 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
|
4508 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4509 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
|
4510 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
|
4511 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
|
4512 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4513 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
|
4514 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
|
4515 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4516 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4517 } |
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
|
4518 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4519 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4520 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
|
4521 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4522 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
|
4523 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
|
4524 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4525 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
|
4526 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4527 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
|
4528 } |
1538 | 4529 break; |
4530 case CHARACTER_ATTRIBUTE_ATTACK: | |
4531 if ( this->IsUnarmed() ) | |
4532 { | |
4533 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4534 if (!unarmedSkill) | |
4535 { | |
4536 return 0; | |
4537 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4538 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4539 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4540 } | |
4541 for (int i = 0; i < 16; ++i) | |
4542 { | |
4543 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4544 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4545 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4546 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4547 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4548 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4549 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4550 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4551 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4552 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4553 return multiplier * (currentItemSkillLevel & 0x3F); |
4554 } | |
4555 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4556 { | |
4557 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
|
4558 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4559 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4560 } | |
4561 else | |
4562 { | |
4563 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4564 } | |
4565 } | |
4566 } | |
4567 } | |
4568 return 0; | |
4569 break; | |
4570 | |
4571 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4572 for (int i = 0; i < 16; i++) | |
4573 { | |
4574 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4575 { | |
4576 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4577 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4578 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4579 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4580 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4581 return multiplier * (currentItemSkillLevel & 0x3F); |
4582 } | |
4583 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4584 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4585 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4586 return multiplier * (currentItemSkillLevel & 0x3F); |
4587 } | |
4588 } | |
4589 } | |
4590 return 0; | |
4591 break; | |
4592 | |
4593 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4594 if ( this->IsUnarmed() ) | |
4595 { | |
4596 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4597 if ( !unarmedSkillLevel ) | |
4598 { | |
4599 return 0; | |
4600 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4601 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4602 return multiplier * (unarmedSkillLevel & 0x3F); |
4603 } | |
4604 for (int i = 0; i < 16; i++) | |
4605 { | |
4606 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4607 { | |
4608 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4609 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4610 { | |
4611 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4612 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4613 int baseSkillBonus; | |
4614 int multiplier; | |
4615 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4616 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4617 case PLAYER_SKILL_STAFF: |
1538 | 4618 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
|
4619 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4620 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
|
4621 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4622 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
|
4623 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4624 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4625 { |
1538 | 4626 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4627 } |
1538 | 4628 break; |
4629 | |
4630 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4631 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4632 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4633 return armsMasterBonus + baseSkillBonus; | |
4634 break; | |
4635 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4636 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4637 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4638 return armsMasterBonus + baseSkillBonus; | |
4639 break; | |
4640 case PLAYER_SKILL_MACE: | |
4641 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4642 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4643 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4644 return armsMasterBonus + baseSkillBonus; | |
4645 break; | |
4646 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4647 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4648 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4649 return armsMasterBonus + baseSkillBonus; | |
4650 break; | |
1535 | 4651 } |
1533 | 4652 } |
1535 | 4653 } |
1538 | 4654 } |
4655 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4656 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4657 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4658 return 0; |
1533 | 4659 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4660 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4661 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4662 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
|
4663 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4664 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
|
4665 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4666 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4667 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
|
4668 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
|
4669 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
|
4670 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
|
4671 } |
1545 | 4672 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
|
4673 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4674 } |
0 | 4675 //----- (00490109) -------------------------------------------------------- |
4676 // faces are: 0 1 2 3 human males | |
4677 // 4 5 6 7 human females | |
4678 // 8 9 elf males | |
4679 // 10 11 elf females | |
4680 // 12 13 dwarf males | |
4681 // 14 15 dwarf females | |
4682 // 16 17 goblin males | |
4683 // 18 19 goblin females | |
4684 // 20 lich male | |
4685 // 21 lich female | |
4686 // 22 underwater suits (unused) | |
4687 // 23 zombie male | |
4688 // 24 zombie female | |
4689 enum CHARACTER_RACE Player::GetRace() | |
4690 { | |
1014 | 4691 if ( uCurrentFace > 15 ) |
4692 { | |
4693 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4694 return CHARACTER_RACE_GOBLIN; |
4695 } | |
4696 else | |
4697 { | |
1014 | 4698 if ( uCurrentFace >= 12 ) |
0 | 4699 { |
4700 return CHARACTER_RACE_DWARF; | |
4701 } | |
4702 else | |
4703 { | |
1014 | 4704 |
4705 if ( uCurrentFace <= 7 ) | |
0 | 4706 { |
4707 return CHARACTER_RACE_HUMAN; | |
4708 } | |
4709 else | |
4710 { | |
1014 | 4711 if ( uCurrentFace <= 11 ) |
0 | 4712 return CHARACTER_RACE_ELF; |
4713 } | |
4714 } | |
4715 } | |
4716 return CHARACTER_RACE_HUMAN; | |
4717 } | |
4718 | |
4719 //----- (00490141) -------------------------------------------------------- | |
187 | 4720 PLAYER_SEX Player::GetSexByVoice() |
0 | 4721 { |
4722 signed int result; // eax@1 | |
4723 | |
4724 result = 0; | |
4725 switch ( this->uVoiceID ) | |
4726 { | |
4727 case 0u: | |
4728 case 1u: | |
4729 case 2u: | |
4730 case 3u: | |
4731 case 8u: | |
4732 case 9u: | |
4733 case 0xCu: | |
4734 case 0xDu: | |
4735 case 0x10u: | |
4736 case 0x11u: | |
4737 case 0x14u: | |
4738 case 0x17u: | |
187 | 4739 return SEX_MALE; |
4740 | |
0 | 4741 case 4u: |
4742 case 5u: | |
4743 case 6u: | |
4744 case 7u: | |
4745 case 0xAu: | |
4746 case 0xBu: | |
4747 case 0xEu: | |
4748 case 0xFu: | |
4749 case 0x12u: | |
4750 case 0x13u: | |
4751 case 0x15u: | |
4752 case 0x18u: | |
187 | 4753 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4754 } |
1545 | 4755 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4756 return SEX_MALE; |
0 | 4757 } |
4758 | |
4759 //----- (00490188) -------------------------------------------------------- | |
4760 void Player::SetInitialStats() | |
4761 { | |
4762 auto v1 = GetRace(); | |
290 | 4763 uMight = StatTable[v1][0].uBaseValue; |
4764 uIntelligence = StatTable[v1][1].uBaseValue; | |
4765 uWillpower = StatTable[v1][2].uBaseValue; | |
4766 uEndurance = StatTable[v1][3].uBaseValue; | |
4767 uAccuracy = StatTable[v1][4].uBaseValue; | |
4768 uSpeed = StatTable[v1][5].uBaseValue; | |
4769 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4770 } |
4771 | |
4772 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4773 void Player::SetSexByVoice() |
4774 { | |
4775 switch ( this->uVoiceID) | |
0 | 4776 { |
4777 case 0: | |
4778 case 1: | |
4779 case 2: | |
4780 case 3: | |
4781 case 8: | |
4782 case 9: | |
4783 case 0xC: | |
4784 case 0xD: | |
4785 case 0x10: | |
4786 case 0x11: | |
4787 case 0x14: | |
4788 case 0x17: | |
1021 | 4789 this->uSex = SEX_MALE; |
0 | 4790 break; |
4791 case 4: | |
4792 case 5: | |
4793 case 6: | |
4794 case 7: | |
4795 case 0xA: | |
4796 case 0xB: | |
4797 case 0xE: | |
4798 case 0xF: | |
4799 case 0x12: | |
4800 case 0x13: | |
4801 case 0x15: | |
4802 case 0x18: | |
1021 | 4803 this->uSex = SEX_FEMALE; |
0 | 4804 break; |
4805 default: | |
4806 break; | |
4807 } | |
1021 | 4808 |
0 | 4809 } |
4810 | |
4811 //----- (0049024A) -------------------------------------------------------- | |
135 | 4812 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4813 { |
4814 sLevelModifier = 0; | |
4815 sAgeModifier = 0; | |
4816 | |
135 | 4817 classType = cls; |
0 | 4818 uLuckBonus = 0; |
4819 uSpeedBonus = 0; | |
4820 uAccuracyBonus = 0; | |
4821 uEnduranceBonus = 0; | |
4822 uWillpowerBonus = 0; | |
4823 uIntelligenceBonus = 0; | |
4824 uMightBonus = 0; | |
4825 uLevel = 1; | |
4826 uExperience = 251 + rand() % 100; | |
4827 uBirthYear = 1147 - rand() % 6; | |
4828 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4829 memset(_achieved_awards_bits, 0, 64); |
0 | 4830 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4831 | |
4832 for (uint i = 0; i < 37; ++i) | |
4833 { | |
135 | 4834 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4835 continue; |
4836 | |
4837 pActiveSkills[i] = 1; | |
4838 | |
4839 switch (i) | |
4840 { | |
886 | 4841 case PLAYER_SKILL_FIRE: |
4842 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4843 |
4844 extern bool all_magic; | |
4845 if ( all_magic == true ) | |
4846 { | |
4847 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4848 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4849 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4850 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4851 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4852 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4853 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4854 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4855 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4856 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4857 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4858 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4859 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4860 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4861 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4862 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4863 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4864 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4865 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4866 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4867 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4868 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4869 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4870 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4871 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4872 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4873 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4874 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4875 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4876 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4877 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4878 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4879 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4880 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4881 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4882 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4883 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4884 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4885 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4886 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4887 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4888 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4889 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4890 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4891 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4892 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4893 } | |
486 | 4894 break; |
886 | 4895 case PLAYER_SKILL_AIR: |
4896 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4897 break; | |
4898 case PLAYER_SKILL_WATER: | |
4899 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4900 break; | |
4901 case PLAYER_SKILL_EARTH: | |
4902 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4903 break; | |
4904 case PLAYER_SKILL_SPIRIT: | |
4905 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4906 break; | |
4907 case PLAYER_SKILL_MIND: | |
4908 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4909 break; | |
4910 case PLAYER_SKILL_BODY: | |
4911 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4912 |
4913 if ( all_magic == true ) | |
4914 { | |
4915 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4916 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4917 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4918 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4919 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4920 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4921 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4922 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4923 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4924 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4925 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4926 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4927 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4928 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4929 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4930 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4931 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4932 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4933 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4934 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4935 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4936 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4937 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4938 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4939 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4940 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4941 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4942 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4943 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4944 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4945 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4946 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4947 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4948 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4949 } | |
569 | 4950 break; |
886 | 4951 case PLAYER_SKILL_LIGHT: |
4952 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4953 break; | |
4954 case PLAYER_SKILL_DARK: | |
4955 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4956 break; | |
0 | 4957 } |
4958 } | |
4959 | |
4960 sHealth = GetMaxHealth(); | |
4961 sMana = GetMaxMana(); | |
4962 } | |
4963 | |
4964 //----- (004903C9) -------------------------------------------------------- | |
821 | 4965 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4966 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4967 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4968 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4969 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4970 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4971 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4972 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4973 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4974 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4975 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4976 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4977 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4978 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4979 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4980 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4981 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4982 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4983 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4984 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4985 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4986 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4987 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4988 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4989 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4990 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4991 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4992 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4993 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4994 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4995 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4996 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4997 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4998 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4999 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5000 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5001 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5002 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5003 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5004 |
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
|
5005 return (PLAYER_SKILL_TYPE)37; |
0 | 5006 } |
5007 | |
5008 | |
5009 | |
5010 //----- (0049048D) -------------------------------------------------------- | |
5011 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
5012 void Player::DecreaseAttribute(int eAttribute) | |
5013 { | |
5014 int v2; // eax@1 | |
5015 int pBaseValue; // ecx@1 | |
5016 int pDroppedStep; // ebx@1 | |
5017 int pStep; // esi@1 | |
5018 unsigned __int16 result; // ax@7 | |
5019 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
5020 | |
5021 v2 = eAttribute + 7 * GetRace(); | |
290 | 5022 pBaseValue = StatTable[0][v2].uBaseValue; |
5023 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 5024 uMinValue = pBaseValue - 2; |
290 | 5025 pStep = StatTable[0][v2].uBaseStep; |
1272 | 5026 unsigned short* AttrToChange = nullptr; |
5027 switch ( eAttribute ) | |
5028 { | |
5029 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5030 AttrToChange = &this->uMight; | |
5031 break; | |
5032 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5033 AttrToChange = &this->uIntelligence; | |
5034 break; | |
5035 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5036 AttrToChange = &this->uWillpower; | |
5037 break; | |
5038 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5039 AttrToChange = &this->uEndurance; | |
5040 break; | |
5041 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5042 AttrToChange = &this->uAccuracy; | |
5043 break; | |
5044 case CHARACTER_ATTRIBUTE_SPEED: | |
5045 AttrToChange = &this->uSpeed; | |
5046 break; | |
5047 case CHARACTER_ATTRIBUTE_LUCK: | |
5048 AttrToChange = &this->uLuck; | |
5049 break; | |
5050 } | |
5051 if ( *AttrToChange <= pBaseValue ) | |
5052 pStep = pDroppedStep; | |
5053 if ( *AttrToChange - pStep >= uMinValue ) | |
5054 *AttrToChange -= pStep; | |
0 | 5055 } |
5056 | |
5057 //----- (004905F5) -------------------------------------------------------- | |
1458 | 5058 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 5059 void Player::IncreaseAttribute( int eAttribute ) |
5060 { | |
5061 int raceId; // eax@1 | |
5062 int maxValue; // ebx@1 | |
5063 signed int baseStep; // edi@1 | |
5064 signed int tmp; // eax@17 | |
0 | 5065 signed int result; // eax@18 |
1273 | 5066 int baseValue; // [sp+Ch] [bp-8h]@1 |
5067 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
5068 unsigned short* statToChange; | |
5069 | |
5070 raceId = GetRace(); | |
5071 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
5072 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
5073 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
5074 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
5075 PlayerCreation_GetUnspentAttributePointCount(); | |
5076 switch ( eAttribute ) | |
5077 { | |
5078 case 0: | |
5079 statToChange = &this->uMight; | |
5080 break; | |
5081 case 1: | |
5082 statToChange = &this->uIntelligence; | |
5083 break; | |
5084 case 2: | |
5085 statToChange = &this->uWillpower; | |
5086 break; | |
5087 case 3: | |
5088 statToChange = &this->uEndurance; | |
5089 break; | |
5090 case 4: | |
5091 statToChange = &this->uAccuracy; | |
5092 break; | |
5093 case 5: | |
5094 statToChange = &this->uSpeed; | |
5095 break; | |
5096 case 6: | |
5097 statToChange = &this->uLuck; | |
5098 default: | |
1545 | 5099 Error("(%u)", eAttribute); |
1273 | 5100 } |
5101 if ( *statToChange < baseValue ) | |
5102 { | |
5103 tmp = baseStep; | |
5104 baseStep = droppedStep; | |
5105 droppedStep = tmp; | |
5106 } | |
5107 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5108 if ( result >= droppedStep ) | |
5109 { | |
5110 if ( baseStep + *statToChange <= maxValue ) | |
5111 *statToChange += baseStep; | |
5112 } | |
0 | 5113 } |
5114 | |
5115 //----- (0049070F) -------------------------------------------------------- | |
5116 void Player::Zero() | |
5117 { | |
5118 this->sLevelModifier = 0; | |
5119 this->sACModifier = 0; | |
5120 this->uLuckBonus = 0; | |
5121 this->uAccuracyBonus = 0; | |
5122 this->uSpeedBonus = 0; | |
5123 this->uEnduranceBonus = 0; | |
5124 this->uWillpowerBonus = 0; | |
5125 this->uIntelligenceBonus = 0; | |
5126 this->uMightBonus = 0; | |
5127 this->field_100 = 0; | |
5128 this->field_FC = 0; | |
5129 this->field_F8 = 0; | |
5130 this->field_F4 = 0; | |
5131 this->field_F0 = 0; | |
5132 this->field_EC = 0; | |
5133 this->field_E8 = 0; | |
5134 this->field_E4 = 0; | |
5135 this->field_E0 = 0; | |
766 | 5136 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5137 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5138 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5139 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5140 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5141 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5142 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5143 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5144 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5145 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5146 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5147 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5148 this->uFullHealthBonus = 0; |
0 | 5149 } |
5150 | |
5151 //----- (004907E7) -------------------------------------------------------- | |
299 | 5152 unsigned int Player::GetStatColor(int uStat) |
0 | 5153 { |
290 | 5154 int attribute_value; // edx@1 |
1393 | 5155 |
5156 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5157 switch (uStat) |
5158 { | |
5159 case 0: attribute_value = uMight; break; | |
5160 case 1: attribute_value = uIntelligence; break; | |
5161 case 2: attribute_value = uWillpower; break; | |
5162 case 3: attribute_value = uEndurance; break; | |
290 | 5163 case 4: attribute_value = uAccuracy; break; |
5164 case 5: attribute_value = uSpeed; break; | |
0 | 5165 case 6: attribute_value = uLuck; break; |
5166 }; | |
5167 | |
1393 | 5168 if (attribute_value == base_attribute_value) |
5169 return ui_character_stat_default_color; | |
5170 else if (attribute_value > base_attribute_value) | |
5171 return ui_character_stat_buffed_color; | |
0 | 5172 else |
1393 | 5173 return ui_character_stat_debuffed_color; |
0 | 5174 } |
5175 | |
5176 //----- (004908A8) -------------------------------------------------------- | |
5177 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5178 { | |
1014 | 5179 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5180 { | |
1393 | 5181 pConditions[uCondition] = 0i64; |
1014 | 5182 return true; |
0 | 5183 } |
5184 else | |
1014 | 5185 return false; |
0 | 5186 } |
5187 | |
5188 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5189 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5190 { |
5191 Player *v3; // esi@1 | |
5192 signed int v5; // eax@17 | |
5193 int v8; // edx@39 | |
5194 char *v13; // eax@45 | |
5195 signed int v15; // edi@68 | |
5196 int v16; // edx@73 | |
5197 unsigned __int16 v17; // edi@73 | |
5198 unsigned int v18; // eax@73 | |
5199 const char *v22; // eax@84 | |
5200 int scroll_id; // esi@96 | |
5201 int v25; // eax@109 | |
5202 int v26; // eax@113 | |
5203 int new_mana_val; // edi@114 | |
5204 signed __int64 v28; // qax@120 | |
5205 __int64 v30; // edi@137 | |
5206 __int64 v32; // ST3C_4@137 | |
5207 __int64 v34; // ST34_4@137 | |
5208 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5209 const char *v66; // [sp-4h] [bp-30h]@69 | |
5210 signed int v67; // [sp-4h] [bp-30h]@77 | |
5211 const char *v68; // [sp-4h] [bp-30h]@89 | |
5212 char v72; // [sp+20h] [bp-Ch]@68 | |
5213 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5214 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5215 Player *thisb; // [sp+28h] [bp-4h]@1 |
5216 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5217 | |
5218 thisb = this; | |
5219 v3 = &pParty->pPlayers[player_num-1]; | |
5220 v73 = 1; | |
1340 | 5221 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5222 return; |
5223 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5224 { |
1021 | 5225 if ( pParty->pPickedItem.uItemID == 160 ) |
5226 { | |
5227 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5228 } | |
5229 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5230 { |
1021 | 5231 new_mana_val = v3->sMana; |
5232 new_mana_val += 2; | |
5233 if ( new_mana_val > v3->GetMaxMana() ) | |
5234 new_mana_val = v3->GetMaxMana(); | |
5235 v3->PlaySound(SPEECH_36, 0); | |
5236 } | |
5237 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5238 { | |
5239 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5240 v3->PlaySound(SPEECH_36, 0); |
1021 | 5241 |
5242 } | |
5243 else | |
5244 { | |
5245 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5246 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
|
5247 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5248 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5249 return; | |
1019 | 5250 } |
1032 | 5251 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5252 | |
5253 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5254 { | |
5255 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5256 } | |
5257 if ( v73 ) | |
5258 { | |
5259 if ( pParty->bTurnBasedModeOn ) | |
5260 { | |
5261 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5262 thisb->SetRecoveryTime(100); | |
1448 | 5263 pTurnEngine->ApplyPlayerAction(); |
1032 | 5264 } |
5265 else | |
5266 { | |
5267 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5268 } | |
5269 } | |
5270 pMouse->RemoveHoldingItem(); | |
5271 return; | |
5272 | |
1021 | 5273 |
5274 } | |
5275 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5276 { |
1021 | 5277 switch ( pParty->pPickedItem.uItemID ) |
5278 { | |
5279 case 221: //Catalyst | |
5280 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5281 break; | |
5282 case 222: //Cure Wounds | |
5283 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5284 pParty->pPlayers[player_num-1].Heal(v25); | |
5285 v3->PlaySound(SPEECH_36, 0); | |
5286 break; | |
5287 case 223: //Magic Potion | |
5288 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5289 new_mana_val = v3->sMana; | |
5290 new_mana_val += v26; | |
5291 if ( new_mana_val > v3->GetMaxMana() ) | |
5292 new_mana_val = v3->GetMaxMana(); | |
5293 v3->PlaySound(SPEECH_36, 0); | |
5294 break; | |
5295 case 224: //Cure Weakness | |
5296 v3->pConditions[Condition_Weak] = 0i64; | |
5297 v3->PlaySound(SPEECH_36, 0); | |
5298 break; | |
5299 case 225: //Cure Disease | |
5300 v3->pConditions[Condition_Disease3] = 0i64; | |
5301 v3->pConditions[Condition_Disease2] = 0i64; | |
5302 v3->pConditions[Condition_Disease1] = 0i64; | |
5303 v3->PlaySound(SPEECH_36, 0); | |
5304 break; | |
5305 case 226: //Cure Poison | |
5306 v3->pConditions[Condition_Poison3] = 0i64; | |
5307 v3->pConditions[Condition_Poison2] = 0i64; | |
5308 v3->pConditions[Condition_Poison1] = 0i64; | |
5309 v3->PlaySound(SPEECH_36, 0); | |
5310 break; | |
5311 case 227: //Awaken | |
5312 v3->pConditions[Condition_Sleep] = 0i64; | |
5313 v3->PlaySound(SPEECH_36, 0); | |
5314 break; | |
5315 case 228: //Haste | |
5316 if ( !v3->pConditions[Condition_Weak] ) | |
5317 { | |
5318 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5319 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5320 v3->PlaySound(SPEECH_36, 0); | |
5321 } | |
5322 break; | |
5323 case 229: //Heroism | |
5324 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5325 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5326 v3->PlaySound(SPEECH_36, 0); | |
5327 break; | |
5328 case 230: //Bless | |
5329 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5330 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5331 v3->PlaySound(SPEECH_36, 0); | |
5332 break; | |
5333 case 231: //Preservation | |
1032 | 5334 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5335 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5336 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5337 v3->PlaySound(SPEECH_36, 0); | |
5338 break; | |
5339 case 232: //Shield | |
1032 | 5340 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5341 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5342 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5343 v3->PlaySound(SPEECH_36, 0); | |
5344 break; | |
5345 case 234: //Stoneskin | |
5346 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5347 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5348 v3->PlaySound(SPEECH_36, 0); | |
5349 break; | |
5350 case 235: //Water Breathing | |
5351 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5352 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5353 break; | |
5354 case 237: //Remove Fear | |
5355 v3->pConditions[Condition_Fear] = 0i64; | |
5356 v3->PlaySound(SPEECH_36, 0); | |
5357 break; | |
5358 case 238: //Remove Curse | |
5359 v3->pConditions[Condition_Cursed] = 0i64; | |
5360 v3->PlaySound(SPEECH_36, 0); | |
5361 break; | |
5362 case 239: //Cure Insanity | |
5363 v3->pConditions[Condition_Insane] = 0i64; | |
5364 v3->PlaySound(SPEECH_36, 0); | |
5365 break; | |
5366 case 240: //Might Boost | |
1032 | 5367 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5368 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5369 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5370 v3->PlaySound(SPEECH_36, 0); | |
5371 break; | |
5372 case 241: //Intellect Boost | |
1032 | 5373 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5374 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5375 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5376 v3->PlaySound(SPEECH_36, 0); | |
5377 break; | |
5378 case 242: //Personality Boost | |
1032 | 5379 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5380 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5381 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5382 v3->PlaySound(SPEECH_36, 0); | |
5383 break; | |
5384 case 243://Endurance Boost | |
1032 | 5385 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5386 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5387 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5388 v3->PlaySound(SPEECH_36, 0); | |
5389 break; | |
5390 case 244: //Speed Boost | |
1032 | 5391 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5392 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5393 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5394 v3->PlaySound(SPEECH_36, 0); | |
5395 break; | |
5396 case 245: //Accuracy Boost | |
1032 | 5397 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5398 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5399 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5400 v3->PlaySound(SPEECH_36, 0); | |
5401 break; | |
5402 case 251: //Cure Paralysis | |
5403 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5404 v3->PlaySound(SPEECH_36, 0); | |
5405 break; | |
5406 case 252://Divine Restoration | |
5407 v30 = v3->pConditions[Condition_Dead]; | |
5408 v32 = v3->pConditions[Condition_Pertified]; | |
5409 v34 = v3->pConditions[Condition_Eradicated]; | |
5410 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5411 v3->pConditions[Condition_Dead] = v30; | |
5412 v3->pConditions[Condition_Pertified] = v32; | |
5413 v3->pConditions[Condition_Eradicated] = v34; | |
5414 v3->PlaySound(SPEECH_36, 0); | |
5415 break; | |
5416 case 253: //Divine Cure | |
5417 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5418 pParty->pPlayers[player_num-1].Heal(v25); | |
5419 v3->PlaySound(SPEECH_36, 0); | |
5420 break; | |
5421 case 254: //Divine Power | |
5422 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5423 new_mana_val = v3->sMana; | |
5424 new_mana_val += v26; | |
5425 if ( new_mana_val > v3->GetMaxMana() ) | |
5426 new_mana_val = v3->GetMaxMana(); | |
5427 v3->PlaySound(SPEECH_36, 0); | |
5428 break; | |
5429 case 255: //Luck Boost | |
1032 | 5430 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5431 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5432 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5433 v3->PlaySound(SPEECH_36, 0); | |
5434 break; | |
5435 case 256: //Fire Resistance | |
1032 | 5436 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5437 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5438 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5439 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5440 break; |
1021 | 5441 case 257: //Air Resistance |
1032 | 5442 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5443 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5444 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5445 v3->PlaySound(SPEECH_36, 0); | |
5446 break; | |
5447 case 258: //Water Resistance | |
1032 | 5448 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5449 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5450 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5451 v3->PlaySound(SPEECH_36, 0); | |
5452 break; | |
5453 case 259: //Earth Resistance | |
1032 | 5454 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5455 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5456 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5457 v3->PlaySound(SPEECH_36, 0); | |
5458 break; | |
5459 case 260: //Mind Resistance | |
1032 | 5460 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5461 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5462 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5463 v3->PlaySound(SPEECH_36, 0); | |
5464 break; | |
5465 case 261: //Body Resistance | |
1032 | 5466 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5467 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5468 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5469 v3->PlaySound(SPEECH_36, 0); | |
5470 break; | |
5471 case 262: //Stone to Flesh | |
5472 v3->pConditions[Condition_Pertified] = 0i64; | |
5473 v3->PlaySound(SPEECH_36, 0); | |
5474 break; | |
5475 case 264: //Pure Luck | |
5476 if ( !v3->pure_luck_used ) | |
5477 { | |
5478 v3->uLuck += 50; | |
5479 v3->pure_luck_used = 1; | |
5480 } | |
5481 v3->PlaySound(SPEECH_36, 0); | |
5482 break; | |
5483 case 265: //Pure Speed | |
5484 if ( !v3->pure_speed_used ) | |
5485 { | |
5486 v3->uSpeed += 50; | |
5487 v3->pure_speed_used = 1; | |
5488 } | |
5489 v3->PlaySound(SPEECH_36, 0); | |
5490 break; | |
5491 case 266: //Pure Intellect | |
5492 if ( !v3->pure_intellect_used ) | |
5493 { | |
5494 v3->uIntelligence += 50; | |
5495 v3->pure_intellect_used = 1; | |
5496 } | |
5497 v3->PlaySound(SPEECH_36, 0); | |
5498 break; | |
5499 case 267: //Pure Endurance | |
5500 if ( !v3->pure_endurance_used ) | |
5501 { | |
5502 v3->uEndurance += 50; | |
5503 v3->pure_endurance_used = 1; | |
5504 } | |
5505 v3->PlaySound(SPEECH_36, 0); | |
5506 break; | |
5507 case 268: //Pure Personality | |
5508 if ( !v3->pure_willpower_used ) | |
5509 { | |
5510 v3->uWillpower += 50; | |
5511 v3->pure_willpower_used = 1; | |
5512 } | |
5513 v3->PlaySound(SPEECH_36, 0); | |
5514 break; | |
5515 case 269: //Pure Accuracy | |
5516 if ( !v3->pure_accuracy_used ) | |
5517 { | |
5518 v3->uAccuracy += 50; | |
5519 v3->pure_accuracy_used = 1; | |
5520 } | |
5521 v3->PlaySound(SPEECH_36, 0); | |
5522 break; | |
5523 case 270: //Pure Might | |
5524 if ( !v3->pure_might_used ) | |
5525 { | |
5526 v3->uMight += 50; | |
5527 v3->pure_might_used = 1; | |
5528 } | |
5529 v3->PlaySound(SPEECH_36, 0); | |
5530 break; | |
5531 case 271: //Rejuvenation | |
5532 v3->sAgeModifier = 0; | |
5533 v3->PlaySound(SPEECH_36, 0); | |
5534 break; | |
5535 | |
5536 default: | |
5537 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5538 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
|
5539 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5540 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5541 return; | |
1032 | 5542 } |
5543 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5544 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5545 { | |
5546 if ( !v73 ) | |
5547 { | |
5548 pMouse->RemoveHoldingItem(); | |
5549 return; | |
5550 } | |
5551 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5552 } |
1032 | 5553 if ( v73 ) |
5554 { | |
5555 if ( pParty->bTurnBasedModeOn ) | |
5556 { | |
5557 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5558 thisb->SetRecoveryTime(100); | |
1448 | 5559 pTurnEngine->ApplyPlayerAction(); |
1032 | 5560 } |
5561 else | |
5562 { | |
5563 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5564 } | |
5565 } | |
5566 pMouse->RemoveHoldingItem(); | |
5567 return; | |
5568 | |
1021 | 5569 } |
5570 | |
5571 | |
5572 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5573 { | |
5574 | |
5575 | |
5576 if ( pCurrentScreen == SCREEN_CASTING ) | |
5577 return; | |
5578 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5579 { | |
5580 | |
5581 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5582 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5583 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5584 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5585 return; |
5586 } | |
5587 if ( bUnderwater == 1 ) | |
5588 { | |
1032 | 5589 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5590 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5591 return; |
5592 } | |
5593 dword_50C9AC = 1; | |
5594 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5595 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5596 { | |
5597 pMouse->RemoveHoldingItem(); | |
5598 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5599 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5600 pCurrentScreen = SCREEN_GAME; |
5601 viewparams->bRedrawGameUI = 1; | |
5602 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5603 } | |
5604 else | |
5605 { | |
5606 _720984_unused = pParty->pPickedItem.uItemID; | |
5607 pMouse->RemoveHoldingItem(); | |
5608 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5609 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5610 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5611 { | |
5612 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5613 } | |
5614 } | |
5615 return; | |
5616 } | |
5617 | |
5618 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5619 | |
5620 { | |
5621 v15 = pParty->pPickedItem.uItemID - 400; | |
5622 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5623 if ( v72 ) | |
5624 { | |
5625 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5626 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
|
5627 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5628 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5629 return; |
5630 } | |
5631 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5632 { | |
5633 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5634 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
|
5635 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5636 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5637 return; |
5638 } | |
5639 v16 = v15 % 11 + 1; | |
5640 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5641 v18 = SkillToMastery(v17) - 1; | |
1032 | 5642 switch (v18) |
5643 { | |
5644 case 0: v67 = 4; break; | |
5645 case 1: v67 = 7; break; | |
5646 case 2: v67 = 10; break; | |
5647 case 3: v67 = 11; break; | |
5648 default: | |
5649 v67 = player_num; | |
5650 } | |
5651 | |
5652 if ( v16 > v67 || !v17 ) | |
1021 | 5653 { |
1032 | 5654 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5655 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
|
5656 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5657 v3->PlaySound((PlayerSpeech)20, 0); |
5658 return; | |
5659 } | |
5660 // v72 = 1; | |
5661 v3->PlaySound(SPEECH_21, 0); | |
5662 v73 = 0; | |
5663 | |
5664 | |
5665 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5666 { | |
5667 if ( !v73 ) | |
1021 | 5668 { |
1032 | 5669 pMouse->RemoveHoldingItem(); |
5670 return; | |
5671 } | |
5672 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5673 } | |
5674 if ( v73 ) | |
5675 { | |
5676 if ( pParty->bTurnBasedModeOn ) | |
5677 { | |
5678 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5679 thisb->SetRecoveryTime(100); | |
1448 | 5680 pTurnEngine->ApplyPlayerAction(); |
1021 | 5681 } |
5682 else | |
5683 { | |
1032 | 5684 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5685 } |
5686 } | |
1032 | 5687 pMouse->RemoveHoldingItem(); |
5688 return; | |
5689 | |
1021 | 5690 } |
5691 | |
5692 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5693 | |
5694 { | |
5695 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5696 { | |
5697 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5698 v3->PlaySound(SPEECH_37, 0); |
1021 | 5699 return; |
5700 } | |
5701 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5702 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5703 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5704 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5705 return; |
5706 } | |
5707 else | |
1459 | 5708 { |
5709 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5710 { | |
1021 | 5711 thisa = pParty->uCurrentMonthWeek + 1; |
5712 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5713 v74 = NULL; |
1021 | 5714 else |
5715 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5716 switch ( pParty->uCurrentMonth ) | |
5717 { | |
1019 | 5718 case 0: |
1021 | 5719 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5720 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5721 break; |
1019 | 5722 case 1: |
1021 | 5723 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5724 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5725 break; |
1019 | 5726 case 2: |
1021 | 5727 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5728 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5729 break; |
1019 | 5730 case 3: |
1021 | 5731 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5732 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5733 break; |
1019 | 5734 case 4: |
1021 | 5735 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5736 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5737 break; |
1019 | 5738 case 5: |
1021 | 5739 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5740 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5741 break; |
1019 | 5742 case 6: |
1021 | 5743 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5744 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5745 break; |
1019 | 5746 case 7: |
1021 | 5747 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5748 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5749 break; |
1019 | 5750 case 8: |
1021 | 5751 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5752 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5753 break; |
0 | 5754 case 9u: |
1021 | 5755 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5756 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5757 break; |
1019 | 5758 case 10: |
1021 | 5759 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5760 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5761 break; |
1019 | 5762 case 11: |
1021 | 5763 v8 = rand() % 6; |
5764 switch (v8) | |
5765 { | |
5766 case 0: | |
5767 v3->sResFireBase += thisa; | |
5768 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5769 break; | |
5770 case 1: | |
5771 v3->sResAirBase += thisa; | |
5772 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5773 break; | |
5774 case 2: | |
5775 v3->sResWaterBase += thisa; | |
5776 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5777 break; | |
5778 case 3: | |
5779 v3->sResEarthBase += thisa; | |
5780 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5781 break; | |
5782 case 4: | |
5783 v3->sResMindBase += thisa; | |
5784 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5785 break; | |
5786 case 5: | |
5787 v3->sResBodyBase += thisa; | |
5788 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5789 break; |
1021 | 5790 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5791 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5792 break; |
5793 | |
5794 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5795 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5796 pMouse->RemoveHoldingItem(); |
1459 | 5797 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5798 v3->PlaySound(SPEECH_93, 0); |
1032 | 5799 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5800 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5801 { |
1021 | 5802 v3->SetCondition(Condition_Eradicated, 0); |
5803 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5804 } |
1021 | 5805 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5806 { | |
5807 v3->SetCondition(Condition_Dead, 0); | |
5808 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5809 } | |
5810 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5811 { | |
5812 v3->SetCondition(Condition_Pertified, 0); | |
5813 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5814 } | |
1019 | 5815 return; |
1021 | 5816 } |
5817 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5818 { |
1021 | 5819 Party::GiveFood(1u); |
1459 | 5820 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5821 } | |
1021 | 5822 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5823 { | |
1459 | 5824 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5825 return; |
5826 } | |
5827 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5828 { | |
1459 | 5829 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5830 return; |
5831 } | |
5832 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5833 { | |
1459 | 5834 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5835 return; |
5836 } | |
1032 | 5837 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5838 { |
5839 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5840 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5841 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5842 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5843 } | |
5844 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5845 { | |
1459 | 5846 TeleportToNWCDungeon(); |
1021 | 5847 return; |
5848 } | |
0 | 5849 else |
1021 | 5850 { |
5851 | |
5852 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5853 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
|
5854 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5855 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5856 return; |
5857 } | |
1032 | 5858 |
0 | 5859 pMouse->RemoveHoldingItem(); |
5860 return; | |
5861 } | |
1021 | 5862 |
5863 } | |
0 | 5864 |
5865 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5866 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5867 { |
0 | 5868 Player *v3; // esi@1 |
5869 signed int v4; // edi@1 | |
5870 unsigned int v5; // eax@8 | |
5871 int v6; // eax@9 | |
5872 enum CHARACTER_RACE v7; // eax@11 | |
5873 signed int v8; // eax@17 | |
5874 unsigned __int8 v9; // sf@17 | |
5875 unsigned __int8 v10; // of@17 | |
5876 int v11; // eax@19 | |
5877 unsigned int v12; // eax@20 | |
484 | 5878 unsigned int test_bit_value; // eax@25 |
5879 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5880 signed int v15; // ecx@28 |
5881 ItemGen *v16; // eax@28 | |
5882 char v17; // zf@31 | |
5883 int v18; // edi@90 | |
5884 DDM_DLV_Header *v19; // eax@122 | |
5885 char v20; // cl@124 | |
5886 DDM_DLV_Header *v21; // eax@126 | |
5887 unsigned int v22; // edi@129 | |
100 | 5888 Player *v23; // esi@134 |
0 | 5889 ItemGen *v24; // ecx@135 |
5890 signed int v25; // edx@135 | |
5891 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5892 char *v27; // edi@155 | |
5893 int v28; // ebx@161 | |
5894 int v29; // eax@161 | |
5895 | |
469 | 5896 v6 = 0; |
0 | 5897 v3 = this; |
5898 v4 = -1; | |
469 | 5899 if ( VarNum > VAR_AutoNotes ) |
5900 { | |
5901 switch ( VarNum ) | |
0 | 5902 { |
5903 case VAR_Invisible: | |
1167 | 5904 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5905 return true; |
484 | 5906 return false; |
0 | 5907 case VAR_NumDeaths: |
5908 v4 = pParty->uNumDeaths; | |
469 | 5909 return v4 >= pValue; |
0 | 5910 case VAR_NumBounties: |
5911 v4 = pParty->uNumBountiesCollected; | |
469 | 5912 return v4 >= pValue; |
0 | 5913 case VAR_PrisonTerms: |
5914 v4 = pParty->uNumPrisonTerms; | |
469 | 5915 return v4 >= pValue; |
0 | 5916 case VAR_ArenaWinsPage: |
5917 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5918 return v4 >= pValue; |
0 | 5919 case VAR_ArenaWinsSquire: |
5920 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5921 return v4 >= pValue; |
0 | 5922 case VAR_ArenaWinsKnight: |
5923 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5924 return v4 >= pValue; |
0 | 5925 case VAR_ArenaWinsLord: |
5926 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5927 return v4 >= pValue; |
0 | 5928 case VAR_ReputationInCurrentLocation: |
5929 v19 = &pOutdoor->ddm; | |
5930 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5931 v19 = &pIndoor->dlv; | |
469 | 5932 v6 = v19->uReputation >= pValue; |
5933 return v6; | |
0 | 5934 case VAR_History_28|VAR_Sex: |
5935 v21 = &pOutdoor->ddm; | |
5936 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5937 v21 = &pIndoor->dlv; | |
469 | 5938 v6 = v21->field_C_alert == pValue; |
0 | 5939 return v6; |
5940 case VAR_MonthEquals2|VAR_Sex: | |
5941 case VAR_MonthEquals2|VAR_Class: | |
5942 case VAR_Counter1: | |
5943 case VAR_Counter2: | |
5944 case VAR_Counter3: | |
5945 case VAR_Counter4: | |
5946 case VAR_Counter5: | |
5947 case VAR_Counter6: | |
5948 case VAR_Counter7: | |
5949 case VAR_Counter8: | |
469 | 5950 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5951 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5952 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5953 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5954 return true; | |
5955 return false; | |
0 | 5956 case VAR_NumSkillPoints: |
5957 v4 = this->uSkillPoints; | |
469 | 5958 return v4 >= pValue; |
0 | 5959 case VAR_CircusPrises: |
5960 v4 = 0; | |
100 | 5961 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5962 do |
5963 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5964 v24 = v23->pInventoryItemList; |
0 | 5965 v25 = 138; |
5966 do | |
5967 { | |
5968 switch ( v24->uItemID ) | |
5969 { | |
5970 case 0x1D6u: | |
5971 ++v4; | |
5972 break; | |
5973 case 0x1D7u: | |
5974 v4 += 3; | |
5975 break; | |
5976 case 0x1DDu: | |
5977 v4 += 5; | |
5978 break; | |
5979 } | |
5980 ++v24; | |
5981 --v25; | |
5982 } | |
5983 while ( v25 ); | |
100 | 5984 ++v23; |
0 | 5985 } |
100 | 5986 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5987 return v4 >= pValue; |
0 | 5988 case VAR_MonthEquals2: |
469 | 5989 v6 = pParty->uCurrentMonth == pValue; |
5990 return v6; | |
0 | 5991 case VAR_IsFlying: |
5992 if ( pParty->bFlying | |
1167 | 5993 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5994 return true; |
5995 return false; | |
0 | 5996 case VAR_HiredNPCHasSpeciality: |
469 | 5997 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 5998 return v6; |
5999 case VAR_NPCs2: | |
469 | 6000 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 6001 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 6002 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
6003 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 6004 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 6005 return v4 >= pValue; |
6006 v4 = pValue; | |
6007 return v4 >= pValue; | |
0 | 6008 case VAR_ItemEquipped: |
6009 v26 = (ITEM_EQUIP_TYPE)0; | |
6010 v27 = (char *)&this->pEquipment; | |
6011 break; | |
6012 case VAR_GoldInBank: | |
6013 v4 = pParty->uNumGoldInBank; | |
469 | 6014 return v4 >= pValue; |
0 | 6015 case VAR_ThieverySkill|0x80: |
6016 v28 = GetActualMight(); | |
6017 v29 = v3->GetBaseStrength(); | |
6018 goto LABEL_168; | |
6019 case VAR_DisarmTrapSkill|0x80: | |
6020 v28 = GetActualIntelligence(); | |
6021 v29 = v3->GetBaseIntelligence(); | |
6022 goto LABEL_168; | |
6023 case VAR_MonthEquals: | |
6024 v28 = GetActualWillpower(); | |
6025 v29 = v3->GetBaseWillpower(); | |
6026 goto LABEL_168; | |
6027 case VAR_MonthEquals|VAR_Sex: | |
6028 v28 = GetActualEndurance(); | |
6029 v29 = v3->GetBaseEndurance(); | |
6030 goto LABEL_168; | |
6031 case VAR_IdentifyMonsterSkill|0x80: | |
6032 v28 = GetActualSpeed(); | |
6033 v29 = v3->GetBaseSpeed(); | |
6034 goto LABEL_168; | |
6035 case VAR_ArmsmasterSkill|0x80: | |
6036 v28 = GetActualAccuracy(); | |
6037 v29 = v3->GetBaseAccuracy(); | |
6038 goto LABEL_168; | |
6039 case VAR_MonthEquals|VAR_MaxHP: | |
6040 v28 = GetActualLuck(); | |
6041 v29 = v3->GetBaseLuck(); | |
6042 LABEL_168: | |
6043 v10 = __OFSUB__(v28, v29); | |
6044 v9 = v28 - v29 < 0; | |
6045 LABEL_169: | |
6046 if ( v9 ^ v10 ) | |
469 | 6047 return v4 >= pValue; |
6048 return true; | |
0 | 6049 default: |
469 | 6050 return v4 >= pValue; |
0 | 6051 } |
6052 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6053 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 6054 { |
6055 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
6056 v27 += 4; | |
6057 if ( (signed int)v26 >= 16 ) | |
469 | 6058 return false; |
6059 } | |
6060 return true; | |
6061 } | |
6062 if ( VarNum == VAR_AutoNotes ) | |
0 | 6063 { |
1033 | 6064 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
6065 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 6066 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6067 return false; | |
6068 return true; | |
469 | 6069 } |
6070 if ( VarNum <= VAR_BaseLuck ) | |
6071 { | |
6072 if ( VarNum != VAR_BaseLuck ) | |
6073 { | |
6074 switch ( VarNum ) | |
0 | 6075 { |
6076 case VAR_Hour: | |
469 | 6077 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
6078 return true; | |
6079 return false; | |
0 | 6080 case VAR_DayOfYear: |
469 | 6081 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
6082 v6 = v5 == pValue; | |
6083 return v6; | |
0 | 6084 case VAR_DayOfWeek: |
469 | 6085 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
6086 v6 = v5 == pValue; | |
0 | 6087 return v6; |
6088 case VAR_Sex: | |
469 | 6089 if ( pValue == (CHARACTER_RACE)this->uSex ) |
6090 return true; | |
6091 return v4 >= pValue; | |
0 | 6092 case VAR_Class: |
135 | 6093 v7 = (CHARACTER_RACE)this->classType; |
469 | 6094 if ( pValue == v7 ) |
6095 return true; | |
6096 return v4 >= pValue; | |
0 | 6097 case VAR_Race: |
6098 v7 = GetRace(); | |
469 | 6099 if ( pValue == v7 ) |
6100 return true; | |
6101 return v4 >= pValue; | |
0 | 6102 case VAR_CurrentHP: |
6103 v4 = this->sHealth; | |
469 | 6104 return v4 >= pValue; |
0 | 6105 case VAR_MaxHP: |
6106 v8 = GetMaxHealth(); | |
6107 v10 = __OFSUB__(v3->sHealth, v8); | |
6108 v9 = v3->sHealth - v8 < 0; | |
6109 goto LABEL_169; | |
6110 case VAR_CurrentSP: | |
6111 v4 = this->sMana; | |
469 | 6112 return v4 >= pValue; |
0 | 6113 case VAR_MaxSP: |
6114 v11 = GetMaxMana(); | |
6115 v10 = __OFSUB__(v3->sMana, v11); | |
6116 v9 = v3->sMana - v11 < 0; | |
6117 goto LABEL_169; | |
6118 case VAR_ActualAC: | |
6119 v12 = GetActualAC(); | |
6120 goto _j_cmp_against_arg; | |
6121 case VAR_ACModifier: | |
6122 v4 = this->sACModifier; | |
469 | 6123 return v4 >= pValue; |
0 | 6124 case VAR_BaseLevel: |
6125 v4 = this->uLevel; | |
469 | 6126 return v4 >= pValue; |
0 | 6127 case VAR_LevelModifier: |
6128 v4 = this->sLevelModifier; | |
469 | 6129 return v4 >= pValue; |
0 | 6130 case VAR_Age: |
6131 v12 = GetActualAge(); | |
6132 goto _j_cmp_against_arg; | |
6133 case VAR_Award: | |
1033 | 6134 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6135 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6136 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6137 return true; | |
6138 return false; | |
0 | 6139 case VAR_Experience: |
6140 v4 = LODWORD(this->uExperience); | |
469 | 6141 return v4 >= pValue; |
0 | 6142 case VAR_QBits_QuestsDone: |
484 | 6143 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6144 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6145 if ( test_bit_value & our_bit_value ) | |
478 | 6146 return true; |
6147 return false; | |
0 | 6148 case VAR_PlayerItemInHands: |
6149 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6150 v16 = v3->pInventoryItemList; |
0 | 6151 break; |
6152 case VAR_FixedGold: | |
6153 v4 = pParty->uNumGold; | |
469 | 6154 return v4 >= pValue; |
0 | 6155 case VAR_MightBonus: |
6156 v4 = this->uMightBonus; | |
469 | 6157 return v4 >= pValue; |
0 | 6158 case VAR_IntellectBonus: |
6159 v4 = this->uIntelligenceBonus; | |
469 | 6160 return v4 >= pValue; |
0 | 6161 case VAR_PersonalityBonus: |
6162 v4 = this->uWillpowerBonus; | |
469 | 6163 return v4 >= pValue; |
0 | 6164 case VAR_EnduranceBonus: |
6165 v4 = this->uEnduranceBonus; | |
469 | 6166 return v4 >= pValue; |
0 | 6167 case VAR_SpeedBonus: |
6168 v4 = this->uSpeedBonus; | |
469 | 6169 return v4 >= pValue; |
0 | 6170 case VAR_AccuracyBonus: |
6171 v4 = this->uAccuracyBonus; | |
469 | 6172 return v4 >= pValue; |
0 | 6173 case VAR_LuckBonus: |
6174 v4 = this->uLuckBonus; | |
469 | 6175 return v4 >= pValue; |
0 | 6176 case VAR_BaseMight: |
6177 v4 = this->uMight; | |
469 | 6178 return v4 >= pValue; |
0 | 6179 case VAR_BaseIntellect: |
6180 v4 = this->uIntelligence; | |
469 | 6181 return v4 >= pValue; |
0 | 6182 case VAR_BasePersonality: |
6183 v4 = this->uWillpower; | |
469 | 6184 return v4 >= pValue; |
0 | 6185 case VAR_BaseEndurance: |
6186 v4 = this->uEndurance; | |
469 | 6187 return v4 >= pValue; |
0 | 6188 case VAR_BaseSpeed: |
6189 v4 = this->uSpeed; | |
469 | 6190 return v4 >= pValue; |
0 | 6191 case VAR_BaseAccuracy: |
6192 v4 = this->uAccuracy; | |
469 | 6193 return v4 >= pValue; |
0 | 6194 case VAR_FixedFood: |
6195 v4 = pParty->uNumFoodRations; | |
469 | 6196 return v4 >= pValue; |
0 | 6197 default: |
469 | 6198 return v4 >= pValue; |
6199 } | |
6200 while ( v16->uItemID != pValue ) | |
0 | 6201 { |
6202 ++v15; | |
6203 ++v16; | |
6204 if ( v15 >= 138 ) | |
6205 { | |
469 | 6206 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6207 return v6; |
6208 } | |
6209 } | |
469 | 6210 return true; |
0 | 6211 } |
6212 v4 = this->uLuck; | |
469 | 6213 return v4 >= pValue; |
6214 } | |
6215 if ( VarNum <= VAR_MagicResistance ) | |
6216 { | |
6217 if ( VarNum == VAR_MagicResistance ) | |
0 | 6218 { |
6219 v4 = this->sResMagicBase; | |
6220 } | |
6221 else | |
6222 { | |
469 | 6223 switch ( VarNum ) |
0 | 6224 { |
6225 case VAR_FireResistance: | |
6226 v4 = this->sResFireBase; | |
469 | 6227 return v4 >= pValue; |
0 | 6228 case VAR_AirResistance: |
6229 v4 = this->sResAirBase; | |
469 | 6230 return v4 >= pValue; |
0 | 6231 case VAR_WaterResistance: |
6232 v4 = this->sResWaterBase; | |
469 | 6233 return v4 >= pValue; |
0 | 6234 case VAR_EarthResistance: |
6235 v4 = this->sResEarthBase; | |
469 | 6236 return v4 >= pValue; |
0 | 6237 case VAR_SpiritResistance: |
6238 v4 = this->sResSpiritBase; | |
469 | 6239 return v4 >= pValue; |
0 | 6240 case VAR_MindResistance: |
6241 v4 = this->sResMindBase; | |
469 | 6242 return v4 >= pValue; |
0 | 6243 case VAR_BodyResistance: |
6244 v4 = this->sResBodyBase; | |
469 | 6245 return v4 >= pValue; |
0 | 6246 case VAR_LightResistance: |
6247 v4 = this->sResLightBase; | |
469 | 6248 return v4 >= pValue; |
0 | 6249 case VAR_DarkResistance: |
6250 v4 = this->sResDarkBase; | |
469 | 6251 return v4 >= pValue; |
0 | 6252 case VAR_ActualMight: |
6253 v12 = GetActualMight(); | |
6254 goto _j_cmp_against_arg; | |
6255 case VAR_ActualIntellect: | |
6256 v12 = GetActualIntelligence(); | |
6257 goto _j_cmp_against_arg; | |
6258 case VAR_ActualPersonality: | |
6259 v12 = GetActualWillpower(); | |
6260 goto _j_cmp_against_arg; | |
6261 case VAR_ActualEndurance: | |
6262 v12 = GetActualEndurance(); | |
6263 goto _j_cmp_against_arg; | |
6264 case VAR_ActualSpeed: | |
6265 v12 = GetActualSpeed(); | |
6266 goto _j_cmp_against_arg; | |
6267 case VAR_ActualAccuracy: | |
6268 v12 = GetActualAccuracy(); | |
6269 goto _j_cmp_against_arg; | |
6270 case VAR_ActualLuck: | |
6271 v12 = GetActualLuck(); | |
6272 _j_cmp_against_arg: | |
6273 v4 = v12; | |
6274 break; | |
6275 default: | |
469 | 6276 return v4 >= pValue; |
6277 } | |
6278 } | |
6279 return v4 >= pValue; | |
6280 } | |
6281 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6282 { | |
6283 if ( VarNum != VAR_DisarmTrapSkill ) | |
6284 { | |
6285 if ( VarNum <= VAR_MindResistanceBonus ) | |
6286 { | |
6287 switch ( VarNum ) | |
0 | 6288 { |
6289 case VAR_MindResistanceBonus: | |
6290 v4 = this->sResMindBonus; | |
6291 break; | |
6292 case VAR_FireResistanceBonus: | |
6293 v4 = this->sResFireBonus; | |
6294 break; | |
6295 case VAR_AirResistanceBonus: | |
6296 v4 = this->sResAirBonus; | |
6297 break; | |
6298 case VAR_WaterResistanceBonus: | |
6299 v4 = this->sResWaterBonus; | |
6300 break; | |
6301 case VAR_EarthResistanceBonus: | |
6302 v4 = this->sResEarthBonus; | |
6303 break; | |
6304 case VAR_SpiritResistanceBonus: | |
6305 v4 = this->sResSpiritBonus; | |
6306 break; | |
6307 } | |
469 | 6308 return v4 >= pValue; |
6309 } | |
6310 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6311 { |
6312 v4 = this->sResBodyBonus; | |
469 | 6313 return v4 >= pValue; |
6314 } | |
6315 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6316 { |
6317 v4 = this->sResLightBonus; | |
469 | 6318 return v4 >= pValue; |
6319 } | |
6320 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6321 { |
6322 v4 = this->sResDarkBonus; | |
469 | 6323 return v4 >= pValue; |
6324 } | |
6325 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6326 { |
6327 v4 = this->sResMagicBonus; | |
469 | 6328 return v4 >= pValue; |
6329 } | |
6330 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6331 return v4 >= pValue; | |
0 | 6332 } |
6333 LABEL_90: | |
469 | 6334 v18 = *((short *)&this->pConditions[16] + VarNum); |
6335 if ( pValue <= 63 ) | |
0 | 6336 v4 = v18 & 0x3F; |
6337 else | |
469 | 6338 v4 = pValue & v18; |
6339 return v4 >= pValue; | |
6340 } | |
6341 if ( VarNum == 104 ) | |
0 | 6342 goto LABEL_90; |
469 | 6343 if ( (signed int)VarNum <= 104 ) |
6344 return v4 >= pValue; | |
6345 if ( (signed int)VarNum > 0x79 ) | |
6346 { | |
6347 if ( VarNum != 122 ) | |
6348 { | |
6349 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6350 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6351 return v4 >= pValue; | |
0 | 6352 } |
6353 v4 = GetMajorConditionIdx(); | |
6354 if ( v4 != 18 ) | |
6355 { | |
469 | 6356 return v4 >= pValue; |
6357 } | |
6358 v4 = pValue; | |
6359 return v4 >= pValue; | |
6360 } | |
1072 | 6361 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6362 } |
6363 | |
6364 | |
6365 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6366 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6367 { | |
6368 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
|
6369 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
|
6370 unsigned int v5_unused; // edi@1 |
0 | 6371 unsigned int v6; // esi@13 |
6372 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
|
6373 signed int v8_unused; // eax@17 |
0 | 6374 ItemGen *v9; // ecx@17 |
6375 int v10; // eax@21 | |
6376 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
|
6377 Player *unused12; // ecx@44 |
0 | 6378 char *v13; // ecx@45 |
6379 Player *v14; // ecx@49 | |
6380 int v15; // ecx@86 | |
6381 int v16; // esi@106 | |
6382 char v17; // al@106 | |
6383 int v18; // eax@107 | |
6384 Player *v19; // ecx@112 | |
6385 Player *v20; // ecx@127 | |
6386 int v21; // eax@127 | |
6387 int v22; // eax@145 | |
6388 char v23; // zf@146 | |
6389 DDM_DLV_Header *v24; // ecx@148 | |
6390 signed int v25; // eax@172 | |
6391 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
|
6392 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
|
6393 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6394 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
|
6395 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
|
6396 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
|
6397 |
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
|
6398 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
|
6399 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
|
6400 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6401 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
|
6402 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6403 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
|
6404 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
|
6405 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6406 } |
1545 | 6407 |
6408 Assert(currPlayerId != -1); | |
492 | 6409 if ( var_type > VAR_AutoNotes ) |
6410 { | |
6411 if ( var_type <= VAR_GoldInBank ) | |
6412 { | |
6413 if ( var_type == VAR_GoldInBank ) | |
6414 { | |
6415 pParty->uNumGoldInBank = var_value; | |
0 | 6416 return; |
6417 } | |
492 | 6418 if ( var_type <= VAR_Counter8 ) |
6419 { | |
6420 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6421 { |
492 | 6422 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6423 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6424 } |
6425 else | |
6426 { | |
492 | 6427 switch ( var_type ) |
0 | 6428 { |
6429 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6430 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6431 break; |
6432 case VAR_NPCs2: | |
6433 pParty->field_709 = 0; | |
492 | 6434 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6435 pParty->CountHirelings(); |
6436 viewparams->bRedrawGameUI = true; | |
0 | 6437 break; |
6438 case VAR_NumSkillPoints: | |
492 | 6439 this->uSkillPoints = var_value; |
0 | 6440 break; |
6441 } | |
6442 } | |
6443 return; | |
6444 } | |
492 | 6445 if ( var_type < VAR_Counter9 ) |
0 | 6446 return; |
492 | 6447 if ( (signed int)var_type <= 0x112 ) |
6448 { | |
6449 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6450 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6451 } |
6452 else | |
6453 { | |
492 | 6454 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6455 { |
6456 v24 = &pOutdoor->ddm; | |
6457 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6458 v24 = &pIndoor->dlv; | |
492 | 6459 v24->uReputation = var_value; |
6460 if ( var_value > 10000 ) | |
0 | 6461 v24->uReputation = 10000; |
6462 return; | |
6463 } | |
492 | 6464 if ( var_type <= VAR_ReputationInCurrentLocation |
6465 || var_type > VAR_History_28 | |
6466 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6467 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6468 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6469 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6470 v23) ) |
6471 return; | |
6472 bFlashHistoryBook = 1; | |
6473 } | |
492 | 6474 v25 = 8 * currPlayerId + 400; |
862 | 6475 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
|
6476 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6477 return; |
6478 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6479 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6480 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6481 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6482 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
|
6483 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6484 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6485 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6486 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6487 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6488 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6489 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6490 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6491 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6492 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6493 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6494 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6495 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6496 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6497 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6498 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6499 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6500 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6501 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6502 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6503 return; |
0 | 6504 } |
492 | 6505 if ( var_type == VAR_AutoNotes ) |
6506 { | |
6507 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
|
6508 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6509 && pAutonoteTxt[var_value].pText ) |
492 | 6510 { |
6511 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6512 v20->PlaySound(SPEECH_96, 0); |
1453 | 6513 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6514 bFlashAutonotesBook = 1; |
1453 | 6515 _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
|
6516 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6517 } |
1453 | 6518 _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
|
6519 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6520 return; |
0 | 6521 } |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6522 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
|
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 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
|
6525 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6526 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
|
6527 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
|
6528 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
|
6529 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
|
6530 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
|
6531 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
|
6532 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6533 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6534 for (int i = 0; i < 138; i++) |
0 | 6535 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6536 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6537 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
|
6538 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
|
6539 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6540 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
|
6541 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6542 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
|
6543 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6544 *(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
|
6545 } |
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
|
6546 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
|
6547 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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 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
|
6559 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
|
6560 { |
7ef8ae7ce42a
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 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
|
6562 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
|
6563 } |
7ef8ae7ce42a
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 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
|
6565 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6566 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
|
6567 this->uVoiceID = 20; |
0 | 6568 } |
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
|
6569 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
|
6570 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6571 goto LABEL_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
|
6572 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
|
6573 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
|
6574 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
|
6575 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
|
6576 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
|
6577 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
|
6578 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
|
6579 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
|
6580 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
|
6581 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
|
6582 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
|
6583 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
|
6584 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
|
6585 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
|
6586 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
|
6587 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
|
6588 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
|
6589 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
|
6590 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
|
6591 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
|
6592 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
|
6593 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
|
6594 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
|
6595 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
|
6596 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
|
6597 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
|
6598 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
|
6599 //&& 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
|
6600 && 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
|
6601 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6602 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
|
6603 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6604 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
|
6605 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6606 _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
|
6607 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
|
6608 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
|
6609 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
|
6610 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
|
6611 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
|
6612 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
|
6613 // && (&dword_722F10)[4 * a3] ) |
1310 | 6614 && pQuestTable[var_value] ) |
0 | 6615 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6616 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
|
6617 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
|
6618 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
|
6619 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6620 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
|
6621 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6622 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
|
6623 _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
|
6624 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
|
6625 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
|
6626 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
|
6627 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
|
6628 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
|
6629 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
|
6630 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
|
6631 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
|
6632 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
|
6633 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
|
6634 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
|
6635 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
|
6636 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
|
6637 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
|
6638 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
|
6639 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
|
6640 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
|
6641 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
|
6642 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
|
6643 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
|
6644 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
|
6645 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
|
6646 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
|
6647 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
|
6648 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
|
6649 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
|
6650 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
|
6651 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
|
6652 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
|
6653 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
|
6654 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
|
6655 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
|
6656 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
|
6657 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
|
6658 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
|
6659 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
|
6660 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
|
6661 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
|
6662 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
|
6663 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
|
6664 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
|
6665 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
|
6666 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
|
6667 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
|
6668 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
|
6669 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
|
6670 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6671 goto LABEL_112; |
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
|
6672 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
|
6673 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
|
6674 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6675 goto LABEL_112; |
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
|
6676 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
|
6677 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
|
6678 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6679 goto LABEL_112; |
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
|
6680 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
|
6681 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
|
6682 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6683 goto LABEL_112; |
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
|
6684 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
|
6685 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
|
6686 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6687 goto LABEL_112; |
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
|
6688 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
|
6689 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
|
6690 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6691 goto LABEL_112; |
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
|
6692 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
|
6693 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
|
6694 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6695 goto LABEL_112; |
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 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
|
6697 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
|
6698 } |
0 | 6699 LABEL_111: |
187 | 6700 v26 = SPEECH_91; |
0 | 6701 LABEL_112: |
492 | 6702 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6703 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
|
6704 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6705 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6706 return; |
0 | 6707 } |
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
|
6708 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
|
6709 { |
492 | 6710 switch ( var_type ) |
0 | 6711 { |
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
|
6712 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
|
6713 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
|
6714 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
|
6715 goto LABEL_111; |
0 | 6716 case VAR_ActualIntellect: |
6717 LABEL_68: | |
492 | 6718 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6719 goto LABEL_111; |
6720 case VAR_ActualPersonality: | |
6721 LABEL_69: | |
492 | 6722 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6723 goto LABEL_111; |
6724 case VAR_ActualEndurance: | |
6725 LABEL_70: | |
492 | 6726 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6727 goto LABEL_111; |
6728 case VAR_ActualSpeed: | |
6729 LABEL_71: | |
492 | 6730 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6731 goto LABEL_111; |
6732 case VAR_ActualAccuracy: | |
6733 LABEL_72: | |
492 | 6734 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6735 goto LABEL_111; |
6736 case VAR_ActualLuck: | |
6737 LABEL_73: | |
492 | 6738 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6739 goto LABEL_111; |
6740 case VAR_FireResistance: | |
492 | 6741 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
|
6742 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6743 goto LABEL_112; |
0 | 6744 case VAR_AirResistance: |
492 | 6745 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
|
6746 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6747 goto LABEL_112; |
0 | 6748 case VAR_WaterResistance: |
492 | 6749 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
|
6750 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6751 goto LABEL_112; |
0 | 6752 case VAR_EarthResistance: |
492 | 6753 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
|
6754 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6755 goto LABEL_112; |
0 | 6756 case VAR_SpiritResistance: |
492 | 6757 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
|
6758 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6759 goto LABEL_112; |
0 | 6760 case VAR_MindResistance: |
492 | 6761 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
|
6762 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6763 goto LABEL_112; |
0 | 6764 case VAR_BodyResistance: |
492 | 6765 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
|
6766 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6767 goto LABEL_112; |
0 | 6768 case VAR_LightResistance: |
492 | 6769 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
|
6770 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6771 goto LABEL_112; |
0 | 6772 case VAR_DarkResistance: |
492 | 6773 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
|
6774 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6775 goto LABEL_112; |
0 | 6776 case VAR_MagicResistance: |
492 | 6777 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6778 v26 = 92; |
6779 goto LABEL_112; | |
6780 default: | |
6781 return; | |
6782 } | |
6783 return; | |
6784 } | |
6785 HIWORD(v15) = 0; | |
492 | 6786 if ( var_type > VAR_DisarmTrapSkill ) |
6787 { | |
6788 if ( var_type != VAR_LearningSkill ) | |
6789 { | |
6790 if ( var_type <= VAR_LearningSkill ) | |
0 | 6791 return; |
492 | 6792 if ( var_type <= VAR_Eradicated ) |
6793 { | |
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
|
6794 this->SetCondition(var_type - 105, 1); |
0 | 6795 } |
6796 else | |
6797 { | |
492 | 6798 if ( var_type != VAR_MajorCondition ) |
0 | 6799 { |
492 | 6800 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6801 byte_5E4C15[var_type] = var_value; | |
0 | 6802 return; |
6803 } | |
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
|
6804 memset(this, 0, 0xA0u); |
0 | 6805 } |
6806 } | |
6807 else | |
6808 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6809 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
|
6810 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6811 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6812 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6813 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6814 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6815 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6816 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6817 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6818 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
|
6819 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6820 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6821 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6822 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6823 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6824 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6825 return; |
0 | 6826 } |
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
|
6827 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6828 { |
6829 switch ( var_type ) | |
0 | 6830 { |
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
|
6831 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
|
6832 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6833 break; |
6834 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
|
6835 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6836 break; |
6837 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
|
6838 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6839 break; |
6840 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
|
6841 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6842 break; |
6843 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
|
6844 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
|
6845 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
|
6846 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
|
6847 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
|
6848 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
|
6849 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
|
6850 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
|
6851 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
|
6852 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
|
6853 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
|
6854 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
|
6855 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
|
6856 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
|
6857 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
|
6858 case VAR_PhysicalResistanceBonus: |
1545 | 6859 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
|
6860 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
|
6861 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
|
6862 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
|
6863 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6864 break; |
6865 default: | |
1545 | 6866 Assert("Unexpected var_type: %u", var_type); |
0 | 6867 return; |
6868 break; | |
6869 } | |
6870 goto LABEL_111; | |
6871 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6872 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
|
6873 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6874 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6875 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6876 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6877 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6878 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6879 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6880 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
|
6881 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6882 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
|
6883 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
|
6884 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
|
6885 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6886 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6887 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6888 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
|
6889 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6890 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
|
6891 } |
0 | 6892 |
6893 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6894 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6895 { |
6896 char v3; // bl@1 | |
6897 Player *v4; // esi@1 | |
6898 signed int uPlayerIdx; // edi@1 | |
6899 int v6; // eax@15 | |
6900 unsigned int v7; // esi@18 | |
6901 int *v8; // ebx@21 | |
6902 int v9; // eax@22 | |
6903 signed int v10; // eax@24 | |
6904 int v11; // eax@27 | |
6905 __int16 *v12; // esi@28 | |
6906 Player *v13; // ecx@34 | |
6907 Player *v14; // ecx@36 | |
6908 char *v15; // ecx@37 | |
6909 unsigned __int8 v16; // cf@38 | |
6910 Player *v17; // ecx@42 | |
6911 __int16 *v18; // esi@53 | |
6912 __int16 *v19; // esi@62 | |
6913 char *v20; // esi@107 | |
6914 __int16 v21; // dx@107 | |
6915 int v22; // ecx@107 | |
6916 Player *v23; // ecx@132 | |
6917 int v24; // eax@132 | |
6918 int v25; // eax@150 | |
6919 char v26; // zf@151 | |
6920 DDM_DLV_Header *v27; // eax@153 | |
6921 signed int v28; // eax@176 | |
6922 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6923 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6924 int v31; // [sp-4h] [bp-3Ch]@84 |
6925 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6926 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6927 char v34; // [sp+37h] [bp-1h]@1 | |
6928 | |
6929 auto Dst = this; | |
6930 v3 = 0; | |
6931 v34 = 0; | |
6932 v4 = Dst; | |
6933 uPlayerIdx = 0; | |
6934 if ( Dst == pPlayers[2] ) | |
6935 uPlayerIdx = 1; | |
310 | 6936 else if ( Dst == pPlayers[3] ) |
6937 uPlayerIdx = 2; | |
6938 else if ( Dst == pPlayers[4] ) | |
6939 uPlayerIdx = 3; | |
6940 | |
6941 if ( var_type <= VAR_AutoNotes ) | |
6942 { | |
6943 if ( var_type != VAR_AutoNotes ) | |
6944 { | |
6945 if ( var_type <= VAR_ActualMight ) | |
6946 { | |
6947 if ( var_type != VAR_ActualMight ) | |
0 | 6948 { |
310 | 6949 switch ( var_type ) |
0 | 6950 { |
6951 case VAR_RandomGold: | |
6952 if ( !val ) | |
6953 val = 1; | |
6954 v6 = rand(); | |
6955 party_finds_gold(v6 % val + 1, 1); | |
6956 GameUI_DrawFoodAndGold(); | |
6957 return; | |
6958 case VAR_RandomFood: | |
6959 if ( !val ) | |
6960 val = 1; | |
6961 v7 = rand() % val + 1; | |
6962 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6963 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
|
6964 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6965 GameUI_DrawFoodAndGold(); |
6966 goto _play_sound; | |
6967 case VAR_Sex: | |
6968 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6969 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6970 goto _play_sound; | |
0 | 6971 case VAR_Class: |
135 | 6972 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6973 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6974 goto _play_sound; | |
0 | 6975 case VAR_CurrentHP: |
6976 v8 = &Dst->sHealth; | |
6977 *v8 += val; | |
6978 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6979 { |
6980 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6981 goto _play_sound; | |
6982 } | |
0 | 6983 v9 = v4->GetMaxHealth(); |
6984 goto LABEL_23; | |
6985 case VAR_MaxHP: | |
6986 v10 = Dst->GetMaxHealth(); | |
6987 v4->_health_related = 0; | |
6988 v4->uFullHealthBonus = 0; | |
6989 v4->sHealth = v10; | |
6990 return; | |
6991 case VAR_CurrentSP: | |
6992 v8 = &Dst->sMana; | |
6993 *v8 += val; | |
6994 if ( Dst->sMana > GetMaxMana() ) | |
6995 { | |
6996 v9 = v4->GetMaxMana(); | |
6997 LABEL_23: | |
6998 *v8 = v9; | |
6999 } | |
1507 | 7000 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7001 goto _play_sound; | |
0 | 7002 case VAR_MaxSP: |
7003 v11 = GetMaxMana(); | |
7004 v4->_mana_related = 0; | |
7005 v4->uFullManaBonus = 0; | |
7006 v4->sMana = v11; | |
7007 return; | |
7008 case VAR_ACModifier: | |
7009 v12 = &Dst->sACModifier; | |
7010 goto LABEL_29; | |
7011 case VAR_BaseLevel: | |
7012 v12 = (__int16 *)&Dst->uLevel; | |
7013 goto LABEL_29; | |
7014 case VAR_LevelModifier: | |
7015 v12 = &Dst->sLevelModifier; | |
7016 LABEL_29: | |
7017 *v12 += val; | |
7018 if ( *v12 > 255 ) | |
7019 *v12 = 255; | |
1507 | 7020 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7021 goto _play_sound; | |
0 | 7022 case VAR_Age: |
7023 Dst->sAgeModifier += val; | |
7024 return; | |
7025 case VAR_Award: | |
7026 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7027 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 7028 |
492 | 7029 && pAwards[val].pText ) |
0 | 7030 { |
7031 v14 = pPlayers[uPlayerIdx + 1]; | |
7032 v34 = 1; | |
7033 v3 = 1; | |
187 | 7034 v14->PlaySound(SPEECH_96, 0); |
0 | 7035 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7036 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 7037 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
7038 if ( v34 != 1 ) | |
7039 { | |
7040 if ( v3 != 1 ) | |
7041 return; | |
7042 goto _play_sound; | |
7043 } | |
7044 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7045 if ( v3 != 1 ) | |
7046 return; | |
7047 goto _play_sound; | |
0 | 7048 case VAR_Experience: |
7049 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
7050 LODWORD(Dst->uExperience) += val; | |
7051 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
7052 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
7053 Dst->uExperience = 4000000000i64; | |
1507 | 7054 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7055 goto _play_sound; | |
0 | 7056 case VAR_QBits_QuestsDone: |
484 | 7057 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
|
7058 //&& (&dword_722F10)[4 * val] ) |
1310 | 7059 && pQuestTable[val] ) |
0 | 7060 { |
501 | 7061 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 7062 bFlashQuestBook = 1; |
7063 v34 = 1; | |
7064 v3 = 1; | |
501 | 7065 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 7066 } |
484 | 7067 v15 = (char *)pParty->_quest_bits; |
1507 | 7068 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
7069 if ( v34 != 1 ) | |
7070 { | |
7071 if ( v3 != 1 ) | |
7072 return; | |
7073 goto _play_sound; | |
7074 } | |
7075 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7076 if ( v3 != 1 ) | |
7077 return; | |
7078 goto _play_sound; | |
0 | 7079 case VAR_PlayerItemInHands: |
7080 item.Reset(); | |
7081 item.Reset(); | |
7082 item.uAttributes = 1; | |
7083 item.uItemID = val; | |
7084 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 7085 pParty->pIsArtifactFound[val-500] = 1; |
0 | 7086 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
7087 { | |
7088 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
7089 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
7090 } | |
7091 pParty->SetHoldingItem(&item); | |
7092 return; | |
7093 case VAR_FixedGold: | |
7094 party_finds_gold(val, 1); | |
7095 return; | |
7096 case VAR_BaseMight: | |
7097 v18 = (__int16 *)&Dst->uMight; | |
7098 goto LABEL_82; | |
7099 case VAR_BaseIntellect: | |
7100 v18 = (__int16 *)&Dst->uIntelligence; | |
7101 goto LABEL_82; | |
7102 case VAR_BasePersonality: | |
7103 v18 = (__int16 *)&Dst->uWillpower; | |
7104 goto LABEL_82; | |
7105 case VAR_BaseEndurance: | |
7106 v18 = (__int16 *)&Dst->uEndurance; | |
7107 goto LABEL_82; | |
7108 case VAR_BaseSpeed: | |
7109 v18 = (__int16 *)&Dst->uSpeed; | |
7110 goto LABEL_82; | |
7111 case VAR_BaseAccuracy: | |
7112 v18 = (__int16 *)&Dst->uAccuracy; | |
7113 goto LABEL_82; | |
7114 case VAR_BaseLuck: | |
7115 v18 = (__int16 *)&Dst->uLuck; | |
7116 goto LABEL_82; | |
7117 case VAR_FixedFood: | |
7118 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7119 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7120 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7121 if ( pParty->uNumFoodRations > 0xFFFF ) |
7122 Party::SetFood(0xFFFFu); | |
7123 goto _play_sound; | |
7124 case VAR_MightBonus: | |
7125 goto LABEL_62; | |
7126 case VAR_IntellectBonus: | |
7127 goto LABEL_66; | |
7128 case VAR_PersonalityBonus: | |
7129 goto LABEL_67; | |
7130 case VAR_EnduranceBonus: | |
7131 goto LABEL_68; | |
7132 case VAR_SpeedBonus: | |
7133 goto LABEL_69; | |
7134 case VAR_AccuracyBonus: | |
7135 goto LABEL_70; | |
7136 case VAR_LuckBonus: | |
7137 goto LABEL_71; | |
7138 default: | |
7139 return; | |
7140 } | |
7141 return; | |
7142 } | |
7143 LABEL_62: | |
7144 v19 = (__int16 *)&Dst->uMightBonus; | |
7145 goto LABEL_113; | |
7146 } | |
310 | 7147 if ( var_type <= VAR_FireResistanceBonus ) |
7148 { | |
7149 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7150 { |
310 | 7151 switch ( var_type ) |
0 | 7152 { |
7153 case VAR_ActualIntellect: | |
7154 LABEL_66: | |
7155 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7156 goto LABEL_113; | |
7157 case VAR_ActualPersonality: | |
7158 LABEL_67: | |
7159 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7160 goto LABEL_113; | |
7161 case VAR_ActualEndurance: | |
7162 LABEL_68: | |
7163 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7164 goto LABEL_113; | |
7165 case VAR_ActualSpeed: | |
7166 LABEL_69: | |
7167 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7168 goto LABEL_113; | |
7169 case VAR_ActualAccuracy: | |
7170 LABEL_70: | |
7171 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7172 goto LABEL_113; | |
7173 case VAR_ActualLuck: | |
7174 LABEL_71: | |
7175 v19 = (__int16 *)&Dst->uLuckBonus; | |
7176 goto LABEL_113; | |
7177 case VAR_FireResistance: | |
7178 v18 = &Dst->sResFireBase; | |
7179 goto LABEL_82; | |
7180 case VAR_AirResistance: | |
7181 v18 = &Dst->sResAirBase; | |
7182 goto LABEL_82; | |
7183 case VAR_WaterResistance: | |
7184 v18 = &Dst->sResWaterBase; | |
7185 goto LABEL_82; | |
7186 case VAR_EarthResistance: | |
7187 v18 = &Dst->sResEarthBase; | |
7188 goto LABEL_82; | |
7189 case VAR_SpiritResistance: | |
7190 v18 = &Dst->sResSpiritBase; | |
7191 goto LABEL_82; | |
7192 case VAR_MindResistance: | |
7193 v18 = &Dst->sResMindBase; | |
7194 goto LABEL_82; | |
7195 case VAR_BodyResistance: | |
7196 v18 = &Dst->sResBodyBase; | |
7197 goto LABEL_82; | |
7198 case VAR_LightResistance: | |
7199 v18 = &Dst->sResLightBase; | |
7200 goto LABEL_82; | |
7201 case VAR_DarkResistance: | |
7202 v18 = &Dst->sResDarkBase; | |
7203 goto LABEL_82; | |
7204 case VAR_MagicResistance: | |
7205 v18 = &Dst->sResMagicBase; | |
7206 LABEL_82: | |
7207 *v18 += val; | |
7208 if ( *v18 > 255 ) | |
7209 *v18 = 255; | |
1507 | 7210 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7211 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7212 goto _play_sound; | |
0 | 7213 default: |
7214 return; | |
7215 } | |
7216 return; | |
7217 } | |
7218 v19 = &Dst->sResFireBonus; | |
7219 LABEL_113: | |
7220 *v19 += val; | |
7221 if ( *v19 > 255 ) | |
7222 *v19 = 255; | |
7223 v31 = 0; | |
187 | 7224 v29 = SPEECH_91; |
7225 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7226 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7227 goto _play_sound; | |
0 | 7228 } |
310 | 7229 if ( var_type <= VAR_DisarmTrapSkill ) |
7230 { | |
7231 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7232 { |
310 | 7233 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7234 { |
310 | 7235 switch ( var_type ) |
0 | 7236 { |
7237 case VAR_BodyResistanceBonus: | |
7238 v19 = &Dst->sResBodyBonus; | |
7239 break; | |
7240 case VAR_AirResistanceBonus: | |
7241 v19 = &Dst->sResAirBonus; | |
7242 break; | |
7243 case VAR_WaterResistanceBonus: | |
7244 v19 = &Dst->sResWaterBonus; | |
7245 break; | |
7246 case VAR_EarthResistanceBonus: | |
7247 v19 = &Dst->sResEarthBonus; | |
7248 break; | |
7249 case VAR_SpiritResistanceBonus: | |
7250 v19 = &Dst->sResSpiritBonus; | |
7251 break; | |
7252 default: | |
310 | 7253 if ( var_type != 62 ) |
0 | 7254 return; |
7255 v19 = &Dst->sResMindBonus; | |
7256 break; | |
7257 } | |
7258 goto LABEL_113; | |
7259 } | |
310 | 7260 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7261 { |
7262 v19 = &Dst->sResLightBonus; | |
7263 goto LABEL_113; | |
7264 } | |
310 | 7265 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7266 { |
7267 v19 = &Dst->sResDarkBonus; | |
7268 goto LABEL_113; | |
7269 } | |
310 | 7270 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7271 { |
7272 v19 = &Dst->sResMagicBonus; | |
7273 goto LABEL_113; | |
7274 } | |
310 | 7275 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7276 return; |
7277 } | |
7278 goto LABEL_106; | |
7279 } | |
310 | 7280 if ( var_type == VAR_LearningSkill ) |
0 | 7281 { |
7282 LABEL_106: | |
7283 if ( val <= VAR_BodyResistanceBonus ) | |
7284 { | |
310 | 7285 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7286 } |
7287 else | |
7288 { | |
310 | 7289 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7290 v21 = *(short *)v20; |
7291 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7292 if ( v22 > 60 ) | |
7293 LOWORD(v22) = 60; | |
7294 LOBYTE(v21) = v21 & 0xC0; | |
7295 *(short *)v20 = v22 | v21; | |
7296 } | |
1507 | 7297 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7298 goto _play_sound; | |
0 | 7299 } |
310 | 7300 if ( var_type <= VAR_LearningSkill ) |
0 | 7301 return; |
310 | 7302 if ( var_type <= VAR_Eradicated ) |
7303 { | |
7304 Dst->SetCondition(var_type - 105, 0); | |
0 | 7305 } |
7306 else | |
7307 { | |
310 | 7308 if ( var_type != VAR_MajorCondition ) |
0 | 7309 { |
310 | 7310 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7311 { |
310 | 7312 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7313 byte_5E4C15[var_type] += val; | |
0 | 7314 else |
310 | 7315 byte_5E4C15[var_type] = -1; |
0 | 7316 } |
7317 return; | |
7318 } | |
7319 memset(Dst, 0, 0xA0u); | |
7320 } | |
7321 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7322 goto _play_sound; | |
7323 } | |
7324 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
|
7325 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7326 && pAutonoteTxt[val].pText ) |
0 | 7327 { |
7328 v23 = pPlayers[uPlayerIdx + 1]; | |
7329 v34 = 1; | |
187 | 7330 v23->PlaySound(SPEECH_96, 0); |
1453 | 7331 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7332 bFlashAutonotesBook = 1; |
1453 | 7333 _506568_autonote_type = pAutonoteTxt[val].eType; |
7334 } | |
7335 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7336 v3 = 1; |
7337 if ( v34 != 1 ) | |
1507 | 7338 { |
7339 if ( v3 != 1 ) | |
7340 return; | |
7341 goto _play_sound; | |
7342 } | |
7343 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7344 if ( v3 != 1 ) | |
7345 return; | |
7346 goto _play_sound; | |
0 | 7347 } |
310 | 7348 if ( var_type > VAR_GoldInBank ) |
7349 { | |
7350 if ( var_type == 307 ) | |
0 | 7351 { |
7352 pParty->uNumDeaths += val; | |
1507 | 7353 if ( v34 != 1 ) |
7354 { | |
7355 if ( v3 != 1 ) | |
7356 return; | |
7357 goto _play_sound; | |
7358 } | |
7359 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7360 if ( v3 != 1 ) | |
7361 return; | |
7362 goto _play_sound; | |
0 | 7363 } |
310 | 7364 switch ( var_type ) |
0 | 7365 { |
7366 case 308: | |
7367 pParty->uNumBountiesCollected += val; | |
7368 break; | |
7369 case 309: | |
7370 pParty->uNumPrisonTerms += val; | |
7371 break; | |
7372 case 310: | |
7373 pParty->uNumArenaPageWins += val; | |
7374 break; | |
7375 case 311: | |
7376 pParty->uNumArenaSquireWins += val; | |
7377 break; | |
7378 case 312: | |
7379 pParty->uNumArenaKnightWins += val; | |
7380 break; | |
7381 case 313: | |
7382 pParty->uNumArenaLordWins += val; | |
7383 break; | |
7384 } | |
7385 } | |
7386 else | |
7387 { | |
310 | 7388 if ( var_type == VAR_GoldInBank ) |
0 | 7389 { |
7390 pParty->uNumGoldInBank += val; | |
7391 return; | |
7392 } | |
310 | 7393 if ( var_type <= VAR_Counter8 ) |
7394 { | |
7395 if ( (signed int)var_type >= 245 ) | |
7396 { | |
7397 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7398 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7399 } |
7400 else | |
7401 { | |
310 | 7402 switch ( var_type ) |
0 | 7403 { |
7404 case VAR_MonthEquals|VAR_CurrentSP: | |
7405 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7406 break; | |
7407 case VAR_NPCs2: | |
7408 pParty->field_709 = 0; | |
7409 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7410 pParty->CountHirelings(); |
7411 viewparams->bRedrawGameUI = true; | |
0 | 7412 break; |
7413 case VAR_NumSkillPoints: | |
7414 Dst->uSkillPoints += val; | |
7415 break; | |
7416 } | |
7417 } | |
7418 return; | |
7419 } | |
310 | 7420 if ( var_type < VAR_Counter9 ) |
0 | 7421 return; |
310 | 7422 if ( (signed int)var_type <= 274 ) |
7423 { | |
7424 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7425 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7426 goto _play_sound; |
7427 } | |
310 | 7428 if ( var_type != VAR_ReputationInCurrentLocation ) |
7429 { | |
7430 if ( var_type <= VAR_ReputationInCurrentLocation | |
7431 || var_type > VAR_History_28 | |
7432 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7433 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7434 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7435 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7436 v26) ) |
7437 return; | |
7438 bFlashHistoryBook = 1; | |
7439 _play_sound: | |
7440 v28 = 8 * uPlayerIdx + 400; | |
862 | 7441 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7442 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7443 return; | |
7444 } | |
7445 v27 = &pOutdoor->ddm; | |
7446 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7447 v27 = &pIndoor->dlv; | |
7448 v27->uReputation += val; | |
7449 if ( v27->uReputation > 10000 ) | |
7450 v27->uReputation = 10000; | |
7451 } | |
7452 } | |
7453 | |
7454 | |
7455 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7456 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7457 { |
7458 unsigned int v3; // ebx@1 | |
7459 signed int v4; // esi@1 | |
501 | 7460 bool result; // eax@8 |
0 | 7461 int v6; // esi@11 |
7462 int v7; // edi@14 | |
7463 signed int v8; // eax@17 | |
7464 char *v9; // eax@20 | |
7465 char v10; // sf@20 | |
7466 char *v11; // ecx@26 | |
7467 char *v12; // ecx@27 | |
7468 __int64 v13; // qax@27 | |
7469 unsigned __int8 v14; // cf@27 | |
501 | 7470 int *v15; // edx@29 |
0 | 7471 char *v16; // eax@90 |
7472 char *v17; // ecx@94 | |
501 | 7473 int v18; // esi@97 |
0 | 7474 signed int v19; // edx@97 |
7475 char *v20; // ecx@98 | |
7476 int v21; // eax@100 | |
7477 __int16 v22; // dx@112 | |
7478 int v23; // [sp-8h] [bp-14h]@45 | |
7479 signed int v24; // [sp-4h] [bp-10h]@4 | |
7480 int v25; // [sp-4h] [bp-10h]@45 | |
7481 | |
7482 v3 = 0; | |
605 | 7483 v4 = uActiveCharacter - 1; |
501 | 7484 result = false; |
7485 if ( (signed int)VarNum > 222 ) | |
7486 { | |
7487 if ( (signed int)VarNum <= 307 ) | |
7488 { | |
7489 if ( VarNum == 307 ) | |
7490 { | |
7491 pParty->uNumDeaths -= (unsigned int)pValue; | |
7492 return pValue; | |
7493 } | |
7494 if ( VarNum == 223 ) | |
0 | 7495 { |
7496 v11 = (char *)pParty->_autonote_bits; | |
501 | 7497 v22 = (short)pValue - 1; |
0 | 7498 } |
7499 else | |
7500 { | |
501 | 7501 if ( VarNum != 231 ) |
0 | 7502 { |
501 | 7503 switch ( VarNum ) |
0 | 7504 { |
7505 case 232: | |
501 | 7506 VarNum = (VariableType)0; |
1094 | 7507 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7508 result = (bool) pValue; |
7509 dword_5B65CC = 0; | |
7510 if ( (int)VarNum == pValue ) | |
0 | 7511 { |
501 | 7512 dword_5B65CC = (int)pValue; |
0 | 7513 } |
7514 else | |
7515 { | |
7516 pParty->field_709 = 0; | |
501 | 7517 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7518 pParty->CountHirelings(); |
7519 viewparams->bRedrawGameUI = true; | |
0 | 7520 } |
7521 break; | |
7522 case 241: | |
7523 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7524 { | |
7525 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7526 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7527 { |
605 | 7528 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7529 { |
7530 v21 = *(int *)v20; | |
7531 if ( (char)*(int *)v20 < 0 ) | |
7532 { | |
7533 LOBYTE(v21) = v21 & 0x7F; | |
7534 *(int *)v20 = v21; | |
7535 } | |
7536 } | |
7537 v20 += 76; | |
7538 } | |
7539 } | |
605 | 7540 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7541 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7542 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7543 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7544 pParty->field_709 = 0; | |
1035 | 7545 pParty->CountHirelings(); |
0 | 7546 break; |
7547 case 243: | |
7548 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7549 result = *v17 != NULL; |
501 | 7550 if ( (unsigned int)pValue <= *(int *)v17 ) |
7551 { | |
7552 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7553 result = (v17 != NULL); |
501 | 7554 } |
0 | 7555 else |
7556 *(int *)v17 = 0; | |
7557 break; | |
7558 case 275: | |
7559 v16 = (char *)&pOutdoor->ddm; | |
7560 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7561 v16 = (char *)&pIndoor->dlv; | |
501 | 7562 *((int *)v16 + 2) -= (int)pValue; |
0 | 7563 if ( *((int *)v16 + 2) < -10000 ) |
7564 *((int *)v16 + 2) = -10000; | |
7565 break; | |
7566 case 306: | |
501 | 7567 result = VarNum - 306; |
7568 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7569 { | |
7570 result = (bool)pValue; | |
7571 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7572 } |
0 | 7573 else |
7574 LABEL_88: | |
7575 dword_5B65C4 = 1; | |
7576 break; | |
7577 } | |
501 | 7578 return result; |
0 | 7579 } |
7580 v11 = this->field_1A50; | |
501 | 7581 v22 = (signed __int16)pValue; |
0 | 7582 } |
7583 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7584 return result; |
7585 } | |
7586 switch ( VarNum ) | |
0 | 7587 { |
7588 case 308: | |
501 | 7589 result = (bool)pValue; |
7590 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7591 break; |
7592 case 309: | |
501 | 7593 result = (bool)pValue; |
7594 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7595 break; |
7596 case 310: | |
501 | 7597 result = (bool)pValue; |
7598 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7599 break; |
7600 case 311: | |
501 | 7601 result = (bool)pValue; |
7602 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7603 break; |
7604 case 312: | |
501 | 7605 result = (bool)pValue; |
7606 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7607 break; |
7608 case 313: | |
501 | 7609 result = (bool)pValue; |
7610 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7611 break; |
7612 } | |
1545 | 7613 Error("Function not returning any value! (%u)", VarNum); |
0 | 7614 } |
7615 else | |
7616 { | |
501 | 7617 if ( (signed int)VarNum >= 123 ) |
7618 { | |
7619 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7620 } |
7621 else | |
7622 { | |
501 | 7623 switch ( VarNum ) |
0 | 7624 { |
7625 case VAR_RandomGold: | |
501 | 7626 v6 = rand() % (signed int)pValue + 1; |
0 | 7627 if ( v6 > pParty->uNumGold ) |
7628 v6 = pParty->uNumGold; | |
7629 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7630 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7631 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7632 GameUI_DrawFoodAndGold(); |
501 | 7633 return result; |
0 | 7634 case VAR_RandomFood: |
501 | 7635 v7 = rand() % (signed int)pValue + 1; |
0 | 7636 if ( v7 > pParty->uNumFoodRations ) |
7637 v7 = pParty->uNumFoodRations; | |
7638 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7639 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7640 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7641 GameUI_DrawFoodAndGold(); |
605 | 7642 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7643 v8 = 8 * v4 + 400; | |
862 | 7644 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7645 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7646 return result; |
0 | 7647 case VAR_CurrentHP: |
1036 | 7648 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7649 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7650 v8 = 8 * v4 + 400; | |
862 | 7651 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7652 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7653 return result; | |
0 | 7654 case VAR_CurrentSP: |
7655 v9 = (char *)&this->sMana; | |
501 | 7656 v10 = this->sMana - (signed int)pValue < 0; |
7657 *(int *)v9 -= (int)pValue; | |
0 | 7658 if ( v10 ) |
7659 *(int *)v9 = 0; | |
605 | 7660 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7661 v8 = 8 * v4 + 400; | |
862 | 7662 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7663 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7664 return result; | |
0 | 7665 case VAR_ACModifier: |
501 | 7666 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7667 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7668 v8 = 8 * v4 + 400; | |
862 | 7669 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7670 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7671 return result; | |
0 | 7672 case VAR_BaseLevel: |
501 | 7673 this->uLevel -= (unsigned __int8)pValue; |
605 | 7674 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7675 v8 = 8 * v4 + 400; | |
862 | 7676 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7677 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7678 return result; | |
0 | 7679 case VAR_LevelModifier: |
501 | 7680 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7681 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7682 v8 = 8 * v4 + 400; | |
862 | 7683 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7684 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7685 return result; | |
0 | 7686 case VAR_Age: |
501 | 7687 this->sAgeModifier -= (signed __int16)pValue; |
7688 return result; | |
0 | 7689 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7690 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7691 return result; |
0 | 7692 case VAR_Experience: |
7693 v12 = (char *)&this->uExperience; | |
501 | 7694 v13 = (signed int)pValue; |
7695 v14 = *(int *)v12 < (unsigned int)pValue; | |
7696 *(int *)v12 -= (int)pValue; | |
0 | 7697 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7698 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7699 v8 = 8 * v4 + 400; | |
862 | 7700 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7701 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7702 return result; | |
0 | 7703 case VAR_QBits_QuestsDone: |
501 | 7704 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7705 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7706 return true; |
0 | 7707 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7708 v15 = this->pInventoryMatrix; |
0 | 7709 break; |
7710 case VAR_FixedGold: | |
501 | 7711 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7712 goto LABEL_88; |
501 | 7713 Party::TakeGold((unsigned int)pValue); |
7714 return result; | |
0 | 7715 case VAR_MightBonus: |
7716 case VAR_ActualMight: | |
501 | 7717 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7718 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7719 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7720 v8 = 8 * v4 + 400; | |
862 | 7721 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7722 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7723 return result; | |
0 | 7724 case VAR_IntellectBonus: |
7725 case VAR_ActualIntellect: | |
501 | 7726 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7727 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7728 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7729 v8 = 8 * v4 + 400; | |
862 | 7730 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7731 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7732 return result; | |
0 | 7733 case VAR_PersonalityBonus: |
7734 case VAR_ActualPersonality: | |
501 | 7735 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7736 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7737 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7738 v8 = 8 * v4 + 400; | |
862 | 7739 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7740 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7741 return result; | |
0 | 7742 case VAR_EnduranceBonus: |
7743 case VAR_ActualEndurance: | |
501 | 7744 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7745 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7746 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7747 v8 = 8 * v4 + 400; | |
862 | 7748 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7749 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7750 return result; | |
0 | 7751 case VAR_SpeedBonus: |
7752 case VAR_ActualSpeed: | |
501 | 7753 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7754 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 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_AccuracyBonus: |
7761 case VAR_ActualAccuracy: | |
501 | 7762 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7763 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7764 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7765 v8 = 8 * v4 + 400; | |
862 | 7766 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7767 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7768 return result; | |
0 | 7769 case VAR_LuckBonus: |
7770 case VAR_ActualLuck: | |
501 | 7771 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7772 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7773 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7774 v8 = 8 * v4 + 400; | |
862 | 7775 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7776 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7777 return result; | |
0 | 7778 case VAR_BaseMight: |
501 | 7779 this->uMight -= (unsigned __int16)pValue; |
605 | 7780 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7781 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7782 v8 = 8 * v4 + 400; | |
862 | 7783 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7784 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7785 return result; | |
0 | 7786 case VAR_BaseIntellect: |
501 | 7787 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 7788 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7789 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7790 v8 = 8 * v4 + 400; | |
862 | 7791 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7792 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7793 return result; | |
0 | 7794 case VAR_BasePersonality: |
501 | 7795 this->uWillpower -= (unsigned __int16)pValue; |
605 | 7796 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7797 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7798 v8 = 8 * v4 + 400; | |
862 | 7799 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7800 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7801 return result; | |
0 | 7802 case VAR_BaseEndurance: |
501 | 7803 this->uEndurance -= (unsigned __int16)pValue; |
605 | 7804 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7805 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7806 v8 = 8 * v4 + 400; | |
862 | 7807 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7808 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7809 return result; | |
0 | 7810 case VAR_BaseSpeed: |
501 | 7811 this->uSpeed -= (unsigned __int16)pValue; |
605 | 7812 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7813 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7814 v8 = 8 * v4 + 400; | |
862 | 7815 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7816 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7817 return result; | |
0 | 7818 case VAR_BaseAccuracy: |
501 | 7819 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 7820 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7821 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7822 v8 = 8 * v4 + 400; | |
862 | 7823 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7824 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7825 return result; | |
0 | 7826 case VAR_BaseLuck: |
501 | 7827 this->uLuck -= (unsigned __int16)pValue; |
605 | 7828 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7829 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7830 v8 = 8 * v4 + 400; | |
862 | 7831 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7832 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7833 return result; | |
0 | 7834 case VAR_FireResistance: |
501 | 7835 this->sResFireBase -= (signed __int16)pValue; |
605 | 7836 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7837 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7838 v8 = 8 * v4 + 400; | |
862 | 7839 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7840 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7841 return result; | |
0 | 7842 case VAR_AirResistance: |
501 | 7843 this->sResAirBase -= (signed __int16)pValue; |
605 | 7844 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7845 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7846 v8 = 8 * v4 + 400; | |
862 | 7847 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7848 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7849 return result; | |
0 | 7850 case VAR_WaterResistance: |
501 | 7851 this->sResWaterBase -= (signed __int16)pValue; |
605 | 7852 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7853 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7854 v8 = 8 * v4 + 400; | |
862 | 7855 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7856 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7857 return result; | |
0 | 7858 case VAR_EarthResistance: |
501 | 7859 this->sResEarthBase -= (signed __int16)pValue; |
605 | 7860 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7861 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7862 v8 = 8 * v4 + 400; | |
862 | 7863 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7864 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7865 return result; | |
0 | 7866 case VAR_SpiritResistance: |
501 | 7867 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 7868 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7869 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7870 v8 = 8 * v4 + 400; | |
862 | 7871 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7872 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7873 return result; | |
0 | 7874 case VAR_MindResistance: |
501 | 7875 this->sResMindBase -= (signed __int16)pValue; |
605 | 7876 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7877 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7878 v8 = 8 * v4 + 400; | |
862 | 7879 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7880 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7881 return result; | |
0 | 7882 case VAR_BodyResistance: |
501 | 7883 this->sResBodyBase -= (signed __int16)pValue; |
605 | 7884 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7885 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7886 v8 = 8 * v4 + 400; | |
862 | 7887 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7888 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7889 return result; | |
0 | 7890 case VAR_LightResistance: |
501 | 7891 this->sResLightBase -= (signed __int16)pValue; |
605 | 7892 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
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_DarkResistance: |
501 | 7899 this->sResDarkBase -= (signed __int16)pValue; |
605 | 7900 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7901 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7902 v8 = 8 * v4 + 400; | |
862 | 7903 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7904 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7905 return result; | |
0 | 7906 case VAR_MagicResistance: |
501 | 7907 this->sResMagicBase -= (signed __int16)pValue; |
605 | 7908 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7909 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7910 v8 = 8 * v4 + 400; | |
862 | 7911 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7912 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7913 return result; | |
0 | 7914 case VAR_FireResistanceBonus: |
501 | 7915 this->sResFireBonus -= (signed __int16)pValue; |
605 | 7916 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7917 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7918 v8 = 8 * v4 + 400; | |
862 | 7919 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7920 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7921 return result; | |
0 | 7922 case VAR_AirResistanceBonus: |
501 | 7923 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7924 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7925 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7926 v8 = 8 * v4 + 400; | |
862 | 7927 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7928 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7929 return result; | |
0 | 7930 case VAR_WaterResistanceBonus: |
501 | 7931 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 7932 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7933 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7934 v8 = 8 * v4 + 400; | |
862 | 7935 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7936 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7937 return result; | |
0 | 7938 case VAR_EarthResistanceBonus: |
501 | 7939 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 7940 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7941 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7942 v8 = 8 * v4 + 400; | |
862 | 7943 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7944 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7945 return result; | |
0 | 7946 case VAR_SpiritResistanceBonus: |
501 | 7947 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 7948 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7949 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7950 v8 = 8 * v4 + 400; | |
862 | 7951 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7952 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7953 return result; | |
0 | 7954 case VAR_MindResistanceBonus: |
501 | 7955 this->sResMindBonus -= (signed __int16)pValue; |
605 | 7956 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7957 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7958 v8 = 8 * v4 + 400; | |
862 | 7959 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7960 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7961 return result; | |
0 | 7962 case VAR_BodyResistanceBonus: |
501 | 7963 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 7964 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7965 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7966 v8 = 8 * v4 + 400; | |
862 | 7967 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7968 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7969 return result; | |
0 | 7970 case VAR_LightResistanceBonus: |
501 | 7971 this->sResLightBonus -= (signed __int16)pValue; |
605 | 7972 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7973 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7974 v8 = 8 * v4 + 400; | |
862 | 7975 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7976 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7977 return result; | |
0 | 7978 case VAR_DarkResistanceBonus: |
501 | 7979 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7980 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7981 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7982 v8 = 8 * v4 + 400; | |
862 | 7983 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7984 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7985 return result; | |
0 | 7986 case VAR_MagicResistanceBonus: |
501 | 7987 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7988 v25 = 0; |
187 | 7989 v23 = SPEECH_91; |
7990 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7991 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7992 v8 = 8 * v4 + 400; | |
862 | 7993 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7994 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7995 return result; | |
0 | 7996 case VAR_FixedFood: |
501 | 7997 Party::TakeFood((unsigned int)pValue); |
605 | 7998 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7999 v8 = 8 * v4 + 400; | |
862 | 8000 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8001 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8002 return result; | |
0 | 8003 case VAR_StaffSkill: |
8004 case VAR_SwordSkill: | |
8005 case VAR_DaggerSkill: | |
8006 case VAR_AxeSkill: | |
8007 case VAR_SpearSkill: | |
8008 case VAR_BowSkill: | |
8009 case VAR_MaceSkill: | |
8010 case VAR_BlasterSkill: | |
8011 case VAR_ShieldSkill: | |
8012 case VAR_LeatherSkill: | |
8013 case VAR_SkillChain: | |
8014 case VAR_PlateSkill: | |
8015 case VAR_FireSkill: | |
8016 case VAR_AirSkill: | |
8017 case VAR_WaterSkill: | |
8018 case VAR_EarthSkill: | |
8019 case VAR_SpiritSkill: | |
8020 case VAR_MindSkill: | |
8021 case VAR_BodySkill: | |
8022 case VAR_LightSkill: | |
8023 case VAR_DarkSkill: | |
8024 case VAR_IdentifyItemSkill: | |
8025 case VAR_MerchantSkill: | |
8026 case VAR_RepairSkill: | |
8027 case VAR_BodybuildingSkill: | |
8028 case VAR_MeditationSkill: | |
8029 case VAR_PerceptionSkill: | |
8030 case VAR_DiplomacySkill: | |
8031 case VAR_DisarmTrapSkill: | |
8032 case VAR_LearningSkill: | |
501 | 8033 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 8034 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8035 v8 = 8 * v4 + 400; | |
862 | 8036 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8037 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8038 return result; | |
0 | 8039 case VAR_Cursed: |
8040 case VAR_Weak: | |
8041 case VAR_Asleep: | |
8042 case VAR_Afraid: | |
8043 case VAR_Drunk: | |
8044 case VAR_Insane: | |
8045 case VAR_PoisonedGreen: | |
8046 case VAR_DiseasedGreen: | |
8047 case VAR_PoisonedYellow: | |
8048 case VAR_DiseasedYellow: | |
8049 case VAR_PoisonedRed: | |
8050 case VAR_DiseasedRed: | |
8051 case VAR_Paralyzed: | |
8052 case VAR_Unconsious: | |
8053 case VAR_Dead: | |
8054 case VAR_Stoned: | |
8055 case VAR_Eradicated: | |
1071 | 8056 //*((int *)this + 2 * VarNum - 210) = 0; |
8057 //*((int *)this + 2 * result - 209) = 0; | |
8058 this->pConditions[VarNum] = 0; | |
0 | 8059 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8060 v8 = 8 * v4 + 400; | |
862 | 8061 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 8062 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 8063 return result; |
605 | 8064 default: |
8065 return result; | |
8066 } | |
8067 for (v3 = 1; v3 < 126; v3++) | |
8068 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8069 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 8070 { |
605 | 8071 RemoveItemAtInventoryIndex(v3); |
501 | 8072 return true; |
0 | 8073 } |
605 | 8074 } |
501 | 8075 if ( pParty->pPickedItem.uItemID == pValue ) |
8076 { | |
605 | 8077 pMouse->RemoveHoldingItem(); |
8078 return true; | |
8079 } | |
8080 return false; | |
0 | 8081 } |
8082 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8083 |
1430 | 8084 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8085 return false; |
0 | 8086 } |
8087 // 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
|
8088 // 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
|
8089 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8090 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8091 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8092 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
|
8093 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8094 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8095 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8096 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8097 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8098 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8099 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8100 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8101 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
|
8102 //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
|
8103 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
|
8104 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
|
8105 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8106 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8107 _this.Reset(); |
1374 | 8108 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8109 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8110 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8111 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8112 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8113 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8114 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8115 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8116 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
|
8117 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8118 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8119 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8120 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8121 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8122 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8123 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8124 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8125 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8126 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8127 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8128 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8129 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8130 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
|
8131 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8132 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8133 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8134 } |
1295 | 8135 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8136 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8137 |
1295 | 8138 //----- (0049387A) -------------------------------------------------------- |
1459 | 8139 int CycleCharacter(bool backwards) |
1295 | 8140 { |
8141 signed int result; // eax@1 | |
8142 signed int v2; // ecx@2 | |
8143 signed int v3; // ecx@8 | |
8144 | |
8145 result = uActiveCharacter; | |
1459 | 8146 if ( backwards ) |
1295 | 8147 { |
8148 v2 = 0; | |
8149 while ( 1 ) | |
8150 { | |
8151 --result; | |
8152 if ( result < 1 ) | |
8153 result = 4; | |
8154 if ( !pPlayers[result]->uTimeToRecovery ) | |
8155 break; | |
8156 ++v2; | |
8157 if ( v2 >= 4 ) | |
8158 return uActiveCharacter; | |
8159 } | |
8160 } | |
8161 else | |
8162 { | |
8163 v3 = 0; | |
8164 while ( 1 ) | |
8165 { | |
8166 ++result; | |
8167 if ( result > 4 ) | |
8168 result = 1; | |
8169 if ( !pPlayers[result]->uTimeToRecovery ) | |
8170 break; | |
8171 ++v3; | |
8172 if ( v3 >= 4 ) | |
8173 return uActiveCharacter; | |
8174 } | |
8175 } | |
8176 return result; | |
1297 | 8177 } |
8178 //----- (0043EE77) -------------------------------------------------------- | |
8179 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8180 { | |
8181 bool result; // eax@0 | |
8182 Player *v2; // edx@3 | |
8183 int v3; // ecx@3 | |
8184 Player **pPlayers; // esi@8 | |
1424 | 8185 //bool item_flag; |
1297 | 8186 Player *v6; // edx@9 |
8187 | |
1424 | 8188 //if ( a1 < 1 || a1 > 4 ) |
8189 //{ | |
8190 //if ( !a1 ) | |
8191 //{ | |
8192 //pPlayers = &::pPlayers[1]; | |
8193 //v5 = 604; | |
8194 //while ( 1 ) | |
1545 | 8195 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8196 for ( uint i = 1; i < 5; ++i ) |
1424 | 8197 { |
8198 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8199 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8200 return false; | |
8201 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8202 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8203 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8204 return false; | |
8205 //result *= 9; | |
1432 | 8206 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8207 return false; |
8208 //++pPlayers; | |
8209 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8210 //return true; | |
8211 } | |
8212 return true; | |
8213 } | |
1432 | 8214 |
1297 | 8215 //----- (0043EE15) -------------------------------------------------------- |
8216 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8217 { | |
8218 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8219 { | |
8220 for ( uint i = 0; i < 126; ++i ) | |
8221 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8222 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8223 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8224 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8225 return true; |
8226 } | |
8227 } | |
8228 for ( uint i = 0; i < 16; ++i ) | |
8229 { | |
8230 if ( pPlayer->pEquipment.pIndices[i] ) | |
8231 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8232 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8233 return true; |
8234 } | |
8235 } | |
8236 } | |
8237 return false; | |
8238 } | |
8239 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8240 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8241 { |
8242 unsigned int pNum; // ebp@1 | |
8243 Player **pPlayer; // ebx@1 | |
8244 Player *pPlayer2; // esi@2 | |
8245 enum CHARACTER_RACE pRace; // edi@2 | |
8246 bool pSex; // eax@2 | |
8247 char v6; // zf@7 | |
8248 | |
8249 //pPlayer = &pPlayers[1]; | |
8250 /*pNum = a1; | |
8251 | |
8252 while ( 1 ) | |
8253 { | |
8254 pPlayer2 = *pPlayer; | |
8255 pRace = pPlayer2->GetRace(); | |
8256 pSex = pPlayer2->GetSexByVoice(); | |
8257 if ( !pRace ) | |
8258 break; | |
8259 if ( pRace == 1 || pRace == 2 ) | |
8260 break; | |
8261 if ( !pSex && pNum == 2 )// | |
8262 //goto LABEL_15; | |
8263 { | |
8264 pSex = 1; | |
8265 return pSex; | |
8266 } | |
8267 v6 = pNum == 3;// | |
8268 LABEL_11: | |
8269 if ( v6 ) | |
8270 //goto LABEL_15; | |
8271 { | |
8272 pSex = 1; | |
8273 return pSex; | |
8274 } | |
8275 ++pPlayer; | |
8276 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8277 { | |
8278 pSex = 0; | |
8279 return pSex; | |
8280 } | |
8281 } | |
8282 if ( pSex || pNum ) | |
8283 { | |
8284 v6 = pNum == 1; | |
8285 goto LABEL_11; | |
8286 } | |
8287 //LABEL_15: | |
8288 pSex = 1; | |
8289 return pSex;*/ | |
8290 for (uint i = 1; i <= 4; ++i) | |
8291 { | |
8292 pRace = pPlayers[i]->GetRace(); | |
8293 pSex = pPlayers[i]->GetSexByVoice(); | |
8294 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8295 return 1; | |
8296 } | |
8297 return 0; | |
8298 } | |
8299 //----- (0043ED6F) -------------------------------------------------------- | |
8300 bool _43ED6F_check_party_races(bool a1) | |
8301 { | |
8302 bool v6; // zf@5 | |
8303 | |
8304 for (uint i = 0; i < 4; ++i) | |
8305 { | |
8306 auto player = pParty->pPlayers + i; | |
8307 auto race = player->GetRace(); | |
8308 | |
8309 if (race != CHARACTER_RACE_HUMAN && | |
8310 race != CHARACTER_RACE_ELF && | |
8311 race != CHARACTER_RACE_GOBLIN) | |
8312 v6 = a1 == 1; | |
8313 else | |
8314 v6 = !a1; | |
8315 | |
8316 if (v6) | |
8317 return true; | |
8318 } | |
8319 return false; | |
8320 } | |
8321 //----- (00439FCB) -------------------------------------------------------- | |
8322 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8323 { | |
8324 signed int v4; // esi@1 | |
8325 unsigned int v5; // ecx@1 | |
8326 Player *v6; // ebx@3 | |
8327 Actor *v7; // esi@3 | |
8328 unsigned int v8; // eax@4 | |
8329 char *v9; // eax@5 | |
8330 signed int v10; // eax@6 | |
8331 int v11; // edx@8 | |
8332 int v12; // edx@9 | |
8333 int v13; // edx@10 | |
8334 int v14; // edx@16 | |
8335 int v15; // edx@17 | |
8336 int v16; // edx@18 | |
8337 enum SoundID v17; // eax@24 | |
8338 int v18; // eax@26 | |
8339 unsigned __int8 v19; // zf@26 | |
8340 unsigned __int8 v20; // sf@26 | |
8341 unsigned __int16 v21; // ax@29 | |
8342 signed int v22; // edi@36 | |
8343 int v23; // eax@38 | |
8344 signed int v24; // eax@44 | |
8345 unsigned __int16 v25; // cx@47 | |
8346 signed int v26; // eax@49 | |
8347 int v27; // eax@54 | |
8348 float v28; // ST18_4@58 | |
8349 double v29; // st7@58 | |
8350 float v30; // ST08_4@58 | |
8351 double v31; // st7@58 | |
8352 float v32; // ST04_4@58 | |
8353 float v33; // ST00_4@58 | |
8354 int v34; // edi@61 | |
8355 int v35; // eax@70 | |
8356 double v36; // st7@70 | |
8357 SpriteObject *v37; // ebx@77 | |
8358 int v38; // edi@77 | |
8359 int v39; // esi@77 | |
8360 int v40; // eax@77 | |
8361 int v41; // eax@77 | |
8362 int v42; // eax@78 | |
8363 Player *v43; // eax@81 | |
8364 Actor *v44; // esi@82 | |
8365 Player *v45; // edi@84 | |
8366 unsigned __int16 v46; // ax@84 | |
8367 int v47; // ebx@105 | |
8368 int v48; // eax@107 | |
8369 unsigned __int16 v49; // ax@116 | |
8370 int v50; // ebx@123 | |
8371 unsigned __int16 v51; // ax@124 | |
8372 char v52; // bl@124 | |
8373 int v53; // eax@128 | |
8374 signed int v54; // eax@134 | |
8375 unsigned __int16 v55; // cx@137 | |
8376 signed int v56; // eax@139 | |
8377 int v57; // eax@144 | |
8378 float v58; // ST18_4@148 | |
8379 double v59; // st7@148 | |
8380 float v60; // ST08_4@148 | |
8381 double v61; // st7@148 | |
8382 float v62; // ST04_4@148 | |
8383 float v63; // ST00_4@148 | |
8384 int v64; // ebx@151 | |
8385 int v65; // eax@161 | |
8386 double v66; // st7@161 | |
8387 signed int v67; // ecx@164 | |
8388 signed int v68; // eax@170 | |
8389 int v69; // ecx@170 | |
8390 int v70; // eax@171 | |
8391 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8392 int v72; // [sp+30h] [bp-24h]@164 | |
8393 double v73; // [sp+40h] [bp-14h]@72 | |
8394 signed int v74; // [sp+44h] [bp-10h]@1 | |
8395 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8396 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8397 int v77; // [sp+50h] [bp-4h]@26 | |
8398 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8399 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8400 | |
8401 v4 = PID_ID(uObjID); | |
8402 v5 = PID_TYPE(uObjID) - 2; | |
8403 v74 = a2; | |
8404 uActorID = v4; | |
8405 if ( v5 ) | |
8406 { | |
8407 if ( v5 != 1 | |
8408 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8409 v75 = v6->sHealth, | |
8410 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8411 return; | |
8412 v8 = v6->pEquipment.uArmor; | |
8413 if ( !v8 | |
8414 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8415 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8416 || v10 > 11 ) | |
8417 { | |
8418 v14 = rand() % 4; | |
8419 if ( !v14 ) | |
8420 { | |
8421 v71 = (SoundID)108; | |
8422 goto LABEL_24; | |
8423 } | |
8424 v15 = v14 - 1; | |
8425 if ( !v15 ) | |
8426 { | |
8427 v71 = (SoundID)109; | |
8428 goto LABEL_24; | |
8429 } | |
8430 v16 = v15 - 1; | |
8431 if ( !v16 ) | |
8432 { | |
8433 v71 = (SoundID)110; | |
8434 goto LABEL_24; | |
8435 } | |
8436 if ( v16 == 1 ) | |
8437 { | |
8438 v71 = (SoundID)44; | |
8439 goto LABEL_24; | |
8440 } | |
8441 } | |
8442 else | |
8443 { | |
8444 v11 = rand() % 4; | |
8445 if ( !v11 ) | |
8446 { | |
8447 v71 = (SoundID)105; | |
8448 goto LABEL_24; | |
8449 } | |
8450 v12 = v11 - 1; | |
8451 if ( !v12 ) | |
8452 { | |
8453 v71 = (SoundID)106; | |
8454 goto LABEL_24; | |
8455 } | |
8456 v13 = v12 - 1; | |
8457 if ( !v13 ) | |
8458 { | |
8459 v71 = (SoundID)107; | |
8460 goto LABEL_24; | |
8461 } | |
8462 if ( v13 == 1 ) | |
8463 { | |
8464 v71 = (SoundID)45; | |
8465 LABEL_24: | |
8466 v17 = v71; | |
8467 goto LABEL_26; | |
8468 } | |
8469 } | |
8470 v17 = (SoundID)a4; | |
8471 LABEL_26: | |
8472 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8473 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8474 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8475 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8476 v77 = v18; | |
8477 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8478 { | |
8479 v21 = v7->pActorBuffs[3].uPower; | |
8480 if ( v21 ) | |
8481 v77 /= (signed int)v21; | |
8482 } | |
8483 if ( v74 ) | |
8484 { | |
8485 if ( v74 == 1 ) | |
8486 { | |
8487 v22 = v7->pMonsterInfo.uAttack2Type; | |
8488 } | |
8489 else | |
8490 { | |
8491 if ( v74 == 2 ) | |
8492 { | |
8493 v23 = v7->pMonsterInfo.uSpell1ID; | |
8494 } | |
8495 else | |
8496 { | |
8497 if ( v74 != 3 ) | |
8498 { | |
8499 if ( v74 == 4 ) | |
8500 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8501 else | |
8502 v22 = 4; | |
8503 goto LABEL_43; | |
8504 } | |
8505 v23 = v7->pMonsterInfo.uSpell2ID; | |
8506 } | |
8507 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8508 } | |
8509 } | |
8510 else | |
8511 { | |
8512 v22 = v7->pMonsterInfo.uAttack1Type; | |
8513 } | |
8514 LABEL_43: | |
8515 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8516 { | |
8517 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8518 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8519 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8520 { | |
8521 v25 = v7->uAIState; | |
8522 if ( v25 != 5 ) | |
8523 { | |
8524 if ( v25 != 4 ) | |
8525 { | |
8526 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8527 v7->sCurrentHP -= v26; | |
8528 if ( v26 ) | |
8529 { | |
8530 if ( v7->sCurrentHP >= 1 ) | |
8531 { | |
8532 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8533 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8534 } | |
8535 else | |
8536 { | |
8537 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8538 { | |
8539 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8540 v74 = v27; | |
8541 if ( pRenderer->pRenderD3D ) | |
8542 { | |
8543 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8544 { | |
8545 v28 = (double)v74; | |
8546 v74 = v7->vPosition.z; | |
8547 v29 = (double)v74; | |
8548 v74 = v7->vPosition.y; | |
8549 v30 = v29; | |
8550 v31 = (double)v74; | |
8551 v74 = v7->vPosition.x; | |
8552 v32 = v31; | |
8553 v33 = (double)v74; | |
8554 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8555 } | |
8556 } | |
8557 } | |
8558 Actor::Die(uActorID); | |
8559 Actor::ApplyFineForKillingPeasant(uActorID); | |
8560 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8561 if ( v7->pMonsterInfo.uExp ) | |
8562 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8563 v34 = SPEECH_51; | |
8564 if ( rand() % 100 < 20 ) | |
8565 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8566 v6->PlaySound((PlayerSpeech)v34, 0); | |
8567 } | |
8568 } | |
8569 } | |
8570 } | |
8571 } | |
8572 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8573 && v7->pMonsterInfo.uSpecialAttack | |
8574 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8575 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8576 } | |
8577 if ( !pParty->bTurnBasedModeOn ) | |
8578 { | |
8579 v35 = v6->GetActualEndurance(); | |
8580 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8581 v6->SetRecoveryTime((signed __int64)v36); | |
8582 } | |
8583 if ( v77 ) | |
8584 { | |
8585 v73 = (double)(signed int)v75; | |
8586 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8587 { | |
8588 if ( v6->sHealth > 0 ) | |
8589 { | |
8590 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8591 v6->PlaySound(SPEECH_48, 0); | |
8592 } | |
8593 } | |
8594 } | |
8595 viewparams->bRedrawGameUI = 1; | |
8596 return; | |
8597 } | |
8598 v37 = &pSpriteObjects[uActorID]; | |
8599 v38 = PID_TYPE(v37->spell_caster_pid); | |
8600 v39 = PID_ID(v37->spell_caster_pid); | |
8601 v40 = PID_TYPE(v37->spell_caster_pid); | |
8602 uActorID = PID_ID(v37->spell_caster_pid); | |
8603 v41 = v40 - 2; | |
8604 if ( !v41 ) | |
8605 goto LABEL_80; | |
8606 v42 = v41 - 1; | |
8607 if ( !v42 ) | |
8608 { | |
8609 v44 = &pActors[v39]; | |
8610 if ( a4 == -1 ) | |
8611 a4 = stru_50C198.which_player_would_attack(v44); | |
8612 v45 = &pParty->pPlayers[a4]; | |
8613 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8614 v46 = v37->uType; | |
8615 if ( v37->uType == 545 ) | |
8616 { | |
8617 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8618 v52 = v51; | |
8619 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8620 { | |
8621 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8622 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8623 v45->PlaySound(SPEECH_6, 0); | |
8624 return; | |
8625 } | |
8626 } | |
8627 else | |
8628 { | |
8629 if ( v46 != 555 | |
8630 && v46 != 510 | |
8631 && v46 != 500 | |
8632 && v46 != 515 | |
8633 && v46 != 505 | |
8634 && v46 != 530 | |
8635 && v46 != 525 | |
8636 && v46 != 520 | |
8637 && v46 != 535 | |
8638 && v46 != 540 ) | |
8639 goto LABEL_115; | |
8640 } | |
8641 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8642 return; | |
8643 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8644 v77 >>= 1; | |
8645 if ( v45->HasEnchantedItemEquipped(36) ) | |
8646 v77 >>= 1; | |
8647 if ( v45->HasEnchantedItemEquipped(69) ) | |
8648 v77 >>= 1; | |
8649 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8650 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8651 v77 >>= 1; |
8652 v75 = 0; | |
8653 v47 = (int)&v45->pEquipment; | |
8654 do | |
8655 { | |
8656 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8657 { | |
8658 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8659 if ( v48 == 520 ) | |
8660 v77 >>= 1; | |
8661 if ( v48 == 531 ) | |
8662 v77 >>= 1; | |
8663 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8664 v77 >>= 1; | |
8665 } | |
8666 ++v75; | |
8667 v47 += 4; | |
8668 } | |
8669 while ( (signed int)v75 <= 1 ); | |
8670 LABEL_115: | |
8671 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8672 { | |
8673 v49 = v44->pActorBuffs[3].uPower; | |
8674 if ( v49 ) | |
8675 v77 /= (signed int)v49; | |
8676 } | |
8677 if ( !v74 ) | |
8678 { | |
8679 v50 = v44->pMonsterInfo.uAttack1Type; | |
8680 goto LABEL_133; | |
8681 } | |
8682 if ( v74 == 1 ) | |
8683 { | |
8684 v50 = v44->pMonsterInfo.uAttack2Type; | |
8685 goto LABEL_133; | |
8686 } | |
8687 if ( v74 == 2 ) | |
8688 { | |
8689 v53 = v44->pMonsterInfo.uSpell1ID; | |
8690 } | |
8691 else | |
8692 { | |
8693 if ( v74 != 3 ) | |
8694 { | |
8695 if ( v74 == 4 ) | |
8696 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8697 else | |
8698 v50 = 4; | |
8699 LABEL_133: | |
8700 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8701 { | |
8702 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8703 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8704 { | |
8705 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8706 { | |
8707 v55 = v44->uAIState; | |
8708 if ( v55 != 5 ) | |
8709 { | |
8710 if ( v55 != 4 ) | |
8711 { | |
8712 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8713 v44->sCurrentHP -= v56; | |
8714 if ( v56 ) | |
8715 { | |
8716 if ( v44->sCurrentHP >= 1 ) | |
8717 { | |
8718 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8719 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8720 } | |
8721 else | |
8722 { | |
8723 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8724 { | |
8725 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8726 v75 = v57; | |
8727 if ( pRenderer->pRenderD3D ) | |
8728 { | |
8729 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8730 { | |
8731 v58 = (double)(signed int)v75; | |
8732 v75 = v44->vPosition.z; | |
8733 v59 = (double)(signed int)v75; | |
8734 v75 = v44->vPosition.y; | |
8735 v60 = v59; | |
8736 v61 = (double)(signed int)v75; | |
8737 v75 = v44->vPosition.x; | |
8738 v62 = v61; | |
8739 v63 = (double)(signed int)v75; | |
8740 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8741 } | |
8742 } | |
8743 } | |
8744 Actor::Die(uActorID); | |
8745 Actor::ApplyFineForKillingPeasant(uActorID); | |
8746 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8747 if ( v44->pMonsterInfo.uExp ) | |
8748 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8749 v64 = SPEECH_51; | |
8750 if ( rand() % 100 < 20 ) | |
8751 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8752 v45->PlaySound((PlayerSpeech)v64, 0); | |
8753 } | |
8754 } | |
8755 } | |
8756 } | |
8757 } | |
8758 } | |
8759 } | |
8760 if ( !v74 | |
8761 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8762 && v44->pMonsterInfo.uSpecialAttack | |
8763 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8764 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8765 if ( !pParty->bTurnBasedModeOn ) | |
8766 { | |
8767 v65 = v45->GetActualEndurance(); | |
8768 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8769 * flt_6BE3A4_debug_recmod1 | |
8770 * 2.133333333333333; | |
8771 v45->SetRecoveryTime((signed __int64)v66); | |
8772 } | |
8773 return; | |
8774 } | |
8775 v53 = v44->pMonsterInfo.uSpell2ID; | |
8776 } | |
8777 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8778 goto LABEL_133; | |
8779 } | |
8780 if ( v42 != 1 ) | |
8781 return; | |
8782 LABEL_80: | |
8783 if ( a4 != -1 ) | |
8784 { | |
8785 v43 = &pParty->pPlayers[a4]; | |
8786 LABEL_168: | |
8787 a4b = v43; | |
8788 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8789 { | |
8790 v70 = v43->GetMaxHealth(); | |
8791 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8792 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8793 } | |
8794 else | |
8795 { | |
8796 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8797 v69 = 0; | |
8798 } | |
8799 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8800 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8801 { | |
8802 qword_A750D8 = 256i64; | |
1406 | 8803 PlayerSpeechID = SPEECH_44; |
1407 | 8804 uSpeakingCharacter = uActorID + 1; |
1297 | 8805 } |
8806 return; | |
8807 } | |
8808 v74 = 0; | |
8809 a4a = 1; | |
8810 do | |
8811 { | |
8812 if ( pPlayers[a4a]->CanAct() ) | |
8813 { | |
8814 v67 = v74++; | |
8815 *(&v72 + v67) = a4a; | |
8816 } | |
8817 ++a4a; | |
8818 } | |
8819 while ( a4a <= 4 ); | |
8820 if ( v74 ) | |
8821 { | |
8822 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8823 goto LABEL_168; | |
8824 } | |
8825 } | |
8826 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8827 void OnInventoryLeftClick() |
1297 | 8828 { |
8829 Player *v0; // ebx@1 | |
8830 signed int v1; // eax@2 | |
8831 signed int v2; // ecx@2 | |
8832 int v3; // eax@2 | |
8833 char v4; // sf@2 | |
8834 int v5; // eax@2 | |
8835 unsigned int v6; // eax@7 | |
8836 unsigned int v7; // esi@12 | |
8837 unsigned int v8; // eax@12 | |
8838 unsigned int v9; // eax@16 | |
8839 unsigned int v10; // eax@18 | |
8840 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8841 POINT a2; // [sp+30h] [bp-18h]@4 | |
8842 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8843 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8844 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8845 int a4; // [sp+44h] [bp-4h]@2 | |
8846 | |
8847 v0 = pPlayers[uActiveCharacter]; | |
8848 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8849 { | |
8850 pMouse->GetClickPos(&pX, &pY); | |
8851 pY = pY - 17; | |
8852 v2 =pX - 14; | |
8853 pX = v2; | |
8854 v3 = 14 * (pY >> 5); | |
8855 v2 >>= 5; | |
8856 v4 = v2 + v3 < 0; | |
8857 v5 = v2 + v3; | |
8858 a4 = v5; | |
8859 if ( !v4 ) | |
8860 { | |
8861 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8862 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8863 { | |
8864 if ( unk_50C9A0 ) | |
8865 { | |
8866 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8867 if ( v6 ) | |
8868 { | |
8869 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8870 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8871 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8872 *((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
|
8873 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8874 unk_50C9A0 = 0; |
8875 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8876 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8877 pMouse->SetCursorBitmap("MICON1"); | |
8878 dword_50C9D0 = 113; | |
8879 dword_50C9D4 = 0; | |
8880 dword_50C9D8 = 256; | |
8881 } | |
8882 return; | |
8883 } | |
8884 if ( ptr_50C9A4 ) | |
8885 return; | |
8886 v7 = pParty->pPickedItem.uItemID; | |
8887 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8888 if ( !v7 ) | |
8889 { | |
8890 if ( !v8 ) | |
8891 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8892 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8893 v0->RemoveItemAtInventoryIndex(a4); |
8894 v9 = pParty->pPickedItem.uItemID; | |
8895 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8896 return; | |
8897 } | |
8898 v13 = v8; | |
8899 if ( v8 ) | |
8900 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8901 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8902 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8903 v0->RemoveItemAtInventoryIndex(a4); | |
8904 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8905 if ( !pX ) | |
8906 { | |
8907 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8908 if ( !pX ) | |
8909 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8910 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8911 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8912 return; | |
8913 } | |
8914 } | |
8915 v9 = this_.uItemID; | |
8916 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8917 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8918 return; | |
8919 } | |
8920 v10 = v0->AddItem(a4, v7); | |
8921 pX = v10; | |
8922 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8923 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8924 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8925 pMouse->RemoveHoldingItem(); |
8926 } | |
8927 } | |
8928 } | |
8929 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8930 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8931 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8932 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8933 bool Player::IsWeak() |
1361
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 return pConditions[Condition_Weak] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8938 bool Player::IsDead() |
1361
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 return pConditions[Condition_Dead] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8943 bool Player::IsEradicated() |
1361
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 return pConditions[Condition_Eradicated] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8948 bool Player::IsZombie() |
1361
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 return pConditions[Condition_Zombie] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8953 bool Player::IsCursed() |
1361
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 return pConditions[Condition_Cursed] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8958 bool Player::IsPertified() |
1361
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 return pConditions[Condition_Pertified] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8963 bool Player::IsUnconcious() |
1361
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 return pConditions[Condition_Unconcious] != 0; |
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 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8968 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8969 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8970 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8971 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8972 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8973 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8974 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8975 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8976 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8977 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8978 void Player::SetCursed( bool state ) |
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 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8981 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8982 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8983 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8984 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8985 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8986 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8987 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8988 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8989 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8990 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8991 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8992 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8993 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8994 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8995 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8996 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8997 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8998 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8999 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9000 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9001 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9002 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9003 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9004 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9005 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9006 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9007 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9008 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9009 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9010 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9011 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9012 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9013 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9014 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9015 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9016 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9017 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9018 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9019 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9020 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9021 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9022 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9023 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9024 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9025 pConditions[Condition_Disease2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9026 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9027 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9028 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9029 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9030 pConditions[Condition_Poison3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9031 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9032 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9033 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9034 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9035 pConditions[Condition_Disease3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9036 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9037 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9038 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9039 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9040 pConditions[Condition_Paralyzed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9041 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9042 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9043 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9044 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9045 pConditions[Condition_Unconcious] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9046 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9047 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9048 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9049 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9050 pConditions[Condition_Dead] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9051 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9052 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9053 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9054 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9055 pConditions[Condition_Pertified] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9056 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9057 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9058 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9059 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9060 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9061 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9062 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9063 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9064 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9065 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9066 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9067 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9068 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9069 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9070 SetCondition(Condition_Weak, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9071 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9072 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9073 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9074 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9075 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9076 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9077 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9078 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9079 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9080 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9081 } |