Mercurial > mm7
annotate Player.cpp @ 1610:fa0e700bcc80
m
author | Ritor1 |
---|---|
date | Sat, 14 Sep 2013 10:28:13 +0600 |
parents | addae48bc203 |
children | 5658d0f3b5ee |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1116
diff
changeset
|
4 |
1016 | 5 #include "stru6.h" |
6 | |
0 | 7 #include "Player.h" |
8 #include "PlayerFrameTable.h" | |
9 #include "AudioPlayer.h" | |
10 #include "Party.h" | |
816 | 11 #include "Log.h" |
0 | 12 #include "LOD.h" |
13 #include "GUIWindow.h" | |
14 #include "Viewport.h" | |
15 #include "Actor.h" | |
16 #include "Game.h" | |
17 #include "Mouse.h" | |
18 #include "TurnEngine.h" | |
19 #include "Events.h" | |
20 #include "Events2D.h" | |
21 #include "Outdoor.h" | |
22 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
23 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
24 #include "Awards.h" |
189 | 25 #include "texts.h" |
816 | 26 |
0 | 27 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
28 #include "MM7.h" |
1297 | 29 #include "SpriteObject.h" |
30 #include "DecalBuilder.h" | |
0 | 31 |
32 | |
33 | |
34 | |
35 | |
36 /* 381 */ | |
37 #pragma pack(push, 1) | |
290 | 38 struct PlayerCreation_AttributeProps |
0 | 39 { |
40 unsigned __int8 uBaseValue; | |
41 char uMaxValue; | |
42 char uDroppedStep; | |
43 char uBaseStep; | |
44 }; | |
45 #pragma pack(pop) | |
46 | |
47 | |
48 #pragma pack(push, 1) | |
290 | 49 |
50 | |
51 | |
0 | 52 #pragma pack(pop) |
290 | 53 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
54 { | |
55 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, | |
56 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, | |
57 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, | |
58 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} | |
0 | 59 }; |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 // available skills per class ( 9 classes X 37 skills ) | |
67 // 0 - not available | |
68 // 1 - available | |
69 // 2 - primary skill | |
70 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
71 { | |
72 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
73 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0}, | |
74 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0}, | |
75 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, | |
76 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1}, | |
77 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}, | |
78 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
79 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, | |
80 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here | |
81 }; | |
82 | |
83 | |
1374 | 84 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398 |
85 { | |
86 1, // EQUIP_OFF_HAND | |
87 1, // EQUIP_MAIN_HAND | |
88 2, // EQUIP_BOW | |
89 3, // EQUIP_ARMOUR | |
90 0, // EQUIP_SHIELD | |
91 4, // EQUIP_HELMET | |
92 5, // EQUIP_BELT | |
93 6, // EQUIP_CLOAK | |
94 7, // EQUIP_GAUNTLETS | |
95 8, // EQUIP_BOOTS | |
96 10, // EQUIP_RING | |
97 9, // EQUIP_AMULET | |
98 1, // EQUIP_WAND | |
99 0, // EQUIP_REAGENT | |
100 0, // EQUIP_POTION | |
101 0, // EQUIP_SPELL_SCROLL | |
102 0, // EQUIP_BOOK | |
103 0, // EQUIP_MESSAGE_SCROLL | |
104 0, // EQUIP_GOLD | |
105 0, // EQUIP_GEM | |
106 0 // EQUIP_NONE | |
107 }; | |
0 | 108 |
109 | |
110 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
111 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
112 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; | |
113 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; | |
114 | |
1325 | 115 unsigned char pConditionAttributeModifier[7][19] = |
116 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might | |
117 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence | |
118 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower | |
119 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance | |
120 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy | |
121 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed | |
122 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck | |
123 | |
124 unsigned char pAgingAttributeModifier[7][4] = | |
125 {{100, 75, 40, 10}, //Might | |
126 {100, 150, 100, 10}, //Intelligence | |
127 {100, 150, 100, 10}, //Willpower | |
128 {100, 75, 40, 10}, //Endurance | |
129 {100, 100, 40, 10}, //Accuracy | |
130 {100, 100, 40, 10}, //Speed | |
131 {100, 100, 100, 100}}; //Luck | |
0 | 132 |
1036 | 133 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 134 |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
135 std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}}; |
0 | 136 |
1036 | 137 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 138 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 139 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
140 signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6}; | |
0 | 141 |
142 | |
816 | 143 unsigned short base_recovery_times_per_weapon_type[12] = |
144 { | |
145 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
146 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
147 60, // PLAYER_SKILL_DAGGER | |
148 100, // PLAYER_SKILL_AXE | |
149 80, // PLAYER_SKILL_SPEAR | |
150 100, // PLAYER_SKILL_BOW | |
151 80, // PLAYER_SKILL_MACE | |
152 30, // PLAYER_SKILL_BLASTER | |
153 10, // PLAYER_SKILL_SHIELD | |
154 10, // PLAYER_SKILL_LEATHER | |
155 20, // PLAYER_SKILL_CHAIN | |
156 30 // PLAYER_SKILL_PLATE | |
157 }; | |
158 | |
159 | |
0 | 160 |
161 //----- (00490913) -------------------------------------------------------- | |
1459 | 162 int PlayerCreation_GetUnspentAttributePointCount() |
0 | 163 { |
164 signed int v0; // edi@1 | |
1273 | 165 int raceId; // ebx@2 |
0 | 166 signed int v4; // eax@17 |
167 int v5; // edx@18 | |
168 signed int v6; // ecx@18 | |
1273 | 169 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 |
170 | |
171 remainingStatPoints = 50; | |
0 | 172 v0 = 50; |
1273 | 173 for (int playerNum = 0; playerNum < 4; playerNum++) |
174 { | |
175 raceId = pParty->pPlayers[playerNum].GetRace(); | |
176 for (int statNum = 0; statNum <= 6; statNum++) | |
177 { | |
178 switch ( statNum ) | |
0 | 179 { |
1273 | 180 case 0: |
181 v0 = pParty->pPlayers[playerNum].uMight; | |
182 break; | |
183 case 1: | |
184 v0 = pParty->pPlayers[playerNum].uIntelligence; | |
185 break; | |
186 case 2: | |
187 v0 = pParty->pPlayers[playerNum].uWillpower; | |
188 break; | |
189 case 3: | |
190 v0 = pParty->pPlayers[playerNum].uEndurance; | |
191 break; | |
192 case 4: | |
193 v0 = pParty->pPlayers[playerNum].uAccuracy; | |
194 break; | |
195 case 5: | |
196 v0 = pParty->pPlayers[playerNum].uSpeed; | |
197 break; | |
198 case 6: | |
199 v0 = pParty->pPlayers[playerNum].uLuck; | |
200 break; | |
201 } | |
202 v4 = StatTable[raceId][statNum].uBaseValue; | |
203 if ( v0 >= v4 ) | |
204 { | |
205 v5 = StatTable[raceId][statNum].uDroppedStep; | |
206 v6 = StatTable[raceId][statNum].uBaseStep; | |
0 | 207 } |
208 else | |
209 { | |
1273 | 210 v5 = StatTable[raceId][statNum].uBaseStep; |
211 v6 = StatTable[raceId][statNum].uDroppedStep; | |
0 | 212 } |
1273 | 213 remainingStatPoints += v5 * (v4 - v0) / v6; |
214 } | |
215 } | |
216 return remainingStatPoints; | |
0 | 217 } |
218 | |
219 | |
220 | |
221 //----- (00427730) -------------------------------------------------------- | |
222 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
223 { | |
1275 | 224 if (sMana >= (signed int)uRequiredMana) |
225 { | |
226 sMana -= (signed int)uRequiredMana; | |
488 | 227 return true; |
228 } | |
229 | |
230 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
231 return false; | |
0 | 232 } |
233 | |
234 | |
235 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 236 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
237 { | |
0 | 238 float v6; // ST04_4@1 |
1014 | 239 signed int item_value; // eax@1 |
240 signed int sell_price; // ebx@1 | |
241 | |
242 item_value =pOwnItems[item_index].GetValue(); | |
243 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
244 sell_price = GetPriceSell(item_value, v6); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
245 if ( pOwnItems[item_index].IsBroken() ) |
1014 | 246 sell_price = 1; |
247 if ( sell_price < 1 ) | |
248 sell_price = 1; | |
249 RemoveItemAtInventoryIndex(inventory_idnx); | |
250 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 251 } |
252 | |
253 | |
254 | |
255 //----- (0043EEF3) -------------------------------------------------------- | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
256 bool Player::NothingOrJustBlastersEquipped() |
0 | 257 { |
1014 | 258 signed int item_idx; // esi@1 |
259 signed int item_id; // esi@1 | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
260 for (int i = 0; i < 16; ++i) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
261 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
262 item_idx = pEquipment.pIndices[i]; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
263 if (item_idx) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
264 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
265 item_id = pOwnItems[item_idx - 1].uItemID; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
266 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
267 return false; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
268 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
269 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
270 return true; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
271 } |
1014 | 272 |
0 | 273 |
274 | |
275 | |
276 //----- (004B8040) -------------------------------------------------------- | |
1036 | 277 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
278 { | |
279 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 280 } |
281 | |
282 //----- (004B807C) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
283 int Player::GetTempleHealCostModifier(float a2) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
284 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
285 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 int conditionTimeMultiplier; // esi@1 |
0 | 287 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 290 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 conditionIdx = GetMajorConditionIdx(); |
1275 | 292 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
293 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
295 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
296 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
297 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
298 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
299 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
300 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 } |
1350 | 304 else |
305 { | |
1275 | 306 conditionTimeMultiplier = 1; |
307 baseConditionMultiplier = 1; | |
1350 | 308 if (conditionIdx < 14) |
309 { | |
310 for (int i = 0; i <= 13; i++) | |
311 { | |
312 v6 = GetConditionDayOfWeek(i); | |
313 if ( v6 > conditionTimeMultiplier ) | |
314 conditionTimeMultiplier = v6; | |
315 } | |
316 } | |
1275 | 317 } |
318 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
319 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
320 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
321 return result; |
0 | 322 } |
323 | |
324 //----- (004B8102) -------------------------------------------------------- | |
917 | 325 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 326 { |
327 signed int v3; // esi@1 | |
328 signed int result; // eax@3 | |
329 | |
1275 | 330 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 331 if ( v3 > uRealValue ) |
332 v3 = uRealValue; | |
0 | 333 result = 1; |
334 if ( v3 >= 1 ) | |
335 result = v3; | |
336 return result; | |
337 } | |
338 | |
339 //----- (004B8142) -------------------------------------------------------- | |
749 | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
341 { | |
1275 | 342 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 343 |
344 if (price < uRealValue) | |
345 price = uRealValue; | |
346 return price; | |
0 | 347 } |
348 | |
349 //----- (004B8179) -------------------------------------------------------- | |
916 | 350 int Player::GetPriceIdentification(float a2) |
0 | 351 { |
352 signed int v2; // esi@1 | |
353 int v3; // ecx@1 | |
354 signed int result; // eax@3 | |
355 | |
1275 | 356 v2 = (signed int)(a2 * 50.0); |
0 | 357 v3 = v2 * (100 - GetMerchant()) / 100; |
358 if ( v3 < v2 / 3 ) | |
359 v3 = v2 / 3; | |
360 result = 1; | |
361 if ( v3 >= 1 ) | |
362 result = v3; | |
363 return result; | |
364 } | |
365 | |
366 //----- (004B81C3) -------------------------------------------------------- | |
916 | 367 int Player::GetPriceRepair(int a2, float a3) |
0 | 368 { |
369 signed int v3; // esi@1 | |
370 int v4; // ecx@1 | |
371 signed int result; // eax@3 | |
372 | |
1275 | 373 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 374 v4 = v3 * (100 - GetMerchant()) / 100; |
375 if ( v4 < v3 / 3 ) | |
376 v4 = v3 / 3; | |
377 result = 1; | |
378 if ( v4 >= 1 ) | |
379 result = v4; | |
380 return result; | |
381 } | |
382 | |
383 //----- (004B8213) -------------------------------------------------------- | |
1275 | 384 int Player::GetBaseSellingPrice(int a2, float a3) |
385 { | |
386 signed int v3; // qax@1 | |
387 | |
388 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
389 if ( v3 < 1 ) | |
390 v3 = 1; | |
0 | 391 return v3; |
392 } | |
393 | |
394 //----- (004B8233) -------------------------------------------------------- | |
1275 | 395 int Player::GetBaseBuyingPrice(int a2, float a3) |
396 { | |
397 signed int v3; // qax@1 | |
398 | |
399 v3 = (signed int)((double)a2 * a3); | |
400 if ( v3 < 1 ) | |
401 v3 = 1; | |
0 | 402 return v3; |
403 } | |
404 | |
405 //----- (004B824B) -------------------------------------------------------- | |
1275 | 406 int Player::GetBaseIdentifyPrice(float a2) |
407 { | |
408 signed int v2; // qax@1 | |
409 | |
410 v2 = (signed int)(a2 * 50.0); | |
411 if ( v2 < 1 ) | |
412 v2 = 1; | |
0 | 413 return v2; |
414 } | |
415 | |
416 //----- (004B8265) -------------------------------------------------------- | |
1275 | 417 int Player::GetBaseRepairPrice(int a2, float a3) |
418 { | |
419 signed int v3; // qax@1 | |
420 | |
421 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
422 if ( v3 < 1 ) | |
423 v3 = 1; | |
0 | 424 return v3; |
425 } | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 432 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
433 { |
0 | 434 signed int v2; // eax@1 |
336 | 435 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 436 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
437 { | |
438 return false; | |
439 } | |
440 else | |
441 { | |
442 if (GetMajorConditionIdx() == Condition_Zombie) | |
443 { | |
444 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
445 { | |
446 return false; | |
447 } | |
448 else | |
449 { | |
450 return true; | |
451 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
452 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
453 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
454 { |
1348 | 455 return true; |
456 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
457 } |
0 | 458 } |
459 | |
460 | |
461 | |
462 //----- (00421E75) -------------------------------------------------------- | |
1012 | 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
464 { | |
465 int item_idx; // eax@1 | |
466 int inv_index; // eax@3 | |
467 | |
1351 | 468 |
1012 | 469 item_idx = *pitem_index; |
470 if ( item_idx >125 || item_idx < 0 ) | |
471 { | |
472 return 0; | |
473 } | |
474 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
475 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 476 if ( inv_index < 0 ) |
477 { | |
478 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
479 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 480 } |
481 | |
482 return inv_index; | |
0 | 483 } |
484 | |
485 | |
486 | |
487 //----- (004160CA) -------------------------------------------------------- | |
1012 | 488 void Player::ItemsEnchant( int enchant_count ) |
489 { | |
490 int avalible_items; // ebx@1 | |
491 int i; // edx@8 | |
492 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
493 | |
494 avalible_items = 0; | |
495 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
496 | |
1349 | 497 for (i = 0; i < 138; ++i) |
498 { | |
499 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
500 item_index_tabl[avalible_items++] = i; | |
501 } | |
1012 | 502 |
503 if ( avalible_items ) | |
504 { | |
505 if ( enchant_count ) | |
506 { | |
1349 | 507 for ( i = 0; i < enchant_count; ++i ) |
508 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
509 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
510 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 511 } |
0 | 512 } |
513 else | |
514 { | |
1012 | 515 for ( i = 0; i < avalible_items; ++i ) |
516 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
517 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 518 } |
519 } | |
520 } | |
0 | 521 } |
522 | |
523 //----- (004948B1) -------------------------------------------------------- | |
187 | 524 void Player::PlaySound(PlayerSpeech speech, int a3) |
525 { | |
1351 | 526 signed int speechCount = 0; // esi@4 |
527 signed int expressionCount = 0; // esi@4 | |
528 int pickedVariant; // esi@10 | |
248 | 529 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 530 signed int pSoundID; // ecx@19 |
1351 | 531 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
532 int expressionVariantArray[5]; | |
533 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
534 unsigned int expressionDuration = 0; | |
187 | 535 |
1351 | 536 pickedSoundID = 0; |
203 | 537 if (uVoicesVolumeMultiplier) |
0 | 538 { |
1351 | 539 for (int i = 0; i < 2; i++) |
540 { | |
1406 | 541 if ( SoundSetAction[speech][i] ) |
542 { | |
543 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 544 speechCount++; |
545 } | |
546 } | |
547 if ( speechCount ) | |
548 { | |
549 pickedVariant = speechVariantArray[rand() % speechCount]; | |
550 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
551 if (numberOfSubvariants > 0) | |
552 { | |
553 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 554 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 555 } |
556 } | |
557 } | |
558 | |
559 for (int i = 0; i < 5; i++) | |
560 { | |
1406 | 561 if ( SoundSetAction[speech][i + 3] ) |
562 { | |
563 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 564 expressionCount++; |
565 } | |
566 } | |
567 if ( expressionCount ) | |
568 { | |
569 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
570 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
571 { | |
1406 | 572 pSoundID = 0; |
573 if ( pSoundList->sNumSounds ) | |
574 { | |
1351 | 575 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 576 { |
1406 | 577 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
578 pSoundID = i; | |
0 | 579 } |
580 } | |
1406 | 581 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 582 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
583 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
584 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
585 } |
0 | 586 } |
587 // 4948B1: using guessed type int var_1C[5]; | |
588 | |
589 //----- (00494A25) -------------------------------------------------------- | |
187 | 590 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
591 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
592 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
593 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
594 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
595 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
598 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
599 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
600 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
601 else |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
602 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
604 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
605 if (v3 >= 2 && v3 <= 11 && v3 != 8 && !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR)) |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
606 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
607 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
608 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
609 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
610 } |
0 | 611 this->uExpressionTimePassed = 0; |
612 if ( !a3 ) | |
613 { | |
187 | 614 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
615 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
616 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
617 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
618 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
619 } |
187 | 620 expression = new_expression; |
0 | 621 viewparams->bRedrawGameUI = 1; |
622 } | |
623 | |
624 //----- (0049327B) -------------------------------------------------------- | |
1355 | 625 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 ) |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
626 { |
135 | 627 if ( this->classType == uClass ) |
0 | 628 { |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
629 return true; |
0 | 630 } |
631 else | |
632 { | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
633 if (!a3) |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
634 { |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
635 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
636 } |
0 | 637 switch ( uClass ) |
638 { | |
639 case 0x1Au: | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
640 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65)); |
0 | 641 case 0x1Bu: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
642 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67)); |
0 | 643 case 0x22u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
644 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
0 | 645 case 0x23u: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
646 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
0 | 647 break; |
648 default: | |
1545 | 649 Error("Should not be able to get here (%u)", uClass); |
0 | 650 break; |
651 } | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
652 return false; |
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
653 } |
0 | 654 } |
655 | |
656 | |
657 //----- (00492C0B) -------------------------------------------------------- | |
658 bool Player::CanAct() | |
659 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
660 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
661 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
662 this->IsPertified() || this->IsEradicated() ) |
1355 | 663 return false; |
0 | 664 else |
1355 | 665 return true; |
0 | 666 } |
667 | |
668 //----- (00492C40) -------------------------------------------------------- | |
669 bool Player::CanSteal() | |
670 { | |
1355 | 671 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 672 } |
673 | |
674 //----- (00492C4E) -------------------------------------------------------- | |
675 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
676 { | |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
677 switch (uItemID) |
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
678 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
679 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
680 case ITEM_RELIC_OLD_NICK: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
681 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
682 case ITEM_RELIC_TALEDONS_HELM: |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1358
diff
changeset
|
683 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
684 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
685 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
686 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
687 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
688 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
689 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break; |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
690 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break; |
1357
06926081358f
Player::CanEquip_RaceAndAlignmentCheck fixed 3 missing return values, started using new race and gender functions, moved everything to a switch
Grumpy7
parents:
1356
diff
changeset
|
691 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
692 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
693 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
694 |
0 | 695 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
696 void Player::SetCondition( unsigned int uConditionIdx, int a3 ) |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
697 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
698 signed int player_sex; // ecx@77 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
699 signed int remainig_player; // ebx@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
700 int players_before; // [sp+10h] [bp-4h]@2 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
701 int players_after; // [sp+20h] [bp+Ch]@82 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
702 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
703 if ( pConditions[uConditionIdx] ) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
704 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
705 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
706 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
707 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
708 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
709 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
710 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
711 switch ( uConditionIdx ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
712 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
713 case Condition_Cursed: PlaySound(SPEECH_30, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
714 case Condition_Weak: PlaySound(SPEECH_25, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
715 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
716 case Condition_Fear: PlaySound(SPEECH_26, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 case Condition_Drunk: PlaySound(SPEECH_31, 0); break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
718 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 719 case Condition_Poison1: |
720 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
721 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 722 case Condition_Disease1: |
723 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
724 case Condition_Disease3: PlaySound(SPEECH_28, 0);break; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 case Condition_Paralyzed: break; //nosound |
1014 | 726 case Condition_Unconcious: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
727 PlaySound(SPEECH_32, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
728 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
729 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
730 break; |
1014 | 731 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
732 PlaySound(SPEECH_33, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
733 if ( sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
734 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
735 if ( sMana > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
736 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
737 break; |
1014 | 738 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
739 PlaySound(SPEECH_34, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
740 break; |
1014 | 741 case Condition_Eradicated: |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
742 PlaySound(SPEECH_35, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
743 if (sHealth > 0 ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
744 sHealth = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
745 if ( sMana > 0 ) |
1014 | 746 sMana = 0; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
747 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
748 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
749 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
750 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
751 memset(&pConditions[0], 0, sizeof(pConditions)); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
752 sHealth = GetMaxHealth(); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
753 sMana = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
754 player_sex = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
755 uPrevFace = uCurrentFace; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
756 uPrevVoiceID = uVoiceID; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
757 if (IsMale()) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
758 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
759 uCurrentFace = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
760 uVoiceID = 23; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
761 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
762 else |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
763 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
764 uCurrentFace = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
765 uVoiceID = 24; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
766 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
767 PlaySound(SPEECH_99, 0); |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
768 break; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
769 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
770 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
771 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
772 for (int i = 1; i < 5; ++i) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
773 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
774 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 ++players_before; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
777 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
778 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
780 remainig_player = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
781 players_after = 0; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
782 for (int i = 1; i < 5; ++i) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
783 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
784 if ( pPlayers[i]->CanAct() ) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
785 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
786 remainig_player = i; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
787 ++players_after; |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
788 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
789 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
790 if (( players_before == 2 ) && ( players_after == 1 )) |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
791 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
792 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0); |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
793 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
794 return; |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
795 } |
0 | 796 |
797 //----- (00492528) -------------------------------------------------------- | |
798 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
799 { | |
1363 | 800 Texture *texture; // esi@1 |
801 unsigned int slotWidth; // ebx@1 | |
802 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
803 | |
804 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
805 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
806 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 807 if ( !areWeLoadingTexture ) |
808 { | |
1363 | 809 texture->Release(); |
1006 | 810 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 811 } |
1555 | 812 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions"); |
1363 | 813 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
814 { | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
815 for (unsigned int x = 0; x < slotWidth; x++) |
1363 | 816 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
817 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 818 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
819 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
820 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
821 return false; |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
822 } |
1363 | 823 } |
824 } | |
825 return true; | |
826 } | |
827 return false; | |
0 | 828 } |
829 // 506128: using guessed type int areWeLoadingTexture; | |
830 | |
831 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
832 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
833 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
834 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
835 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
836 if (pInventoryItemList[i].uItemID == 0) |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
837 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
838 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
839 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
840 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
841 return -1; |
0 | 842 } |
843 | |
844 //----- (00492600) -------------------------------------------------------- | |
845 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
846 { | |
847 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
848 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
849 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
850 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 if ( freeSlot == -1 ) |
0 | 852 { |
853 if ( uActiveCharacter ) | |
201 | 854 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
855 return 0; |
0 | 856 } |
857 else | |
858 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
859 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
860 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
861 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 862 } |
863 return result; | |
864 } | |
865 // 506128: using guessed type int areWeLoadingTexture; | |
866 | |
867 //----- (00492700) -------------------------------------------------------- | |
868 int Player::HasSkill(unsigned int uSkillType) | |
869 { | |
1374 | 870 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
871 { | |
872 return 1; | |
0 | 873 } |
874 else | |
875 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
876 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
877 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 878 return 0; |
879 } | |
0 | 880 } |
881 | |
882 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
883 void Player::WearItem( unsigned int uItemID ) |
0 | 884 { |
1010 | 885 int item_body_anch; // edi@6 |
886 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
887 item_indx = FindFreeInventoryListSlot(); |
1010 | 888 |
889 if ( item_indx != -1 ) | |
890 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
891 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 892 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
893 pEquipment.pIndices[item_body_anch] = item_indx + 1; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
894 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 895 } |
896 } | |
897 | |
898 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
899 int Player::AddItem(int index, unsigned int uItemID) |
0 | 900 { |
1374 | 901 int xStartValue = 0; |
902 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
903 if ( index == -1 ) |
0 | 904 { |
1385 | 905 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
906 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
907 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
0 | 908 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
909 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
910 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
911 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID); |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
912 } |
0 | 913 } |
1385 | 914 } |
0 | 915 return 0; |
916 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
917 if ( !CanFitItem(index, uItemID) ) |
0 | 918 { |
919 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
920 return 0; | |
921 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
922 return CreateItemInInventory(index, uItemID); |
0 | 923 } |
924 | |
925 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
926 int Player::AddItem2(int index, ItemGen *Src) |
0 | 927 { |
928 pItemsTable->SetSpecialBonus(Src); | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
929 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
930 if ( index == -1 ) |
0 | 931 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
932 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
933 { |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
934 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
1385 | 935 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
936 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) ) |
0 | 937 { |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
938 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src); |
0 | 939 } |
1385 | 940 } |
0 | 941 } |
942 return 0; | |
943 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
944 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 945 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
946 return CreateItemInInventory2(index, Src); |
0 | 947 } |
948 | |
949 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
950 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 951 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
952 signed int freeSlot; // ebx@1 |
0 | 953 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
954 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
955 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
956 if ( freeSlot == -1 ) |
0 | 957 { |
958 result = 0; | |
959 } | |
960 else | |
961 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
962 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
963 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
964 result = freeSlot + 1; |
0 | 965 } |
966 return result; | |
967 } | |
968 // 506128: using guessed type int areWeLoadingTexture; | |
969 | |
970 //----- (0049298B) -------------------------------------------------------- | |
1385 | 971 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
972 { |
1014 | 973 Texture *item_texture; // esi@1 |
974 int *pInvPos; // esi@4 | |
975 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
976 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
977 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
978 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 979 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
980 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 981 if ( !areWeLoadingTexture ) |
982 { | |
1014 | 983 item_texture->Release(); |
1006 | 984 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 985 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
986 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
987 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
988 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
989 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
990 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
991 memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
992 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
993 } |
1014 | 994 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
995 pInventoryMatrix[index] = itemListPos + 1; |
0 | 996 } |
278 | 997 |
0 | 998 // 506128: using guessed type int areWeLoadingTexture; |
999 | |
1000 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1001 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1002 { |
1014 | 1003 ItemGen *item_in_slot; // ecx@1 |
1004 Texture *item_texture; // esi@1 | |
1005 unsigned int slot_height; // ebp@1 | |
1006 int *pInvPos; // edx@4 | |
1007 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1008 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1009 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1010 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1011 item_in_slot->Reset(); | |
1012 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1013 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1014 if ( !areWeLoadingTexture ) |
1015 { | |
1014 | 1016 item_texture->Release(); |
1006 | 1017 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1018 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1019 if ( slot_width > 0 ) |
1014 | 1020 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1021 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1022 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1023 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1024 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1025 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1026 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1027 } |
0 | 1028 } |
1029 // 506128: using guessed type int areWeLoadingTexture; | |
1030 | |
1031 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1032 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1033 { | |
1034 unsigned int idemId; // edx@1 | |
1035 signed int equipType; // esi@1 | |
1036 float multiplier; // ST04_4@26 | |
1037 int price; // edi@26 | |
1038 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1039 int itemValue; | |
1040 | |
1041 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1042 idemId = pItem->uItemID; | |
1043 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1044 itemValue = pItem->GetValue(); | |
1045 | |
1046 switch (building_type) | |
1047 { | |
1411 | 1048 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1049 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1050 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1051 if (equipType > EQUIP_BOW) |
1386 | 1052 return 4; |
1053 break; | |
1411 | 1054 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1055 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1056 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1057 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1058 return 4; |
1059 break; | |
1411 | 1060 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1061 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1062 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1063 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1064 return 4; |
1065 break; | |
1411 | 1066 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1067 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1068 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1069 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1070 return 4; |
1071 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1072 default: |
1545 | 1073 Error("(%u)", building_type); |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1074 break; |
1386 | 1075 } |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1076 if (pItem->IsStolen()) |
1386 | 1077 return 6; |
1078 | |
1079 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1080 switch (ShopMenuType) | |
1081 { | |
1082 case 2: | |
1083 price = GetBuyingPrice(itemValue, multiplier); | |
1084 break; | |
1085 case 3: | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1086 if (pItem->IsBroken()) |
1386 | 1087 price = 1; |
917 | 1088 else |
1386 | 1089 price = this->GetPriceSell(itemValue, multiplier); |
1090 break; | |
1091 case 4: | |
1092 price = this->GetPriceIdentification(multiplier); | |
1093 break; | |
1094 case 5: | |
1095 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1096 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1097 default: |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1098 Error("(%u)", ShopMenuType); |
1386 | 1099 break; |
1100 } | |
1101 if ( merchantLevel ) | |
1102 { | |
1103 if (price == itemValue) | |
1104 { | |
1105 return 3; | |
1106 } | |
917 | 1107 else |
1386 | 1108 { |
1109 return 2; | |
1110 } | |
1111 } | |
0 | 1112 else |
1386 | 1113 { |
1114 return 1; | |
1115 } | |
0 | 1116 } |
1117 | |
1118 //----- (0049107D) -------------------------------------------------------- | |
1119 int Player::GetBodybuilding() | |
1120 { | |
1010 | 1121 int v1; // al@1 |
0 | 1122 |
1123 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1124 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1125 return multiplier * (v1 & 0x3F); |
0 | 1126 } |
1127 | |
1128 //----- (004910A8) -------------------------------------------------------- | |
607 | 1129 int Player::GetMeditation() |
0 | 1130 { |
1010 | 1131 int v1; // al@1 |
0 | 1132 |
1133 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1134 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1135 return multiplier * (v1 & 0x3F); |
0 | 1136 } |
1137 | |
1138 //----- (004910D3) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1139 bool Player::CanIdentify( ItemGen *pItem ) |
0 | 1140 { |
1141 unsigned __int16 v2; // ax@1 | |
1142 int v5; // edi@7 | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
1143 |
652 | 1144 if (CheckHiredNPCSpeciality(Scholar)) |
1145 return true; | |
0 | 1146 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1147 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1148 if ( (signed int)SkillToMastery(v2) >= 4 ) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1149 return true; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1150 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1151 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1152 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1153 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St; |
0 | 1154 } |
1155 | |
1156 //----- (00491151) -------------------------------------------------------- | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1157 bool Player::CanRepair( ItemGen *pItem ) |
0 | 1158 { |
1159 unsigned __int16 v2; // ax@1 | |
1160 int v5; // edi@7 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1161 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1162 ItemDesc* v7 = &pItemsTable->pItems[pItem->uItemID]; |
652 | 1163 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || |
1164 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1165 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1166 return true; | |
1167 | |
1010 | 1168 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1169 if ( (signed int)SkillToMastery(v2) >= 4 ) |
0 | 1170 return true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1171 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1172 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1173 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1174 return v5 >= v7->uItemID_Rep_St; |
0 | 1175 } |
1176 | |
1177 //----- (004911F3) -------------------------------------------------------- | |
1178 int Player::GetMerchant() | |
1179 { | |
1180 unsigned __int16 v2; // ax@1 | |
1181 int v5; // edi@1 | |
1182 int v7; // eax@3 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1183 |
607 | 1184 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1185 if ( SkillToMastery(v2) >= 4 ) |
0 | 1186 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1187 |
0 | 1188 v7 = GetPartyReputation(); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1189 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1190 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1191 if (v5 == 0) |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1192 { |
0 | 1193 return -v7; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1194 } |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1195 return v5 - v7 + 7; |
0 | 1196 } |
1197 | |
1198 //----- (0049125A) -------------------------------------------------------- | |
1199 int Player::GetPerception() | |
1200 { | |
1201 unsigned __int16 v2; // ax@1 | |
1202 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1203 |
1010 | 1204 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1205 if ( SkillToMastery(v2) >= 4 ) |
0 | 1206 return 10000; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1207 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1208 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1209 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1210 return v5; |
0 | 1211 } |
1212 | |
1213 //----- (004912B0) -------------------------------------------------------- | |
1214 int Player::GetDisarmTrap() | |
1215 { | |
1216 unsigned __int16 v2; // ax@1 | |
1217 int v5; // edi@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1218 |
1010 | 1219 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 1220 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1221 return 10000; | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1222 |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1223 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1224 if ( HasEnchantedItemEquipped(35) ) //only the real skill level is supposed to be added again, not the multiplied value |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1225 multiplier++; |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1226 v5 = multiplier * (v2 & 0x3F); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1227 return v5; |
0 | 1228 } |
1229 | |
1230 //----- (00491317) -------------------------------------------------------- | |
1231 char Player::GetLearningPercent() | |
1232 { | |
1233 int v2; // eax@1 | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1234 |
1010 | 1235 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1236 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); |
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
1237 return multiplier * v2 + 9; |
0 | 1238 } |
1239 | |
1240 //----- (0048C6AF) -------------------------------------------------------- | |
1241 Player::Player() | |
1242 { | |
1243 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1244 memset(pInventoryMatrix, 0, 126 * sizeof(int)); |
0 | 1245 for (uint i = 0; i < 126; ++i) |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1246 pInventoryItemList[i].Reset(); |
0 | 1247 for (uint i = 0; i < 12; ++i) |
1248 pEquippedItems[i].Reset(); | |
1249 | |
1250 | |
1251 for (uint i = 0; i < 24; ++i) | |
1252 { | |
1253 pPlayerBuffs[i].uSkill = 0; | |
1254 pPlayerBuffs[i].uSkill = 0; | |
1255 pPlayerBuffs[i].uPower = 0; | |
1256 pPlayerBuffs[i].uExpireTime = 0; | |
1257 pPlayerBuffs[i].uCaster = 0; | |
1258 pPlayerBuffs[i].uFlags = 0; | |
1259 } | |
1260 | |
1261 pName[0] = 0; | |
1014 | 1262 uCurrentFace = 0; |
0 | 1263 uVoiceID = 0; |
1264 memset(pConditions, 0, 20 * sizeof(__int64)); | |
1265 | |
1266 field_BB = 0; | |
1267 | |
1268 uMight = uMightBonus = 0; | |
1269 uIntelligence = uIntelligenceBonus = 0; | |
1270 uWillpower = uWillpowerBonus = 0; | |
1271 uEndurance = uEnduranceBonus = 0; | |
1272 uSpeed = uSpeedBonus = 0; | |
1273 uAccuracy = uAccuracyBonus = 0; | |
1274 uLuck = uLuckBonus = 0; | |
1275 uLevel = sLevelModifier = 0; | |
1276 sAgeModifier = 0; | |
1388
60d4885eb107
sACModifier zeroed in player constructor so AC is not always 0(or -some value) ingame
Grumpy7
parents:
1387
diff
changeset
|
1277 sACModifier = 0; |
0 | 1278 |
1019 | 1279 // memset(field_1F5, 0, 30); |
1280 pure_luck_used=0; | |
1281 pure_speed_used=0; | |
1282 pure_intellect_used=0; | |
1283 pure_endurance_used=0; | |
1284 pure_willpower_used=0; | |
1285 pure_accuracy_used=0; | |
1286 pure_might_used=0; | |
0 | 1287 |
1288 sResFireBase = sResFireBonus = 0; | |
1289 sResAirBase = sResAirBonus = 0; | |
1290 sResWaterBase = sResWaterBonus = 0; | |
1291 sResEarthBase = sResEarthBonus = 0; | |
1292 sResMagicBase = sResMagicBonus = 0; | |
1293 sResSpiritBase = sResSpiritBonus = 0; | |
1294 sResMindBase = sResMindBonus = 0; | |
1295 sResBodyBase = sResBodyBonus = 0; | |
1296 sResLightBase = sResLightBonus = 0; | |
1297 sResDarkBase = sResDarkBonus = 0; | |
1298 | |
1299 uTimeToRecovery = 0; | |
1300 | |
1301 uSkillPoints = 0; | |
1302 | |
1303 sHealth = 0; | |
1304 uFullHealthBonus = 0; | |
1305 _health_related = 0; | |
1306 | |
1307 sMana = 0; | |
1308 uFullManaBonus = 0; | |
1309 _mana_related = 0; | |
1310 | |
1311 uQuickSpell = 0; | |
1312 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
1313 | |
1314 _some_attack_bonus = 0; | |
1315 field_1A91 = 0; | |
1316 _melee_dmg_bonus = 0; | |
1317 field_1A93 = 0; | |
1318 _ranged_atk_bonus = 0; | |
1319 field_1A95 = 0; | |
1320 _ranged_dmg_bonus = 0; | |
1321 field_1A97 = 0; | |
1322 | |
130 | 1323 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 1324 uExpressionTimePassed = 0; |
1325 uExpressionTimeLength = 0; | |
1326 | |
1327 uNumDivineInterventionCastsThisDay = 0; | |
1328 uNumArmageddonCasts = 0; | |
1329 uNumFireSpikeCasts = 0; | |
1330 | |
1331 memset(field_1988, 0, 49 * sizeof(int)); | |
1332 memset(field_1A50, 0, 64 * sizeof(char)); | |
1333 | |
1334 field_E0 = 0; | |
1335 field_E4 = 0; | |
1336 field_E8 = 0; | |
1337 field_EC = 0; | |
1338 field_F0 = 0; | |
1339 field_F4 = 0; | |
1340 field_F8 = 0; | |
1341 field_FC = 0; | |
1342 field_100 = 0; | |
1343 field_104 = 0; | |
198 | 1344 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1345 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1346 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1347 |
198 | 1348 lastOpenedSpellbookPage = 0; |
0 | 1349 } |
1350 | |
1351 //----- (0048C6F6) -------------------------------------------------------- | |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1352 bool Party::AddItemToParty(ItemGen *pItem) //TODO move to party.cpp |
0 | 1353 { |
1354 unsigned int v2; // eax@1 | |
1355 char *v5; // eax@8 | |
1356 Texture *v7; // ebx@10 | |
1357 signed int v8; // esi@10 | |
1358 Player *v9; // edi@11 | |
1359 int v10; // eax@11 | |
1360 int v21; // [sp+24h] [bp-4h]@10 | |
1361 | |
1362 v2 = pItem->uItemID; | |
222 | 1363 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1364 pItem->SetIdentified(); |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1365 |
0 | 1366 v5 = pItemsTable->pItems[v2].pIconName; |
1367 if ( v5 ) | |
1368 { | |
973 | 1369 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1370 v21 = areWeLoadingTexture; |
1371 v8 = 0; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1372 int startId = uActiveCharacter >= 0 ? uActiveCharacter - 1 : 0; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1373 for (int i = 0; i < 4; i++) |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1374 { |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1375 v9 = &pPlayers[(startId + i) % 4]; //start with current active player, then cycle right if item won't fit |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1376 v10 = v9->AddItem(-1, pItem->uItemID); |
0 | 1377 if ( v10 ) |
1378 { | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1379 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1380 pItem->Reset(); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1381 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1382 v9->PlaySound(SPEECH_60, 0); |
0 | 1383 if ( !v21 ) |
1384 { | |
1385 v7->Release(); | |
1006 | 1386 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1387 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1388 return true; |
0 | 1389 } |
1390 } | |
1391 if ( !v21 ) | |
1392 { | |
1393 v7->Release(); | |
1006 | 1394 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1395 } |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1396 return false; |
0 | 1397 } |
1398 else | |
1399 { | |
1400 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1401 return false; |
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1402 } |
0 | 1403 } |
1404 // 506128: using guessed type int areWeLoadingTexture; | |
1405 | |
1406 //----- (0048C855) -------------------------------------------------------- | |
1407 int Player::GetBaseStrength() | |
1408 { | |
1409 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1410 } | |
1411 | |
1412 //----- (0048C86C) -------------------------------------------------------- | |
1413 int Player::GetBaseIntelligence() | |
1414 { | |
1415 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1416 } | |
1417 | |
1418 //----- (0048C883) -------------------------------------------------------- | |
1419 int Player::GetBaseWillpower() | |
1420 { | |
1421 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1422 } | |
1423 | |
1424 //----- (0048C89A) -------------------------------------------------------- | |
1425 int Player::GetBaseEndurance() | |
1426 { | |
1427 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1428 } | |
1429 | |
1430 //----- (0048C8B1) -------------------------------------------------------- | |
1431 int Player::GetBaseAccuracy() | |
1432 { | |
1433 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1434 } | |
1435 | |
1436 //----- (0048C8C8) -------------------------------------------------------- | |
1437 int Player::GetBaseSpeed() | |
1438 { | |
1439 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1440 } | |
1441 | |
1442 //----- (0048C8DF) -------------------------------------------------------- | |
1443 int Player::GetBaseLuck() | |
1444 { | |
1445 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1446 } | |
1447 | |
1448 //----- (0048C8F6) -------------------------------------------------------- | |
1449 int Player::GetBaseLevel() | |
1450 { | |
1451 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1452 } | |
1453 | |
1454 //----- (0048C90D) -------------------------------------------------------- | |
1455 int Player::GetActualLevel() | |
1456 { | |
1457 return uLevel + sLevelModifier + | |
1458 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1459 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1460 } | |
1461 | |
1462 //----- (0048C93C) -------------------------------------------------------- | |
1463 int Player::GetActualMight() | |
1464 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1465 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus); |
0 | 1466 } |
1467 | |
1468 //----- (0048C9C2) -------------------------------------------------------- | |
1469 int Player::GetActualIntelligence() | |
1470 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1471 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus); |
0 | 1472 } |
1473 | |
1474 //----- (0048CA3F) -------------------------------------------------------- | |
1475 int Player::GetActualWillpower() | |
1476 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1477 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus); |
0 | 1478 } |
1479 | |
1480 //----- (0048CABC) -------------------------------------------------------- | |
1481 int Player::GetActualEndurance() | |
1482 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1483 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus); |
0 | 1484 } |
1485 | |
1486 //----- (0048CB39) -------------------------------------------------------- | |
1487 int Player::GetActualAccuracy() | |
1488 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1489 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus); |
0 | 1490 } |
1491 | |
1492 //----- (0048CBB6) -------------------------------------------------------- | |
1493 int Player::GetActualSpeed() | |
1494 { | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1495 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus); |
0 | 1496 } |
1497 | |
1498 //----- (0048CC33) -------------------------------------------------------- | |
1499 int Player::GetActualLuck() | |
1500 { | |
1036 | 1501 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1502 | |
1503 npc_luck_bonus = 0; | |
652 | 1504 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1505 npc_luck_bonus = 5; |
652 | 1506 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1507 npc_luck_bonus += 20; |
652 | 1508 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1509 npc_luck_bonus += 10; |
1324 | 1510 |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1511 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus) |
1325 | 1512 + npc_luck_bonus; |
1513 } | |
1514 | |
1515 //----- (new function) -------------------------------------------------------- | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1516 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::* attrValue, unsigned short Player::* attrBonus ) |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1517 { |
1324 | 1518 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1519 uint uAgeingMultiplier = 100; | |
1520 for (uint i = 0; i < 4; ++i) | |
1325 | 1521 { |
1324 | 1522 if (uActualAge >= pAgeingTable[i]) |
1325 | 1523 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1524 else | |
1525 break; | |
1526 } | |
1527 | |
1528 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1529 int magicBonus = GetMagicalBonus(attrId); | |
1530 int itemBonus = GetItemsBonus(attrId, 0); | |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1531 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100 |
1325 | 1532 + magicBonus |
1552
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1533 + itemBonus |
d253172de469
Player::CanFitItem, AddItem, AddItem2 changed changed the retarded 2 dimensional array traversal, changed GetActualAttribute input parameters to get rid of the attrid case
Grumpy7
parents:
1551
diff
changeset
|
1534 + this->*attrBonus; |
0 | 1535 } |
1536 | |
1537 //----- (0048CCF5) -------------------------------------------------------- | |
1538 int Player::GetActualAttack(int a2) | |
1539 { | |
1540 int v3; // eax@1 | |
1541 int v4; // edi@1 | |
1542 int v5; // ebx@1 | |
1543 int v6; // ebp@1 | |
1544 | |
1545 v3 = GetActualAccuracy(); | |
1036 | 1546 v4 = GetParameterBonus(v3); |
0 | 1547 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1548 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1549 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + this->_some_attack_bonus; |
0 | 1550 } |
1551 | |
1552 //----- (0048CD45) -------------------------------------------------------- | |
1553 int Player::GetMeleeDamageMinimal() | |
1554 { | |
1555 int v2; // eax@1 | |
1556 int v3; // esi@1 | |
1557 int v4; // esi@1 | |
1558 int v5; // esi@1 | |
1559 signed int result; // eax@1 | |
1036 | 1560 |
0 | 1561 v2 = GetActualMight(); |
1036 | 1562 v3 = GetParameterBonus(v2); |
0 | 1563 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1564 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1565 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1566 if ( result < 1 ) | |
1567 result = 1; | |
0 | 1568 return result; |
1569 } | |
1570 | |
1571 //----- (0048CD90) -------------------------------------------------------- | |
1572 int Player::GetMeleeDamageMaximal() | |
1573 { | |
1574 int v2; // eax@1 | |
1575 int v3; // esi@1 | |
1576 int v4; // esi@1 | |
1577 int v5; // esi@1 | |
1578 int v6; // esi@1 | |
1579 signed int result; // eax@1 | |
1580 | |
1581 v2 = GetActualMight(); | |
1036 | 1582 v3 = GetParameterBonus(v2); |
0 | 1583 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1584 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1585 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
0 | 1586 result = 1; |
1587 if ( v6 >= 1 ) | |
1588 result = v6; | |
1589 return result; | |
1590 } | |
1591 | |
1592 //----- (0048CDDB) -------------------------------------------------------- | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1593 int Player::CalculateMeleeDamageTo( bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1594 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1595 int dmgSum; // esi@62 |
0 | 1596 signed int result; // eax@64 |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1597 int mainWpnDmg; // [sp+18h] [bp-8h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1598 int offHndWpnDmg; // [sp+1Ch] [bp-4h]@1 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1599 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1600 offHndWpnDmg = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1601 mainWpnDmg = 0; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1602 if ( IsUnarmed() ) |
0 | 1603 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1604 mainWpnDmg = rand() % 3 + 1; |
1549
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1605 } |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1606 else |
5a3afcaa6717
Player::CalculateMeleeDamageTo removed labels, ifdowhile patterns changed to for cycles, magic numbers to enum values, fixing gibbet being only undead slaying
Grumpy7
parents:
1547
diff
changeset
|
1607 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1608 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1609 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1610 ItemGen *mainHandItemGen = &this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1611 int itemId = mainHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1612 bool addOneDice = false; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1613 if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1614 addOneDice = true; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1615 mainWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(mainHandItemGen, uTargetActorID, addOneDice); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1616 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1617 if ( !ignoreOffhand ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1618 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1619 if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) |
0 | 1620 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1621 ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1]; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1622 int itemId = offHandItemGen->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1623 if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) |
0 | 1624 { |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1625 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); |
0 | 1626 } |
1627 } | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1628 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1629 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1630 dmgSum = mainWpnDmg + offHndWpnDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1631 if ( !ignoreSkillBonus ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1632 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1633 int might = GetActualMight(); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1634 int mightBonus = GetParameterBonus(might); |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1635 int mightAndSkillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightBonus; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1636 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus; |
0 | 1637 } |
1638 result = 1; | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1639 if ( dmgSum >= 1 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1640 result = dmgSum; |
0 | 1641 return result; |
1642 } | |
1643 | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1644 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1645 int Player::CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1646 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1647 int itemId = weapon->uItemID; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1648 int diceCount = pItemsTable->pItems[itemId].uDamageDice; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1649 if (addOneDice) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1650 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1651 diceCount++; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1652 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1653 int diceSides = pItemsTable->pItems[itemId].uDamageRoll; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1654 int diceResult = 0; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1655 for (int i = 0; i < diceCount; i++) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1656 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1657 diceResult += rand() % diceSides + 1; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1658 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1659 int totalDmg = pItemsTable->pItems[itemId].uDamageMod + diceResult; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1660 if ( uTargetActorID > 0) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1661 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1662 int enchType = weapon->uSpecEnchantmentType; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1663 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE) ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1664 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1665 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1666 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1667 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1668 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1669 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1670 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1671 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1672 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1673 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1674 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1675 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 )) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1676 { |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1677 totalDmg *= 2; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1678 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1679 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1680 if ( (signed int)SkillToMastery(this->pActiveSkills[2]) >= 3 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1681 && pItemsTable->pItems[itemId].uSkillType == 2 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1682 && rand() % 100 < 10 ) |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1683 totalDmg *= 3; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1684 return totalDmg; |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1685 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1686 |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1687 |
0 | 1688 //----- (0048D0B9) -------------------------------------------------------- |
1689 int Player::GetRangedAttack() | |
1690 { | |
1691 int v2; // eax@1 | |
1692 int v3; // edi@3 | |
1693 int v4; // eax@4 | |
1694 int v5; // edi@4 | |
1695 int v6; // edi@4 | |
1696 int v7; // edi@4 | |
1697 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1698 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1699 if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) |
0 | 1700 { |
1701 v4 = GetActualAccuracy(); | |
1036 | 1702 v5 = GetParameterBonus(v4); |
0 | 1703 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
1704 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1705 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; |
0 | 1706 } |
1707 else | |
1708 { | |
1709 v3 = GetActualAttack(1); | |
1710 } | |
1711 return v3; | |
1712 } | |
1713 | |
1714 //----- (0048D124) -------------------------------------------------------- | |
1715 int Player::GetRangedDamageMin() | |
1716 { | |
1717 int v2; // edi@1 | |
1718 int v3; // edi@1 | |
1719 int v4; // edi@1 | |
1720 int result; // eax@6 | |
1721 | |
1040 | 1722 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
1723 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1724 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1725 if ( v4 >= 1 ) |
1726 result = v4; | |
1727 else | |
1728 result = 0; | |
1729 return result; | |
1730 } | |
1731 | |
1732 //----- (0048D191) -------------------------------------------------------- | |
1733 int Player::GetRangedDamageMax() | |
1734 { | |
1735 int v2; // edi@1 | |
1736 int v3; // edi@1 | |
1737 int v4; // edi@1 | |
1738 int result; // eax@6 | |
1739 | |
1040 | 1740 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
1741 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
1742 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; |
0 | 1743 if ( v4 >= 1 ) |
1744 result = v4; | |
1745 else | |
1746 result = 0; | |
1747 return result; | |
1748 } | |
1749 | |
1750 //----- (0048D1FE) -------------------------------------------------------- | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1751 int Player::CalculateRangedDamageTo( int a2 ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1752 { |
0 | 1753 ItemGen *v4; // ebx@2 |
1754 unsigned int v5; // edi@2 | |
1755 int v9; // esi@5 | |
1756 int v10; // ebx@6 | |
1757 signed int v15; // [sp+8h] [bp-Ch]@2 | |
1758 int v17; // [sp+10h] [bp-4h]@1 | |
1759 | |
1760 v17 = 0; | |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1761 if ( !HasItemEquipped(EQUIP_BOW) ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1762 return 0; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1763 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1]; |
0 | 1764 v5 = v4->uItemID; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1765 v15 = pItemsTable->pItems[v5].uDamageRoll; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1766 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ ) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1767 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1768 int v7 = rand() % v15; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1769 v17 += v7 + 1; |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1770 } |
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1771 v9 = pItemsTable->pItems[v5].uDamageMod + v17; |
0 | 1772 if ( a2 ) |
1773 { | |
377 | 1774 v10 = v4->uSpecEnchantmentType; |
1551
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1775 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1776 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1777 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1778 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1779 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1780 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1781 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1782 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1783 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1784 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1785 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1786 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1787 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF)) |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1788 { |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1789 v9 *= 2; |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1790 } |
a9e8d2a7abb5
Player::CalculateRangedDamageTo, finishing cleanup accidentally commited in previous commit
Grumpy7
parents:
1550
diff
changeset
|
1791 } |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1549
diff
changeset
|
1792 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS); |
0 | 1793 } |
1794 | |
1795 //----- (0048D2EA) -------------------------------------------------------- | |
1796 char *Player::GetMeleeDamageString() | |
1797 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1798 signed int itemid; // eax@1 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1799 int min_damage; // edi@3 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1800 int max_damage; // eax@3 |
0 | 1801 |
1802 static char player__getmeleedamagestring_static_buff[40]; // idb | |
1803 | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1804 if (pEquipment.uMainHand >= 0) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1805 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1806 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1807 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1808 |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1809 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1810 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1811 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1812 return player__getmeleedamagestring_static_buff; |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1813 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1814 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1815 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1816 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1817 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1818 } |
0 | 1819 else |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1820 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1821 min_damage = GetMeleeDamageMinimal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1822 max_damage = GetMeleeDamageMaximal(); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1823 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1824 if ( min_damage == max_damage ) |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1825 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1826 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1827 } |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1828 else |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1829 { |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1830 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); |
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1831 } |
1036 | 1832 return player__getmeleedamagestring_static_buff; |
0 | 1833 } |
1834 | |
1835 //----- (0048D396) -------------------------------------------------------- | |
1836 char *Player::GetRangedDamageString() | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1837 { |
1036 | 1838 signed int itemid; // eax@1 |
1839 int min_damage; // edi@3 | |
1840 int max_damage; // eax@3 | |
1841 | |
1842 static char player__getrangeddamagestring_static_buff[40]; // idb | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1843 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1844 if (pEquipment.uMainHand >= 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1845 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1846 itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1847 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1848 |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1849 if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1850 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1851 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1852 return player__getrangeddamagestring_static_buff; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1853 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1854 else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1855 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1856 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1857 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1858 } |
0 | 1859 else |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1860 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1861 min_damage = GetRangedDamageMin(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1862 max_damage = GetRangedDamageMax(); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1863 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1864 if ( max_damage > 0) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1865 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1866 if ( min_damage == max_damage ) |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1867 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1868 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1869 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1870 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1871 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1872 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1873 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1874 } |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1875 else |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1876 { |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1877 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1878 } |
1036 | 1879 return player__getrangeddamagestring_static_buff; |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
1880 } |
0 | 1881 |
1882 //----- (0048D45A) -------------------------------------------------------- | |
1883 bool Player::CanTrainToNextLevel() | |
1884 { | |
1565
58420268d87d
fixing Player::GetMeleeDamageString and Player::CanTrainToNextLevel
Grumpy7
parents:
1564
diff
changeset
|
1885 int lvl = this->uLevel + 1; |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1886 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000); |
1564 | 1887 return this->uExperience >= neededExp; |
0 | 1888 } |
1889 | |
1890 //----- (0048D498) -------------------------------------------------------- | |
1891 unsigned int Player::GetExperienceDisplayColor() | |
1892 { | |
1893 if ( CanTrainToNextLevel() ) | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1894 return ui_character_bonus_text_color; |
0 | 1895 else |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1896 return ui_character_default_text_color; |
0 | 1897 } |
1898 | |
1899 //----- (0048D4B3) -------------------------------------------------------- | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1900 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg ) |
1561 | 1901 { |
1036 | 1902 int resist_value; // edi@8 |
1903 int player_luck; // eax@21 | |
1904 signed int res_rand_divider; // ebx@2 | |
1905 int armor_skill; // eax@29 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1906 |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1907 if ( classType == PLAYER_CLASS_LICH && (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND || dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY || dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT )) //TODO: determine if spirit resistance should be handled by body res. modifier |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1908 return 0; |
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1909 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1910 resist_value = 0; |
1036 | 1911 switch(dmg_type) |
1912 { | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1913 case DMGT_FIRE: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1914 case DMGT_ELECTR: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1915 case DMGT_COLD: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); break; |
1560
a0cd6465ae0d
Player::CalculateIncommingDamage, liches shouldn't be immune to damage if above 200 resistance to it
Grumpy7
parents:
1559
diff
changeset
|
1916 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break; |
1036 | 1917 |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1918 case DMGT_SPIRIT: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_SPIRIT);break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1919 case DMGT_MIND: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1920 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break; |
1036 | 1921 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1922 |
1036 | 1923 player_luck = GetActualLuck(); |
1924 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
1925 | |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1926 if ( GetParameterBonus(player_luck) + resist_value > 0 ) |
1036 | 1927 { |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1928 for (int i = 0; i < 4; i++) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1929 { |
1036 | 1930 if ( rand() % res_rand_divider >= 30 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1931 dmg >>= 1; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1932 else |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1933 break; |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1934 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1935 } |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1936 if (( dmg_type == DMGT_PHISYCAL ) && ( pEquipment.uArmor )) |
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1937 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
1938 if (!pOwnItems[pEquipment.uArmor - 1].IsBroken()) |
0 | 1939 { |
1036 | 1940 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
1941 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 1942 { |
1036 | 1943 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1944 return dmg / 2; |
0 | 1945 } |
1036 | 1946 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 1947 { |
1036 | 1948 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1949 return dmg * 2 / 3; |
0 | 1950 } |
1951 } | |
1036 | 1952 } |
1559
1f3f01d39300
Player::CanTrainToNextLevel simplified, Player::GetExperienceDisplayColor shortened a bit Player::CalculateIncommingDamage + fixed resistances not working if no resistance bonus (ignored luck bonus)
Grumpy7
parents:
1558
diff
changeset
|
1953 return dmg; |
0 | 1954 } |
1955 | |
1956 //----- (0048D62C) -------------------------------------------------------- | |
816 | 1957 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
1958 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1959 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 1960 } |
1961 | |
1962 //----- (0048D651) -------------------------------------------------------- | |
816 | 1963 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
1964 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1965 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 1966 } |
1967 | |
1968 //----- (0048D676) -------------------------------------------------------- | |
1969 bool Player::IsUnarmed() | |
1970 { | |
1561 | 1971 return !HasItemEquipped(EQUIP_MAIN_HAND) && |
1972 (!HasItemEquipped(EQUIP_OFF_HAND) || GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD); | |
0 | 1973 } |
1974 | |
1975 //----- (0048D6AA) -------------------------------------------------------- | |
1976 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
1977 { | |
1978 auto i = pEquipment.pIndices[uEquipIndex]; | |
1979 if (i) | |
1568 | 1980 return (~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN)) != 0; |
1036 | 1981 else |
1982 return false; | |
0 | 1983 } |
1984 | |
1985 //----- (0048D6D0) -------------------------------------------------------- | |
1986 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
1987 { | |
1988 for (uint i = 0; i < 16; ++i) | |
1989 { | |
1990 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 1991 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 1992 return true; |
1993 } | |
1994 return false; | |
1995 } | |
1996 | |
1997 //----- (0048D709) -------------------------------------------------------- | |
1080 | 1998 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
1563 | 1999 { |
2000 return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); | |
2001 } | |
2002 | |
2003 bool Player::WearsItemAnyWhere(int item_id) | |
2004 { | |
2005 for (int i = 0; i < 16; i++) | |
2006 { | |
2007 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i)) | |
2008 { | |
2009 return true; | |
2010 } | |
2011 } | |
2012 return false; | |
0 | 2013 } |
2014 | |
2015 //----- (0048D76C) -------------------------------------------------------- | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2016 bool Player::StealFromShop(ItemGen *itemToSteal, int a3, int reputation, int a5, int *a6) //check stealing in IDA pro once I get home. The whole thing looks odd, dword_4EDEB4 and dword_4EDEA0 are never filled, might be a bug, might me on purpose |
0 | 2017 { |
2018 unsigned __int16 v6; // cx@8 | |
2019 int v7; // edi@8 | |
2020 unsigned int v8; // ebx@8 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2021 unsigned int itemvalue; // esi@8 |
0 | 2022 int v10; // eax@8 |
2023 int v11; // edi@12 | |
2024 bool result; // eax@13 | |
2025 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2026 if ( !itemToSteal |
0 | 2027 || this->pConditions[16] |
2028 || this->pConditions[14] | |
2029 || this->pConditions[15] | |
2030 || this->pConditions[4] | |
2031 || this->pConditions[13] | |
2032 || this->pConditions[2] ) | |
2033 { | |
2034 result = 0; | |
2035 } | |
2036 else | |
2037 { | |
2038 v6 = this->pActiveSkills[34]; | |
2039 v7 = v6 & 0x3F; | |
2040 v8 = SkillToMastery(v6); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2041 itemvalue = itemToSteal->GetValue(); |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2042 v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2043 if ( !pItemsTable->pItems[itemToSteal->uItemID].uEquipType || v10 == 1 || v10 == 2 ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2044 itemvalue *= 3; |
0 | 2045 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2046 *a6 = 100 * (reputation + a3) + itemvalue + (a5 != 0 ? 0x1F4 : 0); |
0 | 2047 if ( rand() % 100 >= 5 ) |
2048 { | |
2049 if ( *a6 > v11 ) | |
2050 result = *a6 - v11 < 500; | |
2051 else | |
2052 result = 2; | |
2053 } | |
2054 else | |
2055 { | |
2056 result = 0; | |
2057 } | |
2058 } | |
2059 return result; | |
2060 } | |
2061 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2062 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2063 | |
2064 //----- (0048D88B) -------------------------------------------------------- | |
2065 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2066 { | |
2067 Player *v4; // esi@1 | |
2068 Actor *v5; // edi@1 | |
2069 unsigned __int16 v6; // cx@10 | |
2070 int v7; // ebx@10 | |
2071 unsigned int v8; // esi@10 | |
2072 int v9; // eax@10 | |
2073 int v10; // esi@10 | |
2074 int v11; // eax@13 | |
2075 signed int v12; // ebx@15 | |
2076 signed int v13; // edx@15 | |
2077 int v14; // ecx@15 | |
2078 unsigned __int16 v15; // si@21 | |
2079 unsigned int v16; // ebx@24 | |
2080 int v17; // esi@24 | |
2081 const void *v18; // eax@29 | |
2082 unsigned int v19; // esi@31 | |
2083 int v20; // eax@34 | |
2084 char v21; // zf@36 | |
2085 unsigned int v22; // ST0C_4@39 | |
2086 char *v23; // esi@39 | |
2087 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2088 int v26; // [sp-8h] [bp-44h]@40 | |
2089 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2090 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2091 int v29; // [sp+30h] [bp-Ch]@10 | |
2092 int v30; // [sp+34h] [bp-8h]@10 | |
2093 Player *v31; // [sp+38h] [bp-4h]@1 | |
2094 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2095 | |
2096 v4 = this; | |
2097 v5 = &pActors[uActorID]; | |
2098 v31 = this; | |
2099 if ( &pActors[uActorID] | |
2100 && !this->pConditions[16] | |
2101 && !this->pConditions[14] | |
2102 && !this->pConditions[15] | |
2103 && !this->pConditions[4] | |
2104 && !this->pConditions[13] | |
2105 && !this->pConditions[2] ) | |
2106 { | |
2107 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2108 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2109 v6 = v4->pActiveSkills[34]; | |
2110 v7 = v6 & 0x3F; | |
2111 v8 = SkillToMastery(v6); | |
2112 v9 = rand(); | |
2113 v28 = 4 * v8; | |
2114 v30 = dword_4EDEA0[v8]; | |
2115 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2116 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2117 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2118 { | |
322 | 2119 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2120 _steal_perma = 0; |
2121 v26 = (int)v31->pName; | |
2122 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2123 } | |
2124 else | |
2125 { | |
2126 v11 = rand(); | |
2127 if ( v11 % 100 >= 40 ) | |
2128 { | |
2129 if ( v11 % 100 >= 70 ) | |
2130 { | |
2131 v19 = 0; | |
2132 if ( v7 > 0 ) | |
2133 { | |
2134 do | |
2135 { | |
2136 --v7; | |
2137 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2138 } | |
2139 while ( v7 ); | |
2140 } | |
2141 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2142 return _steal_perma; | |
377 | 2143 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2144 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2145 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2146 v21 = *(int *)v20 == v19; |
2147 *(int *)v20 -= v19; | |
2148 if ( v21 ) | |
2149 v5->array_000234[3].uItemID = 0; | |
2150 if ( v19 ) | |
2151 { | |
2152 party_finds_gold(v19, 2); | |
2153 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2154 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2155 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2156 LABEL_43: |
2157 ShowStatusBarString(v23, 2u); | |
2158 return _steal_perma; | |
2159 } | |
2160 } | |
2161 else | |
2162 { | |
2163 v27.Reset(); | |
2164 v12 = 0; | |
2165 v13 = 0; | |
2166 v14 = (int)v5->array_000234; | |
2167 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2168 { | |
2169 ++v13; | |
2170 v14 += 36; | |
2171 if ( v13 >= 4 ) | |
2172 goto LABEL_21; | |
2173 } | |
2174 v12 = 1; | |
2175 LABEL_21: | |
2176 v15 = v5->uCarriedItemID; | |
2177 if ( v15 || v12 ) | |
2178 { | |
2179 v27.Reset(); | |
2180 if ( v15 ) | |
2181 { | |
2182 v16 = (signed __int16)v15; | |
2183 v5->uCarriedItemID = 0; | |
2184 v27.uItemID = (signed __int16)v15; | |
2185 v17 = (signed __int16)v15; | |
2186 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2187 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2188 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2189 { | |
2190 if ( v16 != 220 ) | |
570 | 2191 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2192 } |
2193 } | |
2194 else | |
2195 { | |
2196 v18 = &v5->array_000234[rand() % 4]; | |
2197 memcpy(&v27, v18, sizeof(v27)); | |
2198 ((ItemGen *)v18)->Reset(); | |
2199 v16 = v27.uItemID; | |
2200 } | |
2201 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2202 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2203 pTmpBuf2.data(), |
0 | 2204 pGlobalTXT_LocalizationStrings[304], |
2205 v31->pName, | |
2206 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2207 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2208 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2209 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2210 pMouse->SetCursorBitmapFromItemID(v16); | |
2211 return _steal_perma; | |
2212 } | |
2213 } | |
2214 } | |
2215 v26 = (int)v31->pName; | |
2216 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2217 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2218 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2219 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2220 goto LABEL_43; |
2221 } | |
2222 return 0; | |
2223 } | |
2224 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2225 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2226 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2227 | |
2228 //----- (0048DBB9) -------------------------------------------------------- | |
2229 void Player::Heal(int amount) | |
2230 { | |
1010 | 2231 signed int max_health; // eax@3 |
2232 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2233 if ( !IsEradicated() && !IsDead() ) |
1010 | 2234 { |
2235 max_health = GetMaxHealth(); | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2236 if ( IsZombie() ) |
1010 | 2237 max_health /= 2; |
2238 sHealth += amount; | |
2239 if ( sHealth > max_health ) | |
2240 sHealth = max_health; | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2241 if ( IsUnconcious() ) |
1010 | 2242 { |
2243 if ( sHealth > 0 ) | |
2244 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2245 SetUnconcious(false); |
0 | 2246 } |
2247 } | |
2248 } | |
2249 } | |
2250 | |
2251 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2252 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2253 { | |
2254 signed int recieved_dmg; // eax@1 | |
2255 unsigned int armor_indx; // eax@8 | |
2256 bool broke_armor; | |
2257 | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2258 SetAsleep(false); |
1036 | 2259 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); |
2260 sHealth -= recieved_dmg; | |
2261 broke_armor = sHealth <= -10; | |
2262 if ( sHealth < 1 ) // | |
2263 { | |
2264 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2265 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2266 { |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2267 SetCondUnconsciousWithBlockCheck(false); |
0 | 2268 } |
2269 else | |
2270 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2271 SetCondDeadWithBlockCheck(false); |
1036 | 2272 if ( sHealth > 0 ) |
2273 sHealth = 0; | |
2274 } | |
2275 if (broke_armor ) | |
2276 { | |
2277 armor_indx = pEquipment.uArmor; | |
2278 if ( armor_indx ) | |
0 | 2279 { |
1568 | 2280 if ( !(pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED)) |
0 | 2281 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2282 pOwnItems[armor_indx-1].SetBroken(); |
0 | 2283 } |
2284 } | |
2285 } | |
2286 } | |
1036 | 2287 if ( recieved_dmg && CanAct() ) |
187 | 2288 PlaySound(SPEECH_24, 0); |
1036 | 2289 return recieved_dmg; |
0 | 2290 } |
2291 | |
2292 //----- (0048DCF6) -------------------------------------------------------- | |
1568 | 2293 int Player::_48DCF6(int a2, Actor *pActor) //TODO check this with IDA to see what the uninitialized vars are supposed to contain |
0 | 2294 { |
2295 signed int v3; // edi@1 | |
2296 signed int v4; // ebx@1 | |
2297 Player *v5; // esi@1 | |
2298 int v6; // eax@2 | |
2299 int v7; // eax@5 | |
2300 int v8; // eax@8 | |
2301 int v9; // ebx@8 | |
2302 int v10; // eax@8 | |
2303 int v11; // ebx@8 | |
2304 signed int v12; // edx@9 | |
2305 ItemGen *v13; // eax@9 | |
2306 int v14; // edx@16 | |
2307 unsigned int v15; // edx@17 | |
2308 int v16; // edx@26 | |
2309 unsigned int v17; // edx@27 | |
2310 signed int v19; // edx@38 | |
2311 int *v20; // ecx@38 | |
2312 signed int v21; // eax@40 | |
2313 int v22; // eax@49 | |
2314 signed int v23; // ebx@49 | |
2315 unsigned int v24; // eax@60 | |
2316 int v25; // ecx@61 | |
2317 int v26; // ebx@74 | |
2318 void *v27; // ecx@76 | |
2319 unsigned int v28; // ebx@78 | |
2320 signed int result; // eax@86 | |
2321 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2322 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2323 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2324 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2325 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2326 int v35; // [sp-Ch] [bp-ACh]@56 | |
2327 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2328 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2329 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2330 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2331 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2332 int v41; // [sp-4h] [bp-A4h]@51 | |
2333 int v42; // [sp-4h] [bp-A4h]@56 | |
2334 int v43; // [sp-4h] [bp-A4h]@57 | |
2335 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2336 int v45; // [sp-4h] [bp-A4h]@68 | |
2337 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2338 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2339 int v48; // [sp+9Ch] [bp-4h]@1 | |
2340 | |
2341 v3 = 0; | |
2342 v4 = 0; | |
2343 v5 = this; | |
2344 v47 = 0; | |
2345 v48 = 0; | |
2346 switch ( a2 ) | |
2347 { | |
2348 case 1: | |
2349 v6 = GetActualWillpower(); | |
2350 goto LABEL_46; | |
2351 case 2: | |
2352 case 3: | |
2353 case 4: | |
2354 case 9: | |
2355 case 10: | |
2356 case 11: | |
2357 case 13: | |
2358 case 21: | |
2359 v6 = GetActualEndurance(); | |
2360 goto LABEL_46; | |
2361 case 5: | |
2362 case 12: | |
2363 case 23: | |
2364 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2365 goto LABEL_5; | |
2366 case 15: | |
2367 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2368 goto LABEL_5; | |
2369 case 6: | |
2370 case 7: | |
2371 case 8: | |
2372 case 14: | |
2373 case 16: | |
2374 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2375 LABEL_5: | |
2376 v7 = GetActualResistance(v40); | |
2377 goto LABEL_47; | |
2378 case 22: | |
2379 v8 = GetActualWillpower(); | |
1036 | 2380 v9 = GetParameterBonus(v8); |
0 | 2381 v10 = GetActualIntelligence(); |
1036 | 2382 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2383 break; |
2384 case 17: | |
2385 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2386 v13 = this->pInventoryItemList; |
0 | 2387 do |
2388 { | |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
2389 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->IsBroken()) |
0 | 2390 v46[v4++] = v12; |
2391 ++v12; | |
2392 ++v13; | |
2393 } | |
2394 while ( v12 < 138 ); | |
2395 goto LABEL_36; | |
2396 case 18: | |
2397 v14 = 0; | |
2398 do | |
2399 { | |
2400 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2401 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2402 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2403 if ( v15 == EQUIP_ARMOUR ) |
898 | 2404 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2405 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2406 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2407 } |
2408 v14 = v15 + 1; | |
2409 } | |
2410 while ( v14 < 16 ); | |
2411 goto LABEL_36; | |
2412 case 19: | |
2413 v16 = 0; | |
2414 do | |
2415 { | |
2416 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2417 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2418 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2419 if ( v17 == 2 ) |
2420 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2421 if ( (!v17 || v17 == 1) | |
816 | 2422 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2423 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2424 } |
2425 v16 = v17 + 1; | |
2426 } | |
2427 while ( v16 < 16 ); | |
2428 LABEL_36: | |
2429 if ( !v4 ) | |
2430 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2431 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2432 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2433 break; | |
2434 case 20: | |
2435 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2436 v20 = this->pInventoryMatrix; |
0 | 2437 do |
2438 { | |
2439 if ( *v20 > 0 ) | |
2440 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2441 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2442 if ( v21 > 0 ) |
2443 { | |
2444 if ( v21 <= 134 ) | |
2445 v46[v4++] = v19; | |
2446 } | |
2447 } | |
2448 ++v19; | |
2449 ++v20; | |
2450 } | |
2451 while ( v19 < 126 ); | |
2452 if ( !v4 ) | |
2453 goto LABEL_87; | |
2454 v47 = (unsigned __int8)v46[rand() % v4]; | |
2455 v6 = GetActualAccuracy(); | |
2456 LABEL_46: | |
1036 | 2457 v7 = GetParameterBonus(v6); |
0 | 2458 LABEL_47: |
2459 v11 = v7; | |
2460 break; | |
2461 default: | |
2462 v11 = 0; | |
2463 break; | |
2464 } | |
2465 v22 = GetActualLuck(); | |
1036 | 2466 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2467 if ( rand() % v23 >= 30 ) |
2468 { | |
2469 LABEL_87: | |
2470 result = 0; | |
2471 } | |
2472 else | |
2473 { | |
2474 switch ( a2 ) | |
2475 { | |
2476 case 1: | |
2477 v41 = 1; | |
2478 v36 = 0; | |
2479 goto LABEL_56; | |
2480 case 2: | |
2481 v41 = 1; | |
2482 v36 = 1; | |
2483 goto LABEL_56; | |
2484 case 3: | |
2485 v41 = 1; | |
2486 v36 = 2; | |
2487 goto LABEL_56; | |
2488 case 23: | |
2489 v41 = 1; | |
2490 v36 = 3; | |
2491 goto LABEL_56; | |
2492 case 4: | |
2493 v41 = 1; | |
2494 v36 = 4; | |
2495 LABEL_56: | |
2496 SetCondition(v36, v41); | |
2497 v42 = 0; | |
2498 v37 = 0; | |
2499 v35 = 0; | |
2500 v34 = 0; | |
2501 v33 = -1; | |
2502 v32 = 0; | |
2503 v31 = 0; | |
2504 v30 = (SoundID)221; | |
2505 goto LABEL_83; | |
2506 case 5: | |
2507 v43 = 1; | |
2508 v38 = 5; | |
2509 goto LABEL_70; | |
2510 case 6: | |
2511 case 7: | |
2512 case 8: | |
2513 if ( a2 == 6 ) | |
2514 { | |
2515 v44 = 6; | |
2516 goto LABEL_60; | |
2517 } | |
2518 v25 = 2 * (a2 != 8) + 8; | |
2519 goto LABEL_65; | |
2520 case 9: | |
2521 if ( a2 == 6 ) | |
2522 { | |
2523 v44 = 7; | |
2524 LABEL_60: | |
2525 v24 = v44; | |
2526 } | |
2527 else | |
2528 { | |
2529 v25 = 2 * (a2 != 8) + 9; | |
2530 LABEL_65: | |
2531 v24 = v25; | |
2532 } | |
2533 SetCondition(v24, 1); | |
2534 v42 = 0; | |
2535 v37 = 0; | |
2536 v35 = 0; | |
2537 v34 = 0; | |
2538 v33 = -1; | |
2539 v32 = 0; | |
2540 v31 = 0; | |
2541 v30 = (SoundID)222; | |
2542 LABEL_83: | |
2543 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
2544 do | |
2545 { | |
2546 LABEL_84: | |
2547 if ( v5 == pPlayers[v3 + 1] ) | |
2548 break; | |
2549 ++v3; | |
2550 } | |
2551 while ( v3 < 4 ); | |
2552 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
2553 result = 1; | |
2554 break; | |
2555 case 12: | |
2556 v43 = 1; | |
2557 v38 = 12; | |
2558 goto LABEL_70; | |
2559 case 15: | |
2560 v45 = 1; | |
2561 v39 = 15; | |
2562 goto LABEL_73; | |
2563 case 13: | |
2564 v43 = 1; | |
2565 v38 = 13; | |
2566 LABEL_70: | |
2567 SetCondition(v38, v43); | |
2568 v42 = 0; | |
2569 v37 = 0; | |
2570 v35 = 0; | |
2571 v34 = 0; | |
2572 v33 = -1; | |
2573 v32 = 0; | |
2574 v31 = 0; | |
2575 v30 = (SoundID)224; | |
2576 goto LABEL_83; | |
2577 case 14: | |
2578 v45 = 1; | |
2579 v39 = 14; | |
2580 goto LABEL_73; | |
2581 case 16: | |
2582 v45 = 1; | |
2583 v39 = 16; | |
2584 LABEL_73: | |
2585 SetCondition(v39, v45); | |
2586 v42 = 0; | |
2587 v37 = 0; | |
2588 v35 = 0; | |
2589 v34 = 0; | |
2590 v33 = -1; | |
2591 v32 = 0; | |
2592 v31 = 0; | |
2593 v30 = (SoundID)225; | |
2594 goto LABEL_83; | |
2595 case 17: | |
2596 case 18: | |
2597 case 19: | |
2598 v26 = v48; | |
2599 if ( *(char *)(v48 + 21) & 2 ) | |
2600 goto LABEL_84; | |
187 | 2601 PlaySound(SPEECH_40, 0); |
0 | 2602 *(int *)(v26 + 20) |= 2u; |
2603 goto LABEL_79; | |
2604 case 20: | |
187 | 2605 PlaySound(SPEECH_40, 0); |
0 | 2606 v27 = pActor->array_000234; |
2607 if ( pActor->array_000234[0].uItemID ) | |
2608 { | |
2609 v27 = &pActor->array_000234[1]; | |
2610 if ( pActor->array_000234[1].uItemID ) | |
2611 goto LABEL_84; | |
2612 } | |
2613 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2614 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 2615 RemoveItemAtInventoryIndex(v28); |
2616 LABEL_79: | |
2617 v42 = 0; | |
2618 v37 = 0; | |
2619 v35 = 0; | |
2620 v34 = 0; | |
2621 v33 = -1; | |
2622 v32 = 0; | |
2623 v31 = 0; | |
2624 v30 = (SoundID)47; | |
2625 goto LABEL_83; | |
2626 case 21: | |
187 | 2627 PlaySound(SPEECH_42, 0); |
0 | 2628 ++v5->sAgeModifier; |
2629 goto LABEL_82; | |
2630 case 22: | |
187 | 2631 PlaySound(SPEECH_41, 0); |
0 | 2632 v5->sMana = 0; |
2633 LABEL_82: | |
2634 v42 = 0; | |
2635 v37 = 0; | |
2636 v35 = 0; | |
2637 v34 = 0; | |
2638 v33 = -1; | |
2639 v32 = 0; | |
2640 v31 = 0; | |
2641 v30 = (SoundID)226; | |
2642 goto LABEL_83; | |
2643 default: | |
2644 goto LABEL_87; | |
2645 } | |
2646 } | |
2647 return result; | |
2648 } | |
324 | 2649 |
0 | 2650 // 48DCF6: using guessed type char var_94[140]; |
2651 | |
2652 //----- (0048E1A3) -------------------------------------------------------- | |
2653 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
2654 { | |
1091 | 2655 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 2656 } |
2657 | |
2658 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 2659 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
2660 { | |
2661 ItemGen *weapon = nullptr; | |
2662 ItemDesc *weapon_desc = nullptr; | |
2663 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
2664 if (bRangedAttack) | |
0 | 2665 { |
2666 if ( !HasItemEquipped(EQUIP_BOW) ) | |
2667 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2668 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 2669 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2670 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
2671 goto LABEL_17; | |
2672 } | |
2673 else if ( IsUnarmed() == 1 ) | |
2674 { | |
2675 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
2676 { | |
2677 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 2678 goto LABEL_17; |
2679 } | |
2680 } | |
816 | 2681 |
2682 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
2683 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2684 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 2685 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2686 if (weapon_desc->uEquipType == EQUIP_WAND) | |
2687 { | |
2688 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
2689 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
2690 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
2691 } | |
0 | 2692 else |
816 | 2693 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
2694 } | |
1010 | 2695 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2696 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 2697 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2698 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2699 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
2700 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
2701 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2702 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2703 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
2704 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
2705 } | |
2706 } | |
2707 | |
0 | 2708 LABEL_17: |
816 | 2709 uint armour_recovery = 0; |
0 | 2710 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
2711 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2712 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 2713 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
2714 | |
2715 float armour_recovery_multipliers[4]; | |
2716 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
2717 { | |
2718 armour_recovery_multipliers[0] = 1.0f; | |
2719 armour_recovery_multipliers[1] = 0; | |
2720 armour_recovery_multipliers[2] = 0; | |
2721 armour_recovery_multipliers[3] = 0; | |
2722 } | |
2723 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
2724 { | |
2725 armour_recovery_multipliers[0] = 1.0f; | |
2726 armour_recovery_multipliers[1] = 0.5f; | |
2727 armour_recovery_multipliers[2] = 0; | |
2728 armour_recovery_multipliers[3] = 0; | |
2729 } | |
2730 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
2731 { | |
2732 armour_recovery_multipliers[0] = 1.0f; | |
2733 armour_recovery_multipliers[1] = 0.5f; | |
2734 armour_recovery_multipliers[2] = 0.5f; | |
2735 armour_recovery_multipliers[3] = 0; | |
0 | 2736 } |
2737 else | |
2738 { | |
1545 | 2739 Error("Unknown armour type"); // what kind of armour is that? |
816 | 2740 armour_recovery_multipliers[0] = 1.0f; |
2741 armour_recovery_multipliers[1] = 1.0f; | |
2742 armour_recovery_multipliers[2] = 1.0f; | |
2743 armour_recovery_multipliers[3] = 1.0f; | |
2744 } | |
2745 | |
2746 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
2747 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
2748 } | |
2749 | |
2750 uint shield_recovery = 0; | |
2751 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
2752 { | |
2753 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
2754 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2755 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 2756 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
2757 | |
2758 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
2759 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
2760 } | |
2761 | |
1036 | 2762 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 2763 sword_axe_bow_recovery_reduction = 0; |
2764 bool shooting_laser = false; | |
2765 if (weapon_desc) | |
2766 { | |
2767 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
2768 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
2769 { | |
2770 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
2771 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
2772 } | |
2773 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
2774 shooting_laser = true; | |
2775 } | |
2776 | |
2777 uint armsmaster_recovery_reduction = 0; | |
2778 if (!bRangedAttack && !shooting_laser) | |
2779 { | |
2780 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
2781 { | |
2782 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
2783 if (SkillToMastery(armsmaster_level) >= 4) | |
2784 armsmaster_recovery_reduction *= 2; | |
2785 } | |
2786 } | |
2787 | |
2788 uint v41 = 0; | |
2789 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 2790 v41 = 25; |
816 | 2791 |
2792 uint weapon_enchantment_recovery_reduction = 0; | |
2793 if ( weapon ) | |
2794 { | |
2795 if (weapon->uSpecEnchantmentType == 59 || | |
2796 weapon->uSpecEnchantmentType == 41 || | |
2797 weapon->uSpecEnchantmentType == 500) | |
2798 weapon_enchantment_recovery_reduction = 20; | |
2799 } | |
2800 | |
2801 | |
2802 int recovery = weapon_recovery + | |
2803 armour_recovery + | |
2804 shield_recovery | |
2805 - armsmaster_recovery_reduction | |
2806 - weapon_enchantment_recovery_reduction | |
2807 - v41 | |
2808 - sword_axe_bow_recovery_reduction | |
2809 - player_speed_recovery_reduction; | |
2810 | |
2811 if (recovery < 0) | |
2812 recovery = 0; | |
2813 return recovery; | |
0 | 2814 } |
2815 | |
2816 //----- (0048E4F8) -------------------------------------------------------- | |
2817 int Player::GetMaxHealth() | |
2818 { | |
2819 int v3; // esi@1 | |
2820 int v4; // esi@1 | |
2821 int v6; // esi@1 | |
2822 | |
1036 | 2823 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 2824 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 2825 v6 = uFullHealthBonus |
135 | 2826 + pBaseHealthByClass[classType / 4] |
0 | 2827 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
2828 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
2829 if (v6 <= 0) | |
2830 return 1; | |
2831 return v6; | |
2832 } | |
2833 | |
2834 //----- (0048E565) -------------------------------------------------------- | |
2835 int Player::GetMaxMana() | |
2836 { | |
2837 int v2; // eax@2 | |
2838 int v3; // esi@4 | |
2839 int v4; // eax@5 | |
2840 int v5; // esi@5 | |
2841 int v6; // eax@5 | |
2842 int v7; // esi@6 | |
2843 int v8; // esi@6 | |
2844 int v9; // esi@6 | |
2845 int result; // eax@7 | |
1116 | 2846 |
135 | 2847 switch (classType) |
0 | 2848 { |
1116 | 2849 case PLAYER_CLASS_ROGUE: |
2850 case PLAYER_CLASS_SPY: | |
2851 case PLAYER_CLASS_ASSASSIN: | |
2852 case PLAYER_CLASS_ARCHER: | |
2853 case PLAYER_CLASS_WARRIOR_MAGE: | |
2854 case PLAYER_CLASS_MASTER_ARCHER: | |
2855 case PLAYER_CLASS_SNIPER: | |
2856 case PLAYER_CLASS_SORCERER: | |
2857 case PLAYER_CLASS_WIZARD: | |
2858 case PLAYER_CLASS_ARCHMAGE: | |
2859 case PLAYER_CLASS_LICH: | |
0 | 2860 v2 = GetActualIntelligence(); |
1036 | 2861 v3 = GetParameterBonus(v2); |
1116 | 2862 break; |
2863 case PLAYER_CLASS_INITIATE: | |
2864 case PLAYER_CLASS_MASTER: | |
2865 case PLAYER_CLASS_NINJA: | |
2866 case PLAYER_CLASS_PALADIN: | |
2867 case PLAYER_CLASS_CRUSADER: | |
2868 case PLAYER_CLASS_HERO: | |
2869 case PLAYER_CLASS_VILLIAN: | |
2870 case PLAYER_CLASS_CLERIC: | |
2871 case PLAYER_CLASS_PRIEST: | |
2872 case PLAYER_CLASS_PRIEST_OF_SUN: | |
2873 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 2874 v2 = GetActualWillpower(); |
1036 | 2875 v3 = GetParameterBonus(v2); |
1116 | 2876 break; |
2877 case PLAYER_CLASS_HUNTER: | |
2878 case PLAYER_CLASS_RANGER_LORD: | |
2879 case PLAYER_CLASS_BOUNTY_HUNTER: | |
2880 case PLAYER_CLASS_DRUID: | |
2881 case PLAYER_CLASS_GREAT_DRUID: | |
2882 case PLAYER_CLASS_ARCH_DRUID: | |
2883 case PLAYER_CLASS_WARLOCK: | |
0 | 2884 v4 = GetActualWillpower(); |
1036 | 2885 v5 = GetParameterBonus(v4); |
0 | 2886 v6 = GetActualIntelligence(); |
1036 | 2887 v3 = GetParameterBonus(v6) + v5; |
0 | 2888 break; |
2889 default: | |
1116 | 2890 return 0; |
0 | 2891 break; |
2892 } | |
1116 | 2893 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
2894 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
2895 v9 = uFullManaBonus | |
2896 + pBaseManaByClass[classType / 4] | |
2897 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
2898 + v8; | |
2899 return max(0,v9); | |
0 | 2900 } |
2901 | |
2902 //----- (0048E656) -------------------------------------------------------- | |
2903 int Player::GetBaseAC() | |
2904 { | |
2905 Player *v1; // edi@1 | |
2906 int v2; // eax@1 | |
2907 int v3; // esi@1 | |
2908 int v4; // esi@1 | |
2909 int v5; // esi@1 | |
2910 int result; // eax@2 | |
2911 | |
2912 v1 = this; | |
2913 v2 = GetActualSpeed(); | |
1036 | 2914 v3 = GetParameterBonus(v2); |
0 | 2915 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2916 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2917 if ( v5 >= 1 ) | |
2918 result = v5; | |
2919 else | |
2920 result = 0; | |
2921 return result; | |
2922 } | |
2923 | |
2924 //----- (0048E68F) -------------------------------------------------------- | |
2925 int Player::GetActualAC() | |
2926 { | |
2927 Player *v1; // edi@1 | |
2928 int v2; // eax@1 | |
2929 int v3; // esi@1 | |
2930 int v4; // esi@1 | |
2931 int v5; // esi@1 | |
2932 int v6; // esi@1 | |
2933 int result; // eax@2 | |
2934 | |
2935 v1 = this; | |
2936 v2 = GetActualSpeed(); | |
1036 | 2937 v3 = GetParameterBonus(v2); |
0 | 2938 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
2939 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
2940 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
2941 if ( v6 >= 1 ) | |
2942 result = v6; | |
2943 else | |
2944 result = 0; | |
2945 return result; | |
2946 } | |
2947 | |
2948 //----- (0048E6DC) -------------------------------------------------------- | |
2949 unsigned int Player::GetBaseAge() | |
2950 { | |
352 | 2951 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 2952 } |
2953 | |
2954 //----- (0048E72C) -------------------------------------------------------- | |
2955 unsigned int Player::GetActualAge() | |
2956 { | |
2957 return this->sAgeModifier + GetBaseAge(); | |
2958 } | |
2959 | |
2960 //----- (0048E73F) -------------------------------------------------------- | |
2961 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
2962 { | |
2963 Player *v2; // ebx@1 | |
2964 signed int v3; // esi@1 | |
2965 enum CHARACTER_RACE v4; // eax@1 | |
2966 signed int v5; // edi@8 | |
2967 char v6; // zf@9 | |
2968 int v7; // esi@20 | |
2969 int result; // eax@21 | |
2970 signed int v9; // [sp-4h] [bp-10h]@11 | |
2971 | |
2972 v2 = this; | |
2973 v3 = 0; | |
2974 v4 = GetRace(); | |
2975 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
2976 { | |
2977 v5 = 0; | |
2978 goto LABEL_16; | |
2979 } | |
2980 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
2981 { | |
2982 v5 = 1; | |
2983 LABEL_16: | |
2984 v6 = v4 == 2; | |
2985 goto LABEL_17; | |
2986 } | |
2987 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
2988 { | |
2989 v6 = v4 == 3; | |
2990 v5 = 2; | |
2991 goto LABEL_17; | |
2992 } | |
2993 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
2994 { | |
2995 v5 = 3; | |
2996 v6 = v4 == 3; | |
2997 goto LABEL_17; | |
2998 } | |
2999 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3000 { | |
3001 v5 = 7; | |
3002 if ( v4 != 1 ) | |
3003 goto LABEL_20; | |
3004 v9 = 10; | |
3005 LABEL_19: | |
3006 v3 = v9; | |
3007 goto LABEL_20; | |
3008 } | |
3009 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3010 { | |
3011 v5 = 8; | |
3012 v6 = v4 == 0; | |
3013 LABEL_17: | |
3014 if ( !v6 ) | |
3015 goto LABEL_20; | |
3016 v9 = 5; | |
3017 goto LABEL_19; | |
3018 } | |
3019 v5 = 0; | |
3020 LABEL_20: | |
3021 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3022 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3023 result = v7 + *(&v2->sResFireBase + v5); |
3024 return result; | |
3025 } | |
3026 | |
3027 //----- (0048E7D0) -------------------------------------------------------- | |
3028 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3029 { | |
3030 signed int v2; // edi@1 | |
3031 Player *v3; // esi@1 | |
3032 enum CHARACTER_RACE v4; // ebx@1 | |
3033 char v6; // zf@18 | |
3034 int v7; // ebx@28 | |
3035 int result; // eax@28 | |
3036 signed int v9; // [sp+10h] [bp-8h]@1 | |
3037 signed int v10; // [sp+14h] [bp-4h]@1 | |
3038 | |
3039 v2 = 0; | |
3040 v3 = this; | |
3041 v10 = 0; | |
3042 v9 = 0; | |
3043 v4 = GetRace(); | |
652 | 3044 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3045 v10 = 20; |
3046 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3047 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3048 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3049 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3050 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3051 && HasItemEquipped(EQUIP_ARMOUR) | |
3052 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3053 v10 += v3->pActiveSkills[9] & 0x3F; | |
3054 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3055 goto LABEL_25; | |
3056 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3057 { | |
3058 v2 = 1; | |
3059 LABEL_25: | |
3060 v6 = v4 == 2; | |
3061 LABEL_26: | |
3062 if ( v6 ) | |
3063 v9 = 5; | |
3064 goto LABEL_28; | |
3065 } | |
3066 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3067 { | |
3068 v6 = v4 == 3; | |
3069 v2 = 2; | |
3070 goto LABEL_26; | |
3071 } | |
3072 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3073 { | |
3074 v2 = 3; | |
3075 if ( v4 == 3 ) | |
3076 v10 += 5; | |
3077 } | |
3078 else | |
3079 { | |
3080 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3081 { | |
3082 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3083 goto LABEL_28; | |
3084 v2 = 8; | |
3085 v6 = v4 == 0; | |
3086 goto LABEL_26; | |
3087 } | |
3088 v2 = 7; | |
3089 if ( v4 == 1 ) | |
3090 v9 = 10; | |
3091 } | |
3092 LABEL_28: | |
3093 v7 = GetItemsBonus(a2, 0); | |
3094 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3095 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3096 { |
3097 if ( result > 200 ) | |
3098 result = 200; | |
3099 } | |
3100 return result; | |
3101 } | |
3102 | |
3103 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3104 bool Player::Recover(int dt) |
3105 { | |
3106 //Player *v2; // esi@1 | |
0 | 3107 signed __int64 v3; // qax@1 |
816 | 3108 //bool result; // eax@4 |
3109 | |
3110 //v2 = this; | |
3111 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3112 | |
3113 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3114 | |
3115 if (uTimeToRecovery > v3) | |
3116 { | |
3117 uTimeToRecovery -= v3; | |
3118 return true; | |
0 | 3119 } |
3120 else | |
3121 { | |
816 | 3122 uTimeToRecovery = 0; |
3123 viewparams->bRedrawGameUI = true; | |
3124 if (!uActiveCharacter) | |
0 | 3125 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3126 return false; |
3127 } | |
0 | 3128 } |
3129 | |
3130 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3131 void Player::SetRecoveryTime(signed int rec) |
3132 { | |
1545 | 3133 Assert(rec >= 0); |
816 | 3134 |
3135 if (rec > uTimeToRecovery) | |
3136 uTimeToRecovery = rec; | |
3137 | |
3138 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3139 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3140 |
3141 viewparams->bRedrawGameUI = true; | |
0 | 3142 } |
3143 // 50C0C4: using guessed type int some_active_character; | |
3144 | |
3145 //----- (0048E9B7) -------------------------------------------------------- | |
3146 void Player::RandomizeName() | |
3147 { | |
3148 if (!uExpressionTimePassed) | |
3149 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3150 } | |
3151 | |
3152 //----- (0048E9F4) -------------------------------------------------------- | |
3153 unsigned int Player::GetMajorConditionIdx() | |
3154 { | |
3155 for (uint i = 0; i < 18; ++i) | |
3156 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3157 return pConditionImportancyTable[i]; | |
3158 | |
3159 return 18; | |
3160 } | |
3161 | |
3162 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3163 int Player::GetParameterBonus( int player_parameter ) |
3164 { | |
3165 int i; // eax@1 | |
3166 i = 0; | |
3167 while (param_to_bonus_table[i]) | |
3168 { | |
3169 if (player_parameter >= param_to_bonus_table[i]) | |
3170 break; | |
3171 ++i; | |
3172 } | |
3173 return parameter_to_bonus_value[i]; | |
0 | 3174 } |
3175 | |
3176 //----- (0048EA46) -------------------------------------------------------- | |
3177 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3178 { | |
1032 | 3179 int inv_indx; // eax@3 |
3180 | |
3181 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3182 { | |
3183 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3184 continue; | |
3185 inv_indx = pEquipment.pIndices[i] - 1; | |
3186 if (a2==17) | |
3187 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3188 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3189 return 50; |
3190 } | |
3191 if (a2==24) | |
3192 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3193 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3194 return 5; |
3195 } | |
3196 } | |
3197 return 0; | |
0 | 3198 } |
3199 | |
3200 //----- (0048EAAE) -------------------------------------------------------- | |
3201 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3202 { | |
3203 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3204 // signed int v4; // eax@1 |
0 | 3205 int v5; // edi@1 |
3206 Player *v6; // ebx@1 | |
3207 Player *v8; // ecx@48 | |
3208 int v9; // eax@49 | |
3209 int v10; // edx@49 | |
3210 Player *v11; // ecx@55 | |
3211 int v12; // eax@56 | |
3212 int v13; // edx@56 | |
3213 int v14; // ecx@58 | |
3214 int v15; // eax@58 | |
3215 Player *v16; // ecx@61 | |
3216 int v17; // eax@62 | |
3217 Player *v18; // ecx@66 | |
3218 int v19; // eax@67 | |
3219 int v20; // eax@69 | |
3220 Player *v21; // ecx@75 | |
3221 int v22; // eax@76 | |
3222 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3223 //int v24; // eax@79 |
0 | 3224 int v25; // ecx@80 |
3225 int v26; // edi@80 | |
3226 Player *v27; // ecx@84 | |
3227 int v28; // eax@85 | |
3228 int v29; // edx@85 | |
3229 Player *v30; // ecx@96 | |
3230 int v31; // ebp@97 | |
3231 int v32; // eax@98 | |
3232 unsigned int v33; // eax@100 | |
3233 int v34; // eax@103 | |
3234 char v35; // zf@104 | |
3235 char v36; // zf@107 | |
3236 unsigned __int8 v37; // zf@119 | |
3237 char v38; // sf@119 | |
3238 unsigned __int8 v39; // of@119 | |
3239 char v40; // zf@122 | |
3240 char v41; // zf@145 | |
3241 char v42; // zf@164 | |
3242 char v43; // zf@173 | |
3243 char v44; // zf@189 | |
3244 char v45; // zf@198 | |
3245 char v46; // zf@239 | |
3246 int v47; // eax@268 | |
3247 int v48; // eax@269 | |
3248 int v49; // eax@291 | |
3249 char v50; // zf@295 | |
3250 int v51; // eax@306 | |
3251 int v52; // eax@307 | |
3252 char v53; // zf@312 | |
3253 char v54; // zf@336 | |
3254 char v55; // zf@348 | |
3255 int v56; // eax@365 | |
3256 int v57; // ebx@368 | |
3257 signed int v58; // [sp-4h] [bp-20h]@10 | |
3258 signed int v59; // [sp-4h] [bp-20h]@71 | |
3259 signed int v60; // [sp-4h] [bp-20h]@347 | |
3260 int v61; // [sp+10h] [bp-Ch]@1 | |
3261 int v62; // [sp+14h] [bp-8h]@1 | |
3262 int v63; // [sp+18h] [bp-4h]@101 | |
3263 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3264 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3265 bool no_skills; |
0 | 3266 |
3267 v3 = attr; | |
3268 v5 = 0; | |
3269 v6 = this; | |
3270 v62 = 0; | |
3271 v61 = 0; | |
3272 | |
1040 | 3273 |
3274 no_skills=false; | |
0 | 3275 switch (attr) |
3276 { | |
1040 | 3277 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3278 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3279 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3280 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3281 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3282 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3283 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3284 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3285 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3286 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3287 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3288 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3289 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3290 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3291 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3292 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3293 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3294 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3295 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3296 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3297 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3298 default: | |
3299 no_skills=true; | |
0 | 3300 } |
1040 | 3301 if (!no_skills) |
0 | 3302 { |
1040 | 3303 if ( !this->pActiveSkills[v58] ) |
3304 return 0; | |
0 | 3305 } |
1040 | 3306 |
0 | 3307 if ( (signed int)attr > 28 ) |
3308 { | |
3309 if ( (signed int)attr < 29 ) | |
3310 return v5 + v62 + v61; | |
1040 | 3311 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3312 { |
3313 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3314 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3315 return v5 + v62 + v61; |
3316 } | |
1040 | 3317 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3318 { |
3319 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3320 return v5 + v62 + v61; | |
1040 | 3321 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3322 v5 = pItemsTable->pItems[v57].uDamageMod; |
3323 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3324 v5 += v56; |
3325 return v5 + v62 + v61; | |
3326 } | |
3327 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3328 { |
3329 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3330 return v5 + v62 + v61; | |
1040 | 3331 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3332 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3333 LABEL_365: | |
3334 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3335 LABEL_366: | |
3336 v5 += v56; | |
3337 return v5 + v62 + v61; | |
3338 } | |
3339 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3340 return v5 + v62 + v61; | |
3341 LABEL_95: | |
3342 v65 = 0; | |
3343 while ( 1 ) | |
3344 { | |
3345 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3346 goto LABEL_361; | |
898 | 3347 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3348 if ( v3 == 9 ) |
3349 { | |
816 | 3350 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3351 if ( v32 >= 3 ) |
3352 { | |
3353 if ( v32 <= 11 ) | |
3354 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3355 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3356 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3357 } | |
3358 } | |
3359 } | |
3360 v63 = (int)((char *)v6 + 36 * v31); | |
3361 attra = (ItemGen *)(v63 + 532); | |
377 | 3362 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3363 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3364 { |
3365 v34 = attra->uItemID; | |
3366 switch ( attra->uItemID ) | |
3367 { | |
3368 case 0x1F4u: | |
3369 v35 = v3 == 5; | |
3370 goto LABEL_105; | |
3371 case 0x1F5u: | |
3372 v36 = v3 == 0; | |
3373 goto LABEL_108; | |
3374 case 0x1F6u: | |
3375 if ( v3 == 21 ) | |
3376 v61 += 10; | |
3377 v36 = v3 == 2; | |
3378 goto LABEL_108; | |
3379 case 0x1F7u: | |
3380 if ( v3 == 17 ) | |
3381 v61 += 5; | |
3382 if ( v3 == 18 ) | |
3383 v61 += 5; | |
3384 v36 = v3 == 6; | |
3385 goto LABEL_108; | |
3386 case 0x1F8u: | |
3387 goto LABEL_118; | |
3388 case 0x1F9u: | |
3389 v40 = v3 == 3; | |
3390 goto LABEL_123; | |
3391 case 0x1FAu: | |
3392 v35 = v3 == 10; | |
3393 goto LABEL_105; | |
3394 case 0x1FEu: | |
3395 v35 = v3 == 4; | |
3396 goto LABEL_105; | |
3397 case 0x1FFu: | |
3398 if ( v3 == 23 ) | |
3399 v61 += 10; | |
3400 if ( v3 == 22 ) | |
3401 v61 += 10; | |
3402 goto LABEL_361; | |
3403 case 0x200u: | |
3404 if ( v3 == 36 ) | |
3405 { | |
3406 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3407 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3408 } | |
3409 v36 = v3 == 5; | |
3410 LABEL_108: | |
3411 if ( v36 ) | |
3412 v5 += 40; | |
3413 goto LABEL_361; | |
3414 case 0x201u: | |
3415 if ( v3 == 39 ) | |
3416 { | |
3417 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3418 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3419 v62 = v34; | |
3420 } | |
3421 goto LABEL_136; | |
3422 case 0x202u: | |
3423 if ( !v3 ) | |
3424 v5 += 150; | |
3425 if ( v3 == 1 ) | |
3426 v5 -= 40; | |
3427 if ( v3 == 2 ) | |
3428 v5 -= 40; | |
3429 goto LABEL_145; | |
3430 case 0x203u: | |
3431 if ( v3 == 42 ) | |
3432 { | |
3433 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3434 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3435 } | |
3436 if ( v3 == 43 ) | |
3437 v61 += 15; | |
3438 goto LABEL_361; | |
3439 case 0x204u: | |
3440 if ( v3 == 17 ) | |
3441 v61 += 5; | |
3442 if ( v3 == 18 ) | |
3443 v61 += 5; | |
3444 if ( v3 == 6 ) | |
3445 v5 += 50; | |
3446 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3447 goto LABEL_166; | |
3448 v42 = v3 == 15; | |
3449 goto LABEL_165; | |
3450 case 0x205u: | |
3451 if ( v3 == 18 ) | |
3452 v61 += 5; | |
3453 goto LABEL_361; | |
3454 case 0x206u: | |
3455 if ( !v3 ) | |
3456 v5 += 100; | |
3457 if ( v3 == 3 ) | |
3458 v5 += 100; | |
3459 v43 = v3 == 9; | |
3460 goto LABEL_174; | |
3461 case 0x207u: | |
3462 if ( v3 == 45 ) | |
3463 v61 += 5; | |
3464 if ( v3 == 15 ) | |
3465 v5 -= 10; | |
3466 v42 = v3 == 14; | |
3467 LABEL_165: | |
3468 if ( v42 ) | |
3469 LABEL_166: | |
3470 v5 -= 10; | |
3471 goto LABEL_361; | |
3472 case 0x208u: | |
3473 v35 = v3 == 3; | |
3474 goto LABEL_105; | |
3475 case 0x209u: | |
3476 if ( v3 == 2 ) | |
3477 v5 += 15; | |
3478 if ( !v3 ) | |
3479 v5 += 15; | |
3480 v41 = v3 == 6; | |
3481 goto LABEL_146; | |
3482 case 0x20Au: | |
3483 if ( v3 == 46 ) | |
3484 v61 += 15; | |
3485 v44 = v3 == 3; | |
3486 goto LABEL_190; | |
3487 case 0x20Bu: | |
3488 if ( v3 == 34 ) | |
3489 { | |
3490 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3491 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3492 } | |
3493 if ( v3 == 12 ) | |
3494 v5 += 50; | |
3495 if ( v3 == 2 ) | |
3496 v5 += 30; | |
3497 v45 = v3 == 9; | |
3498 goto LABEL_199; | |
3499 case 0x20Cu: | |
3500 if ( !v3 ) | |
3501 v5 += 75; | |
3502 goto LABEL_145; | |
3503 case 0x20Du: | |
3504 if ( v3 == 5 ) | |
3505 v5 += 50; | |
3506 if ( v3 == 6 ) | |
3507 v5 += 50; | |
3508 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3509 goto LABEL_374; | |
3510 v43 = v3 == 15; | |
3511 LABEL_174: | |
3512 if ( v43 ) | |
3513 LABEL_374: | |
3514 v5 -= 15; | |
3515 goto LABEL_361; | |
3516 case 0x20Eu: | |
3517 if ( v3 == 4 ) | |
3518 v5 += 150; | |
3519 if ( v3 == 44 ) | |
3520 v61 += 5; | |
3521 if ( v3 == 9 ) | |
3522 v5 -= 25; | |
3523 goto LABEL_361; | |
3524 case 0x20Fu: | |
3525 if ( v3 == 39 ) | |
3526 { | |
3527 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3528 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3529 v62 = v34; | |
3530 } | |
3531 if ( v3 == 40 ) | |
3532 { | |
3533 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3534 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3535 } | |
3536 LABEL_145: | |
3537 v41 = v3 == 5; | |
3538 LABEL_146: | |
3539 if ( v41 ) | |
3540 v5 -= 40; | |
3541 goto LABEL_361; | |
3542 case 0x210u: | |
3543 if ( v3 == 38 ) | |
3544 { | |
3545 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3546 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3547 } | |
3548 if ( !v3 ) | |
3549 v5 += 75; | |
3550 v44 = v3 == 11; | |
3551 LABEL_190: | |
3552 if ( v44 ) | |
3553 v5 -= 50; | |
3554 goto LABEL_361; | |
3555 case 0x211u: | |
3556 if ( v3 == 5 ) | |
3557 v5 += 100; | |
3558 if ( v3 == 4 ) | |
3559 v5 += 50; | |
3560 v35 = v3 == 11; | |
3561 LABEL_105: | |
3562 if ( v35 ) | |
3563 v5 += 50; | |
3564 goto LABEL_361; | |
3565 case 0x212u: | |
3566 if ( v3 == 1 ) | |
3567 v5 -= 20; | |
3568 v45 = v3 == 2; | |
3569 LABEL_199: | |
3570 if ( v45 ) | |
3571 v5 -= 20; | |
3572 goto LABEL_361; | |
3573 case 0x214u: | |
3574 if ( v3 == 1 ) | |
3575 v5 += 15; | |
3576 v46 = v3 == 2; | |
3577 goto LABEL_240; | |
3578 case 0x215u: | |
3579 if ( v3 == 5 ) | |
3580 v5 += 15; | |
3581 v46 = v3 == 4; | |
3582 goto LABEL_240; | |
3583 case 0x216u: | |
3584 if ( v3 == 10 ) | |
3585 v5 += 30; | |
3586 if ( !v3 ) | |
3587 v5 += 15; | |
3588 goto LABEL_315; | |
3589 case 0x217u: | |
3590 if ( v3 == 21 ) | |
3591 v61 += 5; | |
3592 if ( !v3 ) | |
3593 v5 += 15; | |
3594 goto LABEL_253; | |
3595 case 0x218u: | |
3596 goto LABEL_253; | |
3597 default: | |
3598 goto LABEL_361; | |
3599 } | |
3600 goto LABEL_361; | |
3601 } | |
3602 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
3603 { | |
3604 if ( (signed int)v3 >= 0 ) | |
3605 { | |
3606 if ( (signed int)v3 <= 15 ) | |
3607 { | |
3608 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
3609 } | |
3610 else | |
3611 { | |
3612 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
3613 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
3614 } | |
3615 } | |
3616 goto LABEL_361; | |
3617 } | |
3618 v34 = *(int *)(v63 + 544); | |
3619 if ( v34 > 48 ) | |
3620 { | |
3621 switch ( v34 ) | |
3622 { | |
3623 case 54: | |
3624 goto LABEL_315; | |
3625 case 49: | |
3626 if ( v3 == 6 ) | |
3627 goto LABEL_121; | |
3628 v50 = v3 == 1; | |
3629 goto LABEL_296; | |
3630 case 51: | |
3631 if ( v3 != 5 && v3 != 1 ) | |
3632 goto LABEL_309; | |
3633 goto LABEL_121; | |
3634 case 52: | |
3635 if ( v3 == 3 ) | |
3636 goto LABEL_121; | |
3637 v50 = v3 == 4; | |
3638 goto LABEL_296; | |
3639 case 53: | |
3640 if ( !v3 ) | |
3641 goto LABEL_121; | |
3642 v50 = v3 == 2; | |
3643 goto LABEL_296; | |
3644 case 55: | |
3645 v46 = v3 == 6; | |
3646 goto LABEL_240; | |
3647 case 56: | |
3648 if ( !v3 ) | |
3649 goto LABEL_351; | |
3650 v53 = v3 == 3; | |
3651 goto LABEL_350; | |
3652 case 57: | |
3653 if ( v3 == 1 ) | |
3654 goto LABEL_351; | |
3655 v53 = v3 == 2; | |
3656 goto LABEL_350; | |
3657 case 50: | |
3658 if ( v3 == 10 ) | |
3659 v5 += 30; | |
3660 goto LABEL_361; | |
3661 case 60: | |
3662 if ( v3 != 23 ) | |
3663 goto LABEL_336; | |
3664 if ( v5 >= 3 ) | |
3665 goto LABEL_361; | |
3666 v5 = 3; | |
3667 LABEL_336: | |
3668 v54 = v3 == 22; | |
3669 goto LABEL_345; | |
3670 case 61: | |
3671 if ( v3 != 17 ) | |
3672 goto LABEL_340; | |
3673 if ( v5 >= 3 ) | |
3674 goto LABEL_361; | |
3675 v5 = 3; | |
3676 LABEL_340: | |
3677 v54 = v3 == 18; | |
3678 goto LABEL_345; | |
3679 case 62: | |
3680 if ( v3 != 19 ) | |
3681 goto LABEL_344; | |
3682 if ( v5 >= 3 ) | |
3683 goto LABEL_361; | |
3684 v5 = 3; | |
3685 LABEL_344: | |
3686 v54 = v3 == 20; | |
3687 LABEL_345: | |
3688 if ( !v54 ) | |
3689 goto LABEL_361; | |
3690 if ( v5 >= 3 ) | |
3691 goto LABEL_361; | |
3692 v60 = 3; | |
3693 goto LABEL_360; | |
3694 case 67: | |
3695 v55 = v3 == 18; | |
3696 goto LABEL_357; | |
3697 case 68: | |
3698 v53 = v3 == 9; | |
3699 goto LABEL_350; | |
3700 case 69: | |
3701 if ( v3 == 11 ) | |
3702 v5 += 20; | |
3703 break; | |
3704 case 70: | |
3705 if ( v3 == 12 ) | |
3706 v5 += 10; | |
3707 v55 = v3 == 16; | |
3708 LABEL_357: | |
3709 if ( v55 && v5 < 2 ) | |
3710 { | |
3711 v60 = 2; | |
3712 LABEL_360: | |
3713 v5 = v60; | |
3714 } | |
3715 break; | |
3716 default: | |
3717 goto LABEL_361; | |
3718 } | |
3719 goto LABEL_361; | |
3720 } | |
3721 if ( v34 == 48 ) | |
3722 { | |
3723 if ( v3 == 9 ) | |
3724 v5 += 5; | |
3725 LABEL_315: | |
3726 v46 = v3 == 3; | |
3727 LABEL_240: | |
3728 if ( v46 ) | |
3729 v5 += 15; | |
3730 goto LABEL_361; | |
3731 } | |
3732 if ( v34 > 32 ) | |
3733 { | |
3734 if ( v34 > 44 ) | |
3735 { | |
3736 v51 = v34 - 45; | |
3737 if ( !v51 ) | |
3738 { | |
3739 if ( v3 == 5 ) | |
3740 goto LABEL_351; | |
3741 v53 = v3 == 4; | |
3742 LABEL_350: | |
3743 if ( v53 ) | |
3744 LABEL_351: | |
3745 v5 += 5; | |
3746 goto LABEL_361; | |
3747 } | |
3748 v52 = v51 - 1; | |
3749 if ( !v52 ) | |
3750 { | |
3751 v40 = v3 == 0; | |
3752 LABEL_123: | |
3753 if ( v40 ) | |
3754 v5 += 25; | |
3755 goto LABEL_361; | |
3756 } | |
3757 if ( v52 == 1 ) | |
3758 { | |
3759 LABEL_309: | |
3760 v50 = v3 == 8; | |
3761 goto LABEL_296; | |
3762 } | |
3763 } | |
3764 else | |
3765 { | |
3766 if ( v34 == 44 ) | |
3767 { | |
3768 v50 = v3 == 7; | |
3769 goto LABEL_296; | |
3770 } | |
3771 v34 -= 33; | |
3772 if ( !v34 ) | |
3773 { | |
3774 if ( v3 != 38 ) | |
3775 goto LABEL_361; | |
3776 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
3777 goto LABEL_138; | |
3778 } | |
3779 --v34; | |
3780 if ( !v34 ) | |
3781 { | |
3782 if ( v3 != 36 ) | |
3783 goto LABEL_361; | |
3784 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3785 goto LABEL_138; | |
3786 } | |
3787 v49 = v34 - 8; | |
3788 if ( !v49 ) | |
3789 { | |
3790 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
3791 ++v5; | |
3792 goto LABEL_361; | |
3793 } | |
3794 if ( v49 == 1 ) | |
3795 { | |
3796 if ( v3 != 3 && v3 != 7 ) | |
3797 { | |
3798 v50 = v3 == 9; | |
3799 LABEL_296: | |
3800 if ( !v50 ) | |
3801 goto LABEL_361; | |
3802 } | |
3803 LABEL_121: | |
3804 v5 += 10; | |
3805 goto LABEL_361; | |
3806 } | |
3807 } | |
3808 } | |
3809 else | |
3810 { | |
3811 if ( v34 == 32 ) | |
3812 { | |
3813 if ( v3 != 39 ) | |
3814 goto LABEL_361; | |
3815 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3816 goto LABEL_138; | |
3817 } | |
3818 if ( v34 > 28 ) | |
3819 { | |
3820 v34 -= 29; | |
3821 if ( v34 ) | |
3822 { | |
3823 --v34; | |
3824 if ( v34 ) | |
3825 { | |
3826 --v34; | |
3827 if ( v34 || v3 != 41 ) | |
3828 goto LABEL_361; | |
3829 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
3830 } | |
3831 else | |
3832 { | |
3833 if ( v3 != 34 ) | |
3834 goto LABEL_361; | |
3835 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3836 } | |
3837 } | |
3838 else | |
3839 { | |
3840 if ( v3 != 37 ) | |
3841 goto LABEL_361; | |
3842 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
3843 } | |
3844 goto LABEL_138; | |
3845 } | |
3846 if ( v34 == 28 ) | |
3847 { | |
3848 LABEL_136: | |
3849 if ( v3 == 42 ) | |
3850 { | |
3851 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3852 LABEL_138: | |
3853 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3854 goto LABEL_361; | |
3855 } | |
3856 } | |
3857 else | |
3858 { | |
3859 v47 = v34 - 1; | |
3860 if ( v47 ) | |
3861 { | |
3862 v48 = v47 - 1; | |
3863 if ( v48 ) | |
3864 { | |
3865 v34 = v48 - 24; | |
3866 if ( v34 ) | |
3867 { | |
3868 --v34; | |
3869 if ( v34 || v3 != 40 ) | |
3870 goto LABEL_361; | |
3871 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
3872 } | |
3873 else | |
3874 { | |
3875 if ( v3 != 35 ) | |
3876 goto LABEL_361; | |
3877 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
3878 } | |
3879 goto LABEL_138; | |
3880 } | |
3881 LABEL_118: | |
3882 if ( (signed int)v3 < 0 ) | |
3883 goto LABEL_361; | |
3884 v39 = __OFSUB__((int)v3, 6); | |
3885 v37 = v3 == 6; | |
3886 v38 = v3 - 6 < 0; | |
3887 } | |
3888 else | |
3889 { | |
3890 LABEL_253: | |
3891 if ( (signed int)v3 < 10 ) | |
3892 goto LABEL_361; | |
3893 v39 = __OFSUB__((int)v3, 15); | |
3894 v37 = v3 == 15; | |
3895 v38 = v3 - 15 < 0; | |
3896 } | |
3897 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
3898 goto LABEL_121; | |
3899 } | |
3900 } | |
3901 LABEL_361: | |
3902 ++v65; | |
3903 if ( (signed int)v65 >= 16 ) | |
3904 return v5 + v62 + v61; | |
3905 } | |
3906 } | |
1040 | 3907 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 3908 { |
3909 if ( IsUnarmed() != 1 ) | |
3910 { | |
816 | 3911 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3912 { | |
3913 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3914 if ( v22 >= 0 ) |
3915 { | |
3916 if ( v22 <= 2 ) | |
3917 { | |
1040 | 3918 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 3919 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 3920 { |
3921 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
3922 v25 = pItemsTable->pItems[v23].uDamageDice; | |
3923 } | |
3924 else | |
3925 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3926 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3927 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 3928 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3929 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 3930 } |
3931 } | |
3932 } | |
1040 | 3933 |
3934 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
3935 { | |
3936 | |
3937 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
3938 if ((v28 < 0) || v28 > 2 ) | |
3939 return v5 + v62 + v61; | |
3940 } | |
1062 | 3941 v15 = pItemsTable->pItems[v23].uDamageMod; |
3942 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 3943 v5 += v15 + v14; |
1049 | 3944 return v5 + v62 + v61; |
0 | 3945 } |
3946 v59 = 3; | |
3947 LABEL_74: | |
3948 v5 = v59; | |
3949 return v5 + v62 + v61; | |
3950 } | |
3951 if ( (signed int)attr < 0 ) | |
3952 return v5 + v62 + v61; | |
1040 | 3953 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 3954 goto LABEL_95; |
1040 | 3955 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
3956 { | |
3957 if ( !Player::HasEnchantedItemEquipped(25) ) | |
3958 return v5 + v62 + v61; | |
3959 v5 = 5; | |
3960 return v5 + v62 + v61; | |
3961 } | |
3962 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 3963 return v5 + v62 + v61; |
1040 | 3964 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 3965 { |
3966 if ( IsUnarmed() == 1 ) | |
3967 { | |
3968 v5 = 0; | |
3969 return v5 + v62 + v61; | |
3970 } | |
816 | 3971 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3972 { | |
3973 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3974 if ( v17 >= 0 ) |
3975 { | |
3976 if ( v17 <= 2 ) | |
1040 | 3977 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 3978 } |
3979 } | |
865 | 3980 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 3981 return v5 + v62 + v61; |
1040 | 3982 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
3983 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3984 v5 += v56; | |
3985 return v5 + v62 + v61; | |
3986 } | |
3987 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 3988 { |
3989 if ( IsUnarmed() == 1 ) | |
3990 { | |
3991 v5 = 1; | |
3992 return v5 + v62 + v61; | |
3993 } | |
816 | 3994 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
3995 { | |
3996 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 3997 if ( v9 >= 0 ) |
3998 { | |
3999 if ( v9 <= 2 ) | |
4000 { | |
1040 | 4001 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4002 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4003 if ( !v6->pEquipment.uShield ) |
0 | 4004 { |
1040 | 4005 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4006 ++v5; |
4007 } | |
4008 } | |
4009 } | |
4010 } | |
1040 | 4011 |
4012 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4013 { | |
4014 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4015 if ((v12 < 0) || v12 > 2 ) | |
4016 return v5 + v62 + v61; | |
4017 } | |
4018 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4019 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4020 LABEL_88: |
4021 v5 += v15 + v14; | |
4022 } | |
4023 return v5 + v62 + v61; | |
4024 } | |
4025 | |
4026 //----- (0048F73C) -------------------------------------------------------- | |
4027 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4028 { | |
4029 int result; // eax@1 | |
4030 int v3; // eax@4 | |
4031 int v4; // ecx@5 | |
4032 | |
4033 switch (a2) | |
4034 { | |
4035 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4036 } | |
4037 | |
4038 result = 0; | |
4039 if ( (signed int)a2 > 10 ) | |
4040 { | |
4041 if ( (signed int)a2 <= 15 ) | |
4042 { | |
4043 switch ( a2 ) | |
4044 { | |
4045 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4046 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4047 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4048 break; |
4049 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4050 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4051 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4052 break; |
4053 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4054 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4055 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4056 break; |
4057 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4058 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4059 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4060 break; |
4061 default: | |
4062 if ( a2 != 14 ) | |
4063 return result; | |
4064 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4065 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4066 break; |
4067 } | |
4068 return v4 + v3; | |
4069 } | |
4070 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4071 { | |
4072 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4073 { | |
4074 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4075 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4076 return v4 + v3; |
4077 } | |
4078 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4079 return result; | |
4080 } | |
4081 return this->pPlayerBuffs[1].uPower; | |
4082 } | |
4083 if ( a2 == 10 ) | |
4084 { | |
4085 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4086 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4087 return v4 + v3; |
4088 } | |
4089 switch ( a2 ) | |
4090 { | |
4091 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4092 v3 = pPlayerBuffs[19].uPower; | |
4093 goto LABEL_5; | |
4094 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4095 v3 = pPlayerBuffs[17].uPower; | |
4096 goto LABEL_5; | |
4097 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4098 v3 = pPlayerBuffs[20].uPower; | |
4099 goto LABEL_5; | |
4100 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4101 v3 = pPlayerBuffs[16].uPower; | |
4102 goto LABEL_5; | |
4103 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4104 v3 = pPlayerBuffs[15].uPower; | |
4105 goto LABEL_5; | |
4106 case CHARACTER_ATTRIBUTE_SPEED: | |
4107 v3 = pPlayerBuffs[21].uPower; | |
4108 goto LABEL_5; | |
4109 case CHARACTER_ATTRIBUTE_LUCK: | |
4110 v3 = pPlayerBuffs[18].uPower; | |
4111 LABEL_5: | |
1167 | 4112 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4113 return v4 + v3; |
4114 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4115 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4116 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4117 return v4 + v3; |
4118 default: | |
4119 return result; | |
4120 } | |
4121 return result; | |
4122 } | |
4123 | |
4124 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4125 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4126 { | |
1064 | 4127 signed int bonus_value; // esi@1 |
4128 unsigned __int16 skill_value; // ax@126 | |
4129 int result; // al@127 | |
353 | 4130 |
1064 | 4131 bonus_value = 0; |
353 | 4132 switch (uSkillType) |
4133 { | |
4134 case PLAYER_SKILL_MONSTER_ID: | |
4135 { | |
652 | 4136 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4137 bonus_value = 6; |
652 | 4138 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4139 bonus_value += 6; |
4140 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4141 } |
4142 break; | |
4143 | |
4144 case PLAYER_SKILL_ARMSMASTER: | |
4145 { | |
652 | 4146 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4147 bonus_value = 2; |
652 | 4148 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4149 bonus_value += 3; |
4150 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4151 } |
4152 break; | |
4153 | |
4154 case PLAYER_SKILL_STEALING: | |
4155 { | |
652 | 4156 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4157 bonus_value = 8; |
4158 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4159 } |
4160 break; | |
4161 | |
4162 | |
4163 case PLAYER_SKILL_ALCHEMY: | |
4164 { | |
652 | 4165 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4166 bonus_value = 4; |
652 | 4167 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4168 bonus_value += 8; |
4169 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4170 } |
4171 break; | |
4172 | |
4173 case PLAYER_SKILL_LEARNING: | |
4174 { | |
652 | 4175 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4176 bonus_value = 10; |
652 | 4177 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4178 bonus_value += 15; |
652 | 4179 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4180 bonus_value += 5; |
4181 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4182 } |
4183 break; | |
4184 | |
4185 case PLAYER_SKILL_UNARMED: | |
4186 { | |
652 | 4187 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4188 bonus_value = 2; |
4189 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4190 } |
4191 break; | |
4192 | |
4193 case PLAYER_SKILL_DODGE: | |
4194 { | |
652 | 4195 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4196 bonus_value = 2; |
4197 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4198 } |
4199 break; | |
4200 | |
4201 case PLAYER_SKILL_BOW: | |
1064 | 4202 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4203 break; |
4204 case PLAYER_SKILL_SHIELD: | |
1064 | 4205 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4206 break; |
4207 | |
4208 case PLAYER_SKILL_EARTH: | |
652 | 4209 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4210 bonus_value = 2; |
652 | 4211 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4212 bonus_value += 3; |
652 | 4213 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4214 bonus_value += 4; |
353 | 4215 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4216 bonus_value += 3; |
4217 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4218 break; |
4219 case PLAYER_SKILL_FIRE: | |
652 | 4220 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4221 bonus_value = 2; |
652 | 4222 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4223 bonus_value += 3; |
652 | 4224 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4225 bonus_value += 4; |
353 | 4226 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4227 bonus_value += 3; |
4228 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4229 break; |
4230 case PLAYER_SKILL_AIR: | |
652 | 4231 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4232 bonus_value = 2; |
652 | 4233 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4234 bonus_value += 3; |
652 | 4235 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4236 bonus_value += 4; |
353 | 4237 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4238 bonus_value += 3; |
4239 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4240 break; |
4241 case PLAYER_SKILL_WATER: | |
652 | 4242 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4243 bonus_value = 2; |
652 | 4244 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4245 bonus_value += 3; |
652 | 4246 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4247 bonus_value += 4; |
353 | 4248 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4249 bonus_value += 3; |
4250 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4251 break; |
4252 case PLAYER_SKILL_SPIRIT: | |
652 | 4253 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4254 bonus_value = 2; |
652 | 4255 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4256 bonus_value += 3; |
652 | 4257 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4258 bonus_value += 4; |
4259 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4260 break; |
4261 case PLAYER_SKILL_MIND: | |
652 | 4262 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4263 bonus_value = 2; |
652 | 4264 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4265 bonus_value += 3; |
652 | 4266 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4267 bonus_value += 4; |
4268 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4269 break; |
4270 case PLAYER_SKILL_BODY: | |
652 | 4271 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4272 bonus_value = 2; |
652 | 4273 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4274 bonus_value += 3; |
652 | 4275 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4276 bonus_value += 4; |
4277 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4278 break; |
4279 case PLAYER_SKILL_LIGHT: | |
1064 | 4280 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4281 break; |
4282 case PLAYER_SKILL_DARK: | |
4283 { | |
1064 | 4284 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4285 } |
4286 break; | |
4287 | |
4288 case PLAYER_SKILL_MERCHANT: | |
4289 { | |
652 | 4290 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4291 bonus_value = 4; |
652 | 4292 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4293 bonus_value += 6; |
652 | 4294 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4295 bonus_value += 3; |
652 | 4296 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4297 bonus_value += 8; |
353 | 4298 } |
4299 break; | |
4300 | |
4301 case PLAYER_SKILL_PERCEPTION: | |
4302 { | |
652 | 4303 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4304 bonus_value = 6; |
652 | 4305 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4306 bonus_value += 5; |
353 | 4307 } |
4308 break; | |
4309 | |
0 | 4310 case PLAYER_SKILL_ITEM_ID: |
1064 | 4311 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4312 break; |
4313 case PLAYER_SKILL_MEDITATION: | |
1064 | 4314 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4315 break; |
0 | 4316 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4317 { |
652 | 4318 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4319 bonus_value = 4; |
652 | 4320 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4321 bonus_value += 6; |
652 | 4322 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4323 bonus_value += 8; |
4324 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4325 } |
4326 break; | |
4327 } | |
4328 | |
1064 | 4329 skill_value = pActiveSkills[uSkillType]; |
4330 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4331 result = bonus_value + skill_value; | |
0 | 4332 else |
1064 | 4333 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4334 return result; |
4335 } | |
4336 | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4337 |
0 | 4338 //----- (0048FC00) -------------------------------------------------------- |
1538 | 4339 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
|
4340 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4341 int armsMasterBonus; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4342 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4343 armsMasterBonus = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4344 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
|
4345 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
|
4346 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4347 int multiplier = 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4348 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
|
4349 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4350 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
|
4351 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4352 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
|
4353 { |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4354 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2); |
1064 | 4355 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4356 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
|
4357 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4358 |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4359 switch(inSkill) |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4360 { |
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
|
4361 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
|
4362 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
|
4363 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4364 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4365 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
|
4366 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
|
4367 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4368 return 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
|
4369 break; |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4370 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
|
4371 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4372 int 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
|
4373 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
|
4374 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
|
4375 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4376 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4377 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
|
4378 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4379 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
|
4380 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
|
4381 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
|
4382 } |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4383 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4384 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
|
4385 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4386 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
|
4387 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
|
4388 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
|
4389 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4390 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
|
4391 { |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
4392 if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].IsBroken())) |
1538 | 4393 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4394 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
|
4395 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
|
4396 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
|
4397 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
|
4398 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
|
4399 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4400 case PLAYER_SKILL_STAFF: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4401 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
|
4402 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
|
4403 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
|
4404 case PLAYER_SKILL_SPEAR: |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4405 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
|
4406 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
|
4407 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
|
4408 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4409 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
|
4410 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4411 case PLAYER_SKILL_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
|
4412 wearingLeather = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4413 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
|
4414 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4415 case PLAYER_SKILL_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
|
4416 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4417 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1); |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4418 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4419 case PLAYER_SKILL_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
|
4420 wearingArmor = true; |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4421 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 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
|
4422 break; |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4423 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4424 ACSum += multiplier * (currArmorSkillLevel & 0x3F); |
1538 | 4425 } |
1539
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4426 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4427 |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4428 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
|
4429 int dodgeMastery = SkillToMastery(dodgeSkillLevel); |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4430 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
|
4431 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
|
4432 { |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4433 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
|
4434 } |
5cf28ec7322d
Player:GetSkillBonus cleanup, added back some brackets, because of var declarations, moved here CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS from GetRangedDamageMin and GetRangedDamageMax
Grumpy7
parents:
1538
diff
changeset
|
4435 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
|
4436 } |
1538 | 4437 break; |
4438 case CHARACTER_ATTRIBUTE_ATTACK: | |
4439 if ( this->IsUnarmed() ) | |
4440 { | |
4441 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4442 if (!unarmedSkill) | |
4443 { | |
4444 return 0; | |
4445 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4446 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2); |
1538 | 4447 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F); |
4448 } | |
4449 for (int i = 0; i < 16; ++i) | |
4450 { | |
4451 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4452 { | |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4453 ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; |
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4454 if ( currItem.uEquipType <= EQUIP_MAIN_HAND) |
1533 | 4455 { |
1547
778916dfa666
Player::GetRangedDamageString fix + some small chnages
Grumpy7
parents:
1539
diff
changeset
|
4456 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; |
1538 | 4457 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); |
4458 if (currItemSkillType == PLAYER_SKILL_BLASTER) | |
4459 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4460 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4461 return multiplier * (currentItemSkillLevel & 0x3F); |
4462 } | |
4463 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) | |
4464 { | |
4465 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
|
4466 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2); |
1538 | 4467 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F); |
4468 } | |
4469 else | |
4470 { | |
4471 return armsMasterBonus + (currentItemSkillLevel & 0x3F); | |
4472 } | |
4473 } | |
4474 } | |
4475 } | |
4476 return 0; | |
4477 break; | |
4478 | |
4479 case CHARACTER_ATTRIBUTE_RANGED_ATTACK: | |
4480 for (int i = 0; i < 16; i++) | |
4481 { | |
4482 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4483 { | |
4484 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; | |
4485 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); | |
4486 if ( currentItemSkillType == PLAYER_SKILL_BOW ) | |
4487 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4488 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1); |
1538 | 4489 return multiplier * (currentItemSkillLevel & 0x3F); |
4490 } | |
4491 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER ) | |
4492 { | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4493 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5); |
1538 | 4494 return multiplier * (currentItemSkillLevel & 0x3F); |
4495 } | |
4496 } | |
4497 } | |
4498 return 0; | |
4499 break; | |
4500 | |
4501 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: | |
4502 if ( this->IsUnarmed() ) | |
4503 { | |
4504 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
4505 if ( !unarmedSkillLevel ) | |
4506 { | |
4507 return 0; | |
4508 } | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4509 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4510 return multiplier * (unarmedSkillLevel & 0x3F); |
4511 } | |
4512 for (int i = 0; i < 16; i++) | |
4513 { | |
4514 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
4515 { | |
4516 int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].uItemID; | |
4517 if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) | |
4518 { | |
4519 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; | |
4520 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); | |
4521 int baseSkillBonus; | |
4522 int multiplier; | |
4523 switch (currItemSkillType) | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4524 { |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4525 case PLAYER_SKILL_STAFF: |
1538 | 4526 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
|
4527 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4528 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
|
4529 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2); |
1538 | 4530 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
|
4531 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4532 else |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4533 { |
1538 | 4534 return armsMasterBonus; |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4535 } |
1538 | 4536 break; |
4537 | |
4538 case PLAYER_SKILL_DAGGER: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4539 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1); |
1538 | 4540 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4541 return armsMasterBonus + baseSkillBonus; | |
4542 break; | |
4543 case PLAYER_SKILL_SWORD: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4544 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0); |
1538 | 4545 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4546 return armsMasterBonus + baseSkillBonus; | |
4547 break; | |
4548 case PLAYER_SKILL_MACE: | |
4549 case PLAYER_SKILL_SPEAR: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4550 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1); |
1538 | 4551 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4552 return armsMasterBonus + baseSkillBonus; | |
4553 break; | |
4554 case PLAYER_SKILL_AXE: | |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4555 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1); |
1538 | 4556 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F); |
4557 return armsMasterBonus + baseSkillBonus; | |
4558 break; | |
1535 | 4559 } |
1533 | 4560 } |
1535 | 4561 } |
1538 | 4562 } |
4563 return 0; | |
1534
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4564 break; |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4565 default: |
d4bc1cb9d953
Player::GetSkillBonus put input value in case, removed labels (introduced a bit of code duplicity)
Grumpy7
parents:
1533
diff
changeset
|
4566 return 0; |
1533 | 4567 } |
1537
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4568 } |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4569 |
1553
b98812ead5d9
Get(skillname) functions cleaned up, using GetMultiplierForSkillLevel instead of nested conditions
Grumpy7
parents:
1552
diff
changeset
|
4570 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
|
4571 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4572 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
|
4573 switch (masteryLvl) |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4574 { |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4575 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
|
4576 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
|
4577 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
|
4578 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
|
4579 } |
1545 | 4580 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
|
4581 return 0; |
fed56133bf8a
Player:GetSkillBonus cleanup, multiplier evaluation moved to a separate function, variable clanup, renaming, scope reduction
Grumpy7
parents:
1536
diff
changeset
|
4582 } |
0 | 4583 //----- (00490109) -------------------------------------------------------- |
4584 // faces are: 0 1 2 3 human males | |
4585 // 4 5 6 7 human females | |
4586 // 8 9 elf males | |
4587 // 10 11 elf females | |
4588 // 12 13 dwarf males | |
4589 // 14 15 dwarf females | |
4590 // 16 17 goblin males | |
4591 // 18 19 goblin females | |
4592 // 20 lich male | |
4593 // 21 lich female | |
4594 // 22 underwater suits (unused) | |
4595 // 23 zombie male | |
4596 // 24 zombie female | |
4597 enum CHARACTER_RACE Player::GetRace() | |
4598 { | |
1014 | 4599 if ( uCurrentFace > 15 ) |
4600 { | |
4601 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 4602 return CHARACTER_RACE_GOBLIN; |
4603 } | |
4604 else | |
4605 { | |
1014 | 4606 if ( uCurrentFace >= 12 ) |
0 | 4607 { |
4608 return CHARACTER_RACE_DWARF; | |
4609 } | |
4610 else | |
4611 { | |
1014 | 4612 |
4613 if ( uCurrentFace <= 7 ) | |
0 | 4614 { |
4615 return CHARACTER_RACE_HUMAN; | |
4616 } | |
4617 else | |
4618 { | |
1014 | 4619 if ( uCurrentFace <= 11 ) |
0 | 4620 return CHARACTER_RACE_ELF; |
4621 } | |
4622 } | |
4623 } | |
4624 return CHARACTER_RACE_HUMAN; | |
4625 } | |
4626 | |
4627 //----- (00490141) -------------------------------------------------------- | |
187 | 4628 PLAYER_SEX Player::GetSexByVoice() |
0 | 4629 { |
4630 signed int result; // eax@1 | |
4631 | |
4632 result = 0; | |
4633 switch ( this->uVoiceID ) | |
4634 { | |
4635 case 0u: | |
4636 case 1u: | |
4637 case 2u: | |
4638 case 3u: | |
4639 case 8u: | |
4640 case 9u: | |
4641 case 0xCu: | |
4642 case 0xDu: | |
4643 case 0x10u: | |
4644 case 0x11u: | |
4645 case 0x14u: | |
4646 case 0x17u: | |
187 | 4647 return SEX_MALE; |
4648 | |
0 | 4649 case 4u: |
4650 case 5u: | |
4651 case 6u: | |
4652 case 7u: | |
4653 case 0xAu: | |
4654 case 0xBu: | |
4655 case 0xEu: | |
4656 case 0xFu: | |
4657 case 0x12u: | |
4658 case 0x13u: | |
4659 case 0x15u: | |
4660 case 0x18u: | |
187 | 4661 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4662 } |
1545 | 4663 Error("(%u)", this->uVoiceID); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4664 return SEX_MALE; |
0 | 4665 } |
4666 | |
4667 //----- (00490188) -------------------------------------------------------- | |
4668 void Player::SetInitialStats() | |
4669 { | |
4670 auto v1 = GetRace(); | |
290 | 4671 uMight = StatTable[v1][0].uBaseValue; |
4672 uIntelligence = StatTable[v1][1].uBaseValue; | |
4673 uWillpower = StatTable[v1][2].uBaseValue; | |
4674 uEndurance = StatTable[v1][3].uBaseValue; | |
4675 uAccuracy = StatTable[v1][4].uBaseValue; | |
4676 uSpeed = StatTable[v1][5].uBaseValue; | |
4677 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 4678 } |
4679 | |
4680 //----- (004901FC) -------------------------------------------------------- | |
1021 | 4681 void Player::SetSexByVoice() |
4682 { | |
4683 switch ( this->uVoiceID) | |
0 | 4684 { |
4685 case 0: | |
4686 case 1: | |
4687 case 2: | |
4688 case 3: | |
4689 case 8: | |
4690 case 9: | |
4691 case 0xC: | |
4692 case 0xD: | |
4693 case 0x10: | |
4694 case 0x11: | |
4695 case 0x14: | |
4696 case 0x17: | |
1021 | 4697 this->uSex = SEX_MALE; |
0 | 4698 break; |
4699 case 4: | |
4700 case 5: | |
4701 case 6: | |
4702 case 7: | |
4703 case 0xA: | |
4704 case 0xB: | |
4705 case 0xE: | |
4706 case 0xF: | |
4707 case 0x12: | |
4708 case 0x13: | |
4709 case 0x15: | |
4710 case 0x18: | |
1021 | 4711 this->uSex = SEX_FEMALE; |
0 | 4712 break; |
4713 default: | |
4714 break; | |
4715 } | |
1021 | 4716 |
0 | 4717 } |
4718 | |
4719 //----- (0049024A) -------------------------------------------------------- | |
135 | 4720 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 4721 { |
4722 sLevelModifier = 0; | |
4723 sAgeModifier = 0; | |
4724 | |
135 | 4725 classType = cls; |
0 | 4726 uLuckBonus = 0; |
4727 uSpeedBonus = 0; | |
4728 uAccuracyBonus = 0; | |
4729 uEnduranceBonus = 0; | |
4730 uWillpowerBonus = 0; | |
4731 uIntelligenceBonus = 0; | |
4732 uMightBonus = 0; | |
4733 uLevel = 1; | |
4734 uExperience = 251 + rand() % 100; | |
4735 uBirthYear = 1147 - rand() % 6; | |
4736 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
4737 memset(_achieved_awards_bits, 0, 64); |
0 | 4738 memset(&spellbook, 0, sizeof(PlayerSpells)); |
4739 | |
4740 for (uint i = 0; i < 37; ++i) | |
4741 { | |
135 | 4742 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 4743 continue; |
4744 | |
4745 pActiveSkills[i] = 1; | |
4746 | |
4747 switch (i) | |
4748 { | |
886 | 4749 case PLAYER_SKILL_FIRE: |
4750 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 4751 |
4752 extern bool all_magic; | |
4753 if ( all_magic == true ) | |
4754 { | |
4755 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
4756 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
4757 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
4758 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
4759 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
4760 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
4761 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
4762 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
4763 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
4764 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
4765 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
4766 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
4767 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 4768 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 4769 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
4770 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
4771 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
4772 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
4773 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
4774 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
4775 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
4776 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
4777 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
4778 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
4779 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4780 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
4781 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
4782 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
4783 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
4784 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 4785 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
4786 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
4787 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 4788 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
4789 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 4790 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
4791 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
4792 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
4793 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
4794 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
4795 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
4796 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
4797 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
4798 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
4799 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
4800 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
4801 } | |
486 | 4802 break; |
886 | 4803 case PLAYER_SKILL_AIR: |
4804 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
4805 break; | |
4806 case PLAYER_SKILL_WATER: | |
4807 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
4808 break; | |
4809 case PLAYER_SKILL_EARTH: | |
4810 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
4811 break; | |
4812 case PLAYER_SKILL_SPIRIT: | |
4813 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
4814 break; | |
4815 case PLAYER_SKILL_MIND: | |
4816 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
4817 break; | |
4818 case PLAYER_SKILL_BODY: | |
4819 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 4820 |
4821 if ( all_magic == true ) | |
4822 { | |
4823 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
4824 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
4825 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
4826 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
4827 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
4828 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
4829 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
4830 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
4831 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
4832 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
4833 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
4834 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 4835 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 4836 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
4837 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
4838 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
4839 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
4840 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
4841 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
4842 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
4843 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
4844 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
4845 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 4846 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 4847 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
4848 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
4849 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
4850 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
4851 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
4852 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
4853 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
4854 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
4855 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
4856 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
4857 } | |
569 | 4858 break; |
886 | 4859 case PLAYER_SKILL_LIGHT: |
4860 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
4861 break; | |
4862 case PLAYER_SKILL_DARK: | |
4863 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
4864 break; | |
0 | 4865 } |
4866 } | |
4867 | |
4868 sHealth = GetMaxHealth(); | |
4869 sMana = GetMaxMana(); | |
4870 } | |
4871 | |
4872 //----- (004903C9) -------------------------------------------------------- | |
821 | 4873 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
4874 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4875 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4876 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4877 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4878 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4879 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4880 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4881 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4882 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4883 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4884 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4885 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4886 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4887 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4888 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4889 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4890 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4891 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4892 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4893 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4894 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4895 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4896 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4897 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4898 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4899 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4900 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4901 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4902 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4903 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4904 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4905 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4906 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4907 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4908 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4909 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4910 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
4911 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4912 |
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
|
4913 return (PLAYER_SKILL_TYPE)37; |
0 | 4914 } |
4915 | |
4916 | |
4917 | |
4918 //----- (0049048D) -------------------------------------------------------- | |
4919 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
4920 void Player::DecreaseAttribute(int eAttribute) | |
4921 { | |
4922 int v2; // eax@1 | |
4923 int pBaseValue; // ecx@1 | |
4924 int pDroppedStep; // ebx@1 | |
4925 int pStep; // esi@1 | |
4926 unsigned __int16 result; // ax@7 | |
4927 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
4928 | |
4929 v2 = eAttribute + 7 * GetRace(); | |
290 | 4930 pBaseValue = StatTable[0][v2].uBaseValue; |
4931 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 4932 uMinValue = pBaseValue - 2; |
290 | 4933 pStep = StatTable[0][v2].uBaseStep; |
1272 | 4934 unsigned short* AttrToChange = nullptr; |
4935 switch ( eAttribute ) | |
4936 { | |
4937 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4938 AttrToChange = &this->uMight; | |
4939 break; | |
4940 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4941 AttrToChange = &this->uIntelligence; | |
4942 break; | |
4943 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4944 AttrToChange = &this->uWillpower; | |
4945 break; | |
4946 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4947 AttrToChange = &this->uEndurance; | |
4948 break; | |
4949 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4950 AttrToChange = &this->uAccuracy; | |
4951 break; | |
4952 case CHARACTER_ATTRIBUTE_SPEED: | |
4953 AttrToChange = &this->uSpeed; | |
4954 break; | |
4955 case CHARACTER_ATTRIBUTE_LUCK: | |
4956 AttrToChange = &this->uLuck; | |
4957 break; | |
4958 } | |
4959 if ( *AttrToChange <= pBaseValue ) | |
4960 pStep = pDroppedStep; | |
4961 if ( *AttrToChange - pStep >= uMinValue ) | |
4962 *AttrToChange -= pStep; | |
0 | 4963 } |
4964 | |
4965 //----- (004905F5) -------------------------------------------------------- | |
1458 | 4966 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute) |
1273 | 4967 void Player::IncreaseAttribute( int eAttribute ) |
4968 { | |
4969 int raceId; // eax@1 | |
4970 int maxValue; // ebx@1 | |
4971 signed int baseStep; // edi@1 | |
4972 signed int tmp; // eax@17 | |
0 | 4973 signed int result; // eax@18 |
1273 | 4974 int baseValue; // [sp+Ch] [bp-8h]@1 |
4975 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
4976 unsigned short* statToChange; | |
4977 | |
4978 raceId = GetRace(); | |
4979 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
4980 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
4981 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
4982 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
4983 PlayerCreation_GetUnspentAttributePointCount(); | |
4984 switch ( eAttribute ) | |
4985 { | |
4986 case 0: | |
4987 statToChange = &this->uMight; | |
4988 break; | |
4989 case 1: | |
4990 statToChange = &this->uIntelligence; | |
4991 break; | |
4992 case 2: | |
4993 statToChange = &this->uWillpower; | |
4994 break; | |
4995 case 3: | |
4996 statToChange = &this->uEndurance; | |
4997 break; | |
4998 case 4: | |
4999 statToChange = &this->uAccuracy; | |
5000 break; | |
5001 case 5: | |
5002 statToChange = &this->uSpeed; | |
5003 break; | |
5004 case 6: | |
5005 statToChange = &this->uLuck; | |
5006 default: | |
1545 | 5007 Error("(%u)", eAttribute); |
1273 | 5008 } |
5009 if ( *statToChange < baseValue ) | |
5010 { | |
5011 tmp = baseStep; | |
5012 baseStep = droppedStep; | |
5013 droppedStep = tmp; | |
5014 } | |
5015 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5016 if ( result >= droppedStep ) | |
5017 { | |
5018 if ( baseStep + *statToChange <= maxValue ) | |
5019 *statToChange += baseStep; | |
5020 } | |
0 | 5021 } |
5022 | |
5023 //----- (0049070F) -------------------------------------------------------- | |
5024 void Player::Zero() | |
5025 { | |
5026 this->sLevelModifier = 0; | |
5027 this->sACModifier = 0; | |
5028 this->uLuckBonus = 0; | |
5029 this->uAccuracyBonus = 0; | |
5030 this->uSpeedBonus = 0; | |
5031 this->uEnduranceBonus = 0; | |
5032 this->uWillpowerBonus = 0; | |
5033 this->uIntelligenceBonus = 0; | |
5034 this->uMightBonus = 0; | |
5035 this->field_100 = 0; | |
5036 this->field_FC = 0; | |
5037 this->field_F8 = 0; | |
5038 this->field_F4 = 0; | |
5039 this->field_F0 = 0; | |
5040 this->field_EC = 0; | |
5041 this->field_E8 = 0; | |
5042 this->field_E4 = 0; | |
5043 this->field_E0 = 0; | |
766 | 5044 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5045 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5046 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5047 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5048 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5049 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5050 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5051 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5052 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5053 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5054 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5055 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5056 this->uFullHealthBonus = 0; |
0 | 5057 } |
5058 | |
5059 //----- (004907E7) -------------------------------------------------------- | |
299 | 5060 unsigned int Player::GetStatColor(int uStat) |
0 | 5061 { |
290 | 5062 int attribute_value; // edx@1 |
1393 | 5063 |
5064 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5065 switch (uStat) |
5066 { | |
5067 case 0: attribute_value = uMight; break; | |
5068 case 1: attribute_value = uIntelligence; break; | |
5069 case 2: attribute_value = uWillpower; break; | |
5070 case 3: attribute_value = uEndurance; break; | |
290 | 5071 case 4: attribute_value = uAccuracy; break; |
5072 case 5: attribute_value = uSpeed; break; | |
0 | 5073 case 6: attribute_value = uLuck; break; |
5074 }; | |
5075 | |
1393 | 5076 if (attribute_value == base_attribute_value) |
5077 return ui_character_stat_default_color; | |
5078 else if (attribute_value > base_attribute_value) | |
5079 return ui_character_stat_buffed_color; | |
0 | 5080 else |
1393 | 5081 return ui_character_stat_debuffed_color; |
0 | 5082 } |
5083 | |
5084 //----- (004908A8) -------------------------------------------------------- | |
5085 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5086 { | |
1014 | 5087 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5088 { | |
1393 | 5089 pConditions[uCondition] = 0i64; |
1014 | 5090 return true; |
0 | 5091 } |
5092 else | |
1014 | 5093 return false; |
0 | 5094 } |
5095 | |
5096 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5097 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5098 { |
5099 Player *v3; // esi@1 | |
5100 signed int v5; // eax@17 | |
5101 int v8; // edx@39 | |
5102 char *v13; // eax@45 | |
5103 signed int v15; // edi@68 | |
5104 int v16; // edx@73 | |
5105 unsigned __int16 v17; // edi@73 | |
5106 unsigned int v18; // eax@73 | |
5107 const char *v22; // eax@84 | |
5108 int scroll_id; // esi@96 | |
5109 int v25; // eax@109 | |
5110 int v26; // eax@113 | |
5111 int new_mana_val; // edi@114 | |
5112 signed __int64 v28; // qax@120 | |
5113 __int64 v30; // edi@137 | |
5114 __int64 v32; // ST3C_4@137 | |
5115 __int64 v34; // ST34_4@137 | |
5116 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5117 const char *v66; // [sp-4h] [bp-30h]@69 | |
5118 signed int v67; // [sp-4h] [bp-30h]@77 | |
5119 const char *v68; // [sp-4h] [bp-30h]@89 | |
5120 char v72; // [sp+20h] [bp-Ch]@68 | |
5121 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5122 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5123 Player *thisb; // [sp+28h] [bp-4h]@1 |
5124 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5125 | |
5126 thisb = this; | |
5127 v3 = &pParty->pPlayers[player_num-1]; | |
5128 v73 = 1; | |
1340 | 5129 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5130 return; |
5131 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5132 { |
1021 | 5133 if ( pParty->pPickedItem.uItemID == 160 ) |
5134 { | |
5135 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5136 } | |
5137 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5138 { |
1021 | 5139 new_mana_val = v3->sMana; |
5140 new_mana_val += 2; | |
5141 if ( new_mana_val > v3->GetMaxMana() ) | |
5142 new_mana_val = v3->GetMaxMana(); | |
5143 v3->PlaySound(SPEECH_36, 0); | |
5144 } | |
5145 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5146 { | |
5147 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5148 v3->PlaySound(SPEECH_36, 0); |
1021 | 5149 |
5150 } | |
5151 else | |
5152 { | |
5153 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5154 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
|
5155 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5156 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5157 return; | |
1019 | 5158 } |
1032 | 5159 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5160 | |
5161 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5162 { | |
5163 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5164 } | |
5165 if ( v73 ) | |
5166 { | |
5167 if ( pParty->bTurnBasedModeOn ) | |
5168 { | |
5169 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5170 thisb->SetRecoveryTime(100); | |
1448 | 5171 pTurnEngine->ApplyPlayerAction(); |
1032 | 5172 } |
5173 else | |
5174 { | |
5175 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5176 } | |
5177 } | |
5178 pMouse->RemoveHoldingItem(); | |
5179 return; | |
5180 | |
1021 | 5181 |
5182 } | |
5183 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5184 { |
1021 | 5185 switch ( pParty->pPickedItem.uItemID ) |
5186 { | |
5187 case 221: //Catalyst | |
5188 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5189 break; | |
5190 case 222: //Cure Wounds | |
5191 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5192 pParty->pPlayers[player_num-1].Heal(v25); | |
5193 v3->PlaySound(SPEECH_36, 0); | |
5194 break; | |
5195 case 223: //Magic Potion | |
5196 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5197 new_mana_val = v3->sMana; | |
5198 new_mana_val += v26; | |
5199 if ( new_mana_val > v3->GetMaxMana() ) | |
5200 new_mana_val = v3->GetMaxMana(); | |
5201 v3->PlaySound(SPEECH_36, 0); | |
5202 break; | |
5203 case 224: //Cure Weakness | |
5204 v3->pConditions[Condition_Weak] = 0i64; | |
5205 v3->PlaySound(SPEECH_36, 0); | |
5206 break; | |
5207 case 225: //Cure Disease | |
5208 v3->pConditions[Condition_Disease3] = 0i64; | |
5209 v3->pConditions[Condition_Disease2] = 0i64; | |
5210 v3->pConditions[Condition_Disease1] = 0i64; | |
5211 v3->PlaySound(SPEECH_36, 0); | |
5212 break; | |
5213 case 226: //Cure Poison | |
5214 v3->pConditions[Condition_Poison3] = 0i64; | |
5215 v3->pConditions[Condition_Poison2] = 0i64; | |
5216 v3->pConditions[Condition_Poison1] = 0i64; | |
5217 v3->PlaySound(SPEECH_36, 0); | |
5218 break; | |
5219 case 227: //Awaken | |
5220 v3->pConditions[Condition_Sleep] = 0i64; | |
5221 v3->PlaySound(SPEECH_36, 0); | |
5222 break; | |
5223 case 228: //Haste | |
5224 if ( !v3->pConditions[Condition_Weak] ) | |
5225 { | |
5226 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5227 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5228 v3->PlaySound(SPEECH_36, 0); | |
5229 } | |
5230 break; | |
5231 case 229: //Heroism | |
5232 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5233 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5234 v3->PlaySound(SPEECH_36, 0); | |
5235 break; | |
5236 case 230: //Bless | |
5237 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5238 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5239 v3->PlaySound(SPEECH_36, 0); | |
5240 break; | |
5241 case 231: //Preservation | |
1032 | 5242 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5243 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5244 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5245 v3->PlaySound(SPEECH_36, 0); | |
5246 break; | |
5247 case 232: //Shield | |
1032 | 5248 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5249 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5250 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5251 v3->PlaySound(SPEECH_36, 0); | |
5252 break; | |
5253 case 234: //Stoneskin | |
5254 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5255 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5256 v3->PlaySound(SPEECH_36, 0); | |
5257 break; | |
5258 case 235: //Water Breathing | |
5259 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5260 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5261 break; | |
5262 case 237: //Remove Fear | |
5263 v3->pConditions[Condition_Fear] = 0i64; | |
5264 v3->PlaySound(SPEECH_36, 0); | |
5265 break; | |
5266 case 238: //Remove Curse | |
5267 v3->pConditions[Condition_Cursed] = 0i64; | |
5268 v3->PlaySound(SPEECH_36, 0); | |
5269 break; | |
5270 case 239: //Cure Insanity | |
5271 v3->pConditions[Condition_Insane] = 0i64; | |
5272 v3->PlaySound(SPEECH_36, 0); | |
5273 break; | |
5274 case 240: //Might Boost | |
1032 | 5275 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5276 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5277 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5278 v3->PlaySound(SPEECH_36, 0); | |
5279 break; | |
5280 case 241: //Intellect Boost | |
1032 | 5281 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5282 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5283 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5284 v3->PlaySound(SPEECH_36, 0); | |
5285 break; | |
5286 case 242: //Personality Boost | |
1032 | 5287 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5288 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5289 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5290 v3->PlaySound(SPEECH_36, 0); | |
5291 break; | |
5292 case 243://Endurance Boost | |
1032 | 5293 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5294 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5295 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5296 v3->PlaySound(SPEECH_36, 0); | |
5297 break; | |
5298 case 244: //Speed Boost | |
1032 | 5299 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5300 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5301 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5302 v3->PlaySound(SPEECH_36, 0); | |
5303 break; | |
5304 case 245: //Accuracy Boost | |
1032 | 5305 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5306 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5307 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5308 v3->PlaySound(SPEECH_36, 0); | |
5309 break; | |
5310 case 251: //Cure Paralysis | |
5311 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5312 v3->PlaySound(SPEECH_36, 0); | |
5313 break; | |
5314 case 252://Divine Restoration | |
5315 v30 = v3->pConditions[Condition_Dead]; | |
5316 v32 = v3->pConditions[Condition_Pertified]; | |
5317 v34 = v3->pConditions[Condition_Eradicated]; | |
5318 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5319 v3->pConditions[Condition_Dead] = v30; | |
5320 v3->pConditions[Condition_Pertified] = v32; | |
5321 v3->pConditions[Condition_Eradicated] = v34; | |
5322 v3->PlaySound(SPEECH_36, 0); | |
5323 break; | |
5324 case 253: //Divine Cure | |
5325 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5326 pParty->pPlayers[player_num-1].Heal(v25); | |
5327 v3->PlaySound(SPEECH_36, 0); | |
5328 break; | |
5329 case 254: //Divine Power | |
5330 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
5331 new_mana_val = v3->sMana; | |
5332 new_mana_val += v26; | |
5333 if ( new_mana_val > v3->GetMaxMana() ) | |
5334 new_mana_val = v3->GetMaxMana(); | |
5335 v3->PlaySound(SPEECH_36, 0); | |
5336 break; | |
5337 case 255: //Luck Boost | |
1032 | 5338 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5339 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5340 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5341 v3->PlaySound(SPEECH_36, 0); | |
5342 break; | |
5343 case 256: //Fire Resistance | |
1032 | 5344 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5345 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5346 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5347 v3->PlaySound(SPEECH_36, 0); | |
1032 | 5348 break; |
1021 | 5349 case 257: //Air Resistance |
1032 | 5350 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5351 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5352 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5353 v3->PlaySound(SPEECH_36, 0); | |
5354 break; | |
5355 case 258: //Water Resistance | |
1032 | 5356 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5357 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5358 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5359 v3->PlaySound(SPEECH_36, 0); | |
5360 break; | |
5361 case 259: //Earth Resistance | |
1032 | 5362 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5363 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5364 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5365 v3->PlaySound(SPEECH_36, 0); | |
5366 break; | |
5367 case 260: //Mind Resistance | |
1032 | 5368 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5369 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5370 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5371 v3->PlaySound(SPEECH_36, 0); | |
5372 break; | |
5373 case 261: //Body Resistance | |
1032 | 5374 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5375 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5376 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5377 v3->PlaySound(SPEECH_36, 0); | |
5378 break; | |
5379 case 262: //Stone to Flesh | |
5380 v3->pConditions[Condition_Pertified] = 0i64; | |
5381 v3->PlaySound(SPEECH_36, 0); | |
5382 break; | |
5383 case 264: //Pure Luck | |
5384 if ( !v3->pure_luck_used ) | |
5385 { | |
5386 v3->uLuck += 50; | |
5387 v3->pure_luck_used = 1; | |
5388 } | |
5389 v3->PlaySound(SPEECH_36, 0); | |
5390 break; | |
5391 case 265: //Pure Speed | |
5392 if ( !v3->pure_speed_used ) | |
5393 { | |
5394 v3->uSpeed += 50; | |
5395 v3->pure_speed_used = 1; | |
5396 } | |
5397 v3->PlaySound(SPEECH_36, 0); | |
5398 break; | |
5399 case 266: //Pure Intellect | |
5400 if ( !v3->pure_intellect_used ) | |
5401 { | |
5402 v3->uIntelligence += 50; | |
5403 v3->pure_intellect_used = 1; | |
5404 } | |
5405 v3->PlaySound(SPEECH_36, 0); | |
5406 break; | |
5407 case 267: //Pure Endurance | |
5408 if ( !v3->pure_endurance_used ) | |
5409 { | |
5410 v3->uEndurance += 50; | |
5411 v3->pure_endurance_used = 1; | |
5412 } | |
5413 v3->PlaySound(SPEECH_36, 0); | |
5414 break; | |
5415 case 268: //Pure Personality | |
5416 if ( !v3->pure_willpower_used ) | |
5417 { | |
5418 v3->uWillpower += 50; | |
5419 v3->pure_willpower_used = 1; | |
5420 } | |
5421 v3->PlaySound(SPEECH_36, 0); | |
5422 break; | |
5423 case 269: //Pure Accuracy | |
5424 if ( !v3->pure_accuracy_used ) | |
5425 { | |
5426 v3->uAccuracy += 50; | |
5427 v3->pure_accuracy_used = 1; | |
5428 } | |
5429 v3->PlaySound(SPEECH_36, 0); | |
5430 break; | |
5431 case 270: //Pure Might | |
5432 if ( !v3->pure_might_used ) | |
5433 { | |
5434 v3->uMight += 50; | |
5435 v3->pure_might_used = 1; | |
5436 } | |
5437 v3->PlaySound(SPEECH_36, 0); | |
5438 break; | |
5439 case 271: //Rejuvenation | |
5440 v3->sAgeModifier = 0; | |
5441 v3->PlaySound(SPEECH_36, 0); | |
5442 break; | |
5443 | |
5444 default: | |
5445 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5446 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
|
5447 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5448 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5449 return; | |
1032 | 5450 } |
5451 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
5452 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5453 { | |
5454 if ( !v73 ) | |
5455 { | |
5456 pMouse->RemoveHoldingItem(); | |
5457 return; | |
5458 } | |
5459 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 5460 } |
1032 | 5461 if ( v73 ) |
5462 { | |
5463 if ( pParty->bTurnBasedModeOn ) | |
5464 { | |
5465 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5466 thisb->SetRecoveryTime(100); | |
1448 | 5467 pTurnEngine->ApplyPlayerAction(); |
1032 | 5468 } |
5469 else | |
5470 { | |
5471 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5472 } | |
5473 } | |
5474 pMouse->RemoveHoldingItem(); | |
5475 return; | |
5476 | |
1021 | 5477 } |
5478 | |
5479 | |
5480 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
5481 { | |
5482 | |
5483 | |
5484 if ( pCurrentScreen == SCREEN_CASTING ) | |
5485 return; | |
5486 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5487 { | |
5488 | |
5489 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5490 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5491 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5492 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5493 return; |
5494 } | |
5495 if ( bUnderwater == 1 ) | |
5496 { | |
1032 | 5497 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
5498 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 5499 return; |
5500 } | |
5501 dword_50C9AC = 1; | |
5502 scroll_id = pParty->pPickedItem.uItemID - 299; | |
5503 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
5504 { | |
5505 pMouse->RemoveHoldingItem(); | |
5506 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
5507 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 5508 pCurrentScreen = SCREEN_GAME; |
5509 viewparams->bRedrawGameUI = 1; | |
5510 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
5511 } | |
5512 else | |
5513 { | |
5514 _720984_unused = pParty->pPickedItem.uItemID; | |
5515 pMouse->RemoveHoldingItem(); | |
5516 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
5517 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
5518 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
5519 { | |
5520 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5521 } | |
5522 } | |
5523 return; | |
5524 } | |
5525 | |
5526 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
5527 | |
5528 { | |
5529 v15 = pParty->pPickedItem.uItemID - 400; | |
5530 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
5531 if ( v72 ) | |
5532 { | |
5533 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5534 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
|
5535 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5536 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5537 return; |
5538 } | |
5539 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
5540 { | |
5541 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5542 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
|
5543 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5544 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5545 return; |
5546 } | |
5547 v16 = v15 % 11 + 1; | |
5548 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
5549 v18 = SkillToMastery(v17) - 1; | |
1032 | 5550 switch (v18) |
5551 { | |
5552 case 0: v67 = 4; break; | |
5553 case 1: v67 = 7; break; | |
5554 case 2: v67 = 10; break; | |
5555 case 3: v67 = 11; break; | |
5556 default: | |
5557 v67 = player_num; | |
5558 } | |
5559 | |
5560 if ( v16 > v67 || !v17 ) | |
1021 | 5561 { |
1032 | 5562 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5563 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
|
5564 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5565 v3->PlaySound((PlayerSpeech)20, 0); |
5566 return; | |
5567 } | |
5568 // v72 = 1; | |
5569 v3->PlaySound(SPEECH_21, 0); | |
5570 v73 = 0; | |
5571 | |
5572 | |
5573 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5574 { | |
5575 if ( !v73 ) | |
1021 | 5576 { |
1032 | 5577 pMouse->RemoveHoldingItem(); |
5578 return; | |
5579 } | |
5580 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5581 } | |
5582 if ( v73 ) | |
5583 { | |
5584 if ( pParty->bTurnBasedModeOn ) | |
5585 { | |
5586 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5587 thisb->SetRecoveryTime(100); | |
1448 | 5588 pTurnEngine->ApplyPlayerAction(); |
1021 | 5589 } |
5590 else | |
5591 { | |
1032 | 5592 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 5593 } |
5594 } | |
1032 | 5595 pMouse->RemoveHoldingItem(); |
5596 return; | |
5597 | |
1021 | 5598 } |
5599 | |
5600 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
5601 | |
5602 { | |
5603 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
5604 { | |
5605 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 5606 v3->PlaySound(SPEECH_37, 0); |
1021 | 5607 return; |
5608 } | |
5609 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5610 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5611 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5612 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5613 return; |
5614 } | |
5615 else | |
1459 | 5616 { |
5617 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp | |
5618 { | |
1021 | 5619 thisa = pParty->uCurrentMonthWeek + 1; |
5620 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 5621 v74 = NULL; |
1021 | 5622 else |
5623 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
5624 switch ( pParty->uCurrentMonth ) | |
5625 { | |
1019 | 5626 case 0: |
1021 | 5627 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5628 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5629 break; |
1019 | 5630 case 1: |
1021 | 5631 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5632 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5633 break; |
1019 | 5634 case 2: |
1021 | 5635 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5636 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5637 break; |
1019 | 5638 case 3: |
1021 | 5639 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5640 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5641 break; |
1019 | 5642 case 4: |
1021 | 5643 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5644 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5645 break; |
1019 | 5646 case 5: |
1021 | 5647 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5648 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5649 break; |
1019 | 5650 case 6: |
1021 | 5651 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5652 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 5653 break; |
1019 | 5654 case 7: |
1021 | 5655 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5656 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 5657 break; |
1019 | 5658 case 8: |
1021 | 5659 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5660 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 5661 break; |
0 | 5662 case 9u: |
1021 | 5663 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5664 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 5665 break; |
1019 | 5666 case 10: |
1021 | 5667 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5668 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 5669 break; |
1019 | 5670 case 11: |
1021 | 5671 v8 = rand() % 6; |
5672 switch (v8) | |
5673 { | |
5674 case 0: | |
5675 v3->sResFireBase += thisa; | |
5676 v13 = pGlobalTXT_LocalizationStrings[87]; | |
5677 break; | |
5678 case 1: | |
5679 v3->sResAirBase += thisa; | |
5680 v13 = pGlobalTXT_LocalizationStrings[6]; | |
5681 break; | |
5682 case 2: | |
5683 v3->sResWaterBase += thisa; | |
5684 v13 = pGlobalTXT_LocalizationStrings[240]; | |
5685 break; | |
5686 case 3: | |
5687 v3->sResEarthBase += thisa; | |
5688 v13 = pGlobalTXT_LocalizationStrings[70]; | |
5689 break; | |
5690 case 4: | |
5691 v3->sResMindBase += thisa; | |
5692 v13 = pGlobalTXT_LocalizationStrings[142]; | |
5693 break; | |
5694 case 5: | |
5695 v3->sResBodyBase += thisa; | |
5696 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 5697 break; |
1021 | 5698 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5699 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 5700 break; |
5701 | |
5702 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5703 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 5704 pMouse->RemoveHoldingItem(); |
1459 | 5705 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); |
1021 | 5706 v3->PlaySound(SPEECH_93, 0); |
1032 | 5707 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5708 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 5709 { |
1021 | 5710 v3->SetCondition(Condition_Eradicated, 0); |
5711 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 5712 } |
1021 | 5713 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
5714 { | |
5715 v3->SetCondition(Condition_Dead, 0); | |
5716 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5717 } | |
5718 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
5719 { | |
5720 v3->SetCondition(Condition_Pertified, 0); | |
5721 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
5722 } | |
1019 | 5723 return; |
1021 | 5724 } |
5725 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
1459 | 5726 { |
1021 | 5727 Party::GiveFood(1u); |
1459 | 5728 pAudioPlayer->PlaySound(SOUND_EatApple, 0, 0, -1, 0, 0, 0, 0); |
5729 } | |
1021 | 5730 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute |
5731 { | |
1459 | 5732 pAudioPlayer->PlaySound(SOUND_PlayLute, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5733 return; |
5734 } | |
5735 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
5736 { | |
1459 | 5737 pAudioPlayer->PlaySound(SOUND_PlayFaeriePipes, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5738 return; |
5739 } | |
5740 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
5741 { | |
1459 | 5742 pAudioPlayer->PlaySound(SOUND_PlayGryphonheartsTrumpet, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5743 return; |
5744 } | |
1032 | 5745 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1459 | 5746 { |
5747 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); | |
5748 v5 = PID(OBJECT_Player, player_num + 49); | |
1021 | 5749 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
5750 v3->AddVariable(VAR_NumSkillPoints, 2); | |
5751 } | |
5752 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
5753 { | |
1459 | 5754 TeleportToNWCDungeon(); |
1021 | 5755 return; |
5756 } | |
0 | 5757 else |
1021 | 5758 { |
5759 | |
5760 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5761 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
|
5762 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 5763 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 5764 return; |
5765 } | |
1032 | 5766 |
0 | 5767 pMouse->RemoveHoldingItem(); |
5768 return; | |
5769 } | |
1021 | 5770 |
5771 } | |
0 | 5772 |
5773 //----- (00449BB4) -------------------------------------------------------- | |
484 | 5774 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 5775 { |
0 | 5776 Player *v3; // esi@1 |
5777 signed int v4; // edi@1 | |
5778 unsigned int v5; // eax@8 | |
5779 int v6; // eax@9 | |
5780 enum CHARACTER_RACE v7; // eax@11 | |
5781 signed int v8; // eax@17 | |
5782 unsigned __int8 v9; // sf@17 | |
5783 unsigned __int8 v10; // of@17 | |
5784 int v11; // eax@19 | |
5785 unsigned int v12; // eax@20 | |
484 | 5786 unsigned int test_bit_value; // eax@25 |
5787 unsigned __int8 our_bit_value; // cl@25 | |
0 | 5788 signed int v15; // ecx@28 |
5789 ItemGen *v16; // eax@28 | |
5790 char v17; // zf@31 | |
5791 int v18; // edi@90 | |
5792 DDM_DLV_Header *v19; // eax@122 | |
5793 char v20; // cl@124 | |
5794 DDM_DLV_Header *v21; // eax@126 | |
5795 unsigned int v22; // edi@129 | |
100 | 5796 Player *v23; // esi@134 |
0 | 5797 ItemGen *v24; // ecx@135 |
5798 signed int v25; // edx@135 | |
5799 ITEM_EQUIP_TYPE v26; // ebx@155 | |
5800 char *v27; // edi@155 | |
5801 int v28; // ebx@161 | |
5802 int v29; // eax@161 | |
5803 | |
469 | 5804 v6 = 0; |
0 | 5805 v3 = this; |
5806 v4 = -1; | |
469 | 5807 if ( VarNum > VAR_AutoNotes ) |
5808 { | |
5809 switch ( VarNum ) | |
0 | 5810 { |
5811 case VAR_Invisible: | |
1167 | 5812 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 5813 return true; |
484 | 5814 return false; |
0 | 5815 case VAR_NumDeaths: |
5816 v4 = pParty->uNumDeaths; | |
469 | 5817 return v4 >= pValue; |
0 | 5818 case VAR_NumBounties: |
5819 v4 = pParty->uNumBountiesCollected; | |
469 | 5820 return v4 >= pValue; |
0 | 5821 case VAR_PrisonTerms: |
5822 v4 = pParty->uNumPrisonTerms; | |
469 | 5823 return v4 >= pValue; |
0 | 5824 case VAR_ArenaWinsPage: |
5825 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 5826 return v4 >= pValue; |
0 | 5827 case VAR_ArenaWinsSquire: |
5828 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 5829 return v4 >= pValue; |
0 | 5830 case VAR_ArenaWinsKnight: |
5831 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 5832 return v4 >= pValue; |
0 | 5833 case VAR_ArenaWinsLord: |
5834 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 5835 return v4 >= pValue; |
0 | 5836 case VAR_ReputationInCurrentLocation: |
5837 v19 = &pOutdoor->ddm; | |
5838 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5839 v19 = &pIndoor->dlv; | |
469 | 5840 v6 = v19->uReputation >= pValue; |
5841 return v6; | |
0 | 5842 case VAR_History_28|VAR_Sex: |
5843 v21 = &pOutdoor->ddm; | |
5844 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5845 v21 = &pIndoor->dlv; | |
469 | 5846 v6 = v21->field_C_alert == pValue; |
0 | 5847 return v6; |
5848 case VAR_MonthEquals2|VAR_Sex: | |
5849 case VAR_MonthEquals2|VAR_Class: | |
5850 case VAR_Counter1: | |
5851 case VAR_Counter2: | |
5852 case VAR_Counter3: | |
5853 case VAR_Counter4: | |
5854 case VAR_Counter5: | |
5855 case VAR_Counter6: | |
5856 case VAR_Counter7: | |
5857 case VAR_Counter8: | |
469 | 5858 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5859 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
5860 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5861 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
5862 return true; | |
5863 return false; | |
0 | 5864 case VAR_NumSkillPoints: |
5865 v4 = this->uSkillPoints; | |
469 | 5866 return v4 >= pValue; |
0 | 5867 case VAR_CircusPrises: |
5868 v4 = 0; | |
100 | 5869 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 5870 do |
5871 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5872 v24 = v23->pInventoryItemList; |
0 | 5873 v25 = 138; |
5874 do | |
5875 { | |
5876 switch ( v24->uItemID ) | |
5877 { | |
5878 case 0x1D6u: | |
5879 ++v4; | |
5880 break; | |
5881 case 0x1D7u: | |
5882 v4 += 3; | |
5883 break; | |
5884 case 0x1DDu: | |
5885 v4 += 5; | |
5886 break; | |
5887 } | |
5888 ++v24; | |
5889 --v25; | |
5890 } | |
5891 while ( v25 ); | |
100 | 5892 ++v23; |
0 | 5893 } |
100 | 5894 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 5895 return v4 >= pValue; |
0 | 5896 case VAR_MonthEquals2: |
469 | 5897 v6 = pParty->uCurrentMonth == pValue; |
5898 return v6; | |
0 | 5899 case VAR_IsFlying: |
5900 if ( pParty->bFlying | |
1167 | 5901 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 5902 return true; |
5903 return false; | |
0 | 5904 case VAR_HiredNPCHasSpeciality: |
469 | 5905 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 5906 return v6; |
5907 case VAR_NPCs2: | |
469 | 5908 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 5909 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 5910 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5911 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 5912 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 5913 return v4 >= pValue; |
5914 v4 = pValue; | |
5915 return v4 >= pValue; | |
0 | 5916 case VAR_ItemEquipped: |
5917 v26 = (ITEM_EQUIP_TYPE)0; | |
5918 v27 = (char *)&this->pEquipment; | |
5919 break; | |
5920 case VAR_GoldInBank: | |
5921 v4 = pParty->uNumGoldInBank; | |
469 | 5922 return v4 >= pValue; |
0 | 5923 case VAR_ThieverySkill|0x80: |
5924 v28 = GetActualMight(); | |
5925 v29 = v3->GetBaseStrength(); | |
5926 goto LABEL_168; | |
5927 case VAR_DisarmTrapSkill|0x80: | |
5928 v28 = GetActualIntelligence(); | |
5929 v29 = v3->GetBaseIntelligence(); | |
5930 goto LABEL_168; | |
5931 case VAR_MonthEquals: | |
5932 v28 = GetActualWillpower(); | |
5933 v29 = v3->GetBaseWillpower(); | |
5934 goto LABEL_168; | |
5935 case VAR_MonthEquals|VAR_Sex: | |
5936 v28 = GetActualEndurance(); | |
5937 v29 = v3->GetBaseEndurance(); | |
5938 goto LABEL_168; | |
5939 case VAR_IdentifyMonsterSkill|0x80: | |
5940 v28 = GetActualSpeed(); | |
5941 v29 = v3->GetBaseSpeed(); | |
5942 goto LABEL_168; | |
5943 case VAR_ArmsmasterSkill|0x80: | |
5944 v28 = GetActualAccuracy(); | |
5945 v29 = v3->GetBaseAccuracy(); | |
5946 goto LABEL_168; | |
5947 case VAR_MonthEquals|VAR_MaxHP: | |
5948 v28 = GetActualLuck(); | |
5949 v29 = v3->GetBaseLuck(); | |
5950 LABEL_168: | |
5951 v10 = __OFSUB__(v28, v29); | |
5952 v9 = v28 - v29 < 0; | |
5953 LABEL_169: | |
5954 if ( v9 ^ v10 ) | |
469 | 5955 return v4 >= pValue; |
5956 return true; | |
0 | 5957 default: |
469 | 5958 return v4 >= pValue; |
0 | 5959 } |
5960 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5961 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 5962 { |
5963 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
5964 v27 += 4; | |
5965 if ( (signed int)v26 >= 16 ) | |
469 | 5966 return false; |
5967 } | |
5968 return true; | |
5969 } | |
5970 if ( VarNum == VAR_AutoNotes ) | |
0 | 5971 { |
1033 | 5972 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
5973 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 5974 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
5975 return false; | |
5976 return true; | |
469 | 5977 } |
5978 if ( VarNum <= VAR_BaseLuck ) | |
5979 { | |
5980 if ( VarNum != VAR_BaseLuck ) | |
5981 { | |
5982 switch ( VarNum ) | |
0 | 5983 { |
5984 case VAR_Hour: | |
469 | 5985 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
5986 return true; | |
5987 return false; | |
0 | 5988 case VAR_DayOfYear: |
469 | 5989 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
5990 v6 = v5 == pValue; | |
5991 return v6; | |
0 | 5992 case VAR_DayOfWeek: |
469 | 5993 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
5994 v6 = v5 == pValue; | |
0 | 5995 return v6; |
5996 case VAR_Sex: | |
469 | 5997 if ( pValue == (CHARACTER_RACE)this->uSex ) |
5998 return true; | |
5999 return v4 >= pValue; | |
0 | 6000 case VAR_Class: |
135 | 6001 v7 = (CHARACTER_RACE)this->classType; |
469 | 6002 if ( pValue == v7 ) |
6003 return true; | |
6004 return v4 >= pValue; | |
0 | 6005 case VAR_Race: |
6006 v7 = GetRace(); | |
469 | 6007 if ( pValue == v7 ) |
6008 return true; | |
6009 return v4 >= pValue; | |
0 | 6010 case VAR_CurrentHP: |
6011 v4 = this->sHealth; | |
469 | 6012 return v4 >= pValue; |
0 | 6013 case VAR_MaxHP: |
6014 v8 = GetMaxHealth(); | |
6015 v10 = __OFSUB__(v3->sHealth, v8); | |
6016 v9 = v3->sHealth - v8 < 0; | |
6017 goto LABEL_169; | |
6018 case VAR_CurrentSP: | |
6019 v4 = this->sMana; | |
469 | 6020 return v4 >= pValue; |
0 | 6021 case VAR_MaxSP: |
6022 v11 = GetMaxMana(); | |
6023 v10 = __OFSUB__(v3->sMana, v11); | |
6024 v9 = v3->sMana - v11 < 0; | |
6025 goto LABEL_169; | |
6026 case VAR_ActualAC: | |
6027 v12 = GetActualAC(); | |
6028 goto _j_cmp_against_arg; | |
6029 case VAR_ACModifier: | |
6030 v4 = this->sACModifier; | |
469 | 6031 return v4 >= pValue; |
0 | 6032 case VAR_BaseLevel: |
6033 v4 = this->uLevel; | |
469 | 6034 return v4 >= pValue; |
0 | 6035 case VAR_LevelModifier: |
6036 v4 = this->sLevelModifier; | |
469 | 6037 return v4 >= pValue; |
0 | 6038 case VAR_Age: |
6039 v12 = GetActualAge(); | |
6040 goto _j_cmp_against_arg; | |
6041 case VAR_Award: | |
1033 | 6042 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6043 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; |
484 | 6044 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6045 return true; | |
6046 return false; | |
0 | 6047 case VAR_Experience: |
6048 v4 = LODWORD(this->uExperience); | |
469 | 6049 return v4 >= pValue; |
0 | 6050 case VAR_QBits_QuestsDone: |
484 | 6051 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6052 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6053 if ( test_bit_value & our_bit_value ) | |
478 | 6054 return true; |
6055 return false; | |
0 | 6056 case VAR_PlayerItemInHands: |
6057 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6058 v16 = v3->pInventoryItemList; |
0 | 6059 break; |
6060 case VAR_FixedGold: | |
6061 v4 = pParty->uNumGold; | |
469 | 6062 return v4 >= pValue; |
0 | 6063 case VAR_MightBonus: |
6064 v4 = this->uMightBonus; | |
469 | 6065 return v4 >= pValue; |
0 | 6066 case VAR_IntellectBonus: |
6067 v4 = this->uIntelligenceBonus; | |
469 | 6068 return v4 >= pValue; |
0 | 6069 case VAR_PersonalityBonus: |
6070 v4 = this->uWillpowerBonus; | |
469 | 6071 return v4 >= pValue; |
0 | 6072 case VAR_EnduranceBonus: |
6073 v4 = this->uEnduranceBonus; | |
469 | 6074 return v4 >= pValue; |
0 | 6075 case VAR_SpeedBonus: |
6076 v4 = this->uSpeedBonus; | |
469 | 6077 return v4 >= pValue; |
0 | 6078 case VAR_AccuracyBonus: |
6079 v4 = this->uAccuracyBonus; | |
469 | 6080 return v4 >= pValue; |
0 | 6081 case VAR_LuckBonus: |
6082 v4 = this->uLuckBonus; | |
469 | 6083 return v4 >= pValue; |
0 | 6084 case VAR_BaseMight: |
6085 v4 = this->uMight; | |
469 | 6086 return v4 >= pValue; |
0 | 6087 case VAR_BaseIntellect: |
6088 v4 = this->uIntelligence; | |
469 | 6089 return v4 >= pValue; |
0 | 6090 case VAR_BasePersonality: |
6091 v4 = this->uWillpower; | |
469 | 6092 return v4 >= pValue; |
0 | 6093 case VAR_BaseEndurance: |
6094 v4 = this->uEndurance; | |
469 | 6095 return v4 >= pValue; |
0 | 6096 case VAR_BaseSpeed: |
6097 v4 = this->uSpeed; | |
469 | 6098 return v4 >= pValue; |
0 | 6099 case VAR_BaseAccuracy: |
6100 v4 = this->uAccuracy; | |
469 | 6101 return v4 >= pValue; |
0 | 6102 case VAR_FixedFood: |
6103 v4 = pParty->uNumFoodRations; | |
469 | 6104 return v4 >= pValue; |
0 | 6105 default: |
469 | 6106 return v4 >= pValue; |
6107 } | |
6108 while ( v16->uItemID != pValue ) | |
0 | 6109 { |
6110 ++v15; | |
6111 ++v16; | |
6112 if ( v15 >= 138 ) | |
6113 { | |
469 | 6114 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6115 return v6; |
6116 } | |
6117 } | |
469 | 6118 return true; |
0 | 6119 } |
6120 v4 = this->uLuck; | |
469 | 6121 return v4 >= pValue; |
6122 } | |
6123 if ( VarNum <= VAR_MagicResistance ) | |
6124 { | |
6125 if ( VarNum == VAR_MagicResistance ) | |
0 | 6126 { |
6127 v4 = this->sResMagicBase; | |
6128 } | |
6129 else | |
6130 { | |
469 | 6131 switch ( VarNum ) |
0 | 6132 { |
6133 case VAR_FireResistance: | |
6134 v4 = this->sResFireBase; | |
469 | 6135 return v4 >= pValue; |
0 | 6136 case VAR_AirResistance: |
6137 v4 = this->sResAirBase; | |
469 | 6138 return v4 >= pValue; |
0 | 6139 case VAR_WaterResistance: |
6140 v4 = this->sResWaterBase; | |
469 | 6141 return v4 >= pValue; |
0 | 6142 case VAR_EarthResistance: |
6143 v4 = this->sResEarthBase; | |
469 | 6144 return v4 >= pValue; |
0 | 6145 case VAR_SpiritResistance: |
6146 v4 = this->sResSpiritBase; | |
469 | 6147 return v4 >= pValue; |
0 | 6148 case VAR_MindResistance: |
6149 v4 = this->sResMindBase; | |
469 | 6150 return v4 >= pValue; |
0 | 6151 case VAR_BodyResistance: |
6152 v4 = this->sResBodyBase; | |
469 | 6153 return v4 >= pValue; |
0 | 6154 case VAR_LightResistance: |
6155 v4 = this->sResLightBase; | |
469 | 6156 return v4 >= pValue; |
0 | 6157 case VAR_DarkResistance: |
6158 v4 = this->sResDarkBase; | |
469 | 6159 return v4 >= pValue; |
0 | 6160 case VAR_ActualMight: |
6161 v12 = GetActualMight(); | |
6162 goto _j_cmp_against_arg; | |
6163 case VAR_ActualIntellect: | |
6164 v12 = GetActualIntelligence(); | |
6165 goto _j_cmp_against_arg; | |
6166 case VAR_ActualPersonality: | |
6167 v12 = GetActualWillpower(); | |
6168 goto _j_cmp_against_arg; | |
6169 case VAR_ActualEndurance: | |
6170 v12 = GetActualEndurance(); | |
6171 goto _j_cmp_against_arg; | |
6172 case VAR_ActualSpeed: | |
6173 v12 = GetActualSpeed(); | |
6174 goto _j_cmp_against_arg; | |
6175 case VAR_ActualAccuracy: | |
6176 v12 = GetActualAccuracy(); | |
6177 goto _j_cmp_against_arg; | |
6178 case VAR_ActualLuck: | |
6179 v12 = GetActualLuck(); | |
6180 _j_cmp_against_arg: | |
6181 v4 = v12; | |
6182 break; | |
6183 default: | |
469 | 6184 return v4 >= pValue; |
6185 } | |
6186 } | |
6187 return v4 >= pValue; | |
6188 } | |
6189 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6190 { | |
6191 if ( VarNum != VAR_DisarmTrapSkill ) | |
6192 { | |
6193 if ( VarNum <= VAR_MindResistanceBonus ) | |
6194 { | |
6195 switch ( VarNum ) | |
0 | 6196 { |
6197 case VAR_MindResistanceBonus: | |
6198 v4 = this->sResMindBonus; | |
6199 break; | |
6200 case VAR_FireResistanceBonus: | |
6201 v4 = this->sResFireBonus; | |
6202 break; | |
6203 case VAR_AirResistanceBonus: | |
6204 v4 = this->sResAirBonus; | |
6205 break; | |
6206 case VAR_WaterResistanceBonus: | |
6207 v4 = this->sResWaterBonus; | |
6208 break; | |
6209 case VAR_EarthResistanceBonus: | |
6210 v4 = this->sResEarthBonus; | |
6211 break; | |
6212 case VAR_SpiritResistanceBonus: | |
6213 v4 = this->sResSpiritBonus; | |
6214 break; | |
6215 } | |
469 | 6216 return v4 >= pValue; |
6217 } | |
6218 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6219 { |
6220 v4 = this->sResBodyBonus; | |
469 | 6221 return v4 >= pValue; |
6222 } | |
6223 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6224 { |
6225 v4 = this->sResLightBonus; | |
469 | 6226 return v4 >= pValue; |
6227 } | |
6228 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6229 { |
6230 v4 = this->sResDarkBonus; | |
469 | 6231 return v4 >= pValue; |
6232 } | |
6233 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6234 { |
6235 v4 = this->sResMagicBonus; | |
469 | 6236 return v4 >= pValue; |
6237 } | |
6238 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6239 return v4 >= pValue; | |
0 | 6240 } |
6241 LABEL_90: | |
469 | 6242 v18 = *((short *)&this->pConditions[16] + VarNum); |
6243 if ( pValue <= 63 ) | |
0 | 6244 v4 = v18 & 0x3F; |
6245 else | |
469 | 6246 v4 = pValue & v18; |
6247 return v4 >= pValue; | |
6248 } | |
6249 if ( VarNum == 104 ) | |
0 | 6250 goto LABEL_90; |
469 | 6251 if ( (signed int)VarNum <= 104 ) |
6252 return v4 >= pValue; | |
6253 if ( (signed int)VarNum > 0x79 ) | |
6254 { | |
6255 if ( VarNum != 122 ) | |
6256 { | |
6257 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6258 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6259 return v4 >= pValue; | |
0 | 6260 } |
6261 v4 = GetMajorConditionIdx(); | |
6262 if ( v4 != 18 ) | |
6263 { | |
469 | 6264 return v4 >= pValue; |
6265 } | |
6266 v4 = pValue; | |
6267 return v4 >= pValue; | |
6268 } | |
1072 | 6269 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6270 } |
6271 | |
6272 | |
6273 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6274 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6275 { | |
6276 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
|
6277 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
|
6278 unsigned int v5_unused; // edi@1 |
0 | 6279 unsigned int v6; // esi@13 |
6280 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
|
6281 signed int v8_unused; // eax@17 |
0 | 6282 ItemGen *v9; // ecx@17 |
6283 int v10; // eax@21 | |
6284 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
|
6285 Player *unused12; // ecx@44 |
0 | 6286 char *v13; // ecx@45 |
6287 Player *v14; // ecx@49 | |
6288 int v15; // ecx@86 | |
6289 int v16; // esi@106 | |
6290 char v17; // al@106 | |
6291 int v18; // eax@107 | |
6292 Player *v19; // ecx@112 | |
6293 Player *v20; // ecx@127 | |
6294 int v21; // eax@127 | |
6295 int v22; // eax@145 | |
6296 char v23; // zf@146 | |
6297 DDM_DLV_Header *v24; // ecx@148 | |
6298 signed int v25; // eax@172 | |
6299 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
|
6300 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
|
6301 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6302 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
|
6303 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
|
6304 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
|
6305 |
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
|
6306 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
|
6307 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
|
6308 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6309 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
|
6310 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6311 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
|
6312 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
|
6313 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6314 } |
1545 | 6315 |
6316 Assert(currPlayerId != -1); | |
492 | 6317 if ( var_type > VAR_AutoNotes ) |
6318 { | |
6319 if ( var_type <= VAR_GoldInBank ) | |
6320 { | |
6321 if ( var_type == VAR_GoldInBank ) | |
6322 { | |
6323 pParty->uNumGoldInBank = var_value; | |
0 | 6324 return; |
6325 } | |
492 | 6326 if ( var_type <= VAR_Counter8 ) |
6327 { | |
6328 if ( (signed int)var_type >= 0xF5 ) | |
0 | 6329 { |
492 | 6330 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
6331 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 6332 } |
6333 else | |
6334 { | |
492 | 6335 switch ( var_type ) |
0 | 6336 { |
6337 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 6338 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 6339 break; |
6340 case VAR_NPCs2: | |
6341 pParty->field_709 = 0; | |
492 | 6342 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 6343 pParty->CountHirelings(); |
6344 viewparams->bRedrawGameUI = true; | |
0 | 6345 break; |
6346 case VAR_NumSkillPoints: | |
492 | 6347 this->uSkillPoints = var_value; |
0 | 6348 break; |
6349 } | |
6350 } | |
6351 return; | |
6352 } | |
492 | 6353 if ( var_type < VAR_Counter9 ) |
0 | 6354 return; |
492 | 6355 if ( (signed int)var_type <= 0x112 ) |
6356 { | |
6357 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
6358 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 6359 } |
6360 else | |
6361 { | |
492 | 6362 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 6363 { |
6364 v24 = &pOutdoor->ddm; | |
6365 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6366 v24 = &pIndoor->dlv; | |
492 | 6367 v24->uReputation = var_value; |
6368 if ( var_value > 10000 ) | |
0 | 6369 v24->uReputation = 10000; |
6370 return; | |
6371 } | |
492 | 6372 if ( var_type <= VAR_ReputationInCurrentLocation |
6373 || var_type > VAR_History_28 | |
6374 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
6375 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
1455 | 6376 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 6377 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 6378 v23) ) |
6379 return; | |
6380 bFlashHistoryBook = 1; | |
6381 } | |
492 | 6382 v25 = 8 * currPlayerId + 400; |
862 | 6383 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
|
6384 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 6385 return; |
6386 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6387 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6388 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6389 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6390 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
|
6391 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6392 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6393 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6394 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6395 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6396 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6397 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6398 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6399 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6400 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6401 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6402 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6403 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6404 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6405 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6406 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6407 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6408 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6409 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6410 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6411 return; |
0 | 6412 } |
492 | 6413 if ( var_type == VAR_AutoNotes ) |
6414 { | |
6415 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
|
6416 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 6417 && pAutonoteTxt[var_value].pText ) |
492 | 6418 { |
6419 v20 = pPlayers[currPlayerId + 1]; | |
187 | 6420 v20->PlaySound(SPEECH_96, 0); |
1453 | 6421 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 6422 bFlashAutonotesBook = 1; |
1453 | 6423 _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
|
6424 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 6425 } |
1453 | 6426 _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
|
6427 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6428 return; |
0 | 6429 } |
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
|
6430 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
|
6431 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6432 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
|
6433 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6434 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
|
6435 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
|
6436 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
|
6437 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
|
6438 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
|
6439 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
|
6440 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6441 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6442 for (int i = 0; i < 138; i++) |
0 | 6443 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6444 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6445 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
|
6446 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
|
6447 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
6448 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
|
6449 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6450 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
|
6451 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6452 *(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
|
6453 } |
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
|
6454 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
|
6455 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
|
6456 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
|
6457 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
|
6458 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
|
6459 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
|
6460 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
|
6461 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
|
6462 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
|
6463 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
|
6464 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
|
6465 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
|
6466 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
|
6467 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
|
6468 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6469 this->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
|
6470 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
|
6471 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6472 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
|
6473 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6474 this->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
|
6475 this->uVoiceID = 20; |
0 | 6476 } |
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
|
6477 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
|
6478 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6479 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
|
6480 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
|
6481 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
|
6482 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6483 case VAR_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
|
6484 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
|
6485 return; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6486 case VAR_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
|
6487 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
|
6488 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6489 case VAR_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
|
6490 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
|
6491 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
|
6492 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
|
6493 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
|
6494 goto LABEL_124; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6495 case VAR_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
|
6496 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
|
6497 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
|
6498 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
|
6499 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
|
6500 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
|
6501 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
|
6502 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
|
6503 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
|
6504 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
|
6505 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
|
6506 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
|
6507 //&& 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
|
6508 && 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
|
6509 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6510 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
|
6511 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6512 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
|
6513 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6514 _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
|
6515 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
|
6516 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
|
6517 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
|
6518 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
|
6519 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
|
6520 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
|
6521 // && (&dword_722F10)[4 * a3] ) |
1310 | 6522 && pQuestTable[var_value] ) |
0 | 6523 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6524 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
|
6525 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
|
6526 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
|
6527 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6528 PlaySoundBasedOnCondition(currPlayerId); |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6529 } |
7ef8ae7ce42a
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 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
|
6531 _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
|
6532 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
|
6533 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
|
6534 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
|
6535 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
|
6536 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
|
6537 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
|
6538 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
|
6539 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
|
6540 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
|
6541 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
|
6542 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
|
6543 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
|
6544 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
|
6545 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
|
6546 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
|
6547 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
|
6548 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
|
6549 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
|
6550 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
|
6551 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
|
6552 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
|
6553 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
|
6554 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
|
6555 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
|
6556 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
|
6557 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
|
6558 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
|
6559 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
|
6560 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
|
6561 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
|
6562 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
|
6563 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
|
6564 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
|
6565 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
|
6566 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
|
6567 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
|
6568 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
|
6569 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
|
6570 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
|
6571 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
|
6572 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
|
6573 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
|
6574 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
|
6575 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
|
6576 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
|
6577 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
|
6578 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6579 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
|
6580 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
|
6581 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
|
6582 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6583 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
|
6584 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
|
6585 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
|
6586 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6587 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6588 case VAR_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
|
6589 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
|
6590 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6591 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6592 case VAR_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
|
6593 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
|
6594 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6595 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6596 case VAR_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
|
6597 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
|
6598 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6599 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6600 case VAR_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
|
6601 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
|
6602 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6603 goto LABEL_112; |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6604 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
|
6605 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
|
6606 } |
0 | 6607 LABEL_111: |
187 | 6608 v26 = SPEECH_91; |
0 | 6609 LABEL_112: |
492 | 6610 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6611 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
|
6612 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6613 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6614 return; |
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 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
|
6617 { |
492 | 6618 switch ( var_type ) |
0 | 6619 { |
1251
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6620 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
|
6621 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
|
6622 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
|
6623 goto LABEL_111; |
0 | 6624 case VAR_ActualIntellect: |
6625 LABEL_68: | |
492 | 6626 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 6627 goto LABEL_111; |
6628 case VAR_ActualPersonality: | |
6629 LABEL_69: | |
492 | 6630 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 6631 goto LABEL_111; |
6632 case VAR_ActualEndurance: | |
6633 LABEL_70: | |
492 | 6634 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 6635 goto LABEL_111; |
6636 case VAR_ActualSpeed: | |
6637 LABEL_71: | |
492 | 6638 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 6639 goto LABEL_111; |
6640 case VAR_ActualAccuracy: | |
6641 LABEL_72: | |
492 | 6642 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 6643 goto LABEL_111; |
6644 case VAR_ActualLuck: | |
6645 LABEL_73: | |
492 | 6646 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 6647 goto LABEL_111; |
6648 case VAR_FireResistance: | |
492 | 6649 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
|
6650 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6651 goto LABEL_112; |
0 | 6652 case VAR_AirResistance: |
492 | 6653 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
|
6654 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6655 goto LABEL_112; |
0 | 6656 case VAR_WaterResistance: |
492 | 6657 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
|
6658 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6659 goto LABEL_112; |
0 | 6660 case VAR_EarthResistance: |
492 | 6661 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
|
6662 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6663 goto LABEL_112; |
0 | 6664 case VAR_SpiritResistance: |
492 | 6665 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
|
6666 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6667 goto LABEL_112; |
0 | 6668 case VAR_MindResistance: |
492 | 6669 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
|
6670 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6671 goto LABEL_112; |
0 | 6672 case VAR_BodyResistance: |
492 | 6673 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
|
6674 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6675 goto LABEL_112; |
0 | 6676 case VAR_LightResistance: |
492 | 6677 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
|
6678 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6679 goto LABEL_112; |
0 | 6680 case VAR_DarkResistance: |
492 | 6681 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
|
6682 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6683 goto LABEL_112; |
0 | 6684 case VAR_MagicResistance: |
492 | 6685 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 6686 v26 = 92; |
6687 goto LABEL_112; | |
6688 default: | |
6689 return; | |
6690 } | |
6691 return; | |
6692 } | |
6693 HIWORD(v15) = 0; | |
492 | 6694 if ( var_type > VAR_DisarmTrapSkill ) |
6695 { | |
6696 if ( var_type != VAR_LearningSkill ) | |
6697 { | |
6698 if ( var_type <= VAR_LearningSkill ) | |
0 | 6699 return; |
492 | 6700 if ( var_type <= VAR_Eradicated ) |
6701 { | |
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
|
6702 this->SetCondition(var_type - 105, 1); |
0 | 6703 } |
6704 else | |
6705 { | |
492 | 6706 if ( var_type != VAR_MajorCondition ) |
0 | 6707 { |
492 | 6708 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
6709 byte_5E4C15[var_type] = var_value; | |
0 | 6710 return; |
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 memset(this, 0, 0xA0u); |
0 | 6713 } |
6714 } | |
6715 else | |
6716 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6717 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
|
6718 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6719 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6720 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6721 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6722 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6723 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6724 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6725 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6726 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
|
6727 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6728 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6729 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6730 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6731 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6732 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
6733 return; |
0 | 6734 } |
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
|
6735 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 6736 { |
6737 switch ( var_type ) | |
0 | 6738 { |
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
|
6739 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
|
6740 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 6741 break; |
6742 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
|
6743 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 6744 break; |
6745 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
|
6746 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 6747 break; |
6748 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
|
6749 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 6750 break; |
6751 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
|
6752 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
|
6753 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6754 case VAR_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
|
6755 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
|
6756 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6757 case VAR_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
|
6758 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
|
6759 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6760 case VAR_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
|
6761 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
|
6762 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
|
6763 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
|
6764 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
|
6765 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
|
6766 case VAR_PhysicalResistanceBonus: |
1545 | 6767 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
|
6768 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
|
6769 break; |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6770 case VAR_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
|
6771 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 6772 break; |
6773 default: | |
1558
30db6d265ceb
Changed the new Assert macro definition slightly, Party::AddItem (for some reason in players.cpp) renamed to Party::AddItemToParty, cleaned up; some unused variables in previous functions removed
Grumpy7
parents:
1555
diff
changeset
|
6774 Error("Unexpected var_type: %u", var_type); |
0 | 6775 return; |
6776 break; | |
6777 } | |
6778 goto LABEL_111; | |
6779 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6780 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
|
6781 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6782 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6783 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6784 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6785 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6786 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6787 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6788 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
|
6789 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6790 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
|
6791 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
|
6792 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
|
6793 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6794 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
6795 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6796 void Player::DrawPlayerBuffAnimBasedOnCondition(int currPlayerId) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6797 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
6798 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
|
6799 } |
0 | 6800 |
6801 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 6802 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 6803 { |
6804 char v3; // bl@1 | |
6805 Player *v4; // esi@1 | |
6806 signed int uPlayerIdx; // edi@1 | |
6807 int v6; // eax@15 | |
6808 unsigned int v7; // esi@18 | |
6809 int *v8; // ebx@21 | |
6810 int v9; // eax@22 | |
6811 signed int v10; // eax@24 | |
6812 int v11; // eax@27 | |
6813 __int16 *v12; // esi@28 | |
6814 Player *v13; // ecx@34 | |
6815 Player *v14; // ecx@36 | |
6816 char *v15; // ecx@37 | |
6817 unsigned __int8 v16; // cf@38 | |
6818 Player *v17; // ecx@42 | |
6819 __int16 *v18; // esi@53 | |
6820 __int16 *v19; // esi@62 | |
6821 char *v20; // esi@107 | |
6822 __int16 v21; // dx@107 | |
6823 int v22; // ecx@107 | |
6824 Player *v23; // ecx@132 | |
6825 int v24; // eax@132 | |
6826 int v25; // eax@150 | |
6827 char v26; // zf@151 | |
6828 DDM_DLV_Header *v27; // eax@153 | |
6829 signed int v28; // eax@176 | |
6830 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 6831 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 6832 int v31; // [sp-4h] [bp-3Ch]@84 |
6833 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
6834 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
6835 char v34; // [sp+37h] [bp-1h]@1 | |
6836 | |
6837 auto Dst = this; | |
6838 v3 = 0; | |
6839 v34 = 0; | |
6840 v4 = Dst; | |
6841 uPlayerIdx = 0; | |
6842 if ( Dst == pPlayers[2] ) | |
6843 uPlayerIdx = 1; | |
310 | 6844 else if ( Dst == pPlayers[3] ) |
6845 uPlayerIdx = 2; | |
6846 else if ( Dst == pPlayers[4] ) | |
6847 uPlayerIdx = 3; | |
6848 | |
6849 if ( var_type <= VAR_AutoNotes ) | |
6850 { | |
6851 if ( var_type != VAR_AutoNotes ) | |
6852 { | |
6853 if ( var_type <= VAR_ActualMight ) | |
6854 { | |
6855 if ( var_type != VAR_ActualMight ) | |
0 | 6856 { |
310 | 6857 switch ( var_type ) |
0 | 6858 { |
6859 case VAR_RandomGold: | |
6860 if ( !val ) | |
6861 val = 1; | |
6862 v6 = rand(); | |
6863 party_finds_gold(v6 % val + 1, 1); | |
6864 GameUI_DrawFoodAndGold(); | |
6865 return; | |
6866 case VAR_RandomFood: | |
6867 if ( !val ) | |
6868 val = 1; | |
6869 v7 = rand() % val + 1; | |
6870 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6871 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
|
6872 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 6873 GameUI_DrawFoodAndGold(); |
6874 goto _play_sound; | |
6875 case VAR_Sex: | |
6876 Dst->uSex = (PLAYER_SEX)val; | |
1507 | 6877 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6878 goto _play_sound; | |
0 | 6879 case VAR_Class: |
135 | 6880 Dst->classType = (PLAYER_CLASS_TYPE)val; |
1507 | 6881 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6882 goto _play_sound; | |
0 | 6883 case VAR_CurrentHP: |
6884 v8 = &Dst->sHealth; | |
6885 *v8 += val; | |
6886 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
1507 | 6887 { |
6888 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6889 goto _play_sound; | |
6890 } | |
0 | 6891 v9 = v4->GetMaxHealth(); |
6892 goto LABEL_23; | |
6893 case VAR_MaxHP: | |
6894 v10 = Dst->GetMaxHealth(); | |
6895 v4->_health_related = 0; | |
6896 v4->uFullHealthBonus = 0; | |
6897 v4->sHealth = v10; | |
6898 return; | |
6899 case VAR_CurrentSP: | |
6900 v8 = &Dst->sMana; | |
6901 *v8 += val; | |
6902 if ( Dst->sMana > GetMaxMana() ) | |
6903 { | |
6904 v9 = v4->GetMaxMana(); | |
6905 LABEL_23: | |
6906 *v8 = v9; | |
6907 } | |
1507 | 6908 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6909 goto _play_sound; | |
0 | 6910 case VAR_MaxSP: |
6911 v11 = GetMaxMana(); | |
6912 v4->_mana_related = 0; | |
6913 v4->uFullManaBonus = 0; | |
6914 v4->sMana = v11; | |
6915 return; | |
6916 case VAR_ACModifier: | |
6917 v12 = &Dst->sACModifier; | |
6918 goto LABEL_29; | |
6919 case VAR_BaseLevel: | |
6920 v12 = (__int16 *)&Dst->uLevel; | |
6921 goto LABEL_29; | |
6922 case VAR_LevelModifier: | |
6923 v12 = &Dst->sLevelModifier; | |
6924 LABEL_29: | |
6925 *v12 += val; | |
6926 if ( *v12 > 255 ) | |
6927 *v12 = 255; | |
1507 | 6928 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6929 goto _play_sound; | |
0 | 6930 case VAR_Age: |
6931 Dst->sAgeModifier += val; | |
6932 return; | |
6933 case VAR_Award: | |
6934 v13 = pPlayers[uPlayerIdx + 1]; | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6935 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) |
521 | 6936 |
492 | 6937 && pAwards[val].pText ) |
0 | 6938 { |
6939 v14 = pPlayers[uPlayerIdx + 1]; | |
6940 v34 = 1; | |
6941 v3 = 1; | |
187 | 6942 v14->PlaySound(SPEECH_96, 0); |
0 | 6943 } |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
6944 v15 = (char *)v4->_achieved_awards_bits; |
1507 | 6945 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6946 if ( v34 != 1 ) | |
6947 { | |
6948 if ( v3 != 1 ) | |
6949 return; | |
6950 goto _play_sound; | |
6951 } | |
6952 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6953 if ( v3 != 1 ) | |
6954 return; | |
6955 goto _play_sound; | |
0 | 6956 case VAR_Experience: |
6957 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
6958 LODWORD(Dst->uExperience) += val; | |
6959 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
6960 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
6961 Dst->uExperience = 4000000000i64; | |
1507 | 6962 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
6963 goto _play_sound; | |
0 | 6964 case VAR_QBits_QuestsDone: |
484 | 6965 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
|
6966 //&& (&dword_722F10)[4 * val] ) |
1310 | 6967 && pQuestTable[val] ) |
0 | 6968 { |
501 | 6969 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 6970 bFlashQuestBook = 1; |
6971 v34 = 1; | |
6972 v3 = 1; | |
501 | 6973 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 6974 } |
484 | 6975 v15 = (char *)pParty->_quest_bits; |
1507 | 6976 _449B7E_toggle_bit((unsigned char *)v15, val, 1); |
6977 if ( v34 != 1 ) | |
6978 { | |
6979 if ( v3 != 1 ) | |
6980 return; | |
6981 goto _play_sound; | |
6982 } | |
6983 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
6984 if ( v3 != 1 ) | |
6985 return; | |
6986 goto _play_sound; | |
0 | 6987 case VAR_PlayerItemInHands: |
6988 item.Reset(); | |
6989 item.Reset(); | |
6990 item.uAttributes = 1; | |
6991 item.uItemID = val; | |
6992 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 6993 pParty->pIsArtifactFound[val-500] = 1; |
0 | 6994 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
6995 { | |
6996 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
6997 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
6998 } | |
6999 pParty->SetHoldingItem(&item); | |
7000 return; | |
7001 case VAR_FixedGold: | |
7002 party_finds_gold(val, 1); | |
7003 return; | |
7004 case VAR_BaseMight: | |
7005 v18 = (__int16 *)&Dst->uMight; | |
7006 goto LABEL_82; | |
7007 case VAR_BaseIntellect: | |
7008 v18 = (__int16 *)&Dst->uIntelligence; | |
7009 goto LABEL_82; | |
7010 case VAR_BasePersonality: | |
7011 v18 = (__int16 *)&Dst->uWillpower; | |
7012 goto LABEL_82; | |
7013 case VAR_BaseEndurance: | |
7014 v18 = (__int16 *)&Dst->uEndurance; | |
7015 goto LABEL_82; | |
7016 case VAR_BaseSpeed: | |
7017 v18 = (__int16 *)&Dst->uSpeed; | |
7018 goto LABEL_82; | |
7019 case VAR_BaseAccuracy: | |
7020 v18 = (__int16 *)&Dst->uAccuracy; | |
7021 goto LABEL_82; | |
7022 case VAR_BaseLuck: | |
7023 v18 = (__int16 *)&Dst->uLuck; | |
7024 goto LABEL_82; | |
7025 case VAR_FixedFood: | |
7026 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7027 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7028 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7029 if ( pParty->uNumFoodRations > 0xFFFF ) |
7030 Party::SetFood(0xFFFFu); | |
7031 goto _play_sound; | |
7032 case VAR_MightBonus: | |
7033 goto LABEL_62; | |
7034 case VAR_IntellectBonus: | |
7035 goto LABEL_66; | |
7036 case VAR_PersonalityBonus: | |
7037 goto LABEL_67; | |
7038 case VAR_EnduranceBonus: | |
7039 goto LABEL_68; | |
7040 case VAR_SpeedBonus: | |
7041 goto LABEL_69; | |
7042 case VAR_AccuracyBonus: | |
7043 goto LABEL_70; | |
7044 case VAR_LuckBonus: | |
7045 goto LABEL_71; | |
7046 default: | |
7047 return; | |
7048 } | |
7049 return; | |
7050 } | |
7051 LABEL_62: | |
7052 v19 = (__int16 *)&Dst->uMightBonus; | |
7053 goto LABEL_113; | |
7054 } | |
310 | 7055 if ( var_type <= VAR_FireResistanceBonus ) |
7056 { | |
7057 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7058 { |
310 | 7059 switch ( var_type ) |
0 | 7060 { |
7061 case VAR_ActualIntellect: | |
7062 LABEL_66: | |
7063 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7064 goto LABEL_113; | |
7065 case VAR_ActualPersonality: | |
7066 LABEL_67: | |
7067 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7068 goto LABEL_113; | |
7069 case VAR_ActualEndurance: | |
7070 LABEL_68: | |
7071 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7072 goto LABEL_113; | |
7073 case VAR_ActualSpeed: | |
7074 LABEL_69: | |
7075 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7076 goto LABEL_113; | |
7077 case VAR_ActualAccuracy: | |
7078 LABEL_70: | |
7079 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7080 goto LABEL_113; | |
7081 case VAR_ActualLuck: | |
7082 LABEL_71: | |
7083 v19 = (__int16 *)&Dst->uLuckBonus; | |
7084 goto LABEL_113; | |
7085 case VAR_FireResistance: | |
7086 v18 = &Dst->sResFireBase; | |
7087 goto LABEL_82; | |
7088 case VAR_AirResistance: | |
7089 v18 = &Dst->sResAirBase; | |
7090 goto LABEL_82; | |
7091 case VAR_WaterResistance: | |
7092 v18 = &Dst->sResWaterBase; | |
7093 goto LABEL_82; | |
7094 case VAR_EarthResistance: | |
7095 v18 = &Dst->sResEarthBase; | |
7096 goto LABEL_82; | |
7097 case VAR_SpiritResistance: | |
7098 v18 = &Dst->sResSpiritBase; | |
7099 goto LABEL_82; | |
7100 case VAR_MindResistance: | |
7101 v18 = &Dst->sResMindBase; | |
7102 goto LABEL_82; | |
7103 case VAR_BodyResistance: | |
7104 v18 = &Dst->sResBodyBase; | |
7105 goto LABEL_82; | |
7106 case VAR_LightResistance: | |
7107 v18 = &Dst->sResLightBase; | |
7108 goto LABEL_82; | |
7109 case VAR_DarkResistance: | |
7110 v18 = &Dst->sResDarkBase; | |
7111 goto LABEL_82; | |
7112 case VAR_MagicResistance: | |
7113 v18 = &Dst->sResMagicBase; | |
7114 LABEL_82: | |
7115 *v18 += val; | |
7116 if ( *v18 > 255 ) | |
7117 *v18 = 255; | |
1507 | 7118 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0); |
7119 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7120 goto _play_sound; | |
0 | 7121 default: |
7122 return; | |
7123 } | |
7124 return; | |
7125 } | |
7126 v19 = &Dst->sResFireBonus; | |
7127 LABEL_113: | |
7128 *v19 += val; | |
7129 if ( *v19 > 255 ) | |
7130 *v19 = 255; | |
7131 v31 = 0; | |
187 | 7132 v29 = SPEECH_91; |
7133 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); | |
1507 | 7134 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7135 goto _play_sound; | |
0 | 7136 } |
310 | 7137 if ( var_type <= VAR_DisarmTrapSkill ) |
7138 { | |
7139 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7140 { |
310 | 7141 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7142 { |
310 | 7143 switch ( var_type ) |
0 | 7144 { |
7145 case VAR_BodyResistanceBonus: | |
7146 v19 = &Dst->sResBodyBonus; | |
7147 break; | |
7148 case VAR_AirResistanceBonus: | |
7149 v19 = &Dst->sResAirBonus; | |
7150 break; | |
7151 case VAR_WaterResistanceBonus: | |
7152 v19 = &Dst->sResWaterBonus; | |
7153 break; | |
7154 case VAR_EarthResistanceBonus: | |
7155 v19 = &Dst->sResEarthBonus; | |
7156 break; | |
7157 case VAR_SpiritResistanceBonus: | |
7158 v19 = &Dst->sResSpiritBonus; | |
7159 break; | |
7160 default: | |
310 | 7161 if ( var_type != 62 ) |
0 | 7162 return; |
7163 v19 = &Dst->sResMindBonus; | |
7164 break; | |
7165 } | |
7166 goto LABEL_113; | |
7167 } | |
310 | 7168 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7169 { |
7170 v19 = &Dst->sResLightBonus; | |
7171 goto LABEL_113; | |
7172 } | |
310 | 7173 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7174 { |
7175 v19 = &Dst->sResDarkBonus; | |
7176 goto LABEL_113; | |
7177 } | |
310 | 7178 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7179 { |
7180 v19 = &Dst->sResMagicBonus; | |
7181 goto LABEL_113; | |
7182 } | |
310 | 7183 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7184 return; |
7185 } | |
7186 goto LABEL_106; | |
7187 } | |
310 | 7188 if ( var_type == VAR_LearningSkill ) |
0 | 7189 { |
7190 LABEL_106: | |
7191 if ( val <= VAR_BodyResistanceBonus ) | |
7192 { | |
310 | 7193 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7194 } |
7195 else | |
7196 { | |
310 | 7197 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7198 v21 = *(short *)v20; |
7199 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7200 if ( v22 > 60 ) | |
7201 LOWORD(v22) = 60; | |
7202 LOBYTE(v21) = v21 & 0xC0; | |
7203 *(short *)v20 = v22 | v21; | |
7204 } | |
1507 | 7205 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); |
7206 goto _play_sound; | |
0 | 7207 } |
310 | 7208 if ( var_type <= VAR_LearningSkill ) |
0 | 7209 return; |
310 | 7210 if ( var_type <= VAR_Eradicated ) |
7211 { | |
7212 Dst->SetCondition(var_type - 105, 0); | |
0 | 7213 } |
7214 else | |
7215 { | |
310 | 7216 if ( var_type != VAR_MajorCondition ) |
0 | 7217 { |
310 | 7218 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7219 { |
310 | 7220 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7221 byte_5E4C15[var_type] += val; | |
0 | 7222 else |
310 | 7223 byte_5E4C15[var_type] = -1; |
0 | 7224 } |
7225 return; | |
7226 } | |
7227 memset(Dst, 0, 0xA0u); | |
7228 } | |
7229 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7230 goto _play_sound; | |
7231 } | |
7232 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
|
7233 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7234 && pAutonoteTxt[val].pText ) |
0 | 7235 { |
7236 v23 = pPlayers[uPlayerIdx + 1]; | |
7237 v34 = 1; | |
187 | 7238 v23->PlaySound(SPEECH_96, 0); |
1453 | 7239 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7240 bFlashAutonotesBook = 1; |
1453 | 7241 _506568_autonote_type = pAutonoteTxt[val].eType; |
7242 } | |
7243 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | |
0 | 7244 v3 = 1; |
7245 if ( v34 != 1 ) | |
1507 | 7246 { |
7247 if ( v3 != 1 ) | |
7248 return; | |
7249 goto _play_sound; | |
7250 } | |
7251 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7252 if ( v3 != 1 ) | |
7253 return; | |
7254 goto _play_sound; | |
0 | 7255 } |
310 | 7256 if ( var_type > VAR_GoldInBank ) |
7257 { | |
7258 if ( var_type == 307 ) | |
0 | 7259 { |
7260 pParty->uNumDeaths += val; | |
1507 | 7261 if ( v34 != 1 ) |
7262 { | |
7263 if ( v3 != 1 ) | |
7264 return; | |
7265 goto _play_sound; | |
7266 } | |
7267 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7268 if ( v3 != 1 ) | |
7269 return; | |
7270 goto _play_sound; | |
0 | 7271 } |
310 | 7272 switch ( var_type ) |
0 | 7273 { |
7274 case 308: | |
7275 pParty->uNumBountiesCollected += val; | |
7276 break; | |
7277 case 309: | |
7278 pParty->uNumPrisonTerms += val; | |
7279 break; | |
7280 case 310: | |
7281 pParty->uNumArenaPageWins += val; | |
7282 break; | |
7283 case 311: | |
7284 pParty->uNumArenaSquireWins += val; | |
7285 break; | |
7286 case 312: | |
7287 pParty->uNumArenaKnightWins += val; | |
7288 break; | |
7289 case 313: | |
7290 pParty->uNumArenaLordWins += val; | |
7291 break; | |
7292 } | |
7293 } | |
7294 else | |
7295 { | |
310 | 7296 if ( var_type == VAR_GoldInBank ) |
0 | 7297 { |
7298 pParty->uNumGoldInBank += val; | |
7299 return; | |
7300 } | |
310 | 7301 if ( var_type <= VAR_Counter8 ) |
7302 { | |
7303 if ( (signed int)var_type >= 245 ) | |
7304 { | |
7305 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7306 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7307 } |
7308 else | |
7309 { | |
310 | 7310 switch ( var_type ) |
0 | 7311 { |
7312 case VAR_MonthEquals|VAR_CurrentSP: | |
7313 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7314 break; | |
7315 case VAR_NPCs2: | |
7316 pParty->field_709 = 0; | |
7317 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7318 pParty->CountHirelings(); |
7319 viewparams->bRedrawGameUI = true; | |
0 | 7320 break; |
7321 case VAR_NumSkillPoints: | |
7322 Dst->uSkillPoints += val; | |
7323 break; | |
7324 } | |
7325 } | |
7326 return; | |
7327 } | |
310 | 7328 if ( var_type < VAR_Counter9 ) |
0 | 7329 return; |
310 | 7330 if ( (signed int)var_type <= 274 ) |
7331 { | |
7332 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7333 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7334 goto _play_sound; |
7335 } | |
310 | 7336 if ( var_type != VAR_ReputationInCurrentLocation ) |
7337 { | |
7338 if ( var_type <= VAR_ReputationInCurrentLocation | |
7339 || var_type > VAR_History_28 | |
7340 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7341 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7342 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7343 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7344 v26) ) |
7345 return; | |
7346 bFlashHistoryBook = 1; | |
7347 _play_sound: | |
7348 v28 = 8 * uPlayerIdx + 400; | |
862 | 7349 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7350 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7351 return; | |
7352 } | |
7353 v27 = &pOutdoor->ddm; | |
7354 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7355 v27 = &pIndoor->dlv; | |
7356 v27->uReputation += val; | |
7357 if ( v27->uReputation > 10000 ) | |
7358 v27->uReputation = 10000; | |
7359 } | |
7360 } | |
7361 | |
7362 | |
7363 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 7364 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 7365 { |
7366 unsigned int v3; // ebx@1 | |
7367 signed int v4; // esi@1 | |
501 | 7368 bool result; // eax@8 |
0 | 7369 int v6; // esi@11 |
7370 int v7; // edi@14 | |
7371 signed int v8; // eax@17 | |
7372 char *v9; // eax@20 | |
7373 char v10; // sf@20 | |
7374 char *v11; // ecx@26 | |
7375 char *v12; // ecx@27 | |
7376 __int64 v13; // qax@27 | |
7377 unsigned __int8 v14; // cf@27 | |
501 | 7378 int *v15; // edx@29 |
0 | 7379 char *v16; // eax@90 |
7380 char *v17; // ecx@94 | |
501 | 7381 int v18; // esi@97 |
0 | 7382 signed int v19; // edx@97 |
7383 char *v20; // ecx@98 | |
7384 int v21; // eax@100 | |
7385 __int16 v22; // dx@112 | |
7386 int v23; // [sp-8h] [bp-14h]@45 | |
7387 signed int v24; // [sp-4h] [bp-10h]@4 | |
7388 int v25; // [sp-4h] [bp-10h]@45 | |
7389 | |
7390 v3 = 0; | |
605 | 7391 v4 = uActiveCharacter - 1; |
501 | 7392 result = false; |
7393 if ( (signed int)VarNum > 222 ) | |
7394 { | |
7395 if ( (signed int)VarNum <= 307 ) | |
7396 { | |
7397 if ( VarNum == 307 ) | |
7398 { | |
7399 pParty->uNumDeaths -= (unsigned int)pValue; | |
7400 return pValue; | |
7401 } | |
7402 if ( VarNum == 223 ) | |
0 | 7403 { |
7404 v11 = (char *)pParty->_autonote_bits; | |
501 | 7405 v22 = (short)pValue - 1; |
0 | 7406 } |
7407 else | |
7408 { | |
501 | 7409 if ( VarNum != 231 ) |
0 | 7410 { |
501 | 7411 switch ( VarNum ) |
0 | 7412 { |
7413 case 232: | |
501 | 7414 VarNum = (VariableType)0; |
1094 | 7415 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 7416 result = (bool) pValue; |
7417 dword_5B65CC = 0; | |
7418 if ( (int)VarNum == pValue ) | |
0 | 7419 { |
501 | 7420 dword_5B65CC = (int)pValue; |
0 | 7421 } |
7422 else | |
7423 { | |
7424 pParty->field_709 = 0; | |
501 | 7425 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 7426 pParty->CountHirelings(); |
7427 viewparams->bRedrawGameUI = true; | |
0 | 7428 } |
7429 break; | |
7430 case 241: | |
7431 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
7432 { | |
7433 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 7434 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 7435 { |
605 | 7436 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 7437 { |
7438 v21 = *(int *)v20; | |
7439 if ( (char)*(int *)v20 < 0 ) | |
7440 { | |
7441 LOBYTE(v21) = v21 & 0x7F; | |
7442 *(int *)v20 = v21; | |
7443 } | |
7444 } | |
7445 v20 += 76; | |
7446 } | |
7447 } | |
605 | 7448 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 7449 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 7450 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 7451 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
7452 pParty->field_709 = 0; | |
1035 | 7453 pParty->CountHirelings(); |
0 | 7454 break; |
7455 case 243: | |
7456 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7457 result = *v17 != NULL; |
501 | 7458 if ( (unsigned int)pValue <= *(int *)v17 ) |
7459 { | |
7460 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
7461 result = (v17 != NULL); |
501 | 7462 } |
0 | 7463 else |
7464 *(int *)v17 = 0; | |
7465 break; | |
7466 case 275: | |
7467 v16 = (char *)&pOutdoor->ddm; | |
7468 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7469 v16 = (char *)&pIndoor->dlv; | |
501 | 7470 *((int *)v16 + 2) -= (int)pValue; |
0 | 7471 if ( *((int *)v16 + 2) < -10000 ) |
7472 *((int *)v16 + 2) = -10000; | |
7473 break; | |
7474 case 306: | |
501 | 7475 result = VarNum - 306; |
7476 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
7477 { | |
7478 result = (bool)pValue; | |
7479 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 7480 } |
0 | 7481 else |
7482 LABEL_88: | |
7483 dword_5B65C4 = 1; | |
7484 break; | |
7485 } | |
501 | 7486 return result; |
0 | 7487 } |
7488 v11 = this->field_1A50; | |
501 | 7489 v22 = (signed __int16)pValue; |
0 | 7490 } |
7491 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 7492 return result; |
7493 } | |
7494 switch ( VarNum ) | |
0 | 7495 { |
7496 case 308: | |
501 | 7497 result = (bool)pValue; |
7498 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 7499 break; |
7500 case 309: | |
501 | 7501 result = (bool)pValue; |
7502 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 7503 break; |
7504 case 310: | |
501 | 7505 result = (bool)pValue; |
7506 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 7507 break; |
7508 case 311: | |
501 | 7509 result = (bool)pValue; |
7510 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 7511 break; |
7512 case 312: | |
501 | 7513 result = (bool)pValue; |
7514 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 7515 break; |
7516 case 313: | |
501 | 7517 result = (bool)pValue; |
7518 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 7519 break; |
7520 } | |
1545 | 7521 Error("Function not returning any value! (%u)", VarNum); |
0 | 7522 } |
7523 else | |
7524 { | |
501 | 7525 if ( (signed int)VarNum >= 123 ) |
7526 { | |
7527 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 7528 } |
7529 else | |
7530 { | |
501 | 7531 switch ( VarNum ) |
0 | 7532 { |
7533 case VAR_RandomGold: | |
501 | 7534 v6 = rand() % (signed int)pValue + 1; |
0 | 7535 if ( v6 > pParty->uNumGold ) |
7536 v6 = pParty->uNumGold; | |
7537 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7538 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7539 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 7540 GameUI_DrawFoodAndGold(); |
501 | 7541 return result; |
0 | 7542 case VAR_RandomFood: |
501 | 7543 v7 = rand() % (signed int)pValue + 1; |
0 | 7544 if ( v7 > pParty->uNumFoodRations ) |
7545 v7 = pParty->uNumFoodRations; | |
7546 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7547 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7548 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7549 GameUI_DrawFoodAndGold(); |
605 | 7550 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7551 v8 = 8 * v4 + 400; | |
862 | 7552 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7553 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7554 return result; |
0 | 7555 case VAR_CurrentHP: |
1036 | 7556 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 7557 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7558 v8 = 8 * v4 + 400; | |
862 | 7559 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7560 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7561 return result; | |
0 | 7562 case VAR_CurrentSP: |
7563 v9 = (char *)&this->sMana; | |
501 | 7564 v10 = this->sMana - (signed int)pValue < 0; |
7565 *(int *)v9 -= (int)pValue; | |
0 | 7566 if ( v10 ) |
7567 *(int *)v9 = 0; | |
605 | 7568 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7569 v8 = 8 * v4 + 400; | |
862 | 7570 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7571 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7572 return result; | |
0 | 7573 case VAR_ACModifier: |
501 | 7574 this->sACModifier -= (unsigned __int8)pValue; |
605 | 7575 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7576 v8 = 8 * v4 + 400; | |
862 | 7577 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7578 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7579 return result; | |
0 | 7580 case VAR_BaseLevel: |
501 | 7581 this->uLevel -= (unsigned __int8)pValue; |
605 | 7582 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7583 v8 = 8 * v4 + 400; | |
862 | 7584 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7585 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7586 return result; | |
0 | 7587 case VAR_LevelModifier: |
501 | 7588 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 7589 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7590 v8 = 8 * v4 + 400; | |
862 | 7591 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7592 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7593 return result; | |
0 | 7594 case VAR_Age: |
501 | 7595 this->sAgeModifier -= (signed __int16)pValue; |
7596 return result; | |
0 | 7597 case VAR_Award: |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1455
diff
changeset
|
7598 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); |
605 | 7599 return result; |
0 | 7600 case VAR_Experience: |
7601 v12 = (char *)&this->uExperience; | |
501 | 7602 v13 = (signed int)pValue; |
7603 v14 = *(int *)v12 < (unsigned int)pValue; | |
7604 *(int *)v12 -= (int)pValue; | |
0 | 7605 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 7606 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7607 v8 = 8 * v4 + 400; | |
862 | 7608 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7609 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7610 return result; | |
0 | 7611 case VAR_QBits_QuestsDone: |
501 | 7612 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 7613 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 7614 return true; |
0 | 7615 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7616 v15 = this->pInventoryMatrix; |
0 | 7617 break; |
7618 case VAR_FixedGold: | |
501 | 7619 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 7620 goto LABEL_88; |
501 | 7621 Party::TakeGold((unsigned int)pValue); |
7622 return result; | |
0 | 7623 case VAR_MightBonus: |
7624 case VAR_ActualMight: | |
501 | 7625 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 7626 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7627 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7628 v8 = 8 * v4 + 400; | |
862 | 7629 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7630 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7631 return result; | |
0 | 7632 case VAR_IntellectBonus: |
7633 case VAR_ActualIntellect: | |
501 | 7634 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 7635 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7636 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7637 v8 = 8 * v4 + 400; | |
862 | 7638 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7639 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7640 return result; | |
0 | 7641 case VAR_PersonalityBonus: |
7642 case VAR_ActualPersonality: | |
501 | 7643 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 7644 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7645 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7646 v8 = 8 * v4 + 400; | |
862 | 7647 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7648 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7649 return result; | |
0 | 7650 case VAR_EnduranceBonus: |
7651 case VAR_ActualEndurance: | |
501 | 7652 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 7653 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7654 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7655 v8 = 8 * v4 + 400; | |
862 | 7656 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7657 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7658 return result; | |
0 | 7659 case VAR_SpeedBonus: |
7660 case VAR_ActualSpeed: | |
501 | 7661 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 7662 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7663 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7664 v8 = 8 * v4 + 400; | |
862 | 7665 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7666 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7667 return result; | |
0 | 7668 case VAR_AccuracyBonus: |
7669 case VAR_ActualAccuracy: | |
501 | 7670 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 7671 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7672 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7673 v8 = 8 * v4 + 400; | |
862 | 7674 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7675 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7676 return result; | |
0 | 7677 case VAR_LuckBonus: |
7678 case VAR_ActualLuck: | |
501 | 7679 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 7680 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
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_BaseMight: |
501 | 7687 this->uMight -= (unsigned __int16)pValue; |
605 | 7688 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7689 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7690 v8 = 8 * v4 + 400; | |
862 | 7691 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7692 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7693 return result; | |
0 | 7694 case VAR_BaseIntellect: |
501 | 7695 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 7696 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7697 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7698 v8 = 8 * v4 + 400; | |
862 | 7699 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7700 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7701 return result; | |
0 | 7702 case VAR_BasePersonality: |
501 | 7703 this->uWillpower -= (unsigned __int16)pValue; |
605 | 7704 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7705 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7706 v8 = 8 * v4 + 400; | |
862 | 7707 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7708 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7709 return result; | |
0 | 7710 case VAR_BaseEndurance: |
501 | 7711 this->uEndurance -= (unsigned __int16)pValue; |
605 | 7712 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7713 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7714 v8 = 8 * v4 + 400; | |
862 | 7715 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7716 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7717 return result; | |
0 | 7718 case VAR_BaseSpeed: |
501 | 7719 this->uSpeed -= (unsigned __int16)pValue; |
605 | 7720 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7721 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7722 v8 = 8 * v4 + 400; | |
862 | 7723 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7724 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7725 return result; | |
0 | 7726 case VAR_BaseAccuracy: |
501 | 7727 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 7728 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7729 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7730 v8 = 8 * v4 + 400; | |
862 | 7731 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7732 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7733 return result; | |
0 | 7734 case VAR_BaseLuck: |
501 | 7735 this->uLuck -= (unsigned __int16)pValue; |
605 | 7736 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7737 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7738 v8 = 8 * v4 + 400; | |
862 | 7739 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7740 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7741 return result; | |
0 | 7742 case VAR_FireResistance: |
501 | 7743 this->sResFireBase -= (signed __int16)pValue; |
605 | 7744 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7745 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7746 v8 = 8 * v4 + 400; | |
862 | 7747 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7748 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7749 return result; | |
0 | 7750 case VAR_AirResistance: |
501 | 7751 this->sResAirBase -= (signed __int16)pValue; |
605 | 7752 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7753 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7754 v8 = 8 * v4 + 400; | |
862 | 7755 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7756 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7757 return result; | |
0 | 7758 case VAR_WaterResistance: |
501 | 7759 this->sResWaterBase -= (signed __int16)pValue; |
605 | 7760 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7761 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7762 v8 = 8 * v4 + 400; | |
862 | 7763 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7764 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7765 return result; | |
0 | 7766 case VAR_EarthResistance: |
501 | 7767 this->sResEarthBase -= (signed __int16)pValue; |
605 | 7768 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7769 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7770 v8 = 8 * v4 + 400; | |
862 | 7771 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7772 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7773 return result; | |
0 | 7774 case VAR_SpiritResistance: |
501 | 7775 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 7776 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7777 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7778 v8 = 8 * v4 + 400; | |
862 | 7779 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7780 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7781 return result; | |
0 | 7782 case VAR_MindResistance: |
501 | 7783 this->sResMindBase -= (signed __int16)pValue; |
605 | 7784 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7785 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7786 v8 = 8 * v4 + 400; | |
862 | 7787 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7788 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7789 return result; | |
0 | 7790 case VAR_BodyResistance: |
501 | 7791 this->sResBodyBase -= (signed __int16)pValue; |
605 | 7792 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7793 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7794 v8 = 8 * v4 + 400; | |
862 | 7795 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7796 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7797 return result; | |
0 | 7798 case VAR_LightResistance: |
501 | 7799 this->sResLightBase -= (signed __int16)pValue; |
605 | 7800 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7801 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7802 v8 = 8 * v4 + 400; | |
862 | 7803 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7804 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7805 return result; | |
0 | 7806 case VAR_DarkResistance: |
501 | 7807 this->sResDarkBase -= (signed __int16)pValue; |
605 | 7808 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7809 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7810 v8 = 8 * v4 + 400; | |
862 | 7811 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7812 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7813 return result; | |
0 | 7814 case VAR_MagicResistance: |
501 | 7815 this->sResMagicBase -= (signed __int16)pValue; |
605 | 7816 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7817 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7818 v8 = 8 * v4 + 400; | |
862 | 7819 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7820 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7821 return result; | |
0 | 7822 case VAR_FireResistanceBonus: |
501 | 7823 this->sResFireBonus -= (signed __int16)pValue; |
605 | 7824 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7825 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7826 v8 = 8 * v4 + 400; | |
862 | 7827 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7828 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7829 return result; | |
0 | 7830 case VAR_AirResistanceBonus: |
501 | 7831 this->sResAirBonus -= (signed __int16)pValue; |
605 | 7832 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
7833 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7834 v8 = 8 * v4 + 400; | |
862 | 7835 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7836 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7837 return result; | |
0 | 7838 case VAR_WaterResistanceBonus: |
501 | 7839 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 7840 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7841 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7842 v8 = 8 * v4 + 400; | |
862 | 7843 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7844 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7845 return result; | |
0 | 7846 case VAR_EarthResistanceBonus: |
501 | 7847 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 7848 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7849 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7850 v8 = 8 * v4 + 400; | |
862 | 7851 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7852 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7853 return result; | |
0 | 7854 case VAR_SpiritResistanceBonus: |
501 | 7855 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 7856 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7857 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7858 v8 = 8 * v4 + 400; | |
862 | 7859 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7860 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7861 return result; | |
0 | 7862 case VAR_MindResistanceBonus: |
501 | 7863 this->sResMindBonus -= (signed __int16)pValue; |
605 | 7864 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7865 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7866 v8 = 8 * v4 + 400; | |
862 | 7867 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7868 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7869 return result; | |
0 | 7870 case VAR_BodyResistanceBonus: |
501 | 7871 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 7872 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7873 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7874 v8 = 8 * v4 + 400; | |
862 | 7875 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7876 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7877 return result; | |
0 | 7878 case VAR_LightResistanceBonus: |
501 | 7879 this->sResLightBonus -= (signed __int16)pValue; |
605 | 7880 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7881 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7882 v8 = 8 * v4 + 400; | |
862 | 7883 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7884 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7885 return result; | |
0 | 7886 case VAR_DarkResistanceBonus: |
501 | 7887 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 7888 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
7889 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
7890 v8 = 8 * v4 + 400; | |
862 | 7891 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7892 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7893 return result; | |
0 | 7894 case VAR_MagicResistanceBonus: |
501 | 7895 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 7896 v25 = 0; |
187 | 7897 v23 = SPEECH_91; |
7898 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 7899 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7900 v8 = 8 * v4 + 400; | |
862 | 7901 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7902 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7903 return result; | |
0 | 7904 case VAR_FixedFood: |
501 | 7905 Party::TakeFood((unsigned int)pValue); |
605 | 7906 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7907 v8 = 8 * v4 + 400; | |
862 | 7908 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7909 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7910 return result; | |
0 | 7911 case VAR_StaffSkill: |
7912 case VAR_SwordSkill: | |
7913 case VAR_DaggerSkill: | |
7914 case VAR_AxeSkill: | |
7915 case VAR_SpearSkill: | |
7916 case VAR_BowSkill: | |
7917 case VAR_MaceSkill: | |
7918 case VAR_BlasterSkill: | |
7919 case VAR_ShieldSkill: | |
7920 case VAR_LeatherSkill: | |
7921 case VAR_SkillChain: | |
7922 case VAR_PlateSkill: | |
7923 case VAR_FireSkill: | |
7924 case VAR_AirSkill: | |
7925 case VAR_WaterSkill: | |
7926 case VAR_EarthSkill: | |
7927 case VAR_SpiritSkill: | |
7928 case VAR_MindSkill: | |
7929 case VAR_BodySkill: | |
7930 case VAR_LightSkill: | |
7931 case VAR_DarkSkill: | |
7932 case VAR_IdentifyItemSkill: | |
7933 case VAR_MerchantSkill: | |
7934 case VAR_RepairSkill: | |
7935 case VAR_BodybuildingSkill: | |
7936 case VAR_MeditationSkill: | |
7937 case VAR_PerceptionSkill: | |
7938 case VAR_DiplomacySkill: | |
7939 case VAR_DisarmTrapSkill: | |
7940 case VAR_LearningSkill: | |
501 | 7941 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 7942 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7943 v8 = 8 * v4 + 400; | |
862 | 7944 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 7945 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
7946 return result; | |
0 | 7947 case VAR_Cursed: |
7948 case VAR_Weak: | |
7949 case VAR_Asleep: | |
7950 case VAR_Afraid: | |
7951 case VAR_Drunk: | |
7952 case VAR_Insane: | |
7953 case VAR_PoisonedGreen: | |
7954 case VAR_DiseasedGreen: | |
7955 case VAR_PoisonedYellow: | |
7956 case VAR_DiseasedYellow: | |
7957 case VAR_PoisonedRed: | |
7958 case VAR_DiseasedRed: | |
7959 case VAR_Paralyzed: | |
7960 case VAR_Unconsious: | |
7961 case VAR_Dead: | |
7962 case VAR_Stoned: | |
7963 case VAR_Eradicated: | |
1071 | 7964 //*((int *)this + 2 * VarNum - 210) = 0; |
7965 //*((int *)this + 2 * result - 209) = 0; | |
7966 this->pConditions[VarNum] = 0; | |
0 | 7967 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
7968 v8 = 8 * v4 + 400; | |
862 | 7969 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 7970 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 7971 return result; |
605 | 7972 default: |
7973 return result; | |
7974 } | |
7975 for (v3 = 1; v3 < 126; v3++) | |
7976 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7977 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 7978 { |
605 | 7979 RemoveItemAtInventoryIndex(v3); |
501 | 7980 return true; |
0 | 7981 } |
605 | 7982 } |
501 | 7983 if ( pParty->pPickedItem.uItemID == pValue ) |
7984 { | |
605 | 7985 pMouse->RemoveHoldingItem(); |
7986 return true; | |
7987 } | |
7988 return false; | |
0 | 7989 } |
7990 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7991 |
1430 | 7992 //assert(false); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
7993 return false; |
0 | 7994 } |
7995 // 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
|
7996 // 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
|
7997 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7998 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
7999 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8000 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
|
8001 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8002 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8003 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8004 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8005 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8006 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8007 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8008 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8009 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
|
8010 //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
|
8011 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
|
8012 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
|
8013 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8014 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8015 _this.Reset(); |
1374 | 8016 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8017 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8018 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8019 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8020 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8021 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8022 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8023 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8024 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
|
8025 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8026 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8027 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8028 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8029 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8030 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8031 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8032 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8033 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8034 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8035 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8036 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8037 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8038 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
|
8039 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8040 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8041 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8042 } |
1295 | 8043 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8044 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8045 |
1295 | 8046 //----- (0049387A) -------------------------------------------------------- |
1459 | 8047 int CycleCharacter(bool backwards) |
1295 | 8048 { |
8049 signed int result; // eax@1 | |
8050 signed int v2; // ecx@2 | |
8051 signed int v3; // ecx@8 | |
8052 | |
8053 result = uActiveCharacter; | |
1459 | 8054 if ( backwards ) |
1295 | 8055 { |
8056 v2 = 0; | |
8057 while ( 1 ) | |
8058 { | |
8059 --result; | |
8060 if ( result < 1 ) | |
8061 result = 4; | |
8062 if ( !pPlayers[result]->uTimeToRecovery ) | |
8063 break; | |
8064 ++v2; | |
8065 if ( v2 >= 4 ) | |
8066 return uActiveCharacter; | |
8067 } | |
8068 } | |
8069 else | |
8070 { | |
8071 v3 = 0; | |
8072 while ( 1 ) | |
8073 { | |
8074 ++result; | |
8075 if ( result > 4 ) | |
8076 result = 1; | |
8077 if ( !pPlayers[result]->uTimeToRecovery ) | |
8078 break; | |
8079 ++v3; | |
8080 if ( v3 >= 4 ) | |
8081 return uActiveCharacter; | |
8082 } | |
8083 } | |
8084 return result; | |
1297 | 8085 } |
8086 //----- (0043EE77) -------------------------------------------------------- | |
8087 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8088 { | |
8089 bool result; // eax@0 | |
8090 Player *v2; // edx@3 | |
8091 int v3; // ecx@3 | |
8092 Player **pPlayers; // esi@8 | |
1424 | 8093 //bool item_flag; |
1297 | 8094 Player *v6; // edx@9 |
8095 | |
1424 | 8096 //if ( a1 < 1 || a1 > 4 ) |
8097 //{ | |
8098 //if ( !a1 ) | |
8099 //{ | |
8100 //pPlayers = &::pPlayers[1]; | |
8101 //v5 = 604; | |
8102 //while ( 1 ) | |
1545 | 8103 Assert ( a1 > 0 && a1 < 5 ); |
1432 | 8104 for ( uint i = 1; i < 5; ++i ) |
1424 | 8105 { |
8106 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8107 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8108 return false; | |
8109 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8110 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8111 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8112 return false; | |
8113 //result *= 9; | |
1432 | 8114 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 ) |
1424 | 8115 return false; |
8116 //++pPlayers; | |
8117 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8118 //return true; | |
8119 } | |
8120 return true; | |
8121 } | |
1432 | 8122 |
1297 | 8123 //----- (0043EE15) -------------------------------------------------------- |
8124 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8125 { | |
8126 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8127 { | |
8128 for ( uint i = 0; i < 126; ++i ) | |
8129 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8130 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8131 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8132 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8133 return true; |
8134 } | |
8135 } | |
8136 for ( uint i = 0; i < 16; ++i ) | |
8137 { | |
8138 if ( pPlayer->pEquipment.pIndices[i] ) | |
8139 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8140 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8141 return true; |
8142 } | |
8143 } | |
8144 } | |
8145 return false; | |
8146 } | |
8147 //----- (0043EDB9) -------------------------------------------------------- | |
1458 | 8148 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
1297 | 8149 { |
8150 unsigned int pNum; // ebp@1 | |
8151 Player **pPlayer; // ebx@1 | |
8152 Player *pPlayer2; // esi@2 | |
8153 enum CHARACTER_RACE pRace; // edi@2 | |
8154 bool pSex; // eax@2 | |
8155 char v6; // zf@7 | |
8156 | |
8157 //pPlayer = &pPlayers[1]; | |
8158 /*pNum = a1; | |
8159 | |
8160 while ( 1 ) | |
8161 { | |
8162 pPlayer2 = *pPlayer; | |
8163 pRace = pPlayer2->GetRace(); | |
8164 pSex = pPlayer2->GetSexByVoice(); | |
8165 if ( !pRace ) | |
8166 break; | |
8167 if ( pRace == 1 || pRace == 2 ) | |
8168 break; | |
8169 if ( !pSex && pNum == 2 )// | |
8170 //goto LABEL_15; | |
8171 { | |
8172 pSex = 1; | |
8173 return pSex; | |
8174 } | |
8175 v6 = pNum == 3;// | |
8176 LABEL_11: | |
8177 if ( v6 ) | |
8178 //goto LABEL_15; | |
8179 { | |
8180 pSex = 1; | |
8181 return pSex; | |
8182 } | |
8183 ++pPlayer; | |
8184 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8185 { | |
8186 pSex = 0; | |
8187 return pSex; | |
8188 } | |
8189 } | |
8190 if ( pSex || pNum ) | |
8191 { | |
8192 v6 = pNum == 1; | |
8193 goto LABEL_11; | |
8194 } | |
8195 //LABEL_15: | |
8196 pSex = 1; | |
8197 return pSex;*/ | |
8198 for (uint i = 1; i <= 4; ++i) | |
8199 { | |
8200 pRace = pPlayers[i]->GetRace(); | |
8201 pSex = pPlayers[i]->GetSexByVoice(); | |
8202 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8203 return 1; | |
8204 } | |
8205 return 0; | |
8206 } | |
8207 //----- (0043ED6F) -------------------------------------------------------- | |
8208 bool _43ED6F_check_party_races(bool a1) | |
8209 { | |
8210 bool v6; // zf@5 | |
8211 | |
8212 for (uint i = 0; i < 4; ++i) | |
8213 { | |
8214 auto player = pParty->pPlayers + i; | |
8215 auto race = player->GetRace(); | |
8216 | |
8217 if (race != CHARACTER_RACE_HUMAN && | |
8218 race != CHARACTER_RACE_ELF && | |
8219 race != CHARACTER_RACE_GOBLIN) | |
8220 v6 = a1 == 1; | |
8221 else | |
8222 v6 = !a1; | |
8223 | |
8224 if (v6) | |
8225 return true; | |
8226 } | |
8227 return false; | |
8228 } | |
8229 //----- (00439FCB) -------------------------------------------------------- | |
8230 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8231 { | |
8232 signed int v4; // esi@1 | |
8233 unsigned int v5; // ecx@1 | |
8234 Player *v6; // ebx@3 | |
8235 Actor *v7; // esi@3 | |
8236 unsigned int v8; // eax@4 | |
8237 char *v9; // eax@5 | |
8238 signed int v10; // eax@6 | |
8239 int v11; // edx@8 | |
8240 int v12; // edx@9 | |
8241 int v13; // edx@10 | |
8242 int v14; // edx@16 | |
8243 int v15; // edx@17 | |
8244 int v16; // edx@18 | |
8245 enum SoundID v17; // eax@24 | |
8246 int v18; // eax@26 | |
8247 unsigned __int8 v19; // zf@26 | |
8248 unsigned __int8 v20; // sf@26 | |
8249 unsigned __int16 v21; // ax@29 | |
8250 signed int v22; // edi@36 | |
8251 int v23; // eax@38 | |
8252 signed int v24; // eax@44 | |
8253 unsigned __int16 v25; // cx@47 | |
8254 signed int v26; // eax@49 | |
8255 int v27; // eax@54 | |
8256 float v28; // ST18_4@58 | |
8257 double v29; // st7@58 | |
8258 float v30; // ST08_4@58 | |
8259 double v31; // st7@58 | |
8260 float v32; // ST04_4@58 | |
8261 float v33; // ST00_4@58 | |
8262 int v34; // edi@61 | |
8263 int v35; // eax@70 | |
8264 double v36; // st7@70 | |
8265 SpriteObject *v37; // ebx@77 | |
8266 int v38; // edi@77 | |
8267 int v39; // esi@77 | |
8268 int v40; // eax@77 | |
8269 int v41; // eax@77 | |
8270 int v42; // eax@78 | |
8271 Player *v43; // eax@81 | |
8272 Actor *v44; // esi@82 | |
8273 Player *v45; // edi@84 | |
8274 unsigned __int16 v46; // ax@84 | |
8275 int v47; // ebx@105 | |
8276 int v48; // eax@107 | |
8277 unsigned __int16 v49; // ax@116 | |
8278 int v50; // ebx@123 | |
8279 unsigned __int16 v51; // ax@124 | |
8280 char v52; // bl@124 | |
8281 int v53; // eax@128 | |
8282 signed int v54; // eax@134 | |
8283 unsigned __int16 v55; // cx@137 | |
8284 signed int v56; // eax@139 | |
8285 int v57; // eax@144 | |
8286 float v58; // ST18_4@148 | |
8287 double v59; // st7@148 | |
8288 float v60; // ST08_4@148 | |
8289 double v61; // st7@148 | |
8290 float v62; // ST04_4@148 | |
8291 float v63; // ST00_4@148 | |
8292 int v64; // ebx@151 | |
8293 int v65; // eax@161 | |
8294 double v66; // st7@161 | |
8295 signed int v67; // ecx@164 | |
8296 signed int v68; // eax@170 | |
8297 int v69; // ecx@170 | |
8298 int v70; // eax@171 | |
8299 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8300 int v72; // [sp+30h] [bp-24h]@164 | |
8301 double v73; // [sp+40h] [bp-14h]@72 | |
8302 signed int v74; // [sp+44h] [bp-10h]@1 | |
8303 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8304 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8305 int v77; // [sp+50h] [bp-4h]@26 | |
8306 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8307 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8308 | |
8309 v4 = PID_ID(uObjID); | |
8310 v5 = PID_TYPE(uObjID) - 2; | |
8311 v74 = a2; | |
8312 uActorID = v4; | |
8313 if ( v5 ) | |
8314 { | |
8315 if ( v5 != 1 | |
8316 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8317 v75 = v6->sHealth, | |
8318 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8319 return; | |
8320 v8 = v6->pEquipment.uArmor; | |
8321 if ( !v8 | |
8322 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8323 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8324 || v10 > 11 ) | |
8325 { | |
8326 v14 = rand() % 4; | |
8327 if ( !v14 ) | |
8328 { | |
8329 v71 = (SoundID)108; | |
8330 goto LABEL_24; | |
8331 } | |
8332 v15 = v14 - 1; | |
8333 if ( !v15 ) | |
8334 { | |
8335 v71 = (SoundID)109; | |
8336 goto LABEL_24; | |
8337 } | |
8338 v16 = v15 - 1; | |
8339 if ( !v16 ) | |
8340 { | |
8341 v71 = (SoundID)110; | |
8342 goto LABEL_24; | |
8343 } | |
8344 if ( v16 == 1 ) | |
8345 { | |
8346 v71 = (SoundID)44; | |
8347 goto LABEL_24; | |
8348 } | |
8349 } | |
8350 else | |
8351 { | |
8352 v11 = rand() % 4; | |
8353 if ( !v11 ) | |
8354 { | |
8355 v71 = (SoundID)105; | |
8356 goto LABEL_24; | |
8357 } | |
8358 v12 = v11 - 1; | |
8359 if ( !v12 ) | |
8360 { | |
8361 v71 = (SoundID)106; | |
8362 goto LABEL_24; | |
8363 } | |
8364 v13 = v12 - 1; | |
8365 if ( !v13 ) | |
8366 { | |
8367 v71 = (SoundID)107; | |
8368 goto LABEL_24; | |
8369 } | |
8370 if ( v13 == 1 ) | |
8371 { | |
8372 v71 = (SoundID)45; | |
8373 LABEL_24: | |
8374 v17 = v71; | |
8375 goto LABEL_26; | |
8376 } | |
8377 } | |
8378 v17 = (SoundID)a4; | |
8379 LABEL_26: | |
8380 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
8381 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
8382 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
8383 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
8384 v77 = v18; | |
8385 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
8386 { | |
8387 v21 = v7->pActorBuffs[3].uPower; | |
8388 if ( v21 ) | |
8389 v77 /= (signed int)v21; | |
8390 } | |
8391 if ( v74 ) | |
8392 { | |
8393 if ( v74 == 1 ) | |
8394 { | |
8395 v22 = v7->pMonsterInfo.uAttack2Type; | |
8396 } | |
8397 else | |
8398 { | |
8399 if ( v74 == 2 ) | |
8400 { | |
8401 v23 = v7->pMonsterInfo.uSpell1ID; | |
8402 } | |
8403 else | |
8404 { | |
8405 if ( v74 != 3 ) | |
8406 { | |
8407 if ( v74 == 4 ) | |
8408 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
8409 else | |
8410 v22 = 4; | |
8411 goto LABEL_43; | |
8412 } | |
8413 v23 = v7->pMonsterInfo.uSpell2ID; | |
8414 } | |
8415 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
8416 } | |
8417 } | |
8418 else | |
8419 { | |
8420 v22 = v7->pMonsterInfo.uAttack1Type; | |
8421 } | |
8422 LABEL_43: | |
8423 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8424 { | |
8425 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
8426 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
8427 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
8428 { | |
8429 v25 = v7->uAIState; | |
8430 if ( v25 != 5 ) | |
8431 { | |
8432 if ( v25 != 4 ) | |
8433 { | |
8434 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
8435 v7->sCurrentHP -= v26; | |
8436 if ( v26 ) | |
8437 { | |
8438 if ( v7->sCurrentHP >= 1 ) | |
8439 { | |
8440 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8441 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8442 } | |
8443 else | |
8444 { | |
8445 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8446 { | |
8447 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
8448 v74 = v27; | |
8449 if ( pRenderer->pRenderD3D ) | |
8450 { | |
8451 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8452 { | |
8453 v28 = (double)v74; | |
8454 v74 = v7->vPosition.z; | |
8455 v29 = (double)v74; | |
8456 v74 = v7->vPosition.y; | |
8457 v30 = v29; | |
8458 v31 = (double)v74; | |
8459 v74 = v7->vPosition.x; | |
8460 v32 = v31; | |
8461 v33 = (double)v74; | |
8462 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
8463 } | |
8464 } | |
8465 } | |
8466 Actor::Die(uActorID); | |
8467 Actor::ApplyFineForKillingPeasant(uActorID); | |
8468 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8469 if ( v7->pMonsterInfo.uExp ) | |
8470 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
8471 v34 = SPEECH_51; | |
8472 if ( rand() % 100 < 20 ) | |
8473 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
8474 v6->PlaySound((PlayerSpeech)v34, 0); | |
8475 } | |
8476 } | |
8477 } | |
8478 } | |
8479 } | |
8480 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
8481 && v7->pMonsterInfo.uSpecialAttack | |
8482 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
8483 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
8484 } | |
8485 if ( !pParty->bTurnBasedModeOn ) | |
8486 { | |
8487 v35 = v6->GetActualEndurance(); | |
8488 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
8489 v6->SetRecoveryTime((signed __int64)v36); | |
8490 } | |
8491 if ( v77 ) | |
8492 { | |
8493 v73 = (double)(signed int)v75; | |
8494 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
8495 { | |
8496 if ( v6->sHealth > 0 ) | |
8497 { | |
8498 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
8499 v6->PlaySound(SPEECH_48, 0); | |
8500 } | |
8501 } | |
8502 } | |
8503 viewparams->bRedrawGameUI = 1; | |
8504 return; | |
8505 } | |
8506 v37 = &pSpriteObjects[uActorID]; | |
8507 v38 = PID_TYPE(v37->spell_caster_pid); | |
8508 v39 = PID_ID(v37->spell_caster_pid); | |
8509 v40 = PID_TYPE(v37->spell_caster_pid); | |
8510 uActorID = PID_ID(v37->spell_caster_pid); | |
8511 v41 = v40 - 2; | |
8512 if ( !v41 ) | |
8513 goto LABEL_80; | |
8514 v42 = v41 - 1; | |
8515 if ( !v42 ) | |
8516 { | |
8517 v44 = &pActors[v39]; | |
8518 if ( a4 == -1 ) | |
8519 a4 = stru_50C198.which_player_would_attack(v44); | |
8520 v45 = &pParty->pPlayers[a4]; | |
8521 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
8522 v46 = v37->uType; | |
8523 if ( v37->uType == 545 ) | |
8524 { | |
8525 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
8526 v52 = v51; | |
8527 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
8528 { | |
8529 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
8530 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8531 v45->PlaySound(SPEECH_6, 0); | |
8532 return; | |
8533 } | |
8534 } | |
8535 else | |
8536 { | |
8537 if ( v46 != 555 | |
8538 && v46 != 510 | |
8539 && v46 != 500 | |
8540 && v46 != 515 | |
8541 && v46 != 505 | |
8542 && v46 != 530 | |
8543 && v46 != 525 | |
8544 && v46 != 520 | |
8545 && v46 != 535 | |
8546 && v46 != 540 ) | |
8547 goto LABEL_115; | |
8548 } | |
8549 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
8550 return; | |
8551 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
8552 v77 >>= 1; | |
8553 if ( v45->HasEnchantedItemEquipped(36) ) | |
8554 v77 >>= 1; | |
8555 if ( v45->HasEnchantedItemEquipped(69) ) | |
8556 v77 >>= 1; | |
8557 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8558 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 8559 v77 >>= 1; |
8560 v75 = 0; | |
8561 v47 = (int)&v45->pEquipment; | |
8562 do | |
8563 { | |
8564 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
8565 { | |
8566 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
8567 if ( v48 == 520 ) | |
8568 v77 >>= 1; | |
8569 if ( v48 == 531 ) | |
8570 v77 >>= 1; | |
8571 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
8572 v77 >>= 1; | |
8573 } | |
8574 ++v75; | |
8575 v47 += 4; | |
8576 } | |
8577 while ( (signed int)v75 <= 1 ); | |
8578 LABEL_115: | |
8579 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
8580 { | |
8581 v49 = v44->pActorBuffs[3].uPower; | |
8582 if ( v49 ) | |
8583 v77 /= (signed int)v49; | |
8584 } | |
8585 if ( !v74 ) | |
8586 { | |
8587 v50 = v44->pMonsterInfo.uAttack1Type; | |
8588 goto LABEL_133; | |
8589 } | |
8590 if ( v74 == 1 ) | |
8591 { | |
8592 v50 = v44->pMonsterInfo.uAttack2Type; | |
8593 goto LABEL_133; | |
8594 } | |
8595 if ( v74 == 2 ) | |
8596 { | |
8597 v53 = v44->pMonsterInfo.uSpell1ID; | |
8598 } | |
8599 else | |
8600 { | |
8601 if ( v74 != 3 ) | |
8602 { | |
8603 if ( v74 == 4 ) | |
8604 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
8605 else | |
8606 v50 = 4; | |
8607 LABEL_133: | |
8608 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
8609 { | |
8610 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
8611 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
8612 { | |
8613 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
8614 { | |
8615 v55 = v44->uAIState; | |
8616 if ( v55 != 5 ) | |
8617 { | |
8618 if ( v55 != 4 ) | |
8619 { | |
8620 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
8621 v44->sCurrentHP -= v56; | |
8622 if ( v56 ) | |
8623 { | |
8624 if ( v44->sCurrentHP >= 1 ) | |
8625 { | |
8626 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
8627 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8628 } | |
8629 else | |
8630 { | |
8631 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
8632 { | |
8633 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
8634 v75 = v57; | |
8635 if ( pRenderer->pRenderD3D ) | |
8636 { | |
8637 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
8638 { | |
8639 v58 = (double)(signed int)v75; | |
8640 v75 = v44->vPosition.z; | |
8641 v59 = (double)(signed int)v75; | |
8642 v75 = v44->vPosition.y; | |
8643 v60 = v59; | |
8644 v61 = (double)(signed int)v75; | |
8645 v75 = v44->vPosition.x; | |
8646 v62 = v61; | |
8647 v63 = (double)(signed int)v75; | |
8648 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
8649 } | |
8650 } | |
8651 } | |
8652 Actor::Die(uActorID); | |
8653 Actor::ApplyFineForKillingPeasant(uActorID); | |
8654 Actor::AggroSurroundingPeasants(uActorID, 1); | |
8655 if ( v44->pMonsterInfo.uExp ) | |
8656 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
8657 v64 = SPEECH_51; | |
8658 if ( rand() % 100 < 20 ) | |
8659 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
8660 v45->PlaySound((PlayerSpeech)v64, 0); | |
8661 } | |
8662 } | |
8663 } | |
8664 } | |
8665 } | |
8666 } | |
8667 } | |
8668 if ( !v74 | |
8669 && !(dword_6BE368_debug_settings_2 & 0x10) | |
8670 && v44->pMonsterInfo.uSpecialAttack | |
8671 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
8672 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
8673 if ( !pParty->bTurnBasedModeOn ) | |
8674 { | |
8675 v65 = v45->GetActualEndurance(); | |
8676 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
8677 * flt_6BE3A4_debug_recmod1 | |
8678 * 2.133333333333333; | |
8679 v45->SetRecoveryTime((signed __int64)v66); | |
8680 } | |
8681 return; | |
8682 } | |
8683 v53 = v44->pMonsterInfo.uSpell2ID; | |
8684 } | |
8685 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
8686 goto LABEL_133; | |
8687 } | |
8688 if ( v42 != 1 ) | |
8689 return; | |
8690 LABEL_80: | |
8691 if ( a4 != -1 ) | |
8692 { | |
8693 v43 = &pParty->pPlayers[a4]; | |
8694 LABEL_168: | |
8695 a4b = v43; | |
8696 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
8697 { | |
8698 v70 = v43->GetMaxHealth(); | |
8699 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
8700 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
8701 } | |
8702 else | |
8703 { | |
8704 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
8705 v69 = 0; | |
8706 } | |
8707 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
8708 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
8709 { | |
8710 qword_A750D8 = 256i64; | |
1406 | 8711 PlayerSpeechID = SPEECH_44; |
1407 | 8712 uSpeakingCharacter = uActorID + 1; |
1297 | 8713 } |
8714 return; | |
8715 } | |
8716 v74 = 0; | |
8717 a4a = 1; | |
8718 do | |
8719 { | |
8720 if ( pPlayers[a4a]->CanAct() ) | |
8721 { | |
8722 v67 = v74++; | |
8723 *(&v72 + v67) = a4a; | |
8724 } | |
8725 ++a4a; | |
8726 } | |
8727 while ( a4a <= 4 ); | |
8728 if ( v74 ) | |
8729 { | |
8730 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
8731 goto LABEL_168; | |
8732 } | |
8733 } | |
8734 //----- (00421EA6) -------------------------------------------------------- | |
1458 | 8735 void OnInventoryLeftClick() |
1297 | 8736 { |
8737 Player *v0; // ebx@1 | |
8738 signed int v1; // eax@2 | |
8739 signed int v2; // ecx@2 | |
8740 int v3; // eax@2 | |
8741 char v4; // sf@2 | |
8742 int v5; // eax@2 | |
8743 unsigned int v6; // eax@7 | |
8744 unsigned int v7; // esi@12 | |
8745 unsigned int v8; // eax@12 | |
8746 unsigned int v9; // eax@16 | |
8747 unsigned int v10; // eax@18 | |
8748 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
8749 POINT a2; // [sp+30h] [bp-18h]@4 | |
8750 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
8751 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
8752 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
8753 int a4; // [sp+44h] [bp-4h]@2 | |
8754 | |
8755 v0 = pPlayers[uActiveCharacter]; | |
8756 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
8757 { | |
8758 pMouse->GetClickPos(&pX, &pY); | |
8759 pY = pY - 17; | |
8760 v2 =pX - 14; | |
8761 pX = v2; | |
8762 v3 = 14 * (pY >> 5); | |
8763 v2 >>= 5; | |
8764 v4 = v2 + v3 < 0; | |
8765 v5 = v2 + v3; | |
8766 a4 = v5; | |
8767 if ( !v4 ) | |
8768 { | |
8769 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
8770 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
8771 { | |
8772 if ( unk_50C9A0 ) | |
8773 { | |
8774 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
8775 if ( v6 ) | |
8776 { | |
8777 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
8778 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
8779 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
8780 *((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
|
8781 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 8782 unk_50C9A0 = 0; |
8783 if ( pMessageQueue_50CBD0->uNumMessages ) | |
8784 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
8785 pMouse->SetCursorBitmap("MICON1"); | |
8786 dword_50C9D0 = 113; | |
8787 dword_50C9D4 = 0; | |
8788 dword_50C9D8 = 256; | |
8789 } | |
8790 return; | |
8791 } | |
8792 if ( ptr_50C9A4 ) | |
8793 return; | |
8794 v7 = pParty->pPickedItem.uItemID; | |
8795 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
8796 if ( !v7 ) | |
8797 { | |
8798 if ( !v8 ) | |
8799 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8800 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 8801 v0->RemoveItemAtInventoryIndex(a4); |
8802 v9 = pParty->pPickedItem.uItemID; | |
8803 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8804 return; | |
8805 } | |
8806 v13 = v8; | |
8807 if ( v8 ) | |
8808 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8809 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 8810 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
8811 v0->RemoveItemAtInventoryIndex(a4); | |
8812 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
8813 if ( !pX ) | |
8814 { | |
8815 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
8816 if ( !pX ) | |
8817 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
8818 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 8819 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
8820 return; | |
8821 } | |
8822 } | |
8823 v9 = this_.uItemID; | |
8824 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
8825 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
8826 return; | |
8827 } | |
8828 v10 = v0->AddItem(a4, v7); | |
8829 pX = v10; | |
8830 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
8831 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8832 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 8833 pMouse->RemoveHoldingItem(); |
8834 } | |
8835 } | |
8836 } | |
8837 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8838 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8839 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8840 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8841 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8842 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8843 return pConditions[Condition_Weak] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8844 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8845 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8846 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8847 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8848 return pConditions[Condition_Dead] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8849 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8850 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8851 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8852 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8853 return pConditions[Condition_Eradicated] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8854 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8855 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8856 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8857 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8858 return pConditions[Condition_Zombie] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8859 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8860 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8861 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8862 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8863 return pConditions[Condition_Cursed] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8864 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8865 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8866 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8867 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8868 return pConditions[Condition_Pertified] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8869 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8870 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8871 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8872 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8873 return pConditions[Condition_Unconcious] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8874 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8875 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8876 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8877 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8878 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8879 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8880 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8881 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8882 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8883 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8884 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8885 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8886 void Player::SetCursed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8887 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8888 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8889 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8890 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8891 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8892 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8893 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8894 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8895 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8896 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8897 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8898 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8899 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8900 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8901 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8902 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8903 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8904 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8905 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8906 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8907 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8908 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8909 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8910 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8911 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8912 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8913 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8914 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8915 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8916 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8917 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8918 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8919 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8920 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8921 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8922 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8923 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8924 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8925 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8926 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8927 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8928 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8929 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8930 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8931 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8932 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8933 pConditions[Condition_Disease2] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8936 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8937 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8938 pConditions[Condition_Poison3] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8941 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8942 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8943 pConditions[Condition_Disease3] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8946 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8947 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8948 pConditions[Condition_Paralyzed] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8951 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8952 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8953 pConditions[Condition_Unconcious] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8956 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8957 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8958 pConditions[Condition_Dead] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8961 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8962 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8963 pConditions[Condition_Pertified] = state; |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8966 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8967 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8968 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8969 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8970 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8971 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8972 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8973 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8974 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8975 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8976 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8977 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8978 SetCondition(Condition_Weak, blockable); |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8981 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
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 SetCondition(Condition_Insane, blockable); |
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8986 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8987 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8988 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
8989 } |
1567
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8990 |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8991 void Player::SetCondUnconsciousWithBlockCheck( int blockable ) |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8992 { |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8993 SetCondition(Condition_Dead, blockable); |
9f8b3e904e14
Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents:
1565
diff
changeset
|
8994 } |