Mercurial > mm7
annotate Player.cpp @ 1424:5930342f092b
fall to the water
author | Ritor1 |
---|---|
date | Tue, 30 Jul 2013 15:14:46 +0600 |
parents | 2423bc2af692 |
children | 71a2cf416478 2489c8aeac90 |
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 |
187 | 5 #include <assert.h> |
6 | |
1016 | 7 #include "stru6.h" |
8 | |
9 | |
0 | 10 #include "Player.h" |
11 #include "PlayerFrameTable.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Party.h" | |
816 | 14 #include "Log.h" |
0 | 15 #include "LOD.h" |
16 #include "GUIWindow.h" | |
17 #include "Viewport.h" | |
18 #include "Actor.h" | |
19 #include "Game.h" | |
20 #include "Mouse.h" | |
21 #include "TurnEngine.h" | |
22 #include "Events.h" | |
23 #include "Events2D.h" | |
24 #include "Outdoor.h" | |
25 #include "StorylineTextTable.h" | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
26 #include "Autonotes.h" |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
45
diff
changeset
|
27 #include "Awards.h" |
189 | 28 #include "texts.h" |
816 | 29 |
0 | 30 #include "mm7_data.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
31 #include "MM7.h" |
1297 | 32 #include "SpriteObject.h" |
33 #include "DecalBuilder.h" | |
0 | 34 |
35 | |
36 | |
37 | |
38 | |
39 /* 381 */ | |
40 #pragma pack(push, 1) | |
290 | 41 struct PlayerCreation_AttributeProps |
0 | 42 { |
43 unsigned __int8 uBaseValue; | |
44 char uMaxValue; | |
45 char uDroppedStep; | |
46 char uBaseStep; | |
47 }; | |
48 #pragma pack(pop) | |
49 | |
50 | |
51 #pragma pack(push, 1) | |
290 | 52 |
53 | |
54 | |
0 | 55 #pragma pack(pop) |
290 | 56 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
57 { | |
58 {{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},}, | |
59 {{ 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},}, | |
60 {{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},}, | |
61 {{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 | 62 }; |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 // available skills per class ( 9 classes X 37 skills ) | |
70 // 0 - not available | |
71 // 1 - available | |
72 // 2 - primary skill | |
73 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820 | |
74 { | |
75 {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}, | |
76 {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}, | |
77 {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}, | |
78 {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}, | |
79 {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}, | |
80 {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}, | |
81 {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}, | |
82 {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}, | |
83 {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 | |
84 }; | |
85 | |
86 | |
1374 | 87 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398 |
88 { | |
89 1, // EQUIP_OFF_HAND | |
90 1, // EQUIP_MAIN_HAND | |
91 2, // EQUIP_BOW | |
92 3, // EQUIP_ARMOUR | |
93 0, // EQUIP_SHIELD | |
94 4, // EQUIP_HELMET | |
95 5, // EQUIP_BELT | |
96 6, // EQUIP_CLOAK | |
97 7, // EQUIP_GAUNTLETS | |
98 8, // EQUIP_BOOTS | |
99 10, // EQUIP_RING | |
100 9, // EQUIP_AMULET | |
101 1, // EQUIP_WAND | |
102 0, // EQUIP_REAGENT | |
103 0, // EQUIP_POTION | |
104 0, // EQUIP_SPELL_SCROLL | |
105 0, // EQUIP_BOOK | |
106 0, // EQUIP_MESSAGE_SCROLL | |
107 0, // EQUIP_GOLD | |
108 0, // EQUIP_GEM | |
109 0 // EQUIP_NONE | |
110 }; | |
0 | 111 |
112 | |
113 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0}; | |
114 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0}; | |
115 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}; | |
116 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}; | |
117 | |
1325 | 118 unsigned char pConditionAttributeModifier[7][19] = |
119 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might | |
120 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence | |
121 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower | |
122 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance | |
123 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy | |
124 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed | |
125 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck | |
126 | |
127 unsigned char pAgingAttributeModifier[7][4] = | |
128 {{100, 75, 40, 10}, //Might | |
129 {100, 150, 100, 10}, //Intelligence | |
130 {100, 150, 100, 10}, //Willpower | |
131 {100, 75, 40, 10}, //Endurance | |
132 {100, 100, 40, 10}, //Accuracy | |
133 {100, 100, 40, 10}, //Speed | |
134 {100, 100, 100, 100}}; //Luck | |
0 | 135 |
1036 | 136 signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; |
0 | 137 |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
138 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 | 139 |
1036 | 140 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, |
0 | 141 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, |
1036 | 142 19, 17, 15, 13, 11, 9, 7, 5, 3, 0}; |
143 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 | 144 |
145 | |
816 | 146 unsigned short base_recovery_times_per_weapon_type[12] = |
147 { | |
148 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill | |
149 90, // PLAYER_SKILL_SWORD && Unarmed with skill | |
150 60, // PLAYER_SKILL_DAGGER | |
151 100, // PLAYER_SKILL_AXE | |
152 80, // PLAYER_SKILL_SPEAR | |
153 100, // PLAYER_SKILL_BOW | |
154 80, // PLAYER_SKILL_MACE | |
155 30, // PLAYER_SKILL_BLASTER | |
156 10, // PLAYER_SKILL_SHIELD | |
157 10, // PLAYER_SKILL_LEATHER | |
158 20, // PLAYER_SKILL_CHAIN | |
159 30 // PLAYER_SKILL_PLATE | |
160 }; | |
161 | |
162 | |
0 | 163 |
164 //----- (00490913) -------------------------------------------------------- | |
1273 | 165 signed int __cdecl PlayerCreation_GetUnspentAttributePointCount() |
0 | 166 { |
167 signed int v0; // edi@1 | |
1273 | 168 int raceId; // ebx@2 |
0 | 169 signed int v4; // eax@17 |
170 int v5; // edx@18 | |
171 signed int v6; // ecx@18 | |
1273 | 172 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 |
173 | |
174 remainingStatPoints = 50; | |
0 | 175 v0 = 50; |
1273 | 176 for (int playerNum = 0; playerNum < 4; playerNum++) |
177 { | |
178 raceId = pParty->pPlayers[playerNum].GetRace(); | |
179 for (int statNum = 0; statNum <= 6; statNum++) | |
180 { | |
181 switch ( statNum ) | |
0 | 182 { |
1273 | 183 case 0: |
184 v0 = pParty->pPlayers[playerNum].uMight; | |
185 break; | |
186 case 1: | |
187 v0 = pParty->pPlayers[playerNum].uIntelligence; | |
188 break; | |
189 case 2: | |
190 v0 = pParty->pPlayers[playerNum].uWillpower; | |
191 break; | |
192 case 3: | |
193 v0 = pParty->pPlayers[playerNum].uEndurance; | |
194 break; | |
195 case 4: | |
196 v0 = pParty->pPlayers[playerNum].uAccuracy; | |
197 break; | |
198 case 5: | |
199 v0 = pParty->pPlayers[playerNum].uSpeed; | |
200 break; | |
201 case 6: | |
202 v0 = pParty->pPlayers[playerNum].uLuck; | |
203 break; | |
204 } | |
205 v4 = StatTable[raceId][statNum].uBaseValue; | |
206 if ( v0 >= v4 ) | |
207 { | |
208 v5 = StatTable[raceId][statNum].uDroppedStep; | |
209 v6 = StatTable[raceId][statNum].uBaseStep; | |
0 | 210 } |
211 else | |
212 { | |
1273 | 213 v5 = StatTable[raceId][statNum].uBaseStep; |
214 v6 = StatTable[raceId][statNum].uDroppedStep; | |
0 | 215 } |
1273 | 216 remainingStatPoints += v5 * (v4 - v0) / v6; |
217 } | |
218 } | |
219 return remainingStatPoints; | |
0 | 220 } |
221 | |
222 | |
223 | |
224 //----- (00427730) -------------------------------------------------------- | |
225 bool Player::CanCastSpell(unsigned int uRequiredMana) | |
226 { | |
1275 | 227 if (sMana >= (signed int)uRequiredMana) |
228 { | |
229 sMana -= (signed int)uRequiredMana; | |
488 | 230 return true; |
231 } | |
232 | |
233 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | |
234 return false; | |
0 | 235 } |
236 | |
237 | |
238 //----- (004BE2DD) -------------------------------------------------------- | |
1014 | 239 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx ) |
240 { | |
0 | 241 float v6; // ST04_4@1 |
1014 | 242 signed int item_value; // eax@1 |
243 signed int sell_price; // ebx@1 | |
244 | |
245 item_value =pOwnItems[item_index].GetValue(); | |
246 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier; | |
247 sell_price = GetPriceSell(item_value, v6); | |
248 if ( pOwnItems[item_index].Broken() ) | |
249 sell_price = 1; | |
250 if ( sell_price < 1 ) | |
251 sell_price = 1; | |
252 RemoveItemAtInventoryIndex(inventory_idnx); | |
253 Party::SetGold(pParty->uNumGold + sell_price); | |
0 | 254 } |
255 | |
256 | |
257 | |
258 //----- (0043EEF3) -------------------------------------------------------- | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
259 bool Player::NothingOrJustBlastersEquipped() |
0 | 260 { |
1014 | 261 signed int item_idx; // esi@1 |
262 signed int item_id; // esi@1 | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
263 for (int i = 0; i < 16; ++i) |
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_idx = pEquipment.pIndices[i]; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
266 if (item_idx) |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
267 { |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
268 item_id = pOwnItems[item_idx - 1].uItemID; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
269 if ( item_id != 64 && item_id != 65 ) //blaster& blaster rifle |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
270 return false; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
271 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
272 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
273 return true; |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
274 } |
1014 | 275 |
0 | 276 |
277 | |
278 | |
279 //----- (004B8040) -------------------------------------------------------- | |
1036 | 280 int Player::GetConditionDayOfWeek( unsigned int uCondition ) |
281 { | |
282 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1; | |
0 | 283 } |
284 | |
285 //----- (004B807C) -------------------------------------------------------- | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
286 int Player::GetTempleHealCostModifier(float a2) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
287 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
288 unsigned int conditionIdx; // eax@1 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
289 int conditionTimeMultiplier; // esi@1 |
0 | 290 int v6; // eax@8 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
291 signed int result; // qax@13 |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
292 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 |
1275 | 293 |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
294 conditionIdx = GetMajorConditionIdx(); |
1275 | 295 if ( conditionIdx >= 14 && conditionIdx <= 16) |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
296 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
297 if ( conditionIdx <= 15 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
298 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
299 baseConditionMultiplier = 5; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
300 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
301 if ( conditionIdx == 16 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
302 { |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
303 baseConditionMultiplier = 10; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
304 } |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
305 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
306 } |
1350 | 307 else |
308 { | |
1275 | 309 conditionTimeMultiplier = 1; |
310 baseConditionMultiplier = 1; | |
1350 | 311 if (conditionIdx < 14) |
312 { | |
313 for (int i = 0; i <= 13; i++) | |
314 { | |
315 v6 = GetConditionDayOfWeek(i); | |
316 if ( v6 > conditionTimeMultiplier ) | |
317 conditionTimeMultiplier = v6; | |
318 } | |
319 } | |
1275 | 320 } |
321 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); | |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
322 if ( result < 1 ) |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
323 result = 1; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
324 return result; |
0 | 325 } |
326 | |
327 //----- (004B8102) -------------------------------------------------------- | |
917 | 328 int Player::GetPriceSell(int uRealValue, float price_multiplier) |
0 | 329 { |
330 signed int v3; // esi@1 | |
331 signed int result; // eax@3 | |
332 | |
1275 | 333 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); |
917 | 334 if ( v3 > uRealValue ) |
335 v3 = uRealValue; | |
0 | 336 result = 1; |
337 if ( v3 >= 1 ) | |
338 result = v3; | |
339 return result; | |
340 } | |
341 | |
342 //----- (004B8142) -------------------------------------------------------- | |
749 | 343 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
344 { | |
1275 | 345 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
749 | 346 assert (price > 0); |
347 | |
348 if (price < uRealValue) | |
349 price = uRealValue; | |
350 return price; | |
0 | 351 } |
352 | |
353 //----- (004B8179) -------------------------------------------------------- | |
916 | 354 int Player::GetPriceIdentification(float a2) |
0 | 355 { |
356 signed int v2; // esi@1 | |
357 int v3; // ecx@1 | |
358 signed int result; // eax@3 | |
359 | |
1275 | 360 v2 = (signed int)(a2 * 50.0); |
0 | 361 v3 = v2 * (100 - GetMerchant()) / 100; |
362 if ( v3 < v2 / 3 ) | |
363 v3 = v2 / 3; | |
364 result = 1; | |
365 if ( v3 >= 1 ) | |
366 result = v3; | |
367 return result; | |
368 } | |
369 | |
370 //----- (004B81C3) -------------------------------------------------------- | |
916 | 371 int Player::GetPriceRepair(int a2, float a3) |
0 | 372 { |
373 signed int v3; // esi@1 | |
374 int v4; // ecx@1 | |
375 signed int result; // eax@3 | |
376 | |
1275 | 377 v3 = (signed int)((double)a2 / (6.0 - a3)); |
0 | 378 v4 = v3 * (100 - GetMerchant()) / 100; |
379 if ( v4 < v3 / 3 ) | |
380 v4 = v3 / 3; | |
381 result = 1; | |
382 if ( v4 >= 1 ) | |
383 result = v4; | |
384 return result; | |
385 } | |
386 | |
387 //----- (004B8213) -------------------------------------------------------- | |
1275 | 388 int Player::GetBaseSellingPrice(int a2, float a3) |
389 { | |
390 signed int v3; // qax@1 | |
391 | |
392 v3 = (signed int)((double)a2 / (a3 + 2.0)); | |
393 if ( v3 < 1 ) | |
394 v3 = 1; | |
0 | 395 return v3; |
396 } | |
397 | |
398 //----- (004B8233) -------------------------------------------------------- | |
1275 | 399 int Player::GetBaseBuyingPrice(int a2, float a3) |
400 { | |
401 signed int v3; // qax@1 | |
402 | |
403 v3 = (signed int)((double)a2 * a3); | |
404 if ( v3 < 1 ) | |
405 v3 = 1; | |
0 | 406 return v3; |
407 } | |
408 | |
409 //----- (004B824B) -------------------------------------------------------- | |
1275 | 410 int Player::GetBaseIdentifyPrice(float a2) |
411 { | |
412 signed int v2; // qax@1 | |
413 | |
414 v2 = (signed int)(a2 * 50.0); | |
415 if ( v2 < 1 ) | |
416 v2 = 1; | |
0 | 417 return v2; |
418 } | |
419 | |
420 //----- (004B8265) -------------------------------------------------------- | |
1275 | 421 int Player::GetBaseRepairPrice(int a2, float a3) |
422 { | |
423 signed int v3; // qax@1 | |
424 | |
425 v3 = (signed int)((double)a2 / (6.0 - a3)); | |
426 if ( v3 < 1 ) | |
427 v3 = 1; | |
0 | 428 return v3; |
429 } | |
430 | |
431 | |
432 | |
433 | |
434 | |
435 //----- (004B6FF9) -------------------------------------------------------- | |
1348 | 436 bool Player::IsPlayerHealableByTemple() |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
437 { |
0 | 438 signed int v2; // eax@1 |
336 | 439 v2 = (signed int)window_SpeakInHouse->ptr_1C; |
1348 | 440 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good) |
441 { | |
442 return false; | |
443 } | |
444 else | |
445 { | |
446 if (GetMajorConditionIdx() == Condition_Zombie) | |
447 { | |
448 if ((v2 == 78 || v2 == 81 || v2 == 82)) | |
449 { | |
450 return false; | |
451 } | |
452 else | |
453 { | |
454 return true; | |
455 } | |
1346
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
456 } |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
457 else |
1434b36f4bdb
Player::_43EEF3 renamed to NothingOrJustBlastersEquipped
Grumpy7
parents:
1325
diff
changeset
|
458 { |
1348 | 459 return true; |
460 } | |
1278
ce8ea73e7678
changed Player::_4B6FF9 to Player::IsPlayerHealableByTemple
Grumpy7
parents:
1276
diff
changeset
|
461 } |
0 | 462 } |
463 | |
464 | |
465 | |
466 //----- (00421E75) -------------------------------------------------------- | |
1012 | 467 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index) |
468 { | |
469 int item_idx; // eax@1 | |
470 int inv_index; // eax@3 | |
471 | |
1351 | 472 |
1012 | 473 item_idx = *pitem_index; |
474 if ( item_idx >125 || item_idx < 0 ) | |
475 { | |
476 return 0; | |
477 } | |
478 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
479 inv_index = this->pInventoryMatrix[item_idx]; |
1012 | 480 if ( inv_index < 0 ) |
481 { | |
482 *pitem_index = -1 - inv_index; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
483 inv_index = this->pInventoryMatrix[-1 - inv_index]; |
1012 | 484 } |
485 | |
486 return inv_index; | |
0 | 487 } |
488 | |
489 | |
490 | |
491 //----- (004160CA) -------------------------------------------------------- | |
1012 | 492 void Player::ItemsEnchant( int enchant_count ) |
493 { | |
494 int avalible_items; // ebx@1 | |
495 int i; // edx@8 | |
496 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1 | |
497 | |
498 avalible_items = 0; | |
499 memset (item_index_tabl,0,sizeof(item_index_tabl)); | |
500 | |
1349 | 501 for (i = 0; i < 138; ++i) |
502 { | |
503 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134)) | |
504 item_index_tabl[avalible_items++] = i; | |
505 } | |
1012 | 506 |
507 if ( avalible_items ) | |
508 { | |
509 if ( enchant_count ) | |
510 { | |
1349 | 511 for ( i = 0; i < enchant_count; ++i ) |
512 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
513 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
|
514 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; |
1349 | 515 } |
0 | 516 } |
517 else | |
518 { | |
1012 | 519 for ( i = 0; i < avalible_items; ++i ) |
520 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
521 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; |
1349 | 522 } |
523 } | |
524 } | |
0 | 525 } |
526 | |
527 //----- (004948B1) -------------------------------------------------------- | |
187 | 528 void Player::PlaySound(PlayerSpeech speech, int a3) |
529 { | |
1351 | 530 signed int speechCount = 0; // esi@4 |
531 signed int expressionCount = 0; // esi@4 | |
532 int pickedVariant; // esi@10 | |
248 | 533 CHARACTER_EXPRESSION_ID expression; // ebx@17 |
1406 | 534 signed int pSoundID; // ecx@19 |
1351 | 535 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7 |
536 int expressionVariantArray[5]; | |
537 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4 | |
538 unsigned int expressionDuration = 0; | |
187 | 539 |
1351 | 540 pickedSoundID = 0; |
203 | 541 if (uVoicesVolumeMultiplier) |
0 | 542 { |
1351 | 543 for (int i = 0; i < 2; i++) |
544 { | |
1406 | 545 if ( SoundSetAction[speech][i] ) |
546 { | |
547 speechVariantArray[speechCount] = SoundSetAction[speech][i]; | |
1351 | 548 speechCount++; |
549 } | |
550 } | |
551 if ( speechCount ) | |
552 { | |
553 pickedVariant = speechVariantArray[rand() % speechCount]; | |
554 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID]; | |
555 if (numberOfSubvariants > 0) | |
556 { | |
557 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998; | |
1406 | 558 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0); |
1351 | 559 } |
560 } | |
561 } | |
562 | |
563 for (int i = 0; i < 5; i++) | |
564 { | |
1406 | 565 if ( SoundSetAction[speech][i + 3] ) |
566 { | |
567 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3]; | |
1351 | 568 expressionCount++; |
569 } | |
570 } | |
571 if ( expressionCount ) | |
572 { | |
573 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount]; | |
574 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID ) | |
575 { | |
1406 | 576 pSoundID = 0; |
577 if ( pSoundList->sNumSounds ) | |
578 { | |
1351 | 579 for (int i = 0; i < pSoundList->sNumSounds; i++) |
0 | 580 { |
1406 | 581 if (pSoundList->pSounds[i].uSoundID == pickedSoundID) |
582 pSoundID = i; | |
0 | 583 } |
584 } | |
1406 | 585 if ( pSoundList->pSounds[pSoundID].pSoundData[0] ) |
1351 | 586 expressionDuration = (sLastTrackLengthMS << 7) / 1000; |
587 } | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
588 PlayEmotion(expression, expressionDuration); |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
589 } |
0 | 590 } |
591 // 4948B1: using guessed type int var_1C[5]; | |
592 | |
593 //----- (00494A25) -------------------------------------------------------- | |
187 | 594 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
595 { | |
1352
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
596 unsigned int v3 = expression; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
597 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
|
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 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
|
602 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
603 return; |
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 else |
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 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
|
608 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
609 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
|
610 { |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
611 return; |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
612 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
613 } |
88f80476c99c
Player::PlayEmotion simplified main condition, renamed a few expression enum vals
Grumpy7
parents:
1351
diff
changeset
|
614 } |
0 | 615 this->uExpressionTimePassed = 0; |
616 if ( !a3 ) | |
617 { | |
187 | 618 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
619 } | |
1353
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
620 else |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
621 { |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
622 this->uExpressionTimeLength = 0; |
8f69f77a0067
Player::PlayEmotion removed unused variables, deleted a useless secion of code (unused calculations)
Grumpy7
parents:
1352
diff
changeset
|
623 } |
187 | 624 expression = new_expression; |
0 | 625 viewparams->bRedrawGameUI = 1; |
626 } | |
627 | |
628 //----- (0049327B) -------------------------------------------------------- | |
1355 | 629 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
|
630 { |
135 | 631 if ( this->classType == uClass ) |
0 | 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 return true; |
0 | 634 } |
635 else | |
636 { | |
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
|
637 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
|
638 { |
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
|
639 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
|
640 } |
0 | 641 switch ( uClass ) |
642 { | |
643 case 0x1Au: | |
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
|
644 return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 65)); |
0 | 645 case 0x1Bu: |
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
|
646 return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 67)); |
0 | 647 case 0x22u: |
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
|
648 return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 77)); |
0 | 649 case 0x23u: |
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
|
650 return(_449B57_test_bit((unsigned __int8 *)this->_guilds_member_bits, 79)); |
0 | 651 break; |
652 default: | |
1354
05becb008006
Player::_49327B to Player::ProfessionOrGuildFlagsCorrect, removed a huge section of the function that's never used (only 4 inputs used)
Grumpy7
parents:
1353
diff
changeset
|
653 assert("Should not be able to get here" && false); |
0 | 654 break; |
655 } | |
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
|
656 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
|
657 } |
0 | 658 } |
659 | |
660 | |
661 //----- (00492C0B) -------------------------------------------------------- | |
662 bool Player::CanAct() | |
663 { | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
664 if ( this->IsAsleep() || this->IsParalyzed() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
665 this->IsUnconcious() || this->IsDead() || |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
666 this->IsPertified() || this->IsEradicated() ) |
1355 | 667 return false; |
0 | 668 else |
1355 | 669 return true; |
0 | 670 } |
671 | |
672 //----- (00492C40) -------------------------------------------------------- | |
673 bool Player::CanSteal() | |
674 { | |
1355 | 675 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0; |
0 | 676 } |
677 | |
678 //----- (00492C4E) -------------------------------------------------------- | |
679 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID) | |
680 { | |
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
|
681 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
|
682 { |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
683 case ITEM_RELIC_ETHRICS_STAFF: |
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
684 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
|
685 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
|
686 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 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
|
695 default: return 1; break; |
1356
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
696 } |
301e227439e7
Player::CanEquip_RaceAndAlignmentCheck condition reorganizing, label removal, using GetSexByVoice()
Grumpy7
parents:
1355
diff
changeset
|
697 } |
1360
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
698 |
0 | 699 //----- (00492D65) -------------------------------------------------------- |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
700 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
|
701 { |
a47d9282ea7c
Player::SetCondition 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 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
|
703 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
|
704 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
|
705 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
|
706 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
707 if ( pConditions[uConditionIdx] ) |
1361
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 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
710 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3)) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
711 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
712 return; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
713 } |
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
|
714 |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
715 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
|
716 { |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
717 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
|
718 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
|
719 case Condition_Sleep: break; //nosound |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
720 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
|
721 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
|
722 case Condition_Insane: PlaySound(SPEECH_29, 0); break; |
1014 | 723 case Condition_Poison1: |
724 case Condition_Poison2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
725 case Condition_Poison3: PlaySound(SPEECH_27, 0); break; |
1014 | 726 case Condition_Disease1: |
727 case Condition_Disease2: | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
728 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
|
729 case Condition_Paralyzed: break; //nosound |
1014 | 730 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
|
731 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
|
732 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
|
733 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 break; |
1014 | 735 case Condition_Dead: |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
736 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
|
737 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
|
738 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
|
739 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
|
740 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
|
741 break; |
1014 | 742 case Condition_Pertified: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
743 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
|
744 break; |
1014 | 745 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
|
746 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
|
747 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
|
748 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
|
749 if ( sMana > 0 ) |
1014 | 750 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
|
751 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
|
752 case Condition_Zombie: |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
763 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
|
764 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
|
765 } |
a47d9282ea7c
Player::SetCondition 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 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
|
767 { |
a47d9282ea7c
Player::SetCondition 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 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
|
769 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
|
770 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
771 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
|
772 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
|
773 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
774 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
775 players_before = 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
776 for (int i = 1; i < 5; ++i) |
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 if ( pPlayers[i]->CanAct() ) |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
779 ++players_before; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
780 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
781 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
782 pConditions[uConditionIdx] = 1; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
783 |
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
|
784 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
|
785 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
|
786 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
|
787 { |
a47d9282ea7c
Player::SetCondition 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 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
|
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 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
|
791 ++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
|
792 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
793 } |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
794 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
|
795 { |
a47d9282ea7c
Player::SetCondition added spaces for readability, fixed stoning and poisioning bug wit prot. from magic, using IsMale() function instead of case
Grumpy7
parents:
1359
diff
changeset
|
796 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
|
797 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
798 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
|
799 } |
0 | 800 |
801 //----- (00492528) -------------------------------------------------------- | |
802 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) | |
803 { | |
1363 | 804 Texture *texture; // esi@1 |
805 unsigned int slotWidth; // ebx@1 | |
806 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1 | |
807 | |
808 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
809 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth); | |
810 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight); | |
0 | 811 if ( !areWeLoadingTexture ) |
812 { | |
1363 | 813 texture->Release(); |
1006 | 814 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 815 } |
1363 | 816 if ( slotHeight == 0 || slotWidth == 0) |
817 { | |
818 assert("Items should have nonzero dimensions"); | |
819 return 1; | |
820 } | |
821 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) | |
822 { | |
823 int startOfInnerLoop = uSlot; | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
824 for (unsigned int y = 0; y < slotHeight; y++) |
1363 | 825 { |
826 int innerLoopPos = startOfInnerLoop; | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
827 for (unsigned int x = 0; x < slotWidth; x++) |
1363 | 828 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
829 if (pInventoryMatrix[innerLoopPos] != 0) |
1363 | 830 { |
831 return false; | |
832 } | |
833 innerLoopPos++; | |
834 } | |
835 startOfInnerLoop += INVETORYSLOTSWIDTH; | |
836 } | |
837 return true; | |
838 } | |
839 return false; | |
0 | 840 } |
841 // 506128: using guessed type int areWeLoadingTexture; | |
842 | |
843 //----- (004925E6) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
844 int Player::FindFreeInventoryListSlot() |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
845 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
846 for (int i = 0; i < 126; i++ ) |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
847 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
848 if (pInventoryItemList[i].uItemID == 0) |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
849 { |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
850 return i; |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
851 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
852 } |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
853 return -1; |
0 | 854 } |
855 | |
856 //----- (00492600) -------------------------------------------------------- | |
857 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) | |
858 { | |
859 int result; // eax@8 | |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
860 signed int freeSlot; // [sp+8h] [bp-4h]@4 |
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
861 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
862 freeSlot = FindFreeInventoryListSlot(); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
863 if ( freeSlot == -1 ) |
0 | 864 { |
865 if ( uActiveCharacter ) | |
201 | 866 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
1366
8f339c3bbdaf
Player::CreateItemInInventory small bugfix from previous change
Grumpy7
parents:
1365
diff
changeset
|
867 return 0; |
0 | 868 } |
869 else | |
870 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
871 PutItemArInventoryIndex(uItemID, freeSlot, uSlot); |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
872 result = freeSlot + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
873 this->pInventoryItemList[freeSlot].uItemID = uItemID; |
0 | 874 } |
875 return result; | |
876 } | |
877 // 506128: using guessed type int areWeLoadingTexture; | |
878 | |
879 //----- (00492700) -------------------------------------------------------- | |
880 int Player::HasSkill(unsigned int uSkillType) | |
881 { | |
1374 | 882 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) |
883 { | |
884 return 1; | |
0 | 885 } |
886 else | |
887 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
888 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
889 ShowStatusBarString(pTmpBuf.data(), 2u); |
1374 | 890 return 0; |
891 } | |
0 | 892 } |
893 | |
894 //----- (00492745) -------------------------------------------------------- | |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
895 void Player::WearItem( unsigned int uItemID ) |
0 | 896 { |
1010 | 897 int item_body_anch; // edi@6 |
898 int item_indx; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
899 item_indx = FindFreeInventoryListSlot(); |
1010 | 900 |
901 if ( item_indx != -1 ) | |
902 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
903 pInventoryItemList[item_indx].uItemID = uItemID; |
1374 | 904 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; |
905 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
|
906 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; |
0 | 907 } |
908 } | |
909 | |
910 //----- (004927A8) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
911 int Player::AddItem(int index, unsigned int uItemID) |
0 | 912 { |
1374 | 913 int xStartValue = 0; |
1385 | 914 int startOfInnerLoop = 0; |
1374 | 915 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
916 if ( index == -1 ) |
0 | 917 { |
1374 | 918 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
919 { | |
1385 | 920 int innerLoopPos = startOfInnerLoop; |
921 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) | |
922 { | |
923 if ( CanFitItem(innerLoopPos, uItemID) ) | |
0 | 924 { |
1385 | 925 return CreateItemInInventory(innerLoopPos, uItemID); |
0 | 926 } |
1385 | 927 innerLoopPos++; |
928 } | |
929 startOfInnerLoop += INVETORYSLOTSWIDTH; | |
0 | 930 } |
931 return 0; | |
932 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
933 if ( !CanFitItem(index, uItemID) ) |
0 | 934 { |
935 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
936 return 0; | |
937 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
938 return CreateItemInInventory(index, uItemID); |
0 | 939 } |
940 | |
941 //----- (00492826) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
942 int Player::AddItem2(int index, ItemGen *Src) |
0 | 943 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
944 int xStartValue = 0; |
0 | 945 pItemsTable->SetSpecialBonus(Src); |
1385 | 946 int startOfInnerLoop = 0; |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
947 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
948 if ( index == -1 ) |
0 | 949 { |
1385 | 950 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. |
951 { | |
952 int innerLoopPos = startOfInnerLoop; | |
953 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) | |
954 { | |
955 if ( CanFitItem(innerLoopPos, Src->uItemID) ) | |
0 | 956 { |
1385 | 957 return CreateItemInInventory2(innerLoopPos, Src); |
0 | 958 } |
1385 | 959 innerLoopPos++; |
960 } | |
961 startOfInnerLoop += INVETORYSLOTSWIDTH; | |
0 | 962 } |
963 return 0; | |
964 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
965 if ( !CanFitItem(index, Src->uItemID) ) |
0 | 966 return 0; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
967 return CreateItemInInventory2(index, Src); |
0 | 968 } |
969 | |
970 //----- (0049289C) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
971 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) |
0 | 972 { |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
973 signed int freeSlot; // ebx@1 |
0 | 974 int result; // eax@6 |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
975 |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
976 freeSlot = FindFreeInventoryListSlot(); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
977 if ( freeSlot == -1 ) |
0 | 978 { |
979 result = 0; | |
980 } | |
981 else | |
982 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
983 PutItemArInventoryIndex(Src->uItemID, freeSlot, index); |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
984 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); |
1382
132a6a0d5cef
Player::AddItem2, Player::CreateItemInInventory2 cleanup
Grumpy7
parents:
1374
diff
changeset
|
985 result = freeSlot + 1; |
0 | 986 } |
987 return result; | |
988 } | |
989 // 506128: using guessed type int areWeLoadingTexture; | |
990 | |
991 //----- (0049298B) -------------------------------------------------------- | |
1385 | 992 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
|
993 { |
1014 | 994 Texture *item_texture; // esi@1 |
995 int *pInvPos; // esi@4 | |
996 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 | |
997 unsigned int slot_height; // [sp+18h] [bp+8h]@1 | |
998 | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
999 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1014 | 1000 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); |
1001 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1002 if ( !areWeLoadingTexture ) |
1003 { | |
1014 | 1004 item_texture->Release(); |
1006 | 1005 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1006 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1007 if ( slot_width > 0 ) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1008 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1009 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1010 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1011 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1012 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
|
1013 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1014 } |
1014 | 1015 } |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1016 pInventoryMatrix[index] = itemListPos + 1; |
0 | 1017 } |
278 | 1018 |
0 | 1019 // 506128: using guessed type int areWeLoadingTexture; |
1020 | |
1021 //----- (00492A36) -------------------------------------------------------- | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1022 void Player::RemoveItemAtInventoryIndex( unsigned int index ) |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1023 { |
1014 | 1024 ItemGen *item_in_slot; // ecx@1 |
1025 Texture *item_texture; // esi@1 | |
1026 unsigned int slot_height; // ebp@1 | |
1027 int *pInvPos; // edx@4 | |
1028 unsigned int slot_width; // [sp+14h] [bp+4h]@1 | |
1029 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1030 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; |
1014 | 1031 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1032 item_in_slot->Reset(); | |
1033 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); | |
1034 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); | |
0 | 1035 if ( !areWeLoadingTexture ) |
1036 { | |
1014 | 1037 item_texture->Release(); |
1006 | 1038 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1039 } |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1040 if ( slot_width > 0 ) |
1014 | 1041 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1042 pInvPos = &pInventoryMatrix[index]; |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1043 for (unsigned int i = 0; i < slot_height; i++) |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1044 { |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1045 memset32(pInvPos, 0, slot_width); |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1046 pInvPos += INVETORYSLOTSWIDTH; |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1047 } |
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
1048 } |
0 | 1049 } |
1050 // 506128: using guessed type int areWeLoadingTexture; | |
1051 | |
1052 //----- (00490EEE) -------------------------------------------------------- | |
1386 | 1053 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1054 { | |
1055 unsigned int idemId; // edx@1 | |
1056 signed int equipType; // esi@1 | |
1057 float multiplier; // ST04_4@26 | |
1058 int price; // edi@26 | |
1059 int merchantLevel; // [sp+10h] [bp-8h]@1 | |
1060 int itemValue; | |
1061 | |
1062 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | |
1063 idemId = pItem->uItemID; | |
1064 equipType = pItemsTable->pItems[idemId].uEquipType; | |
1065 itemValue = pItem->GetValue(); | |
1066 | |
1067 switch (building_type) | |
1068 { | |
1411 | 1069 case BuildingType_WeaponShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1070 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1071 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1072 if (equipType > EQUIP_BOW) |
1386 | 1073 return 4; |
1074 break; | |
1411 | 1075 case BuildingType_ArmorShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1076 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1077 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1078 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) |
1386 | 1079 return 4; |
1080 break; | |
1411 | 1081 case BuildingType_MagicShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1082 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) |
1386 | 1083 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1084 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) |
1386 | 1085 return 4; |
1086 break; | |
1411 | 1087 case BuildingType_AlchemistShop: |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1088 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) |
1386 | 1089 return 5; |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1090 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1386 | 1091 return 4; |
1092 break; | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1093 default: |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1094 assert(false); |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1095 break; |
1386 | 1096 } |
1097 if (pItem->Stolen()) | |
1098 return 6; | |
1099 | |
1100 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1101 switch (ShopMenuType) | |
1102 { | |
1103 case 2: | |
1104 price = GetBuyingPrice(itemValue, multiplier); | |
1105 break; | |
1106 case 3: | |
917 | 1107 if (pItem->Broken()) |
1386 | 1108 price = 1; |
917 | 1109 else |
1386 | 1110 price = this->GetPriceSell(itemValue, multiplier); |
1111 break; | |
1112 case 4: | |
1113 price = this->GetPriceIdentification(multiplier); | |
1114 break; | |
1115 case 5: | |
1116 price = this->GetPriceRepair(itemValue, multiplier); | |
1387
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1117 break; |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1118 default: |
297b6f192232
Player::SelectPhrasesTransaction finished, some constants changed to enum values, removed unused vars
Grumpy7
parents:
1386
diff
changeset
|
1119 assert(false); |
1386 | 1120 break; |
1121 } | |
1122 if ( merchantLevel ) | |
1123 { | |
1124 if (price == itemValue) | |
1125 { | |
1126 return 3; | |
1127 } | |
917 | 1128 else |
1386 | 1129 { |
1130 return 2; | |
1131 } | |
1132 } | |
0 | 1133 else |
1386 | 1134 { |
1135 return 1; | |
1136 } | |
0 | 1137 } |
1138 | |
1139 //----- (0049107D) -------------------------------------------------------- | |
1140 int Player::GetBodybuilding() | |
1141 { | |
1010 | 1142 int v1; // al@1 |
0 | 1143 int v2; // ecx@1 |
1144 int v4; // eax@3 | |
1145 signed int v6; // [sp-4h] [bp-4h]@2 | |
1146 | |
1147 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); | |
1148 v2 = v1 & 0x3F; | |
1149 if ( v1 & 0x100 ) | |
1150 { | |
1151 v6 = 5; | |
1152 } | |
1153 else | |
1154 { | |
1008 | 1155 if ( (v1&0xFF) >= 0 ) |
0 | 1156 { |
1157 v4 = ((v1 & 0x40) != 0) + 1; | |
1158 return v2 * v4; | |
1159 } | |
1160 v6 = 3; | |
1161 } | |
1162 v4 = v6; | |
1163 return v2 * v4; | |
1164 } | |
1165 | |
1166 //----- (004910A8) -------------------------------------------------------- | |
607 | 1167 int Player::GetMeditation() |
0 | 1168 { |
1010 | 1169 int v1; // al@1 |
1008 | 1170 int base_level; // ecx@1 |
0 | 1171 int v4; // eax@3 |
1172 signed int v6; // [sp-4h] [bp-4h]@2 | |
1173 | |
1174 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); | |
1008 | 1175 base_level = v1 & 0x3F; |
0 | 1176 if ( v1 & 0x100 ) |
1177 { | |
1178 v6 = 5; | |
1179 } | |
1180 else | |
1181 { | |
1008 | 1182 if ( (v1&0xFF) >= 0 ) |
0 | 1183 { |
1184 v4 = ((v1 & 0x40) != 0) + 1; | |
1008 | 1185 return base_level * v4; |
0 | 1186 } |
1187 v6 = 3; | |
1188 } | |
1189 v4 = v6; | |
1008 | 1190 return base_level * v4; |
0 | 1191 } |
1192 | |
1193 //----- (004910D3) -------------------------------------------------------- | |
1194 int Player::CanIdentify(ItemGen *pItem) | |
1195 { | |
1196 unsigned __int16 v2; // ax@1 | |
1197 unsigned __int16 v3; // bx@1 | |
1198 int uSkillMult; // eax@3 | |
1199 int v5; // edi@7 | |
1200 signed int v6; // ebp@7 | |
1201 char *v7; // esi@7 | |
1202 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 | |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
1203 |
652 | 1204 if (CheckHiredNPCSpeciality(Scholar)) |
1205 return true; | |
0 | 1206 |
179 | 1207 v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
0 | 1208 v3 = v2; |
179 | 1209 if ( v2 & 1 ) |
0 | 1210 { |
1211 uSkillMultiplier = 5; | |
1212 } | |
1213 else | |
1214 { | |
1215 if ( (v2 & 0x80u) == 0 ) | |
1216 { | |
1217 uSkillMult = ((v2 & 0x40) != 0) + 1; | |
179 | 1218 v5 = uSkillMult * (v3 & 0x3F); |
1219 v6 = 0; | |
1220 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1221 |
179 | 1222 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1223 v6 = 1; | |
1224 if ( v5 >= (unsigned __int8)v7[46] ) | |
1225 v6 = 1; | |
1226 return v6; | |
0 | 1227 } |
1228 uSkillMultiplier = 3; | |
1229 } | |
1230 uSkillMult = uSkillMultiplier; | |
1231 v5 = uSkillMult * (v3 & 0x3F); | |
1232 v6 = 0; | |
1233 v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; | |
652 | 1234 |
0 | 1235 if ( (signed int)SkillToMastery(v3) >= 4 ) |
1236 v6 = 1; | |
1237 if ( v5 >= (unsigned __int8)v7[46] ) | |
1238 v6 = 1; | |
1239 return v6; | |
1240 } | |
1241 | |
1242 //----- (00491151) -------------------------------------------------------- | |
1243 int Player::CanRepair(ItemGen *a2) | |
1244 { | |
1245 unsigned __int16 v2; // ax@1 | |
1246 unsigned __int16 v3; // bx@1 | |
1247 int v4; // eax@3 | |
1248 int v5; // edi@7 | |
1249 signed int v6; // ebp@7 | |
1250 signed int v10; // [sp-4h] [bp-14h]@2 | |
1251 | |
652 | 1252 |
1253 auto v7 = &pItemsTable->pItems[a2->uItemID]; | |
1254 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || | |
1255 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || | |
1256 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) | |
1257 return true; | |
1258 | |
1010 | 1259 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); |
0 | 1260 v3 = v2; |
1010 | 1261 if (v2 & 0x100 ) |
0 | 1262 { |
1263 v10 = 5; | |
1264 } | |
1265 else | |
1266 { | |
1267 if ( (v2 & 0x80u) == 0 ) | |
1268 { | |
1269 v4 = ((v2 & 0x40) != 0) + 1; | |
1270 goto LABEL_7; | |
1271 } | |
1272 v10 = 3; | |
1273 } | |
1274 v4 = v10; | |
1275 LABEL_7: | |
1276 v5 = v4 * (v3 & 0x3F); | |
1277 v6 = 0; | |
1278 if ( (signed int)SkillToMastery(v3) >= 4 ) | |
1279 return true; | |
1280 if ( v5 >= *((char *)(v7 + 1) + 2) ) | |
1281 { | |
1282 __debugbreak(); // really odd | |
1283 return true; | |
1284 } | |
1285 return false; | |
1286 } | |
1287 | |
1288 //----- (004911F3) -------------------------------------------------------- | |
1289 int Player::GetMerchant() | |
1290 { | |
1291 Player *v1; // edi@1 | |
1292 unsigned __int16 v2; // ax@1 | |
1293 unsigned __int16 v3; // bx@1 | |
1294 int v4; // esi@1 | |
1295 int v5; // edi@1 | |
1296 int v7; // eax@3 | |
1297 int v8; // ecx@7 | |
1298 signed int v9; // [sp-4h] [bp-10h]@6 | |
1299 | |
1300 v1 = this; | |
607 | 1301 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1010 | 1302 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT]; |
607 | 1303 v4 = v2 & 0x003F; |
1010 | 1304 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F; |
0 | 1305 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1306 return 10000; | |
1307 v7 = GetPartyReputation(); | |
1308 if ( !v4 ) | |
1309 return -v7; | |
1010 | 1310 if ( v3 & 0x100 ) |
0 | 1311 { |
1312 v9 = 5; | |
1313 } | |
1314 else | |
1315 { | |
1316 if ( (v3 & 0x80u) == 0 ) | |
1317 { | |
1318 v8 = ((v3 & 0x40) != 0) + 1; | |
1319 return v5 * (v8 - 1) - v7 + v4 + 7; | |
1320 } | |
1321 v9 = 3; | |
1322 } | |
1323 v8 = v9; | |
1324 return v5 * (v8 - 1) - v7 + v4 + 7; | |
1325 } | |
1326 | |
1327 //----- (0049125A) -------------------------------------------------------- | |
1328 int Player::GetPerception() | |
1329 { | |
1330 Player *v1; // edi@1 | |
1331 unsigned __int16 v2; // ax@1 | |
1332 unsigned __int16 v3; // bx@1 | |
1333 int v4; // esi@1 | |
1334 int v5; // edi@1 | |
1335 int v7; // eax@5 | |
1336 signed int v8; // [sp-4h] [bp-10h]@4 | |
1337 | |
1338 v1 = this; | |
1010 | 1339 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); |
1340 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION]; | |
0 | 1341 v4 = v2 & 0x3F; |
1010 | 1342 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F; |
0 | 1343 if ( (signed int)SkillToMastery(v2) >= 4 ) |
1344 return 10000; | |
1010 | 1345 if ( v3 & 0x100 ) |
0 | 1346 { |
1347 v8 = 5; | |
1348 } | |
1349 else | |
1350 { | |
1351 if ( (v3 & 0x80u) == 0 ) | |
1352 { | |
1353 v7 = ((v3 & 0x40) != 0) + 1; | |
1354 return v4 + v5 * (v7 - 1); | |
1355 } | |
1356 v8 = 3; | |
1357 } | |
1358 v7 = v8; | |
1359 return v4 + v5 * (v7 - 1); | |
1360 } | |
1361 | |
1362 //----- (004912B0) -------------------------------------------------------- | |
1363 int Player::GetDisarmTrap() | |
1364 { | |
1365 Player *v1; // ebp@1 | |
1366 unsigned __int16 v2; // ax@1 | |
1367 unsigned __int16 v3; // bx@1 | |
1368 int v4; // esi@1 | |
1369 int v5; // edi@1 | |
1370 int v7; // eax@7 | |
1371 signed int v8; // [sp-4h] [bp-14h]@6 | |
1372 | |
1373 v1 = this; | |
1010 | 1374 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); |
0 | 1375 v3 = v1->pActiveSkills[29]; |
1376 v4 = v2 & 0x3F; | |
1377 v5 = v1->pActiveSkills[29] & 0x3F; | |
1378 if ( (signed int)SkillToMastery(v2) >= 4 ) | |
1379 return 10000; | |
1380 if ( HasEnchantedItemEquipped(35) ) | |
1381 v4 *= 2; | |
1010 | 1382 if ( v3 & 0x100 ) |
0 | 1383 { |
1384 v8 = 5; | |
1385 } | |
1386 else | |
1387 { | |
1388 if ( (v3 & 0x80u) == 0 ) | |
1389 { | |
1390 v7 = ((v3 & 0x40) != 0) + 1; | |
1391 return v4 + v5 * (v7 - 1); | |
1392 } | |
1393 v8 = 3; | |
1394 } | |
1395 v7 = v8; | |
1396 return v4 + v5 * (v7 - 1); | |
1397 } | |
1398 | |
1399 //----- (00491317) -------------------------------------------------------- | |
1400 char Player::GetLearningPercent() | |
1401 { | |
1402 Player *v1; // esi@1 | |
1403 int v2; // eax@1 | |
1404 unsigned __int16 v3; // bx@1 | |
1405 int v4; // ecx@1 | |
1406 int v5; // eax@4 | |
1407 signed int v7; // [sp-4h] [bp-Ch]@3 | |
1408 | |
1409 v1 = this; | |
1010 | 1410 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING); |
0 | 1411 v3 = v1->pActiveSkills[36]; |
1412 v4 = v2 & 0x3F; | |
1413 if ( v2 ) | |
1414 { | |
1010 | 1415 if (v3 & 0x100 ) |
0 | 1416 { |
1417 v7 = 5; | |
1418 } | |
1419 else | |
1420 { | |
1421 if ( (v3 & 0x80u) == 0 ) | |
1422 { | |
1423 v5 = ((v3 & 0x40) != 0) + 1; | |
1424 goto LABEL_8; | |
1425 } | |
1426 v7 = 3; | |
1427 } | |
1428 v5 = v7; | |
1429 LABEL_8: | |
1430 v2 = (v1->pActiveSkills[36] & 0x3F) * (v5 - 1) + v4 + 9; | |
1431 } | |
1432 return v2; | |
1433 } | |
1434 | |
1435 //----- (0048C6AF) -------------------------------------------------------- | |
1436 Player::Player() | |
1437 { | |
1438 memset(&pEquipment, 0, sizeof(PlayerEquipment)); | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1439 memset(pInventoryMatrix, 0, 126 * sizeof(int)); |
0 | 1440 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
|
1441 pInventoryItemList[i].Reset(); |
0 | 1442 for (uint i = 0; i < 12; ++i) |
1443 pEquippedItems[i].Reset(); | |
1444 | |
1445 | |
1446 for (uint i = 0; i < 24; ++i) | |
1447 { | |
1448 pPlayerBuffs[i].uSkill = 0; | |
1449 pPlayerBuffs[i].uSkill = 0; | |
1450 pPlayerBuffs[i].uPower = 0; | |
1451 pPlayerBuffs[i].uExpireTime = 0; | |
1452 pPlayerBuffs[i].uCaster = 0; | |
1453 pPlayerBuffs[i].uFlags = 0; | |
1454 } | |
1455 | |
1456 pName[0] = 0; | |
1014 | 1457 uCurrentFace = 0; |
0 | 1458 uVoiceID = 0; |
1459 memset(pConditions, 0, 20 * sizeof(__int64)); | |
1460 | |
1461 field_BB = 0; | |
1462 | |
1463 uMight = uMightBonus = 0; | |
1464 uIntelligence = uIntelligenceBonus = 0; | |
1465 uWillpower = uWillpowerBonus = 0; | |
1466 uEndurance = uEnduranceBonus = 0; | |
1467 uSpeed = uSpeedBonus = 0; | |
1468 uAccuracy = uAccuracyBonus = 0; | |
1469 uLuck = uLuckBonus = 0; | |
1470 uLevel = sLevelModifier = 0; | |
1471 sAgeModifier = 0; | |
1388
60d4885eb107
sACModifier zeroed in player constructor so AC is not always 0(or -some value) ingame
Grumpy7
parents:
1387
diff
changeset
|
1472 sACModifier = 0; |
0 | 1473 |
1019 | 1474 // memset(field_1F5, 0, 30); |
1475 pure_luck_used=0; | |
1476 pure_speed_used=0; | |
1477 pure_intellect_used=0; | |
1478 pure_endurance_used=0; | |
1479 pure_willpower_used=0; | |
1480 pure_accuracy_used=0; | |
1481 pure_might_used=0; | |
0 | 1482 |
1483 sResFireBase = sResFireBonus = 0; | |
1484 sResAirBase = sResAirBonus = 0; | |
1485 sResWaterBase = sResWaterBonus = 0; | |
1486 sResEarthBase = sResEarthBonus = 0; | |
1487 sResMagicBase = sResMagicBonus = 0; | |
1488 sResSpiritBase = sResSpiritBonus = 0; | |
1489 sResMindBase = sResMindBonus = 0; | |
1490 sResBodyBase = sResBodyBonus = 0; | |
1491 sResLightBase = sResLightBonus = 0; | |
1492 sResDarkBase = sResDarkBonus = 0; | |
1493 | |
1494 uTimeToRecovery = 0; | |
1495 | |
1496 uSkillPoints = 0; | |
1497 | |
1498 sHealth = 0; | |
1499 uFullHealthBonus = 0; | |
1500 _health_related = 0; | |
1501 | |
1502 sMana = 0; | |
1503 uFullManaBonus = 0; | |
1504 _mana_related = 0; | |
1505 | |
1506 uQuickSpell = 0; | |
1507 memset(pInstalledBeacons, 0, 5 * sizeof(LloydBeacon)); | |
1508 | |
1509 _some_attack_bonus = 0; | |
1510 field_1A91 = 0; | |
1511 _melee_dmg_bonus = 0; | |
1512 field_1A93 = 0; | |
1513 _ranged_atk_bonus = 0; | |
1514 field_1A95 = 0; | |
1515 _ranged_dmg_bonus = 0; | |
1516 field_1A97 = 0; | |
1517 | |
130 | 1518 expression = CHARACTER_EXPRESSION_INVALID; |
0 | 1519 uExpressionTimePassed = 0; |
1520 uExpressionTimeLength = 0; | |
1521 | |
1522 uNumDivineInterventionCastsThisDay = 0; | |
1523 uNumArmageddonCasts = 0; | |
1524 uNumFireSpikeCasts = 0; | |
1525 | |
1526 memset(field_1988, 0, 49 * sizeof(int)); | |
1527 memset(field_1A50, 0, 64 * sizeof(char)); | |
1528 | |
1529 field_E0 = 0; | |
1530 field_E4 = 0; | |
1531 field_E8 = 0; | |
1532 field_EC = 0; | |
1533 field_F0 = 0; | |
1534 field_F4 = 0; | |
1535 field_F8 = 0; | |
1536 field_FC = 0; | |
1537 field_100 = 0; | |
1538 field_104 = 0; | |
198 | 1539 |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1540 _expression21_animtime = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1541 _expression21_frameset = 0; |
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
521
diff
changeset
|
1542 |
198 | 1543 lastOpenedSpellbookPage = 0; |
0 | 1544 } |
1545 | |
1546 //----- (0048C6F6) -------------------------------------------------------- | |
1547 bool Party::AddItem(ItemGen *pItem) | |
1548 { | |
1549 unsigned int v2; // eax@1 | |
1550 unsigned int v3; // ecx@4 | |
1551 signed int v4; // edx@4 | |
1552 char *v5; // eax@8 | |
973 | 1553 //unsigned int v6; // eax@10 |
0 | 1554 Texture *v7; // ebx@10 |
1555 signed int v8; // esi@10 | |
1556 Player *v9; // edi@11 | |
1557 int v10; // eax@11 | |
1558 bool result; // eax@15 | |
1559 std::string v12; // [sp-18h] [bp-40h]@9 | |
1010 | 1560 |
1561 | |
188 | 1562 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 |
1563 //int v16; // [sp+10h] [bp-18h]@3 | |
1564 //int v17; // [sp+14h] [bp-14h]@3 | |
1565 //int v18; // [sp+18h] [bp-10h]@3 | |
0 | 1566 Player *v19; // [sp+1Ch] [bp-Ch]@9 |
1567 Party *v20; // [sp+20h] [bp-8h]@1 | |
1568 int v21; // [sp+24h] [bp-4h]@10 | |
1569 | |
1570 auto thos = this; | |
1571 | |
1572 v20 = thos; | |
1573 v2 = pItem->uItemID; | |
222 | 1574 if ( !pItemsTable->pItems[v2].uItemID_Rep_St ) |
315 | 1575 pItem->SetIdentified(); |
188 | 1576 ///v15 = 0; |
1577 //v16 = 1; | |
1578 //v18 = 3; | |
1579 //v17 = 2; | |
0 | 1580 if ( uActiveCharacter ) |
1581 { | |
1582 v3 = uActiveCharacter - 1; | |
1583 v4 = 0; | |
1584 do | |
1585 { | |
188 | 1586 v15[v4++] = v3++; |
0 | 1587 if ( (signed int)v3 >= 4 ) |
1588 v3 = 0; | |
1589 } | |
1590 while ( v4 < 4 ); | |
1591 } | |
1592 v5 = pItemsTable->pItems[v2].pIconName; | |
1593 if ( v5 ) | |
1594 { | |
973 | 1595 v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); |
0 | 1596 v21 = areWeLoadingTexture; |
1597 v8 = 0; | |
1598 while ( 1 ) | |
1599 { | |
188 | 1600 v9 = &v20->pPlayers[v15[v8]]; |
1601 v19 = &v20->pPlayers[v15[v8]]; | |
1014 | 1602 v10 = v19->AddItem(-1, pItem->uItemID); |
0 | 1603 if ( v10 ) |
1604 break; | |
1605 ++v8; | |
1606 if ( v8 >= 4 ) | |
1607 { | |
1608 if ( !v21 ) | |
1609 { | |
1610 v7->Release(); | |
1006 | 1611 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1612 } |
1613 goto LABEL_15; | |
1614 } | |
1615 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1616 memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); |
0 | 1617 pItem->Reset(); |
1618 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | |
187 | 1619 v19->PlaySound(SPEECH_60, 0); |
0 | 1620 if ( !v21 ) |
1621 { | |
1622 v7->Release(); | |
1006 | 1623 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1624 } |
1625 result = 1; | |
1626 } | |
1627 else | |
1628 { | |
1629 MessageBoxW(nullptr, L"Invalid picture_name detected ::addItem()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Party.cpp:795", 0); | |
1630 LABEL_15: | |
1631 result = 0; | |
1632 } | |
1633 return result; | |
1634 } | |
1635 // 506128: using guessed type int areWeLoadingTexture; | |
1636 | |
1637 //----- (0048C855) -------------------------------------------------------- | |
1638 int Player::GetBaseStrength() | |
1639 { | |
1640 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); | |
1641 } | |
1642 | |
1643 //----- (0048C86C) -------------------------------------------------------- | |
1644 int Player::GetBaseIntelligence() | |
1645 { | |
1646 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); | |
1647 } | |
1648 | |
1649 //----- (0048C883) -------------------------------------------------------- | |
1650 int Player::GetBaseWillpower() | |
1651 { | |
1652 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0); | |
1653 } | |
1654 | |
1655 //----- (0048C89A) -------------------------------------------------------- | |
1656 int Player::GetBaseEndurance() | |
1657 { | |
1658 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); | |
1659 } | |
1660 | |
1661 //----- (0048C8B1) -------------------------------------------------------- | |
1662 int Player::GetBaseAccuracy() | |
1663 { | |
1664 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); | |
1665 } | |
1666 | |
1667 //----- (0048C8C8) -------------------------------------------------------- | |
1668 int Player::GetBaseSpeed() | |
1669 { | |
1670 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); | |
1671 } | |
1672 | |
1673 //----- (0048C8DF) -------------------------------------------------------- | |
1674 int Player::GetBaseLuck() | |
1675 { | |
1676 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); | |
1677 } | |
1678 | |
1679 //----- (0048C8F6) -------------------------------------------------------- | |
1680 int Player::GetBaseLevel() | |
1681 { | |
1682 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1683 } | |
1684 | |
1685 //----- (0048C90D) -------------------------------------------------------- | |
1686 int Player::GetActualLevel() | |
1687 { | |
1688 return uLevel + sLevelModifier + | |
1689 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) + | |
1690 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL, 0); | |
1691 } | |
1692 | |
1693 //----- (0048C93C) -------------------------------------------------------- | |
1694 int Player::GetActualMight() | |
1695 { | |
1325 | 1696 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH); |
0 | 1697 } |
1698 | |
1699 //----- (0048C9C2) -------------------------------------------------------- | |
1700 int Player::GetActualIntelligence() | |
1701 { | |
1325 | 1702 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE); |
0 | 1703 } |
1704 | |
1705 //----- (0048CA3F) -------------------------------------------------------- | |
1706 int Player::GetActualWillpower() | |
1707 { | |
1325 | 1708 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER); |
0 | 1709 } |
1710 | |
1711 //----- (0048CABC) -------------------------------------------------------- | |
1712 int Player::GetActualEndurance() | |
1713 { | |
1325 | 1714 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE); |
0 | 1715 } |
1716 | |
1717 //----- (0048CB39) -------------------------------------------------------- | |
1718 int Player::GetActualAccuracy() | |
1719 { | |
1325 | 1720 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY); |
0 | 1721 } |
1722 | |
1723 //----- (0048CBB6) -------------------------------------------------------- | |
1724 int Player::GetActualSpeed() | |
1725 { | |
1325 | 1726 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED); |
0 | 1727 } |
1728 | |
1729 //----- (0048CC33) -------------------------------------------------------- | |
1730 int Player::GetActualLuck() | |
1731 { | |
1036 | 1732 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 |
1733 | |
1734 npc_luck_bonus = 0; | |
652 | 1735 if ( CheckHiredNPCSpeciality(Fool) ) |
1036 | 1736 npc_luck_bonus = 5; |
652 | 1737 if ( CheckHiredNPCSpeciality(ChimneySweep) ) |
1036 | 1738 npc_luck_bonus += 20; |
652 | 1739 if ( CheckHiredNPCSpeciality(Psychic) ) |
1036 | 1740 npc_luck_bonus += 10; |
1324 | 1741 |
1325 | 1742 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK) |
1743 + npc_luck_bonus; | |
1744 } | |
1745 | |
1746 //----- (new function) -------------------------------------------------------- | |
1747 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId ) | |
1748 { | |
1749 unsigned __int16 attrValue = 0; | |
1750 unsigned __int16 attrBonus = 0; | |
1751 switch (attrId) | |
1752 { | |
1753 case CHARACTER_ATTRIBUTE_STRENGTH: | |
1754 attrValue = uMight; | |
1755 attrBonus = uMightBonus; | |
1756 break; | |
1757 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
1758 attrValue = uIntelligence; | |
1759 attrBonus = uIntelligenceBonus; | |
1760 break; | |
1761 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
1762 attrValue = uWillpower; | |
1763 attrBonus = uWillpowerBonus; | |
1764 break; | |
1765 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
1766 attrValue = uEndurance; | |
1767 attrBonus = uEnduranceBonus; | |
1768 break; | |
1769 case CHARACTER_ATTRIBUTE_ACCURACY: | |
1770 attrValue = uAccuracy; | |
1771 attrBonus = uAccuracyBonus; | |
1772 break; | |
1773 case CHARACTER_ATTRIBUTE_SPEED: | |
1774 attrValue = uSpeed; | |
1775 attrBonus = uSpeedBonus; | |
1776 break; | |
1777 case CHARACTER_ATTRIBUTE_LUCK: | |
1778 attrValue = uLuck; | |
1779 attrBonus = uLuckBonus; | |
1780 break; | |
1781 default: | |
1782 return 0; | |
1783 } | |
1784 | |
1324 | 1785 uint uActualAge = this->sAgeModifier + GetBaseAge(); |
1786 uint uAgeingMultiplier = 100; | |
1787 for (uint i = 0; i < 4; ++i) | |
1325 | 1788 { |
1324 | 1789 if (uActualAge >= pAgeingTable[i]) |
1325 | 1790 uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; |
1791 else | |
1792 break; | |
1793 } | |
1794 | |
1795 auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; | |
1796 int magicBonus = GetMagicalBonus(attrId); | |
1797 int itemBonus = GetItemsBonus(attrId, 0); | |
1798 return uConditionMult * uAgeingMultiplier * attrValue / 100 / 100 | |
1799 + magicBonus | |
1800 + magicBonus | |
1801 + attrBonus; | |
0 | 1802 } |
1803 | |
1804 //----- (0048CCF5) -------------------------------------------------------- | |
1805 int Player::GetActualAttack(int a2) | |
1806 { | |
1807 Player *v2; // esi@1 | |
1808 int v3; // eax@1 | |
1809 int v4; // edi@1 | |
1810 int v5; // ebx@1 | |
1811 int v6; // ebp@1 | |
1812 | |
1813 v2 = this; | |
1814 v3 = GetActualAccuracy(); | |
1036 | 1815 v4 = GetParameterBonus(v3); |
0 | 1816 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK); |
1817 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2); | |
1818 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + v2->_some_attack_bonus; | |
1819 } | |
1820 | |
1821 //----- (0048CD45) -------------------------------------------------------- | |
1822 int Player::GetMeleeDamageMinimal() | |
1823 { | |
1824 Player *v1; // edi@1 | |
1825 int v2; // eax@1 | |
1826 int v3; // esi@1 | |
1827 int v4; // esi@1 | |
1828 int v5; // esi@1 | |
1829 int v6; // esi@1 | |
1830 signed int result; // eax@1 | |
1831 | |
1036 | 1832 |
0 | 1833 v2 = GetActualMight(); |
1036 | 1834 v3 = GetParameterBonus(v2); |
0 | 1835 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0) + v3; |
1836 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1036 | 1837 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; |
1838 if ( result < 1 ) | |
1839 result = 1; | |
0 | 1840 return result; |
1841 } | |
1842 | |
1843 //----- (0048CD90) -------------------------------------------------------- | |
1844 int Player::GetMeleeDamageMaximal() | |
1845 { | |
1846 Player *v1; // edi@1 | |
1847 int v2; // eax@1 | |
1848 int v3; // esi@1 | |
1849 int v4; // esi@1 | |
1850 int v5; // esi@1 | |
1851 int v6; // esi@1 | |
1852 signed int result; // eax@1 | |
1853 | |
1854 v1 = this; | |
1855 v2 = GetActualMight(); | |
1036 | 1856 v3 = GetParameterBonus(v2); |
0 | 1857 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0) + v3; |
1858 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4; | |
1859 v6 = v1->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5; | |
1860 result = 1; | |
1861 if ( v6 >= 1 ) | |
1862 result = v6; | |
1863 return result; | |
1864 } | |
1865 | |
1866 //----- (0048CDDB) -------------------------------------------------------- | |
1867 int Player::CalculateMeleeDamageTo(int a2, int a3, unsigned int uTargetActorID) | |
1868 { | |
1869 int v4; // esi@1 | |
1870 Player *v5; // edi@1 | |
1871 ItemGen *v6; // ebx@4 | |
1872 unsigned int v7; // ebp@4 | |
1873 unsigned int v8; // esi@4 | |
1874 int v9; // eax@4 | |
1875 int v10; // eax@9 | |
1876 char v11; // zf@9 | |
1877 int v12; // esi@10 | |
1878 int v13; // eax@11 | |
1879 enum MONSTER_SUPERTYPE v14; // edx@24 | |
1880 ItemGen *v15; // ebx@35 | |
1881 unsigned int v16; // ebp@35 | |
1882 unsigned int v17; // esi@35 | |
1883 int v18; // edx@38 | |
1884 int v19; // eax@40 | |
1885 enum MONSTER_SUPERTYPE v20; // edx@53 | |
1886 int v21; // esi@62 | |
1887 int v22; // eax@63 | |
1888 int v23; // ebx@63 | |
1889 int v24; // ebx@63 | |
1890 signed int result; // eax@64 | |
1891 MONSTER_SUPERTYPE v26; // [sp-4h] [bp-24h]@20 | |
1892 MONSTER_SUPERTYPE v27; // [sp-4h] [bp-24h]@49 | |
1893 int v28; // [sp+10h] [bp-10h]@1 | |
1894 int v29; // [sp+10h] [bp-10h]@33 | |
1895 signed int v30; // [sp+14h] [bp-Ch]@7 | |
1896 signed int v31; // [sp+14h] [bp-Ch]@36 | |
1897 int v32; // [sp+18h] [bp-8h]@1 | |
1898 int v33; // [sp+18h] [bp-8h]@8 | |
1899 int v34; // [sp+1Ch] [bp-4h]@1 | |
1900 int v35; // [sp+28h] [bp+8h]@37 | |
1901 | |
1902 v4 = 0; | |
1903 v5 = this; | |
1904 v34 = 0; | |
1905 v32 = 0; | |
1906 v28 = 0; | |
1907 if ( IsUnarmed() == 1 ) | |
1908 { | |
1909 v32 = rand() % 3 + 1; | |
1910 LABEL_61: | |
1911 v34 = v4; | |
1912 goto LABEL_62; | |
1913 } | |
816 | 1914 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) |
0 | 1915 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1916 v6 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uMainHand-1]; |
0 | 1917 v7 = v6->uItemID; |
1918 v8 = v6->uItemID; | |
1919 v9 = pItemsTable->pItems[v8].uDamageDice; | |
898 | 1920 if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) |
0 | 1921 ++v9; |
1922 v30 = pItemsTable->pItems[v8].uDamageRoll; | |
1923 if ( v9 > 0 ) | |
1924 { | |
1925 v33 = v9; | |
1926 do | |
1927 { | |
1928 v10 = rand(); | |
1929 v11 = v33-- == 1; | |
1930 v28 += v10 % v30 + 1; | |
1931 } | |
1932 while ( !v11 ); | |
1933 } | |
1934 v12 = pItemsTable->pItems[v8].uDamageMod + v28; | |
1935 if ( !uTargetActorID ) | |
1936 goto LABEL_28; | |
377 | 1937 v13 = v6->uSpecEnchantmentType; |
0 | 1938 if ( v13 == 64 || v7 == 507 || v7 == 508 || v7 == 527 ) |
1939 { | |
1940 v14 = (MONSTER_SUPERTYPE)1; | |
1941 } | |
1942 else | |
1943 { | |
1944 if ( v13 == 39 ) | |
1945 { | |
1946 v26 = MONSTER_SUPERTYPE_KREEGAN; | |
1947 } | |
1948 else | |
1949 { | |
1950 if ( v13 == 40 ) | |
1951 { | |
1952 v26 = MONSTER_SUPERTYPE_DRAGON; | |
1953 } | |
1954 else | |
1955 { | |
1956 if ( v13 == 63 || v7 == 517 ) | |
1957 { | |
1958 v26 = MONSTER_SUPERTYPE_ELF; | |
1959 } | |
1960 else | |
1961 { | |
1962 if ( v13 != 65 ) | |
1963 { | |
1964 LABEL_28: | |
1965 if ( (signed int)SkillToMastery(v5->pActiveSkills[2]) >= 3 | |
1966 && pItemsTable->pItems[v6->uItemID].uSkillType == 2 | |
1967 && rand() % 100 < 10 ) | |
1968 v12 *= 3; | |
1969 v32 = v12; | |
1970 goto LABEL_33; | |
1971 } | |
1972 v26 = MONSTER_SUPERTYPE_TITAN; | |
1973 } | |
1974 } | |
1975 } | |
1976 v14 = v26; | |
1977 } | |
1978 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v14) ) | |
1979 v12 *= 2; | |
1980 goto LABEL_28; | |
1981 } | |
1982 LABEL_33: | |
1983 v29 = 0; | |
1984 if ( !a3 ) | |
1985 { | |
1986 if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) | |
1987 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
1988 v15 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uShield - 1]; |
0 | 1989 v16 = v15->uItemID; |
1990 v17 = v15->uItemID; | |
1991 if ( pItemsTable->pItems[v17].uEquipType != 4 ) | |
1992 { | |
1993 v31 = pItemsTable->pItems[v17].uDamageRoll; | |
1994 if ( (signed int)pItemsTable->pItems[v17].uDamageDice > 0 ) | |
1995 { | |
1996 v35 = pItemsTable->pItems[v17].uDamageDice; | |
1997 do | |
1998 { | |
1999 v18 = rand() % v31; | |
2000 v11 = v35-- == 1; | |
2001 v29 += v18 + 1; | |
2002 } | |
2003 while ( !v11 ); | |
2004 } | |
2005 v4 = pItemsTable->pItems[v17].uDamageMod + v29; | |
2006 if ( !uTargetActorID ) | |
2007 goto LABEL_57; | |
377 | 2008 v19 = v15->uSpecEnchantmentType; |
0 | 2009 if ( v19 == 64 || v16 == 507 || v16 == 508 || v16 == 527 ) |
2010 { | |
2011 v20 = (MONSTER_SUPERTYPE)1; | |
2012 } | |
2013 else | |
2014 { | |
2015 if ( v19 == 39 ) | |
2016 { | |
2017 v27 = MONSTER_SUPERTYPE_KREEGAN; | |
2018 } | |
2019 else | |
2020 { | |
2021 if ( v19 == 40 ) | |
2022 { | |
2023 v27 = MONSTER_SUPERTYPE_DRAGON; | |
2024 } | |
2025 else | |
2026 { | |
2027 if ( v19 == 63 || v16 == 517 ) | |
2028 { | |
2029 v27 = MONSTER_SUPERTYPE_ELF; | |
2030 } | |
2031 else | |
2032 { | |
2033 if ( v19 != 65 ) | |
2034 { | |
2035 LABEL_57: | |
2036 if ( pItemsTable->pItems[v15->uItemID].uSkillType == PLAYER_SKILL_DAGGER | |
2037 && SkillToMastery(v5->pActiveSkills[2] >= 3u) | |
2038 && rand() % 100 < 10 ) | |
2039 v4 *= 3; | |
2040 goto LABEL_61; | |
2041 } | |
2042 v27 = MONSTER_SUPERTYPE_TITAN; | |
2043 } | |
2044 } | |
2045 } | |
2046 v20 = v27; | |
2047 } | |
2048 if ( MonsterStats::BelongsToSupertype(uTargetActorID, v20) ) | |
2049 v4 *= 2; | |
2050 goto LABEL_57; | |
2051 } | |
2052 } | |
2053 } | |
2054 LABEL_62: | |
2055 v21 = v32 + v34; | |
2056 if ( !a2 ) | |
2057 { | |
2058 v22 = GetActualMight(); | |
1036 | 2059 v23 = GetParameterBonus(v22); |
0 | 2060 v24 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v23; |
2061 v21 += v5->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v24; | |
2062 } | |
2063 result = 1; | |
2064 if ( v21 >= 1 ) | |
2065 result = v21; | |
2066 return result; | |
2067 } | |
2068 | |
2069 //----- (0048D0B9) -------------------------------------------------------- | |
2070 int Player::GetRangedAttack() | |
2071 { | |
2072 Player *v1; // esi@1 | |
2073 int v2; // eax@1 | |
2074 int v3; // edi@3 | |
2075 int v4; // eax@4 | |
2076 int v5; // edi@4 | |
2077 int v6; // edi@4 | |
2078 int v7; // edi@4 | |
2079 | |
2080 v1 = this; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2081 v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; |
0 | 2082 if ( v2 < 64 || v2 > 65 ) |
2083 { | |
2084 v4 = GetActualAccuracy(); | |
1036 | 2085 v5 = GetParameterBonus(v4); |
0 | 2086 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK, 0) + v5; |
2087 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6; | |
2088 v3 = v1->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7; | |
2089 } | |
2090 else | |
2091 { | |
2092 v3 = GetActualAttack(1); | |
2093 } | |
2094 return v3; | |
2095 } | |
2096 | |
2097 //----- (0048D124) -------------------------------------------------------- | |
2098 int Player::GetRangedDamageMin() | |
2099 { | |
2100 Player *v1; // esi@1 | |
2101 int v2; // edi@1 | |
2102 int v3; // edi@1 | |
2103 int v4; // edi@1 | |
2104 unsigned __int16 v5; // ax@1 | |
2105 int result; // eax@6 | |
2106 | |
2107 v1 = this; | |
1040 | 2108 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN, 0); |
2109 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2110 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2111 v5 = v1->pActiveSkills[5]; |
2112 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2113 v4 += v1->pActiveSkills[5] & 0x3F; | |
2114 if ( v4 >= 1 ) | |
2115 result = v4; | |
2116 else | |
2117 result = 0; | |
2118 return result; | |
2119 } | |
2120 | |
2121 //----- (0048D191) -------------------------------------------------------- | |
2122 int Player::GetRangedDamageMax() | |
2123 { | |
2124 Player *v1; // esi@1 | |
2125 int v2; // edi@1 | |
2126 int v3; // edi@1 | |
2127 int v4; // edi@1 | |
2128 unsigned __int16 v5; // ax@1 | |
2129 int result; // eax@6 | |
2130 | |
2131 v1 = this; | |
1040 | 2132 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX, 0); |
2133 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2; | |
2134 v4 = v1->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3; | |
0 | 2135 v5 = v1->pActiveSkills[5]; |
2136 if ( v5 && (signed int)SkillToMastery(v5) >= 4 && HasItemEquipped(EQUIP_BOW) ) | |
2137 v4 += v1->pActiveSkills[5] & 0x3F; | |
2138 if ( v4 >= 1 ) | |
2139 result = v4; | |
2140 else | |
2141 result = 0; | |
2142 return result; | |
2143 } | |
2144 | |
2145 //----- (0048D1FE) -------------------------------------------------------- | |
2146 bool Player::CalculateRangedDamageTo(int a2) | |
2147 { | |
2148 Player *v2; // ebx@1 | |
2149 bool result; // eax@1 | |
2150 ItemGen *v4; // ebx@2 | |
2151 unsigned int v5; // edi@2 | |
2152 unsigned int v6; // esi@2 | |
2153 int v7; // edx@4 | |
2154 char v8; // zf@4 | |
2155 int v9; // esi@5 | |
2156 int v10; // ebx@6 | |
2157 enum MONSTER_SUPERTYPE v11; // edx@7 | |
2158 unsigned __int16 v12; // ax@19 | |
2159 MONSTER_SUPERTYPE v13; // [sp-Ch] [bp-20h]@13 | |
2160 Player *v14; // [sp+4h] [bp-10h]@1 | |
2161 signed int v15; // [sp+8h] [bp-Ch]@2 | |
2162 int v16; // [sp+Ch] [bp-8h]@3 | |
2163 int v17; // [sp+10h] [bp-4h]@1 | |
2164 | |
2165 v17 = 0; | |
2166 v2 = this; | |
2167 v14 = this; | |
2168 result = HasItemEquipped(EQUIP_BOW); | |
2169 if ( !result ) | |
2170 return result; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2171 v4 = (ItemGen *)&v2->pInventoryItemList[v2->pEquipment.uBow-1]; |
0 | 2172 v5 = v4->uItemID; |
2173 v6 = v4->uItemID; | |
2174 v15 = pItemsTable->pItems[v6].uDamageRoll; | |
2175 if ( (signed int)pItemsTable->pItems[v6].uDamageDice > 0 ) | |
2176 { | |
2177 v16 = pItemsTable->pItems[v6].uDamageDice; | |
2178 do | |
2179 { | |
2180 v7 = rand() % v15; | |
2181 v8 = v16-- == 1; | |
2182 v17 += v7 + 1; | |
2183 } | |
2184 while ( !v8 ); | |
2185 } | |
2186 v9 = pItemsTable->pItems[v6].uDamageMod + v17; | |
2187 if ( a2 ) | |
2188 { | |
377 | 2189 v10 = v4->uSpecEnchantmentType; |
0 | 2190 if ( v10 == 64 ) |
2191 { | |
2192 v11 = (MONSTER_SUPERTYPE)1; | |
2193 goto LABEL_17; | |
2194 } | |
2195 if ( v10 == 39 || v5 == 508 ) | |
2196 { | |
2197 v13 = MONSTER_SUPERTYPE_KREEGAN; | |
2198 goto LABEL_16; | |
2199 } | |
2200 if ( v10 == 40 ) | |
2201 { | |
2202 v13 = MONSTER_SUPERTYPE_DRAGON; | |
2203 goto LABEL_16; | |
2204 } | |
2205 if ( v10 == 63 || v5 == 517 ) | |
2206 { | |
2207 v13 = MONSTER_SUPERTYPE_ELF; | |
2208 LABEL_16: | |
2209 v11 = v13; | |
2210 LABEL_17: | |
2211 if ( MonsterStats::BelongsToSupertype(a2, v11) ) | |
2212 v9 *= 2; | |
2213 goto LABEL_19; | |
2214 } | |
2215 } | |
2216 LABEL_19: | |
2217 v12 = v14->pActiveSkills[5]; | |
2218 if ( v12 ) | |
2219 { | |
2220 if ( (signed int)SkillToMastery(v12) >= 4 ) | |
2221 v9 += v14->pActiveSkills[5] & 0x3F; | |
2222 } | |
2223 return v9; | |
2224 } | |
2225 | |
2226 //----- (0048D2EA) -------------------------------------------------------- | |
2227 char *Player::GetMeleeDamageString() | |
2228 { | |
1036 | 2229 signed int itemid; // eax@1 |
2230 int min_damage; // edi@3 | |
2231 int max_damage; // eax@3 | |
0 | 2232 |
2233 static char player__getmeleedamagestring_static_buff[40]; // idb | |
2234 | |
1036 | 2235 if ( pEquipment.uMainHand) |
2236 { | |
2237 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
2238 if ( itemid < 64 || itemid > 65 ) //blasters | |
2239 { | |
2240 min_damage = GetMeleeDamageMinimal(); | |
2241 max_damage = GetMeleeDamageMaximal(); | |
2242 } | |
2243 else | |
2244 { //for blasters | |
2245 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 0); | |
2246 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 0); | |
2247 } | |
2248 if ( max_damage ) | |
2249 { | |
2250 if ( min_damage == max_damage ) | |
2251 { | |
2252 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage); | |
2253 } | |
2254 else | |
2255 { | |
2256 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
2257 } | |
2258 } | |
2259 else | |
2260 { | |
2261 strcpy(player__getmeleedamagestring_static_buff, "N/A"); | |
2262 } | |
2263 | |
2264 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
2265 { | |
2266 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
2267 } | |
2268 } | |
0 | 2269 else |
1036 | 2270 strcpy(player__getmeleedamagestring_static_buff, "N/A"); |
2271 return player__getmeleedamagestring_static_buff; | |
0 | 2272 } |
2273 | |
2274 //----- (0048D396) -------------------------------------------------------- | |
2275 char *Player::GetRangedDamageString() | |
1036 | 2276 { |
2277 signed int itemid; // eax@1 | |
2278 int min_damage; // edi@3 | |
2279 int max_damage; // eax@3 | |
2280 | |
2281 static char player__getrangeddamagestring_static_buff[40]; // idb | |
2282 if ( pEquipment.uMainHand) | |
2283 { | |
2284 itemid= pOwnItems[this->pEquipment.uMainHand-1].uItemID; | |
2285 if ( itemid < 64 || itemid > 65 ) //blasters | |
2286 { | |
2287 min_damage = GetRangedDamageMin(); | |
2288 max_damage = GetRangedDamageMax(); | |
2289 } | |
2290 else | |
2291 { //for blasters | |
2292 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, 1); | |
2293 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, 1); | |
2294 } | |
2295 if ( max_damage ) | |
2296 { | |
2297 if ( min_damage == max_damage ) | |
2298 { | |
2299 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage); | |
2300 } | |
2301 else | |
2302 { | |
2303 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage); | |
2304 } | |
2305 } | |
2306 else | |
2307 { | |
2308 strcpy(player__getrangeddamagestring_static_buff, "N/A"); | |
2309 } | |
2310 | |
2311 if (( itemid >= 135 )&&( itemid <= 159 )) //wands | |
2312 { | |
2313 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" | |
2314 } | |
2315 } | |
0 | 2316 else |
1036 | 2317 strcpy(player__getrangeddamagestring_static_buff, "N/A"); |
2318 return player__getrangeddamagestring_static_buff; | |
2319 } | |
0 | 2320 |
2321 //----- (0048D45A) -------------------------------------------------------- | |
2322 bool Player::CanTrainToNextLevel() | |
2323 { | |
2324 int v1; // edx@1 | |
2325 int v2; // eax@1 | |
2326 int i; // esi@1 | |
2327 | |
2328 v1 = this->uLevel; | |
2329 v2 = 0; | |
2330 for ( i = 0; i < v1; ++i ) | |
2331 v2 += i + 1; | |
2332 return (signed __int64)this->uExperience >= 1000 * v2; | |
2333 } | |
2334 | |
2335 //----- (0048D498) -------------------------------------------------------- | |
2336 unsigned int Player::GetExperienceDisplayColor() | |
2337 { | |
2338 unsigned int result; // eax@2 | |
2339 | |
2340 if ( CanTrainToNextLevel() ) | |
995 | 2341 result = ui_character_bonus_text_color; |
0 | 2342 else |
995 | 2343 result = ui_character_default_text_color; |
0 | 2344 return result; |
2345 } | |
2346 | |
2347 //----- (0048D4B3) -------------------------------------------------------- | |
1036 | 2348 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int amount ) |
2349 { | |
2350 | |
2351 int resist_value; // edi@8 | |
2352 int player_luck; // eax@21 | |
2353 signed int res_rand_divider; // ebx@2 | |
2354 int armor_skill; // eax@29 | |
2355 enum CHARACTER_ATTRIBUTE_TYPE player_resist; // [sp-4h] [bp-10h]@9 | |
2356 signed int result_amount_dmg; // [sp+8h] [bp-4h]@17 | |
2357 | |
2358 player_resist=CHARACTER_ATTRIBUTE_STRENGTH; | |
2359 switch(dmg_type) | |
2360 { | |
2361 case DMGT_FIRE: player_resist=CHARACTER_ATTRIBUTE_RESIST_FIRE; break; | |
2362 case DMGT_ELECTR: player_resist=CHARACTER_ATTRIBUTE_RESIST_AIR; break; | |
2363 case DMGT_COLD: player_resist=CHARACTER_ATTRIBUTE_RESIST_WATER; break; | |
2364 case DMGT_3: player_resist=CHARACTER_ATTRIBUTE_RESIST_EARTH; break; | |
2365 | |
2366 case DMGT_SPIRIT: player_resist=CHARACTER_ATTRIBUTE_RESIST_SPIRIT;break; | |
2367 case DMGT_MIND: player_resist=CHARACTER_ATTRIBUTE_RESIST_MIND; break; | |
2368 case DMGT_BODY: player_resist=CHARACTER_ATTRIBUTE_RESIST_BODY; break; | |
2369 } | |
2370 if (player_resist) | |
2371 resist_value = GetActualResistance(player_resist); | |
2372 else | |
2373 resist_value = 0; | |
2374 | |
2375 result_amount_dmg = amount; | |
2376 if ( classType == PLAYER_CLASS_LICH && resist_value >= 200 ) | |
0 | 2377 return 0; |
1036 | 2378 player_luck = GetActualLuck(); |
2379 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30; | |
2380 | |
2381 if ( resist_value ) | |
2382 { | |
2383 if ( rand() % res_rand_divider >= 30 ) | |
2384 { | |
2385 result_amount_dmg = amount >> 1; | |
2386 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2387 { |
1036 | 2388 result_amount_dmg = amount >> 2; |
2389 if ( rand() % res_rand_divider >= 30 ) | |
0 | 2390 { |
1036 | 2391 result_amount_dmg = amount >> 3; |
2392 if ( rand() % res_rand_divider >= 30 ) | |
2393 result_amount_dmg = amount >> 4; | |
0 | 2394 } |
2395 } | |
2396 } | |
2397 } | |
1036 | 2398 if (( dmg_type == DMGT_PHISYCAL )&&( pEquipment.uArmor )) |
2399 { | |
2400 if (!pOwnItems[pEquipment.uArmor-1].Broken()) | |
0 | 2401 { |
1036 | 2402 armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); |
2403 if ( armor_skill==PLAYER_SKILL_PLATE ) | |
0 | 2404 { |
1036 | 2405 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) |
2406 return (int)(double)result_amount_dmg * 0.5; | |
0 | 2407 } |
1036 | 2408 if (armor_skill==PLAYER_SKILL_CHAIN ) |
0 | 2409 { |
1036 | 2410 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4) |
2411 return (int)(double)result_amount_dmg * 0.66670001; | |
0 | 2412 } |
2413 } | |
1036 | 2414 } |
2415 return result_amount_dmg; | |
0 | 2416 } |
2417 | |
2418 //----- (0048D62C) -------------------------------------------------------- | |
816 | 2419 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) |
2420 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2421 return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; |
0 | 2422 } |
2423 | |
2424 //----- (0048D651) -------------------------------------------------------- | |
816 | 2425 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) |
2426 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2427 return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; |
0 | 2428 } |
2429 | |
2430 //----- (0048D676) -------------------------------------------------------- | |
2431 bool Player::IsUnarmed() | |
2432 { | |
1091 | 2433 return HasItemEquipped(EQUIP_MAIN_HAND) != 0 && |
2434 !(HasItemEquipped(EQUIP_OFF_HAND) == 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD); | |
0 | 2435 } |
2436 | |
2437 //----- (0048D6AA) -------------------------------------------------------- | |
2438 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex) | |
2439 { | |
2440 auto i = pEquipment.pIndices[uEquipIndex]; | |
2441 if (i) | |
1080 | 2442 return ~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN); |
1036 | 2443 else |
2444 return false; | |
0 | 2445 } |
2446 | |
2447 //----- (0048D6D0) -------------------------------------------------------- | |
2448 bool Player::HasEnchantedItemEquipped(int uEnchantment) | |
2449 { | |
2450 for (uint i = 0; i < 16; ++i) | |
2451 { | |
2452 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && | |
1080 | 2453 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) |
0 | 2454 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) |
2455 return true; | |
2456 } | |
2457 return false; | |
2458 } | |
2459 | |
2460 //----- (0048D709) -------------------------------------------------------- | |
1080 | 2461 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) |
2462 { | |
1010 | 2463 |
0 | 2464 int v6; // esi@5 |
2465 | |
1080 | 2466 if ( equip_type >= 16 ) |
0 | 2467 { |
2468 v6 = 0; | |
2469 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2470 || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) |
0 | 2471 { |
2472 ++v6; | |
2473 if ( (signed int)v6 >= 16 ) | |
2474 return 0; | |
2475 } | |
2476 return 1; | |
2477 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2478 if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) |
0 | 2479 return 1; |
2480 return 0; | |
2481 } | |
2482 | |
2483 //----- (0048D76C) -------------------------------------------------------- | |
2484 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) | |
2485 { | |
2486 unsigned __int16 v6; // cx@8 | |
2487 int v7; // edi@8 | |
2488 unsigned int v8; // ebx@8 | |
2489 unsigned int v9; // esi@8 | |
2490 int v10; // eax@8 | |
2491 int v11; // edi@12 | |
2492 bool result; // eax@13 | |
2493 | |
2494 if ( !a2 | |
2495 || this->pConditions[16] | |
2496 || this->pConditions[14] | |
2497 || this->pConditions[15] | |
2498 || this->pConditions[4] | |
2499 || this->pConditions[13] | |
2500 || this->pConditions[2] ) | |
2501 { | |
2502 result = 0; | |
2503 } | |
2504 else | |
2505 { | |
2506 v6 = this->pActiveSkills[34]; | |
2507 v7 = v6 & 0x3F; | |
2508 v8 = SkillToMastery(v6); | |
2509 v9 = a2->GetValue(); | |
2510 v10 = pItemsTable->pItems[a2->uItemID].uEquipType; | |
2511 if ( !pItemsTable->pItems[a2->uItemID].uEquipType || v10 == 1 || v10 == 2 ) | |
2512 v9 *= 3; | |
2513 v11 = dword_4EDEB4[rand() % 100 / 20] + v7 * dword_4EDEA0[v8]; | |
2514 *a6 = 100 * (a4 + a3) + v9 + (a5 != 0 ? 0x1F4 : 0); | |
2515 if ( rand() % 100 >= 5 ) | |
2516 { | |
2517 if ( *a6 > v11 ) | |
2518 result = *a6 - v11 < 500; | |
2519 else | |
2520 result = 2; | |
2521 } | |
2522 else | |
2523 { | |
2524 result = 0; | |
2525 } | |
2526 } | |
2527 return result; | |
2528 } | |
2529 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2530 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2531 | |
2532 //----- (0048D88B) -------------------------------------------------------- | |
2533 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) | |
2534 { | |
2535 Player *v4; // esi@1 | |
2536 Actor *v5; // edi@1 | |
2537 unsigned __int16 v6; // cx@10 | |
2538 int v7; // ebx@10 | |
2539 unsigned int v8; // esi@10 | |
2540 int v9; // eax@10 | |
2541 int v10; // esi@10 | |
2542 int v11; // eax@13 | |
2543 signed int v12; // ebx@15 | |
2544 signed int v13; // edx@15 | |
2545 int v14; // ecx@15 | |
2546 unsigned __int16 v15; // si@21 | |
2547 unsigned int v16; // ebx@24 | |
2548 int v17; // esi@24 | |
2549 const void *v18; // eax@29 | |
2550 unsigned int v19; // esi@31 | |
2551 int v20; // eax@34 | |
2552 char v21; // zf@36 | |
2553 unsigned int v22; // ST0C_4@39 | |
2554 char *v23; // esi@39 | |
2555 const char *v25; // [sp-Ch] [bp-48h]@40 | |
2556 int v26; // [sp-8h] [bp-44h]@40 | |
2557 ItemGen v27; // [sp+8h] [bp-34h]@15 | |
2558 unsigned int v28; // [sp+2Ch] [bp-10h]@10 | |
2559 int v29; // [sp+30h] [bp-Ch]@10 | |
2560 int v30; // [sp+34h] [bp-8h]@10 | |
2561 Player *v31; // [sp+38h] [bp-4h]@1 | |
2562 signed int _steal_perma; // [sp+48h] [bp+Ch]@12 | |
2563 | |
2564 v4 = this; | |
2565 v5 = &pActors[uActorID]; | |
2566 v31 = this; | |
2567 if ( &pActors[uActorID] | |
2568 && !this->pConditions[16] | |
2569 && !this->pConditions[14] | |
2570 && !this->pConditions[15] | |
2571 && !this->pConditions[4] | |
2572 && !this->pConditions[13] | |
2573 && !this->pConditions[2] ) | |
2574 { | |
2575 if ( !(BYTE2(v5->uAttributes) & 0x80) ) | |
2576 pActors[uActorID].SetRandomGoldIfTheresNoItem(); | |
2577 v6 = v4->pActiveSkills[34]; | |
2578 v7 = v6 & 0x3F; | |
2579 v8 = SkillToMastery(v6); | |
2580 v9 = rand(); | |
2581 v28 = 4 * v8; | |
2582 v30 = dword_4EDEA0[v8]; | |
2583 v29 = dword_4EDEB4[v9 % 100 / 20]; | |
2584 v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | |
2585 if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) ) | |
2586 { | |
322 | 2587 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 2588 _steal_perma = 0; |
2589 v26 = (int)v31->pName; | |
2590 v25 = pGlobalTXT_LocalizationStrings[376]; | |
2591 } | |
2592 else | |
2593 { | |
2594 v11 = rand(); | |
2595 if ( v11 % 100 >= 40 ) | |
2596 { | |
2597 if ( v11 % 100 >= 70 ) | |
2598 { | |
2599 v19 = 0; | |
2600 if ( v7 > 0 ) | |
2601 { | |
2602 do | |
2603 { | |
2604 --v7; | |
2605 v19 += rand() % dword_4EDEC4[v28 / 4] + 1; | |
2606 } | |
2607 while ( v7 ); | |
2608 } | |
2609 if ( pItemsTable->pItems[v5->array_000234[3].uItemID].uEquipType != 18 ) | |
2610 return _steal_perma; | |
377 | 2611 v20 = (int)&v5->array_000234[3].uSpecEnchantmentType; |
2612 if ( (signed int)v19 > v5->array_000234[3].uSpecEnchantmentType ) | |
2613 v19 = v5->array_000234[3].uSpecEnchantmentType; | |
0 | 2614 v21 = *(int *)v20 == v19; |
2615 *(int *)v20 -= v19; | |
2616 if ( v21 ) | |
2617 v5->array_000234[3].uItemID = 0; | |
2618 if ( v19 ) | |
2619 { | |
2620 party_finds_gold(v19, 2); | |
2621 v22 = v19; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2622 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2623 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22); |
0 | 2624 LABEL_43: |
2625 ShowStatusBarString(v23, 2u); | |
2626 return _steal_perma; | |
2627 } | |
2628 } | |
2629 else | |
2630 { | |
2631 v27.Reset(); | |
2632 v12 = 0; | |
2633 v13 = 0; | |
2634 v14 = (int)v5->array_000234; | |
2635 while ( !*(int *)v14 || pItemsTable->pItems[*(int *)v14].uEquipType == 18 ) | |
2636 { | |
2637 ++v13; | |
2638 v14 += 36; | |
2639 if ( v13 >= 4 ) | |
2640 goto LABEL_21; | |
2641 } | |
2642 v12 = 1; | |
2643 LABEL_21: | |
2644 v15 = v5->uCarriedItemID; | |
2645 if ( v15 || v12 ) | |
2646 { | |
2647 v27.Reset(); | |
2648 if ( v15 ) | |
2649 { | |
2650 v16 = (signed __int16)v15; | |
2651 v5->uCarriedItemID = 0; | |
2652 v27.uItemID = (signed __int16)v15; | |
2653 v17 = (signed __int16)v15; | |
2654 if ( pItemsTable->pItems[v17].uEquipType == 12 ) | |
2655 v27.uNumCharges = rand() % 6 + pItemsTable->pItems[v17].uDamageMod + 1; | |
2656 if ( pItemsTable->pItems[v17].uEquipType == 14 ) | |
2657 { | |
2658 if ( v16 != 220 ) | |
570 | 2659 v27.uEnchantmentType = 2 * rand() % 4 + 2; |
0 | 2660 } |
2661 } | |
2662 else | |
2663 { | |
2664 v18 = &v5->array_000234[rand() % 4]; | |
2665 memcpy(&v27, v18, sizeof(v27)); | |
2666 ((ItemGen *)v18)->Reset(); | |
2667 v16 = v27.uItemID; | |
2668 } | |
2669 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | |
2670 sprintf( | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2671 pTmpBuf2.data(), |
0 | 2672 pGlobalTXT_LocalizationStrings[304], |
2673 v31->pName, | |
2674 pItemsTable->pItems[v16].pUnidentifiedName); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2675 ShowStatusBarString(pTmpBuf2.data(), 2u); |
0 | 2676 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2677 memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem)); | |
2678 pMouse->SetCursorBitmapFromItemID(v16); | |
2679 return _steal_perma; | |
2680 } | |
2681 } | |
2682 } | |
2683 v26 = (int)v31->pName; | |
2684 v25 = pGlobalTXT_LocalizationStrings[377]; | |
2685 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2686 v23 = pTmpBuf2.data(); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
2687 sprintfex(pTmpBuf2.data(), v25, v26); |
0 | 2688 goto LABEL_43; |
2689 } | |
2690 return 0; | |
2691 } | |
2692 // 4EDEA0: using guessed type int dword_4EDEA0[]; | |
2693 // 4EDEB4: using guessed type int dword_4EDEB4[]; | |
2694 // 4EDEC4: using guessed type int dword_4EDEC4[]; | |
2695 | |
2696 //----- (0048DBB9) -------------------------------------------------------- | |
2697 void Player::Heal(int amount) | |
2698 { | |
1010 | 2699 signed int max_health; // eax@3 |
2700 | |
2701 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] ) | |
2702 { | |
2703 max_health = GetMaxHealth(); | |
2704 if ( pConditions[Condition_Zombie] ) | |
2705 max_health /= 2; | |
2706 sHealth += amount; | |
2707 if ( sHealth > max_health ) | |
2708 sHealth = max_health; | |
2709 if ( pConditions[Condition_Unconcious] ) | |
2710 { | |
2711 if ( sHealth > 0 ) | |
2712 { | |
2713 pConditions[Condition_Unconcious] = 0i64; | |
0 | 2714 } |
2715 } | |
2716 } | |
2717 } | |
2718 | |
2719 //----- (0048DC1E) -------------------------------------------------------- | |
1036 | 2720 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) |
2721 { | |
2722 signed int recieved_dmg; // eax@1 | |
2723 unsigned int armor_indx; // eax@8 | |
2724 bool broke_armor; | |
2725 | |
2726 pConditions[Condition_Sleep] = 0i64; | |
2727 recieved_dmg = CalculateIncommingDamage(dmg_type, amount); | |
2728 sHealth -= recieved_dmg; | |
2729 broke_armor = sHealth <= -10; | |
2730 if ( sHealth < 1 ) // | |
2731 { | |
2732 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1) | |
2733 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0i64 ) | |
0 | 2734 { |
1019 | 2735 SetCondition(Condition_Unconcious, 0); |
0 | 2736 } |
2737 else | |
2738 { | |
1019 | 2739 SetCondition(Condition_Dead, 0); |
1036 | 2740 //v6 = LODWORD(pParty->uTimePlayed); ???? if equals 0 do not broke armor? |
2741 if ( sHealth > 0 ) | |
2742 sHealth = 0; | |
2743 } | |
2744 if (broke_armor ) | |
2745 { | |
2746 armor_indx = pEquipment.uArmor; | |
2747 if ( armor_indx ) | |
0 | 2748 { |
1036 | 2749 if ( !pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED) |
0 | 2750 { |
1036 | 2751 pOwnItems[armor_indx-1].uAttributes|=ITEM_BROKEN; |
0 | 2752 } |
2753 } | |
2754 } | |
2755 } | |
1036 | 2756 if ( recieved_dmg && CanAct() ) |
187 | 2757 PlaySound(SPEECH_24, 0); |
1036 | 2758 return recieved_dmg; |
0 | 2759 } |
2760 | |
2761 //----- (0048DCF6) -------------------------------------------------------- | |
2762 int Player::_48DCF6(int a2, Actor *pActor) | |
2763 { | |
2764 signed int v3; // edi@1 | |
2765 signed int v4; // ebx@1 | |
2766 Player *v5; // esi@1 | |
2767 int v6; // eax@2 | |
2768 int v7; // eax@5 | |
2769 int v8; // eax@8 | |
2770 int v9; // ebx@8 | |
2771 int v10; // eax@8 | |
2772 int v11; // ebx@8 | |
2773 signed int v12; // edx@9 | |
2774 ItemGen *v13; // eax@9 | |
2775 int v14; // edx@16 | |
2776 unsigned int v15; // edx@17 | |
2777 int v16; // edx@26 | |
2778 unsigned int v17; // edx@27 | |
2779 signed int v19; // edx@38 | |
2780 int *v20; // ecx@38 | |
2781 signed int v21; // eax@40 | |
2782 int v22; // eax@49 | |
2783 signed int v23; // ebx@49 | |
2784 unsigned int v24; // eax@60 | |
2785 int v25; // ecx@61 | |
2786 int v26; // ebx@74 | |
2787 void *v27; // ecx@76 | |
2788 unsigned int v28; // ebx@78 | |
2789 signed int result; // eax@86 | |
2790 SoundID v30; // [sp-20h] [bp-C0h]@56 | |
2791 signed int v31; // [sp-1Ch] [bp-BCh]@56 | |
2792 unsigned int v32; // [sp-18h] [bp-B8h]@56 | |
2793 signed int v33; // [sp-14h] [bp-B4h]@56 | |
2794 signed int v34; // [sp-10h] [bp-B0h]@56 | |
2795 int v35; // [sp-Ch] [bp-ACh]@56 | |
2796 unsigned int v36; // [sp-8h] [bp-A8h]@51 | |
2797 unsigned int v37; // [sp-8h] [bp-A8h]@56 | |
2798 unsigned int v38; // [sp-8h] [bp-A8h]@57 | |
2799 unsigned int v39; // [sp-8h] [bp-A8h]@68 | |
2800 enum CHARACTER_ATTRIBUTE_TYPE v40; // [sp-4h] [bp-A4h]@4 | |
2801 int v41; // [sp-4h] [bp-A4h]@51 | |
2802 int v42; // [sp-4h] [bp-A4h]@56 | |
2803 int v43; // [sp-4h] [bp-A4h]@57 | |
2804 signed int v44; // [sp-4h] [bp-A4h]@59 | |
2805 int v45; // [sp-4h] [bp-A4h]@68 | |
2806 char v46[140]; // [sp+Ch] [bp-94h]@13 | |
2807 unsigned int v47; // [sp+98h] [bp-8h]@1 | |
2808 int v48; // [sp+9Ch] [bp-4h]@1 | |
2809 | |
2810 v3 = 0; | |
2811 v4 = 0; | |
2812 v5 = this; | |
2813 v47 = 0; | |
2814 v48 = 0; | |
2815 switch ( a2 ) | |
2816 { | |
2817 case 1: | |
2818 v6 = GetActualWillpower(); | |
2819 goto LABEL_46; | |
2820 case 2: | |
2821 case 3: | |
2822 case 4: | |
2823 case 9: | |
2824 case 10: | |
2825 case 11: | |
2826 case 13: | |
2827 case 21: | |
2828 v6 = GetActualEndurance(); | |
2829 goto LABEL_46; | |
2830 case 5: | |
2831 case 12: | |
2832 case 23: | |
2833 v40 = (CHARACTER_ATTRIBUTE_TYPE)14; | |
2834 goto LABEL_5; | |
2835 case 15: | |
2836 v40 = (CHARACTER_ATTRIBUTE_TYPE)13; | |
2837 goto LABEL_5; | |
2838 case 6: | |
2839 case 7: | |
2840 case 8: | |
2841 case 14: | |
2842 case 16: | |
2843 v40 = (CHARACTER_ATTRIBUTE_TYPE)15; | |
2844 LABEL_5: | |
2845 v7 = GetActualResistance(v40); | |
2846 goto LABEL_47; | |
2847 case 22: | |
2848 v8 = GetActualWillpower(); | |
1036 | 2849 v9 = GetParameterBonus(v8); |
0 | 2850 v10 = GetActualIntelligence(); |
1036 | 2851 v11 = (GetParameterBonus(v10) + v9) >> 1; |
0 | 2852 break; |
2853 case 17: | |
2854 v12 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2855 v13 = this->pInventoryItemList; |
0 | 2856 do |
2857 { | |
315 | 2858 if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) |
0 | 2859 v46[v4++] = v12; |
2860 ++v12; | |
2861 ++v13; | |
2862 } | |
2863 while ( v12 < 138 ); | |
2864 goto LABEL_36; | |
2865 case 18: | |
2866 v14 = 0; | |
2867 do | |
2868 { | |
2869 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) | |
2870 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2871 __debugbreak(); // player.cpp(2871): warning C4700: uninitialized local variable 'v15' used |
816 | 2872 if ( v15 == EQUIP_ARMOUR ) |
898 | 2873 v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; |
816 | 2874 if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) |
898 | 2875 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; |
0 | 2876 } |
2877 v14 = v15 + 1; | |
2878 } | |
2879 while ( v14 < 16 ); | |
2880 goto LABEL_36; | |
2881 case 19: | |
2882 v16 = 0; | |
2883 do | |
2884 { | |
2885 if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) ) | |
2886 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2887 __debugbreak(); // player.cpp(2886): warning C4700: uninitialized local variable 'v17' used |
0 | 2888 if ( v17 == 2 ) |
2889 v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; | |
2890 if ( (!v17 || v17 == 1) | |
816 | 2891 && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) |
898 | 2892 v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; |
0 | 2893 } |
2894 v16 = v17 + 1; | |
2895 } | |
2896 while ( v16 < 16 ); | |
2897 LABEL_36: | |
2898 if ( !v4 ) | |
2899 goto LABEL_87; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2900 v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; |
0 | 2901 v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); |
2902 break; | |
2903 case 20: | |
2904 v19 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2905 v20 = this->pInventoryMatrix; |
0 | 2906 do |
2907 { | |
2908 if ( *v20 > 0 ) | |
2909 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
2910 v21 = *(int *)&v5->pInventoryItemList[*v20-1]; |
0 | 2911 if ( v21 > 0 ) |
2912 { | |
2913 if ( v21 <= 134 ) | |
2914 v46[v4++] = v19; | |
2915 } | |
2916 } | |
2917 ++v19; | |
2918 ++v20; | |
2919 } | |
2920 while ( v19 < 126 ); | |
2921 if ( !v4 ) | |
2922 goto LABEL_87; | |
2923 v47 = (unsigned __int8)v46[rand() % v4]; | |
2924 v6 = GetActualAccuracy(); | |
2925 LABEL_46: | |
1036 | 2926 v7 = GetParameterBonus(v6); |
0 | 2927 LABEL_47: |
2928 v11 = v7; | |
2929 break; | |
2930 default: | |
2931 v11 = 0; | |
2932 break; | |
2933 } | |
2934 v22 = GetActualLuck(); | |
1036 | 2935 v23 = GetParameterBonus(v22) + v11 + 30; |
0 | 2936 if ( rand() % v23 >= 30 ) |
2937 { | |
2938 LABEL_87: | |
2939 result = 0; | |
2940 } | |
2941 else | |
2942 { | |
2943 switch ( a2 ) | |
2944 { | |
2945 case 1: | |
2946 v41 = 1; | |
2947 v36 = 0; | |
2948 goto LABEL_56; | |
2949 case 2: | |
2950 v41 = 1; | |
2951 v36 = 1; | |
2952 goto LABEL_56; | |
2953 case 3: | |
2954 v41 = 1; | |
2955 v36 = 2; | |
2956 goto LABEL_56; | |
2957 case 23: | |
2958 v41 = 1; | |
2959 v36 = 3; | |
2960 goto LABEL_56; | |
2961 case 4: | |
2962 v41 = 1; | |
2963 v36 = 4; | |
2964 LABEL_56: | |
2965 SetCondition(v36, v41); | |
2966 v42 = 0; | |
2967 v37 = 0; | |
2968 v35 = 0; | |
2969 v34 = 0; | |
2970 v33 = -1; | |
2971 v32 = 0; | |
2972 v31 = 0; | |
2973 v30 = (SoundID)221; | |
2974 goto LABEL_83; | |
2975 case 5: | |
2976 v43 = 1; | |
2977 v38 = 5; | |
2978 goto LABEL_70; | |
2979 case 6: | |
2980 case 7: | |
2981 case 8: | |
2982 if ( a2 == 6 ) | |
2983 { | |
2984 v44 = 6; | |
2985 goto LABEL_60; | |
2986 } | |
2987 v25 = 2 * (a2 != 8) + 8; | |
2988 goto LABEL_65; | |
2989 case 9: | |
2990 if ( a2 == 6 ) | |
2991 { | |
2992 v44 = 7; | |
2993 LABEL_60: | |
2994 v24 = v44; | |
2995 } | |
2996 else | |
2997 { | |
2998 v25 = 2 * (a2 != 8) + 9; | |
2999 LABEL_65: | |
3000 v24 = v25; | |
3001 } | |
3002 SetCondition(v24, 1); | |
3003 v42 = 0; | |
3004 v37 = 0; | |
3005 v35 = 0; | |
3006 v34 = 0; | |
3007 v33 = -1; | |
3008 v32 = 0; | |
3009 v31 = 0; | |
3010 v30 = (SoundID)222; | |
3011 LABEL_83: | |
3012 pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42); | |
3013 do | |
3014 { | |
3015 LABEL_84: | |
3016 if ( v5 == pPlayers[v3 + 1] ) | |
3017 break; | |
3018 ++v3; | |
3019 } | |
3020 while ( v3 < 4 ); | |
3021 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); | |
3022 result = 1; | |
3023 break; | |
3024 case 12: | |
3025 v43 = 1; | |
3026 v38 = 12; | |
3027 goto LABEL_70; | |
3028 case 15: | |
3029 v45 = 1; | |
3030 v39 = 15; | |
3031 goto LABEL_73; | |
3032 case 13: | |
3033 v43 = 1; | |
3034 v38 = 13; | |
3035 LABEL_70: | |
3036 SetCondition(v38, v43); | |
3037 v42 = 0; | |
3038 v37 = 0; | |
3039 v35 = 0; | |
3040 v34 = 0; | |
3041 v33 = -1; | |
3042 v32 = 0; | |
3043 v31 = 0; | |
3044 v30 = (SoundID)224; | |
3045 goto LABEL_83; | |
3046 case 14: | |
3047 v45 = 1; | |
3048 v39 = 14; | |
3049 goto LABEL_73; | |
3050 case 16: | |
3051 v45 = 1; | |
3052 v39 = 16; | |
3053 LABEL_73: | |
3054 SetCondition(v39, v45); | |
3055 v42 = 0; | |
3056 v37 = 0; | |
3057 v35 = 0; | |
3058 v34 = 0; | |
3059 v33 = -1; | |
3060 v32 = 0; | |
3061 v31 = 0; | |
3062 v30 = (SoundID)225; | |
3063 goto LABEL_83; | |
3064 case 17: | |
3065 case 18: | |
3066 case 19: | |
3067 v26 = v48; | |
3068 if ( *(char *)(v48 + 21) & 2 ) | |
3069 goto LABEL_84; | |
187 | 3070 PlaySound(SPEECH_40, 0); |
0 | 3071 *(int *)(v26 + 20) |= 2u; |
3072 goto LABEL_79; | |
3073 case 20: | |
187 | 3074 PlaySound(SPEECH_40, 0); |
0 | 3075 v27 = pActor->array_000234; |
3076 if ( pActor->array_000234[0].uItemID ) | |
3077 { | |
3078 v27 = &pActor->array_000234[1]; | |
3079 if ( pActor->array_000234[1].uItemID ) | |
3080 goto LABEL_84; | |
3081 } | |
3082 v28 = v47; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3083 memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); |
0 | 3084 RemoveItemAtInventoryIndex(v28); |
3085 LABEL_79: | |
3086 v42 = 0; | |
3087 v37 = 0; | |
3088 v35 = 0; | |
3089 v34 = 0; | |
3090 v33 = -1; | |
3091 v32 = 0; | |
3092 v31 = 0; | |
3093 v30 = (SoundID)47; | |
3094 goto LABEL_83; | |
3095 case 21: | |
187 | 3096 PlaySound(SPEECH_42, 0); |
0 | 3097 ++v5->sAgeModifier; |
3098 goto LABEL_82; | |
3099 case 22: | |
187 | 3100 PlaySound(SPEECH_41, 0); |
0 | 3101 v5->sMana = 0; |
3102 LABEL_82: | |
3103 v42 = 0; | |
3104 v37 = 0; | |
3105 v35 = 0; | |
3106 v34 = 0; | |
3107 v33 = -1; | |
3108 v32 = 0; | |
3109 v31 = 0; | |
3110 v30 = (SoundID)226; | |
3111 goto LABEL_83; | |
3112 default: | |
3113 goto LABEL_87; | |
3114 } | |
3115 } | |
3116 return result; | |
3117 } | |
324 | 3118 |
0 | 3119 // 48DCF6: using guessed type char var_94[140]; |
3120 | |
3121 //----- (0048E1A3) -------------------------------------------------------- | |
3122 unsigned int Player::GetSpellSchool(unsigned int uSpellID) | |
3123 { | |
1091 | 3124 return pSpellStats->pInfos[uSpellID].uSchool; |
0 | 3125 } |
3126 | |
3127 //----- (0048E1B5) -------------------------------------------------------- | |
816 | 3128 int Player::GetAttackRecoveryTime(bool bRangedAttack) |
3129 { | |
3130 ItemGen *weapon = nullptr; | |
3131 ItemDesc *weapon_desc = nullptr; | |
3132 uint weapon_recovery = base_recovery_times_per_weapon_type[0]; | |
3133 if (bRangedAttack) | |
0 | 3134 { |
3135 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3136 goto LABEL_17; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3137 weapon = &pInventoryItemList[pEquipment.uBow - 1]; |
816 | 3138 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3139 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; | |
3140 goto LABEL_17; | |
3141 } | |
3142 else if ( IsUnarmed() == 1 ) | |
3143 { | |
3144 if (GetActualSkillLevel(PLAYER_SKILL_UNARMED)) | |
3145 { | |
3146 weapon_recovery = base_recovery_times_per_weapon_type[1]; | |
0 | 3147 goto LABEL_17; |
3148 } | |
3149 } | |
816 | 3150 |
3151 if ( HasItemEquipped(EQUIP_MAIN_HAND) ) | |
3152 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3153 weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; |
816 | 3154 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3155 if (weapon_desc->uEquipType == EQUIP_WAND) | |
3156 { | |
3157 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 | |
3158 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now | |
3159 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; | |
3160 } | |
0 | 3161 else |
816 | 3162 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; |
3163 } | |
1010 | 3164 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
3165 // ADD: shield check because shield recovery is added later and can be accidentally doubled | |
816 | 3166 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3167 auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 3168 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; |
3169 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) | |
3170 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3171 weapon = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 3172 weapon_desc = &pItemsTable->pItems[weapon->uItemID]; |
3173 weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; | |
3174 } | |
3175 } | |
3176 | |
0 | 3177 LABEL_17: |
816 | 3178 uint armour_recovery = 0; |
0 | 3179 if ( HasItemEquipped(EQUIP_ARMOUR) ) |
3180 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3181 auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; |
816 | 3182 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; |
3183 | |
3184 float armour_recovery_multipliers[4]; | |
3185 if (armour_skill_type == PLAYER_SKILL_LEATHER) | |
3186 { | |
3187 armour_recovery_multipliers[0] = 1.0f; | |
3188 armour_recovery_multipliers[1] = 0; | |
3189 armour_recovery_multipliers[2] = 0; | |
3190 armour_recovery_multipliers[3] = 0; | |
3191 } | |
3192 else if (armour_skill_type == PLAYER_SKILL_CHAIN) | |
3193 { | |
3194 armour_recovery_multipliers[0] = 1.0f; | |
3195 armour_recovery_multipliers[1] = 0.5f; | |
3196 armour_recovery_multipliers[2] = 0; | |
3197 armour_recovery_multipliers[3] = 0; | |
3198 } | |
3199 else if (armour_skill_type == PLAYER_SKILL_PLATE) | |
3200 { | |
3201 armour_recovery_multipliers[0] = 1.0f; | |
3202 armour_recovery_multipliers[1] = 0.5f; | |
3203 armour_recovery_multipliers[2] = 0.5f; | |
3204 armour_recovery_multipliers[3] = 0; | |
0 | 3205 } |
3206 else | |
3207 { | |
816 | 3208 assert(false && "Unknown armour type"); // what kind of armour is that? |
3209 armour_recovery_multipliers[0] = 1.0f; | |
3210 armour_recovery_multipliers[1] = 1.0f; | |
3211 armour_recovery_multipliers[2] = 1.0f; | |
3212 armour_recovery_multipliers[3] = 1.0f; | |
3213 } | |
3214 | |
3215 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]); | |
3216 armour_recovery = base_armour_recovery * armour_recovery_multipliers[skill_mastery - 1]; | |
3217 } | |
3218 | |
3219 uint shield_recovery = 0; | |
3220 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) | |
3221 { | |
3222 float shield_recovery_multipliers[4] = {1, 0, 0, 0}; | |
3223 | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3224 auto shield = &pInventoryItemList[pEquipment.uShield - 1]; |
816 | 3225 auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; |
3226 | |
3227 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; | |
3228 shield_recovery = shield_base_recovery * SkillToMastery(pActiveSkills[skill_type]); | |
3229 } | |
3230 | |
1036 | 3231 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), |
816 | 3232 sword_axe_bow_recovery_reduction = 0; |
3233 bool shooting_laser = false; | |
3234 if (weapon_desc) | |
3235 { | |
3236 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && | |
3237 (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) | |
3238 { | |
3239 if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery | |
3240 sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; | |
3241 } | |
3242 if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) | |
3243 shooting_laser = true; | |
3244 } | |
3245 | |
3246 uint armsmaster_recovery_reduction = 0; | |
3247 if (!bRangedAttack && !shooting_laser) | |
3248 { | |
3249 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER)) | |
3250 { | |
3251 armsmaster_recovery_reduction = armsmaster_level & 0x3F; | |
3252 if (SkillToMastery(armsmaster_level) >= 4) | |
3253 armsmaster_recovery_reduction *= 2; | |
3254 } | |
3255 } | |
3256 | |
3257 uint v41 = 0; | |
3258 if (pPlayerBuffs[PLAYER_BUFF_7].uExpireTime > 0) | |
0 | 3259 v41 = 25; |
816 | 3260 |
3261 uint weapon_enchantment_recovery_reduction = 0; | |
3262 if ( weapon ) | |
3263 { | |
3264 if (weapon->uSpecEnchantmentType == 59 || | |
3265 weapon->uSpecEnchantmentType == 41 || | |
3266 weapon->uSpecEnchantmentType == 500) | |
3267 weapon_enchantment_recovery_reduction = 20; | |
3268 } | |
3269 | |
3270 | |
3271 int recovery = weapon_recovery + | |
3272 armour_recovery + | |
3273 shield_recovery | |
3274 - armsmaster_recovery_reduction | |
3275 - weapon_enchantment_recovery_reduction | |
3276 - v41 | |
3277 - sword_axe_bow_recovery_reduction | |
3278 - player_speed_recovery_reduction; | |
3279 | |
3280 if (recovery < 0) | |
3281 recovery = 0; | |
3282 return recovery; | |
0 | 3283 } |
3284 | |
3285 //----- (0048E4F8) -------------------------------------------------------- | |
3286 int Player::GetMaxHealth() | |
3287 { | |
3288 int v3; // esi@1 | |
3289 int v4; // esi@1 | |
3290 int v6; // esi@1 | |
3291 | |
1036 | 3292 v3 = GetParameterBonus(GetActualEndurance()); |
135 | 3293 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3); |
0 | 3294 v6 = uFullHealthBonus |
135 | 3295 + pBaseHealthByClass[classType / 4] |
0 | 3296 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH) |
3297 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH, 0) + v4; | |
3298 if (v6 <= 0) | |
3299 return 1; | |
3300 return v6; | |
3301 } | |
3302 | |
3303 //----- (0048E565) -------------------------------------------------------- | |
3304 int Player::GetMaxMana() | |
3305 { | |
3306 int v2; // eax@2 | |
3307 int v3; // esi@4 | |
3308 int v4; // eax@5 | |
3309 int v5; // esi@5 | |
3310 int v6; // eax@5 | |
3311 int v7; // esi@6 | |
3312 int v8; // esi@6 | |
3313 int v9; // esi@6 | |
3314 int result; // eax@7 | |
1116 | 3315 |
135 | 3316 switch (classType) |
0 | 3317 { |
1116 | 3318 case PLAYER_CLASS_ROGUE: |
3319 case PLAYER_CLASS_SPY: | |
3320 case PLAYER_CLASS_ASSASSIN: | |
3321 case PLAYER_CLASS_ARCHER: | |
3322 case PLAYER_CLASS_WARRIOR_MAGE: | |
3323 case PLAYER_CLASS_MASTER_ARCHER: | |
3324 case PLAYER_CLASS_SNIPER: | |
3325 case PLAYER_CLASS_SORCERER: | |
3326 case PLAYER_CLASS_WIZARD: | |
3327 case PLAYER_CLASS_ARCHMAGE: | |
3328 case PLAYER_CLASS_LICH: | |
0 | 3329 v2 = GetActualIntelligence(); |
1036 | 3330 v3 = GetParameterBonus(v2); |
1116 | 3331 break; |
3332 case PLAYER_CLASS_INITIATE: | |
3333 case PLAYER_CLASS_MASTER: | |
3334 case PLAYER_CLASS_NINJA: | |
3335 case PLAYER_CLASS_PALADIN: | |
3336 case PLAYER_CLASS_CRUSADER: | |
3337 case PLAYER_CLASS_HERO: | |
3338 case PLAYER_CLASS_VILLIAN: | |
3339 case PLAYER_CLASS_CLERIC: | |
3340 case PLAYER_CLASS_PRIEST: | |
3341 case PLAYER_CLASS_PRIEST_OF_SUN: | |
3342 case PLAYER_CLASS_PRIEST_OF_MOON: | |
0 | 3343 v2 = GetActualWillpower(); |
1036 | 3344 v3 = GetParameterBonus(v2); |
1116 | 3345 break; |
3346 case PLAYER_CLASS_HUNTER: | |
3347 case PLAYER_CLASS_RANGER_LORD: | |
3348 case PLAYER_CLASS_BOUNTY_HUNTER: | |
3349 case PLAYER_CLASS_DRUID: | |
3350 case PLAYER_CLASS_GREAT_DRUID: | |
3351 case PLAYER_CLASS_ARCH_DRUID: | |
3352 case PLAYER_CLASS_WARLOCK: | |
0 | 3353 v4 = GetActualWillpower(); |
1036 | 3354 v5 = GetParameterBonus(v4); |
0 | 3355 v6 = GetActualIntelligence(); |
1036 | 3356 v3 = GetParameterBonus(v6) + v5; |
0 | 3357 break; |
3358 default: | |
1116 | 3359 return 0; |
0 | 3360 break; |
3361 } | |
1116 | 3362 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3); |
3363 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7; | |
3364 v9 = uFullManaBonus | |
3365 + pBaseManaByClass[classType / 4] | |
3366 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA) | |
3367 + v8; | |
3368 return max(0,v9); | |
0 | 3369 } |
3370 | |
3371 //----- (0048E656) -------------------------------------------------------- | |
3372 int Player::GetBaseAC() | |
3373 { | |
3374 Player *v1; // edi@1 | |
3375 int v2; // eax@1 | |
3376 int v3; // esi@1 | |
3377 int v4; // esi@1 | |
3378 int v5; // esi@1 | |
3379 int result; // eax@2 | |
3380 | |
3381 v1 = this; | |
3382 v2 = GetActualSpeed(); | |
1036 | 3383 v3 = GetParameterBonus(v2); |
0 | 3384 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3385 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3386 if ( v5 >= 1 ) | |
3387 result = v5; | |
3388 else | |
3389 result = 0; | |
3390 return result; | |
3391 } | |
3392 | |
3393 //----- (0048E68F) -------------------------------------------------------- | |
3394 int Player::GetActualAC() | |
3395 { | |
3396 Player *v1; // edi@1 | |
3397 int v2; // eax@1 | |
3398 int v3; // esi@1 | |
3399 int v4; // esi@1 | |
3400 int v5; // esi@1 | |
3401 int v6; // esi@1 | |
3402 int result; // eax@2 | |
3403 | |
3404 v1 = this; | |
3405 v2 = GetActualSpeed(); | |
1036 | 3406 v3 = GetParameterBonus(v2); |
0 | 3407 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS, 0) + v3; |
3408 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4; | |
3409 v6 = v1->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5; | |
3410 if ( v6 >= 1 ) | |
3411 result = v6; | |
3412 else | |
3413 result = 0; | |
3414 return result; | |
3415 } | |
3416 | |
3417 //----- (0048E6DC) -------------------------------------------------------- | |
3418 unsigned int Player::GetBaseAge() | |
3419 { | |
352 | 3420 return ((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year; |
0 | 3421 } |
3422 | |
3423 //----- (0048E72C) -------------------------------------------------------- | |
3424 unsigned int Player::GetActualAge() | |
3425 { | |
3426 return this->sAgeModifier + GetBaseAge(); | |
3427 } | |
3428 | |
3429 //----- (0048E73F) -------------------------------------------------------- | |
3430 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3431 { | |
3432 Player *v2; // ebx@1 | |
3433 signed int v3; // esi@1 | |
3434 enum CHARACTER_RACE v4; // eax@1 | |
3435 signed int v5; // edi@8 | |
3436 char v6; // zf@9 | |
3437 int v7; // esi@20 | |
3438 int result; // eax@21 | |
3439 signed int v9; // [sp-4h] [bp-10h]@11 | |
3440 | |
3441 v2 = this; | |
3442 v3 = 0; | |
3443 v4 = GetRace(); | |
3444 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3445 { | |
3446 v5 = 0; | |
3447 goto LABEL_16; | |
3448 } | |
3449 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3450 { | |
3451 v5 = 1; | |
3452 LABEL_16: | |
3453 v6 = v4 == 2; | |
3454 goto LABEL_17; | |
3455 } | |
3456 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3457 { | |
3458 v6 = v4 == 3; | |
3459 v5 = 2; | |
3460 goto LABEL_17; | |
3461 } | |
3462 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3463 { | |
3464 v5 = 3; | |
3465 v6 = v4 == 3; | |
3466 goto LABEL_17; | |
3467 } | |
3468 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3469 { | |
3470 v5 = 7; | |
3471 if ( v4 != 1 ) | |
3472 goto LABEL_20; | |
3473 v9 = 10; | |
3474 LABEL_19: | |
3475 v3 = v9; | |
3476 goto LABEL_20; | |
3477 } | |
3478 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_BODY || a2 == 33 ) | |
3479 { | |
3480 v5 = 8; | |
3481 v6 = v4 == 0; | |
3482 LABEL_17: | |
3483 if ( !v6 ) | |
3484 goto LABEL_20; | |
3485 v9 = 5; | |
3486 goto LABEL_19; | |
3487 } | |
3488 v5 = 0; | |
3489 LABEL_20: | |
3490 v7 = GetItemsBonus(a2, 0) + v3; | |
135 | 3491 if ( v2->classType != PLAYER_CLASS_LICH || (result = 200, v7 + *(&v2->sResFireBase + v5) <= 200) ) |
0 | 3492 result = v7 + *(&v2->sResFireBase + v5); |
3493 return result; | |
3494 } | |
3495 | |
3496 //----- (0048E7D0) -------------------------------------------------------- | |
3497 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
3498 { | |
3499 signed int v2; // edi@1 | |
3500 Player *v3; // esi@1 | |
3501 enum CHARACTER_RACE v4; // ebx@1 | |
3502 char v6; // zf@18 | |
3503 int v7; // ebx@28 | |
3504 int result; // eax@28 | |
3505 signed int v9; // [sp+10h] [bp-8h]@1 | |
3506 signed int v10; // [sp+14h] [bp-4h]@1 | |
3507 | |
3508 v2 = 0; | |
3509 v3 = this; | |
3510 v10 = 0; | |
3511 v9 = 0; | |
3512 v4 = GetRace(); | |
652 | 3513 if ( CheckHiredNPCSpeciality(Enchanter) ) |
0 | 3514 v10 = 20; |
3515 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE | |
3516 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR | |
3517 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER | |
3518 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH) | |
3519 && SkillToMastery(v3->pActiveSkills[9]) == 4 | |
3520 && HasItemEquipped(EQUIP_ARMOUR) | |
3521 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | |
3522 v10 += v3->pActiveSkills[9] & 0x3F; | |
3523 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE ) | |
3524 goto LABEL_25; | |
3525 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_AIR ) | |
3526 { | |
3527 v2 = 1; | |
3528 LABEL_25: | |
3529 v6 = v4 == 2; | |
3530 LABEL_26: | |
3531 if ( v6 ) | |
3532 v9 = 5; | |
3533 goto LABEL_28; | |
3534 } | |
3535 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_WATER ) | |
3536 { | |
3537 v6 = v4 == 3; | |
3538 v2 = 2; | |
3539 goto LABEL_26; | |
3540 } | |
3541 if ( a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH ) | |
3542 { | |
3543 v2 = 3; | |
3544 if ( v4 == 3 ) | |
3545 v10 += 5; | |
3546 } | |
3547 else | |
3548 { | |
3549 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_MIND ) | |
3550 { | |
3551 if ( a2 != CHARACTER_ATTRIBUTE_RESIST_BODY && a2 != 33 ) | |
3552 goto LABEL_28; | |
3553 v2 = 8; | |
3554 v6 = v4 == 0; | |
3555 goto LABEL_26; | |
3556 } | |
3557 v2 = 7; | |
3558 if ( v4 == 1 ) | |
3559 v9 = 10; | |
3560 } | |
3561 LABEL_28: | |
3562 v7 = GetItemsBonus(a2, 0); | |
3563 result = v10 + GetMagicalBonus(a2) + v7 + v9 + *(&v3->sResFireBonus + v2) + *(&v3->sResFireBase + v2); | |
135 | 3564 if ( v3->classType == PLAYER_CLASS_LICH ) |
0 | 3565 { |
3566 if ( result > 200 ) | |
3567 result = 200; | |
3568 } | |
3569 return result; | |
3570 } | |
3571 | |
3572 //----- (0048E8F5) -------------------------------------------------------- | |
816 | 3573 bool Player::Recover(int dt) |
3574 { | |
3575 //Player *v2; // esi@1 | |
0 | 3576 signed __int64 v3; // qax@1 |
816 | 3577 //bool result; // eax@4 |
3578 | |
3579 //v2 = this; | |
3580 v3 = (signed __int64)((double)(dt * _48EA46_calc_special_bonus_by_items(17)) * 0.01 + (double)dt); | |
3581 | |
3582 Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery); | |
3583 | |
3584 if (uTimeToRecovery > v3) | |
3585 { | |
3586 uTimeToRecovery -= v3; | |
3587 return true; | |
0 | 3588 } |
3589 else | |
3590 { | |
816 | 3591 uTimeToRecovery = 0; |
3592 viewparams->bRedrawGameUI = true; | |
3593 if (!uActiveCharacter) | |
0 | 3594 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3595 return false; |
3596 } | |
0 | 3597 } |
3598 | |
3599 //----- (0048E96A) -------------------------------------------------------- | |
816 | 3600 void Player::SetRecoveryTime(signed int rec) |
3601 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
821
diff
changeset
|
3602 assert(rec >= 0); |
816 | 3603 |
3604 if (rec > uTimeToRecovery) | |
3605 uTimeToRecovery = rec; | |
3606 | |
3607 if (pPlayers[uActiveCharacter] == this && !some_active_character) | |
0 | 3608 uActiveCharacter = pParty->GetNextActiveCharacter(); |
816 | 3609 |
3610 viewparams->bRedrawGameUI = true; | |
0 | 3611 } |
3612 // 50C0C4: using guessed type int some_active_character; | |
3613 | |
3614 //----- (0048E9B7) -------------------------------------------------------- | |
3615 void Player::RandomizeName() | |
3616 { | |
3617 if (!uExpressionTimePassed) | |
3618 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]); | |
3619 } | |
3620 | |
3621 //----- (0048E9F4) -------------------------------------------------------- | |
3622 unsigned int Player::GetMajorConditionIdx() | |
3623 { | |
3624 for (uint i = 0; i < 18; ++i) | |
3625 if (pConditions[pConditionImportancyTable[i]] != 0) | |
3626 return pConditionImportancyTable[i]; | |
3627 | |
3628 return 18; | |
3629 } | |
3630 | |
3631 //----- (0048EA1B) -------------------------------------------------------- | |
1036 | 3632 int Player::GetParameterBonus( int player_parameter ) |
3633 { | |
3634 int i; // eax@1 | |
3635 i = 0; | |
3636 while (param_to_bonus_table[i]) | |
3637 { | |
3638 if (player_parameter >= param_to_bonus_table[i]) | |
3639 break; | |
3640 ++i; | |
3641 } | |
3642 return parameter_to_bonus_value[i]; | |
0 | 3643 } |
3644 | |
3645 //----- (0048EA46) -------------------------------------------------------- | |
3646 int Player::_48EA46_calc_special_bonus_by_items(int a2) | |
3647 { | |
1032 | 3648 int inv_indx; // eax@3 |
3649 | |
3650 for (int i=EQUIP_OFF_HAND; i<EQUIP_BOOK; ++i ) | |
3651 { | |
3652 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
3653 continue; | |
3654 inv_indx = pEquipment.pIndices[i] - 1; | |
3655 if (a2==17) | |
3656 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3657 if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery |
1032 | 3658 return 50; |
3659 } | |
3660 if (a2==24) | |
3661 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3662 if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. |
1032 | 3663 return 5; |
3664 } | |
3665 } | |
3666 return 0; | |
0 | 3667 } |
3668 | |
3669 //----- (0048EAAE) -------------------------------------------------------- | |
3670 int Player::GetItemsBonus(CHARACTER_ATTRIBUTE_TYPE attr, int a3) | |
3671 { | |
3672 CHARACTER_ATTRIBUTE_TYPE v3; // esi@1 | |
1040 | 3673 // signed int v4; // eax@1 |
0 | 3674 int v5; // edi@1 |
3675 Player *v6; // ebx@1 | |
3676 Player *v8; // ecx@48 | |
3677 int v9; // eax@49 | |
3678 int v10; // edx@49 | |
3679 Player *v11; // ecx@55 | |
3680 int v12; // eax@56 | |
3681 int v13; // edx@56 | |
3682 int v14; // ecx@58 | |
3683 int v15; // eax@58 | |
3684 Player *v16; // ecx@61 | |
3685 int v17; // eax@62 | |
3686 Player *v18; // ecx@66 | |
3687 int v19; // eax@67 | |
3688 int v20; // eax@69 | |
3689 Player *v21; // ecx@75 | |
3690 int v22; // eax@76 | |
3691 int v23; // edx@76 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
3692 //int v24; // eax@79 |
0 | 3693 int v25; // ecx@80 |
3694 int v26; // edi@80 | |
3695 Player *v27; // ecx@84 | |
3696 int v28; // eax@85 | |
3697 int v29; // edx@85 | |
3698 Player *v30; // ecx@96 | |
3699 int v31; // ebp@97 | |
3700 int v32; // eax@98 | |
3701 unsigned int v33; // eax@100 | |
3702 int v34; // eax@103 | |
3703 char v35; // zf@104 | |
3704 char v36; // zf@107 | |
3705 unsigned __int8 v37; // zf@119 | |
3706 char v38; // sf@119 | |
3707 unsigned __int8 v39; // of@119 | |
3708 char v40; // zf@122 | |
3709 char v41; // zf@145 | |
3710 char v42; // zf@164 | |
3711 char v43; // zf@173 | |
3712 char v44; // zf@189 | |
3713 char v45; // zf@198 | |
3714 char v46; // zf@239 | |
3715 int v47; // eax@268 | |
3716 int v48; // eax@269 | |
3717 int v49; // eax@291 | |
3718 char v50; // zf@295 | |
3719 int v51; // eax@306 | |
3720 int v52; // eax@307 | |
3721 char v53; // zf@312 | |
3722 char v54; // zf@336 | |
3723 char v55; // zf@348 | |
3724 int v56; // eax@365 | |
3725 int v57; // ebx@368 | |
3726 signed int v58; // [sp-4h] [bp-20h]@10 | |
3727 signed int v59; // [sp-4h] [bp-20h]@71 | |
3728 signed int v60; // [sp-4h] [bp-20h]@347 | |
3729 int v61; // [sp+10h] [bp-Ch]@1 | |
3730 int v62; // [sp+14h] [bp-8h]@1 | |
3731 int v63; // [sp+18h] [bp-4h]@101 | |
3732 ItemGen *attra; // [sp+20h] [bp+4h]@101 | |
3733 unsigned int v65; // [sp+24h] [bp+8h]@95 | |
1040 | 3734 bool no_skills; |
0 | 3735 |
3736 v3 = attr; | |
3737 v5 = 0; | |
3738 v6 = this; | |
3739 v62 = 0; | |
3740 v61 = 0; | |
3741 | |
1040 | 3742 |
3743 no_skills=false; | |
0 | 3744 switch (attr) |
3745 { | |
1040 | 3746 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break; |
3747 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break; | |
3748 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break; | |
3749 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break; | |
3750 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break; | |
3751 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break; | |
3752 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break; | |
3753 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break; | |
3754 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break; | |
3755 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break; | |
3756 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break; | |
3757 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break; | |
3758 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break; | |
3759 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break; | |
3760 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break; | |
3761 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break; | |
3762 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break; | |
3763 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break; | |
3764 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break; | |
3765 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break; | |
3766 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break; | |
3767 default: | |
3768 no_skills=true; | |
0 | 3769 } |
1040 | 3770 if (!no_skills) |
0 | 3771 { |
1040 | 3772 if ( !this->pActiveSkills[v58] ) |
3773 return 0; | |
0 | 3774 } |
1040 | 3775 |
0 | 3776 if ( (signed int)attr > 28 ) |
3777 { | |
3778 if ( (signed int)attr < 29 ) | |
3779 return v5 + v62 + v61; | |
1040 | 3780 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS ) |
0 | 3781 { |
3782 if ( HasItemEquipped(EQUIP_BOW) ) | |
1040 | 3783 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uBow-1].uItemID].uDamageMod; |
0 | 3784 return v5 + v62 + v61; |
3785 } | |
1040 | 3786 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) |
0 | 3787 { |
3788 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3789 return v5 + v62 + v61; | |
1040 | 3790 v57 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3791 v5 = pItemsTable->pItems[v57].uDamageMod; |
3792 v56 = pItemsTable->pItems[v57].uDamageDice; | |
1040 | 3793 v5 += v56; |
3794 return v5 + v62 + v61; | |
3795 } | |
3796 if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) | |
0 | 3797 { |
3798 if ( !HasItemEquipped(EQUIP_BOW) ) | |
3799 return v5 + v62 + v61; | |
1040 | 3800 v20 = v6->pOwnItems[v6->pEquipment.uBow-1].uItemID; |
0 | 3801 v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; |
3802 LABEL_365: | |
3803 v56 = pItemsTable->pItems[v20].uDamageMod; | |
3804 LABEL_366: | |
3805 v5 += v56; | |
3806 return v5 + v62 + v61; | |
3807 } | |
3808 if ( (signed int)attr <= 33 || (signed int)attr > 46 ) | |
3809 return v5 + v62 + v61; | |
3810 LABEL_95: | |
3811 v65 = 0; | |
3812 while ( 1 ) | |
3813 { | |
3814 if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) | |
3815 goto LABEL_361; | |
898 | 3816 v31 = *(&v6->pEquipment.uShield + v65) - 1; |
0 | 3817 if ( v3 == 9 ) |
3818 { | |
816 | 3819 v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); |
0 | 3820 if ( v32 >= 3 ) |
3821 { | |
3822 if ( v32 <= 11 ) | |
3823 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
3824 v33 = v6->pInventoryItemList[v31].uItemID; |
0 | 3825 v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; |
3826 } | |
3827 } | |
3828 } | |
3829 v63 = (int)((char *)v6 + 36 * v31); | |
3830 attra = (ItemGen *)(v63 + 532); | |
377 | 3831 if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(v63 + 532)) == 1 |
3832 && !pItemsTable->IsMaterialSpecial(attra) ) | |
0 | 3833 { |
3834 v34 = attra->uItemID; | |
3835 switch ( attra->uItemID ) | |
3836 { | |
3837 case 0x1F4u: | |
3838 v35 = v3 == 5; | |
3839 goto LABEL_105; | |
3840 case 0x1F5u: | |
3841 v36 = v3 == 0; | |
3842 goto LABEL_108; | |
3843 case 0x1F6u: | |
3844 if ( v3 == 21 ) | |
3845 v61 += 10; | |
3846 v36 = v3 == 2; | |
3847 goto LABEL_108; | |
3848 case 0x1F7u: | |
3849 if ( v3 == 17 ) | |
3850 v61 += 5; | |
3851 if ( v3 == 18 ) | |
3852 v61 += 5; | |
3853 v36 = v3 == 6; | |
3854 goto LABEL_108; | |
3855 case 0x1F8u: | |
3856 goto LABEL_118; | |
3857 case 0x1F9u: | |
3858 v40 = v3 == 3; | |
3859 goto LABEL_123; | |
3860 case 0x1FAu: | |
3861 v35 = v3 == 10; | |
3862 goto LABEL_105; | |
3863 case 0x1FEu: | |
3864 v35 = v3 == 4; | |
3865 goto LABEL_105; | |
3866 case 0x1FFu: | |
3867 if ( v3 == 23 ) | |
3868 v61 += 10; | |
3869 if ( v3 == 22 ) | |
3870 v61 += 10; | |
3871 goto LABEL_361; | |
3872 case 0x200u: | |
3873 if ( v3 == 36 ) | |
3874 { | |
3875 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
3876 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3877 } | |
3878 v36 = v3 == 5; | |
3879 LABEL_108: | |
3880 if ( v36 ) | |
3881 v5 += 40; | |
3882 goto LABEL_361; | |
3883 case 0x201u: | |
3884 if ( v3 == 39 ) | |
3885 { | |
3886 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3887 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3888 v62 = v34; | |
3889 } | |
3890 goto LABEL_136; | |
3891 case 0x202u: | |
3892 if ( !v3 ) | |
3893 v5 += 150; | |
3894 if ( v3 == 1 ) | |
3895 v5 -= 40; | |
3896 if ( v3 == 2 ) | |
3897 v5 -= 40; | |
3898 goto LABEL_145; | |
3899 case 0x203u: | |
3900 if ( v3 == 42 ) | |
3901 { | |
3902 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
3903 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3904 } | |
3905 if ( v3 == 43 ) | |
3906 v61 += 15; | |
3907 goto LABEL_361; | |
3908 case 0x204u: | |
3909 if ( v3 == 17 ) | |
3910 v61 += 5; | |
3911 if ( v3 == 18 ) | |
3912 v61 += 5; | |
3913 if ( v3 == 6 ) | |
3914 v5 += 50; | |
3915 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3916 goto LABEL_166; | |
3917 v42 = v3 == 15; | |
3918 goto LABEL_165; | |
3919 case 0x205u: | |
3920 if ( v3 == 18 ) | |
3921 v61 += 5; | |
3922 goto LABEL_361; | |
3923 case 0x206u: | |
3924 if ( !v3 ) | |
3925 v5 += 100; | |
3926 if ( v3 == 3 ) | |
3927 v5 += 100; | |
3928 v43 = v3 == 9; | |
3929 goto LABEL_174; | |
3930 case 0x207u: | |
3931 if ( v3 == 45 ) | |
3932 v61 += 5; | |
3933 if ( v3 == 15 ) | |
3934 v5 -= 10; | |
3935 v42 = v3 == 14; | |
3936 LABEL_165: | |
3937 if ( v42 ) | |
3938 LABEL_166: | |
3939 v5 -= 10; | |
3940 goto LABEL_361; | |
3941 case 0x208u: | |
3942 v35 = v3 == 3; | |
3943 goto LABEL_105; | |
3944 case 0x209u: | |
3945 if ( v3 == 2 ) | |
3946 v5 += 15; | |
3947 if ( !v3 ) | |
3948 v5 += 15; | |
3949 v41 = v3 == 6; | |
3950 goto LABEL_146; | |
3951 case 0x20Au: | |
3952 if ( v3 == 46 ) | |
3953 v61 += 15; | |
3954 v44 = v3 == 3; | |
3955 goto LABEL_190; | |
3956 case 0x20Bu: | |
3957 if ( v3 == 34 ) | |
3958 { | |
3959 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
3960 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
3961 } | |
3962 if ( v3 == 12 ) | |
3963 v5 += 50; | |
3964 if ( v3 == 2 ) | |
3965 v5 += 30; | |
3966 v45 = v3 == 9; | |
3967 goto LABEL_199; | |
3968 case 0x20Cu: | |
3969 if ( !v3 ) | |
3970 v5 += 75; | |
3971 goto LABEL_145; | |
3972 case 0x20Du: | |
3973 if ( v3 == 5 ) | |
3974 v5 += 50; | |
3975 if ( v3 == 6 ) | |
3976 v5 += 50; | |
3977 if ( v3 == 11 || v3 == 10 || v3 == 12 || v3 == 13 || v3 == 33 || v3 == 14 ) | |
3978 goto LABEL_374; | |
3979 v43 = v3 == 15; | |
3980 LABEL_174: | |
3981 if ( v43 ) | |
3982 LABEL_374: | |
3983 v5 -= 15; | |
3984 goto LABEL_361; | |
3985 case 0x20Eu: | |
3986 if ( v3 == 4 ) | |
3987 v5 += 150; | |
3988 if ( v3 == 44 ) | |
3989 v61 += 5; | |
3990 if ( v3 == 9 ) | |
3991 v5 -= 25; | |
3992 goto LABEL_361; | |
3993 case 0x20Fu: | |
3994 if ( v3 == 39 ) | |
3995 { | |
3996 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
3997 v34 = ((unsigned int)v34 >> 1) & 0x1F; | |
3998 v62 = v34; | |
3999 } | |
4000 if ( v3 == 40 ) | |
4001 { | |
4002 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4003 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4004 } | |
4005 LABEL_145: | |
4006 v41 = v3 == 5; | |
4007 LABEL_146: | |
4008 if ( v41 ) | |
4009 v5 -= 40; | |
4010 goto LABEL_361; | |
4011 case 0x210u: | |
4012 if ( v3 == 38 ) | |
4013 { | |
4014 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4015 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4016 } | |
4017 if ( !v3 ) | |
4018 v5 += 75; | |
4019 v44 = v3 == 11; | |
4020 LABEL_190: | |
4021 if ( v44 ) | |
4022 v5 -= 50; | |
4023 goto LABEL_361; | |
4024 case 0x211u: | |
4025 if ( v3 == 5 ) | |
4026 v5 += 100; | |
4027 if ( v3 == 4 ) | |
4028 v5 += 50; | |
4029 v35 = v3 == 11; | |
4030 LABEL_105: | |
4031 if ( v35 ) | |
4032 v5 += 50; | |
4033 goto LABEL_361; | |
4034 case 0x212u: | |
4035 if ( v3 == 1 ) | |
4036 v5 -= 20; | |
4037 v45 = v3 == 2; | |
4038 LABEL_199: | |
4039 if ( v45 ) | |
4040 v5 -= 20; | |
4041 goto LABEL_361; | |
4042 case 0x214u: | |
4043 if ( v3 == 1 ) | |
4044 v5 += 15; | |
4045 v46 = v3 == 2; | |
4046 goto LABEL_240; | |
4047 case 0x215u: | |
4048 if ( v3 == 5 ) | |
4049 v5 += 15; | |
4050 v46 = v3 == 4; | |
4051 goto LABEL_240; | |
4052 case 0x216u: | |
4053 if ( v3 == 10 ) | |
4054 v5 += 30; | |
4055 if ( !v3 ) | |
4056 v5 += 15; | |
4057 goto LABEL_315; | |
4058 case 0x217u: | |
4059 if ( v3 == 21 ) | |
4060 v61 += 5; | |
4061 if ( !v3 ) | |
4062 v5 += 15; | |
4063 goto LABEL_253; | |
4064 case 0x218u: | |
4065 goto LABEL_253; | |
4066 default: | |
4067 goto LABEL_361; | |
4068 } | |
4069 goto LABEL_361; | |
4070 } | |
4071 if ( *(int *)(v63 + 536) == v3 + 1 ) | |
4072 { | |
4073 if ( (signed int)v3 >= 0 ) | |
4074 { | |
4075 if ( (signed int)v3 <= 15 ) | |
4076 { | |
4077 v5 += *((int *)v6->pConditions + 9 * v31 + 135); | |
4078 } | |
4079 else | |
4080 { | |
4081 if ( (signed int)v3 <= 23 && v5 < *((int *)v6->pConditions + 9 * v31 + 135) ) | |
4082 v5 = *((int *)v6->pConditions + 9 * v31 + 135); | |
4083 } | |
4084 } | |
4085 goto LABEL_361; | |
4086 } | |
4087 v34 = *(int *)(v63 + 544); | |
4088 if ( v34 > 48 ) | |
4089 { | |
4090 switch ( v34 ) | |
4091 { | |
4092 case 54: | |
4093 goto LABEL_315; | |
4094 case 49: | |
4095 if ( v3 == 6 ) | |
4096 goto LABEL_121; | |
4097 v50 = v3 == 1; | |
4098 goto LABEL_296; | |
4099 case 51: | |
4100 if ( v3 != 5 && v3 != 1 ) | |
4101 goto LABEL_309; | |
4102 goto LABEL_121; | |
4103 case 52: | |
4104 if ( v3 == 3 ) | |
4105 goto LABEL_121; | |
4106 v50 = v3 == 4; | |
4107 goto LABEL_296; | |
4108 case 53: | |
4109 if ( !v3 ) | |
4110 goto LABEL_121; | |
4111 v50 = v3 == 2; | |
4112 goto LABEL_296; | |
4113 case 55: | |
4114 v46 = v3 == 6; | |
4115 goto LABEL_240; | |
4116 case 56: | |
4117 if ( !v3 ) | |
4118 goto LABEL_351; | |
4119 v53 = v3 == 3; | |
4120 goto LABEL_350; | |
4121 case 57: | |
4122 if ( v3 == 1 ) | |
4123 goto LABEL_351; | |
4124 v53 = v3 == 2; | |
4125 goto LABEL_350; | |
4126 case 50: | |
4127 if ( v3 == 10 ) | |
4128 v5 += 30; | |
4129 goto LABEL_361; | |
4130 case 60: | |
4131 if ( v3 != 23 ) | |
4132 goto LABEL_336; | |
4133 if ( v5 >= 3 ) | |
4134 goto LABEL_361; | |
4135 v5 = 3; | |
4136 LABEL_336: | |
4137 v54 = v3 == 22; | |
4138 goto LABEL_345; | |
4139 case 61: | |
4140 if ( v3 != 17 ) | |
4141 goto LABEL_340; | |
4142 if ( v5 >= 3 ) | |
4143 goto LABEL_361; | |
4144 v5 = 3; | |
4145 LABEL_340: | |
4146 v54 = v3 == 18; | |
4147 goto LABEL_345; | |
4148 case 62: | |
4149 if ( v3 != 19 ) | |
4150 goto LABEL_344; | |
4151 if ( v5 >= 3 ) | |
4152 goto LABEL_361; | |
4153 v5 = 3; | |
4154 LABEL_344: | |
4155 v54 = v3 == 20; | |
4156 LABEL_345: | |
4157 if ( !v54 ) | |
4158 goto LABEL_361; | |
4159 if ( v5 >= 3 ) | |
4160 goto LABEL_361; | |
4161 v60 = 3; | |
4162 goto LABEL_360; | |
4163 case 67: | |
4164 v55 = v3 == 18; | |
4165 goto LABEL_357; | |
4166 case 68: | |
4167 v53 = v3 == 9; | |
4168 goto LABEL_350; | |
4169 case 69: | |
4170 if ( v3 == 11 ) | |
4171 v5 += 20; | |
4172 break; | |
4173 case 70: | |
4174 if ( v3 == 12 ) | |
4175 v5 += 10; | |
4176 v55 = v3 == 16; | |
4177 LABEL_357: | |
4178 if ( v55 && v5 < 2 ) | |
4179 { | |
4180 v60 = 2; | |
4181 LABEL_360: | |
4182 v5 = v60; | |
4183 } | |
4184 break; | |
4185 default: | |
4186 goto LABEL_361; | |
4187 } | |
4188 goto LABEL_361; | |
4189 } | |
4190 if ( v34 == 48 ) | |
4191 { | |
4192 if ( v3 == 9 ) | |
4193 v5 += 5; | |
4194 LABEL_315: | |
4195 v46 = v3 == 3; | |
4196 LABEL_240: | |
4197 if ( v46 ) | |
4198 v5 += 15; | |
4199 goto LABEL_361; | |
4200 } | |
4201 if ( v34 > 32 ) | |
4202 { | |
4203 if ( v34 > 44 ) | |
4204 { | |
4205 v51 = v34 - 45; | |
4206 if ( !v51 ) | |
4207 { | |
4208 if ( v3 == 5 ) | |
4209 goto LABEL_351; | |
4210 v53 = v3 == 4; | |
4211 LABEL_350: | |
4212 if ( v53 ) | |
4213 LABEL_351: | |
4214 v5 += 5; | |
4215 goto LABEL_361; | |
4216 } | |
4217 v52 = v51 - 1; | |
4218 if ( !v52 ) | |
4219 { | |
4220 v40 = v3 == 0; | |
4221 LABEL_123: | |
4222 if ( v40 ) | |
4223 v5 += 25; | |
4224 goto LABEL_361; | |
4225 } | |
4226 if ( v52 == 1 ) | |
4227 { | |
4228 LABEL_309: | |
4229 v50 = v3 == 8; | |
4230 goto LABEL_296; | |
4231 } | |
4232 } | |
4233 else | |
4234 { | |
4235 if ( v34 == 44 ) | |
4236 { | |
4237 v50 = v3 == 7; | |
4238 goto LABEL_296; | |
4239 } | |
4240 v34 -= 33; | |
4241 if ( !v34 ) | |
4242 { | |
4243 if ( v3 != 38 ) | |
4244 goto LABEL_361; | |
4245 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[16]); | |
4246 goto LABEL_138; | |
4247 } | |
4248 --v34; | |
4249 if ( !v34 ) | |
4250 { | |
4251 if ( v3 != 36 ) | |
4252 goto LABEL_361; | |
4253 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[14]); | |
4254 goto LABEL_138; | |
4255 } | |
4256 v49 = v34 - 8; | |
4257 if ( !v49 ) | |
4258 { | |
4259 if ( (signed int)v3 >= 0 && (signed int)v3 <= 15 ) | |
4260 ++v5; | |
4261 goto LABEL_361; | |
4262 } | |
4263 if ( v49 == 1 ) | |
4264 { | |
4265 if ( v3 != 3 && v3 != 7 ) | |
4266 { | |
4267 v50 = v3 == 9; | |
4268 LABEL_296: | |
4269 if ( !v50 ) | |
4270 goto LABEL_361; | |
4271 } | |
4272 LABEL_121: | |
4273 v5 += 10; | |
4274 goto LABEL_361; | |
4275 } | |
4276 } | |
4277 } | |
4278 else | |
4279 { | |
4280 if ( v34 == 32 ) | |
4281 { | |
4282 if ( v3 != 39 ) | |
4283 goto LABEL_361; | |
4284 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[17]); | |
4285 goto LABEL_138; | |
4286 } | |
4287 if ( v34 > 28 ) | |
4288 { | |
4289 v34 -= 29; | |
4290 if ( v34 ) | |
4291 { | |
4292 --v34; | |
4293 if ( v34 ) | |
4294 { | |
4295 --v34; | |
4296 if ( v34 || v3 != 41 ) | |
4297 goto LABEL_361; | |
4298 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[19]); | |
4299 } | |
4300 else | |
4301 { | |
4302 if ( v3 != 34 ) | |
4303 goto LABEL_361; | |
4304 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[12]); | |
4305 } | |
4306 } | |
4307 else | |
4308 { | |
4309 if ( v3 != 37 ) | |
4310 goto LABEL_361; | |
4311 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[15]); | |
4312 } | |
4313 goto LABEL_138; | |
4314 } | |
4315 if ( v34 == 28 ) | |
4316 { | |
4317 LABEL_136: | |
4318 if ( v3 == 42 ) | |
4319 { | |
4320 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[20]); | |
4321 LABEL_138: | |
4322 v62 = ((unsigned int)v34 >> 1) & 0x1F; | |
4323 goto LABEL_361; | |
4324 } | |
4325 } | |
4326 else | |
4327 { | |
4328 v47 = v34 - 1; | |
4329 if ( v47 ) | |
4330 { | |
4331 v48 = v47 - 1; | |
4332 if ( v48 ) | |
4333 { | |
4334 v34 = v48 - 24; | |
4335 if ( v34 ) | |
4336 { | |
4337 --v34; | |
4338 if ( v34 || v3 != 40 ) | |
4339 goto LABEL_361; | |
4340 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[18]); | |
4341 } | |
4342 else | |
4343 { | |
4344 if ( v3 != 35 ) | |
4345 goto LABEL_361; | |
4346 LOBYTE(v34) = LOBYTE(v6->pActiveSkills[13]); | |
4347 } | |
4348 goto LABEL_138; | |
4349 } | |
4350 LABEL_118: | |
4351 if ( (signed int)v3 < 0 ) | |
4352 goto LABEL_361; | |
4353 v39 = __OFSUB__((int)v3, 6); | |
4354 v37 = v3 == 6; | |
4355 v38 = v3 - 6 < 0; | |
4356 } | |
4357 else | |
4358 { | |
4359 LABEL_253: | |
4360 if ( (signed int)v3 < 10 ) | |
4361 goto LABEL_361; | |
4362 v39 = __OFSUB__((int)v3, 15); | |
4363 v37 = v3 == 15; | |
4364 v38 = v3 - 15 < 0; | |
4365 } | |
4366 if ( (unsigned __int8)(v38 ^ v39) | v37 ) | |
4367 goto LABEL_121; | |
4368 } | |
4369 } | |
4370 LABEL_361: | |
4371 ++v65; | |
4372 if ( (signed int)v65 >= 16 ) | |
4373 return v5 + v62 + v61; | |
4374 } | |
4375 } | |
1040 | 4376 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
0 | 4377 { |
4378 if ( IsUnarmed() != 1 ) | |
4379 { | |
816 | 4380 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4381 { | |
4382 v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4383 if ( v22 >= 0 ) |
4384 { | |
4385 if ( v22 <= 2 ) | |
4386 { | |
1040 | 4387 v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; |
898 | 4388 if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) |
0 | 4389 { |
4390 v26 = pItemsTable->pItems[v23].uDamageRoll; | |
4391 v25 = pItemsTable->pItems[v23].uDamageDice; | |
4392 } | |
4393 else | |
4394 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4395 v25 = pItemsTable->pItems[v23].uDamageRoll; |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4396 v26 = pItemsTable->pItems[v23].uDamageDice + 1; |
0 | 4397 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
4398 v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; |
0 | 4399 } |
4400 } | |
4401 } | |
1040 | 4402 |
4403 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) ) | |
4404 { | |
4405 | |
4406 v28 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4407 if ((v28 < 0) || v28 > 2 ) | |
4408 return v5 + v62 + v61; | |
4409 } | |
1062 | 4410 v15 = pItemsTable->pItems[v23].uDamageMod; |
4411 v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; | |
1040 | 4412 v5 += v15 + v14; |
1049 | 4413 return v5 + v62 + v61; |
0 | 4414 } |
4415 v59 = 3; | |
4416 LABEL_74: | |
4417 v5 = v59; | |
4418 return v5 + v62 + v61; | |
4419 } | |
4420 if ( (signed int)attr < 0 ) | |
4421 return v5 + v62 + v61; | |
1040 | 4422 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) |
0 | 4423 goto LABEL_95; |
1040 | 4424 if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) |
4425 { | |
4426 if ( !Player::HasEnchantedItemEquipped(25) ) | |
4427 return v5 + v62 + v61; | |
4428 v5 = 5; | |
4429 return v5 + v62 + v61; | |
4430 } | |
4431 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) | |
0 | 4432 return v5 + v62 + v61; |
1040 | 4433 if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
0 | 4434 { |
4435 if ( IsUnarmed() == 1 ) | |
4436 { | |
4437 v5 = 0; | |
4438 return v5 + v62 + v61; | |
4439 } | |
816 | 4440 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4441 { | |
4442 v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4443 if ( v17 >= 0 ) |
4444 { | |
4445 if ( v17 <= 2 ) | |
1040 | 4446 v5 = pItemsTable->pItems[v6->pOwnItems[v6->pEquipment.uMainHand-1].uItemID].uDamageMod; |
0 | 4447 } |
4448 } | |
865 | 4449 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) |
0 | 4450 return v5 + v62 + v61; |
1040 | 4451 v20 = v6->pOwnItems[v6->pEquipment.uShield - 1].uItemID; |
4452 v56 = pItemsTable->pItems[v20].uDamageMod; | |
4453 v5 += v56; | |
4454 return v5 + v62 + v61; | |
4455 } | |
4456 if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) | |
0 | 4457 { |
4458 if ( IsUnarmed() == 1 ) | |
4459 { | |
4460 v5 = 1; | |
4461 return v5 + v62 + v61; | |
4462 } | |
816 | 4463 if ( v6->HasItemEquipped(EQUIP_MAIN_HAND) ) |
4464 { | |
4465 v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); | |
0 | 4466 if ( v9 >= 0 ) |
4467 { | |
4468 if ( v9 <= 2 ) | |
4469 { | |
1040 | 4470 v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + |
4471 pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; | |
898 | 4472 if ( !v6->pEquipment.uShield ) |
0 | 4473 { |
1040 | 4474 if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) |
0 | 4475 ++v5; |
4476 } | |
4477 } | |
4478 } | |
4479 } | |
1040 | 4480 |
4481 if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND)) | |
4482 { | |
4483 v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND); | |
4484 if ((v12 < 0) || v12 > 2 ) | |
4485 return v5 + v62 + v61; | |
4486 } | |
4487 v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; | |
4488 v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; | |
0 | 4489 LABEL_88: |
4490 v5 += v15 + v14; | |
4491 } | |
4492 return v5 + v62 + v61; | |
4493 } | |
4494 | |
4495 //----- (0048F73C) -------------------------------------------------------- | |
4496 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4497 { | |
4498 int result; // eax@1 | |
4499 int v3; // eax@4 | |
4500 int v4; // ecx@5 | |
4501 | |
4502 switch (a2) | |
4503 { | |
4504 case CHARACTER_ATTRIBUTE_LEVEL: return 0; | |
4505 } | |
4506 | |
4507 result = 0; | |
4508 if ( (signed int)a2 > 10 ) | |
4509 { | |
4510 if ( (signed int)a2 <= 15 ) | |
4511 { | |
4512 switch ( a2 ) | |
4513 { | |
4514 case CHARACTER_ATTRIBUTE_RESIST_BODY: | |
4515 v3 = this->pPlayerBuffs[2].uPower; | |
1167 | 4516 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower; |
0 | 4517 break; |
4518 case CHARACTER_ATTRIBUTE_RESIST_AIR: | |
4519 v3 = this->pPlayerBuffs[0].uPower; | |
1167 | 4520 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower; |
0 | 4521 break; |
4522 case CHARACTER_ATTRIBUTE_RESIST_WATER: | |
4523 v3 = this->pPlayerBuffs[22].uPower; | |
1167 | 4524 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower; |
0 | 4525 break; |
4526 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | |
4527 v3 = this->pPlayerBuffs[3].uPower; | |
1167 | 4528 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower; |
0 | 4529 break; |
4530 default: | |
4531 if ( a2 != 14 ) | |
4532 return result; | |
4533 v3 = this->pPlayerBuffs[9].uPower; | |
1167 | 4534 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower; |
0 | 4535 break; |
4536 } | |
4537 return v4 + v3; | |
4538 } | |
4539 if ( a2 != CHARACTER_ATTRIBUTE_ATTACK ) | |
4540 { | |
4541 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) | |
4542 { | |
4543 v3 = this->pPlayerBuffs[8].uPower; | |
1167 | 4544 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower; |
0 | 4545 return v4 + v3; |
4546 } | |
4547 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
4548 return result; | |
4549 } | |
4550 return this->pPlayerBuffs[1].uPower; | |
4551 } | |
4552 if ( a2 == 10 ) | |
4553 { | |
4554 v3 = this->pPlayerBuffs[5].uPower; | |
1167 | 4555 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower; |
0 | 4556 return v4 + v3; |
4557 } | |
4558 switch ( a2 ) | |
4559 { | |
4560 case CHARACTER_ATTRIBUTE_STRENGTH: | |
4561 v3 = pPlayerBuffs[19].uPower; | |
4562 goto LABEL_5; | |
4563 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
4564 v3 = pPlayerBuffs[17].uPower; | |
4565 goto LABEL_5; | |
4566 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
4567 v3 = pPlayerBuffs[20].uPower; | |
4568 goto LABEL_5; | |
4569 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
4570 v3 = pPlayerBuffs[16].uPower; | |
4571 goto LABEL_5; | |
4572 case CHARACTER_ATTRIBUTE_ACCURACY: | |
4573 v3 = pPlayerBuffs[15].uPower; | |
4574 goto LABEL_5; | |
4575 case CHARACTER_ATTRIBUTE_SPEED: | |
4576 v3 = pPlayerBuffs[21].uPower; | |
4577 goto LABEL_5; | |
4578 case CHARACTER_ATTRIBUTE_LUCK: | |
4579 v3 = pPlayerBuffs[18].uPower; | |
4580 LABEL_5: | |
1167 | 4581 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower; |
0 | 4582 return v4 + v3; |
4583 case CHARACTER_ATTRIBUTE_AC_BONUS: | |
4584 v3 = this->pPlayerBuffs[14].uPower; | |
1167 | 4585 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower; |
0 | 4586 return v4 + v3; |
4587 default: | |
4588 return result; | |
4589 } | |
4590 return result; | |
4591 } | |
4592 | |
4593 //----- (0048F882) -------------------------------------------------------- | |
1008 | 4594 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) |
4595 { | |
1064 | 4596 signed int bonus_value; // esi@1 |
4597 unsigned __int16 skill_value; // ax@126 | |
4598 int result; // al@127 | |
353 | 4599 |
1064 | 4600 bonus_value = 0; |
353 | 4601 switch (uSkillType) |
4602 { | |
4603 case PLAYER_SKILL_MONSTER_ID: | |
4604 { | |
652 | 4605 if ( CheckHiredNPCSpeciality(Hunter) ) |
1064 | 4606 bonus_value = 6; |
652 | 4607 if ( CheckHiredNPCSpeciality(Sage) ) |
1064 | 4608 bonus_value += 6; |
4609 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 0); | |
353 | 4610 } |
4611 break; | |
4612 | |
4613 case PLAYER_SKILL_ARMSMASTER: | |
4614 { | |
652 | 4615 if ( CheckHiredNPCSpeciality(Armsmaster) ) |
1064 | 4616 bonus_value = 2; |
652 | 4617 if ( CheckHiredNPCSpeciality(Weaponsmaster) ) |
1064 | 4618 bonus_value += 3; |
4619 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 0); | |
353 | 4620 } |
4621 break; | |
4622 | |
4623 case PLAYER_SKILL_STEALING: | |
4624 { | |
652 | 4625 if (CheckHiredNPCSpeciality(Burglar)) |
1064 | 4626 bonus_value = 8; |
4627 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING, 0); | |
353 | 4628 } |
4629 break; | |
4630 | |
4631 | |
4632 case PLAYER_SKILL_ALCHEMY: | |
4633 { | |
652 | 4634 if ( CheckHiredNPCSpeciality(Herbalist) ) |
1064 | 4635 bonus_value = 4; |
652 | 4636 if ( CheckHiredNPCSpeciality(Apothecary) ) |
1064 | 4637 bonus_value += 8; |
4638 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 0); | |
353 | 4639 } |
4640 break; | |
4641 | |
4642 case PLAYER_SKILL_LEARNING: | |
4643 { | |
652 | 4644 if ( CheckHiredNPCSpeciality(Teacher) ) |
1064 | 4645 bonus_value = 10; |
652 | 4646 if ( CheckHiredNPCSpeciality(Instructor) ) |
1064 | 4647 bonus_value += 15; |
652 | 4648 if ( CheckHiredNPCSpeciality(Scholar) ) |
1064 | 4649 bonus_value += 5; |
4650 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING, 0); | |
353 | 4651 } |
4652 break; | |
4653 | |
4654 case PLAYER_SKILL_UNARMED: | |
4655 { | |
652 | 4656 if (CheckHiredNPCSpeciality(Monk) ) |
1064 | 4657 bonus_value = 2; |
4658 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 0); | |
353 | 4659 } |
4660 break; | |
4661 | |
4662 case PLAYER_SKILL_DODGE: | |
4663 { | |
652 | 4664 if ( CheckHiredNPCSpeciality(Monk) ) |
1064 | 4665 bonus_value = 2; |
4666 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE, 0); | |
353 | 4667 } |
4668 break; | |
4669 | |
4670 case PLAYER_SKILL_BOW: | |
1064 | 4671 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW, 0); |
353 | 4672 break; |
4673 case PLAYER_SKILL_SHIELD: | |
1064 | 4674 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 0); |
353 | 4675 break; |
4676 | |
4677 case PLAYER_SKILL_EARTH: | |
652 | 4678 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4679 bonus_value = 2; |
652 | 4680 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4681 bonus_value += 3; |
652 | 4682 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4683 bonus_value += 4; |
353 | 4684 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4685 bonus_value += 3; |
4686 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH, 0); | |
353 | 4687 break; |
4688 case PLAYER_SKILL_FIRE: | |
652 | 4689 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4690 bonus_value = 2; |
652 | 4691 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4692 bonus_value += 3; |
652 | 4693 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4694 bonus_value += 4; |
353 | 4695 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4696 bonus_value += 3; |
4697 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0); | |
353 | 4698 break; |
4699 case PLAYER_SKILL_AIR: | |
652 | 4700 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4701 bonus_value = 2; |
652 | 4702 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4703 bonus_value += 3; |
652 | 4704 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4705 bonus_value += 4; |
353 | 4706 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4707 bonus_value += 3; |
4708 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR, 0); | |
353 | 4709 break; |
4710 case PLAYER_SKILL_WATER: | |
652 | 4711 if ( CheckHiredNPCSpeciality(Apprentice) ) |
1064 | 4712 bonus_value = 2; |
652 | 4713 if ( CheckHiredNPCSpeciality(Mystic) ) |
1064 | 4714 bonus_value += 3; |
652 | 4715 if ( CheckHiredNPCSpeciality(Spellmaster) ) |
1064 | 4716 bonus_value += 4; |
353 | 4717 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() ) |
1064 | 4718 bonus_value += 3; |
4719 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER, 0); | |
353 | 4720 break; |
4721 case PLAYER_SKILL_SPIRIT: | |
652 | 4722 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4723 bonus_value = 2; |
652 | 4724 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4725 bonus_value += 3; |
652 | 4726 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4727 bonus_value += 4; |
4728 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0); | |
353 | 4729 break; |
4730 case PLAYER_SKILL_MIND: | |
652 | 4731 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4732 bonus_value = 2; |
652 | 4733 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4734 bonus_value += 3; |
652 | 4735 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4736 bonus_value += 4; |
4737 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND, 0); | |
353 | 4738 break; |
4739 case PLAYER_SKILL_BODY: | |
652 | 4740 if ( CheckHiredNPCSpeciality(Acolyte2) ) |
1064 | 4741 bonus_value = 2; |
652 | 4742 if ( CheckHiredNPCSpeciality(Initiate) ) |
1064 | 4743 bonus_value += 3; |
652 | 4744 if ( CheckHiredNPCSpeciality(Prelate) ) |
1064 | 4745 bonus_value += 4; |
4746 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY, 0); | |
353 | 4747 break; |
4748 case PLAYER_SKILL_LIGHT: | |
1064 | 4749 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0); |
353 | 4750 break; |
4751 case PLAYER_SKILL_DARK: | |
4752 { | |
1064 | 4753 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK, 0); |
353 | 4754 } |
4755 break; | |
4756 | |
4757 case PLAYER_SKILL_MERCHANT: | |
4758 { | |
652 | 4759 if ( CheckHiredNPCSpeciality(Trader) ) |
1064 | 4760 bonus_value = 4; |
652 | 4761 if ( CheckHiredNPCSpeciality(Merchant) ) |
1064 | 4762 bonus_value += 6; |
652 | 4763 if ( CheckHiredNPCSpeciality(Gypsy) ) |
1064 | 4764 bonus_value += 3; |
652 | 4765 if ( CheckHiredNPCSpeciality(Duper) ) |
1064 | 4766 bonus_value += 8; |
353 | 4767 } |
4768 break; | |
4769 | |
4770 case PLAYER_SKILL_PERCEPTION: | |
4771 { | |
652 | 4772 if ( CheckHiredNPCSpeciality(Scout) ) |
1064 | 4773 bonus_value = 6; |
652 | 4774 if ( CheckHiredNPCSpeciality(Psychic) ) |
1064 | 4775 bonus_value += 5; |
353 | 4776 } |
4777 break; | |
4778 | |
0 | 4779 case PLAYER_SKILL_ITEM_ID: |
1064 | 4780 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 0); |
0 | 4781 break; |
4782 case PLAYER_SKILL_MEDITATION: | |
1064 | 4783 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 0); |
353 | 4784 break; |
0 | 4785 case PLAYER_SKILL_TRAP_DISARM: |
353 | 4786 { |
652 | 4787 if ( CheckHiredNPCSpeciality(Tinker) ) |
1064 | 4788 bonus_value = 4; |
652 | 4789 if ( CheckHiredNPCSpeciality(Locksmith) ) |
1064 | 4790 bonus_value += 6; |
652 | 4791 if ( CheckHiredNPCSpeciality(Burglar) ) |
1064 | 4792 bonus_value += 8; |
4793 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 0); | |
353 | 4794 } |
4795 break; | |
4796 } | |
4797 | |
1064 | 4798 skill_value = pActiveSkills[uSkillType]; |
4799 if ( bonus_value + (skill_value & 0x3F) < 60 ) | |
4800 result = bonus_value + skill_value; | |
0 | 4801 else |
1064 | 4802 result = skill_value & 0xFFFC | 0x3C; //al |
0 | 4803 return result; |
4804 } | |
4805 | |
4806 //----- (0048FC00) -------------------------------------------------------- | |
4807 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) | |
4808 { | |
1064 | 4809 |
4810 | |
4811 | |
0 | 4812 Player *v2; // esi@1 |
1064 | 4813 int armmaster_skill; // eax@1 |
0 | 4814 char v4; // di@1 |
4815 signed int v5; // ebx@1 | |
1064 | 4816 unsigned int armaster_mastery; // eax@2 |
0 | 4817 unsigned __int8 v7; // sf@5 |
4818 unsigned __int8 v8; // of@5 | |
4819 PlayerEquipment *v9; // ebx@19 | |
4820 Player *v10; // ecx@20 | |
821 | 4821 PLAYER_SKILL_TYPE v11; // edi@21 |
0 | 4822 int v12; // eax@21 |
4823 int v13; // edi@21 | |
4824 char v14; // di@25 | |
4825 signed int v15; // esi@25 | |
4826 char v16; // al@32 | |
4827 int v18; // eax@36 | |
4828 unsigned int v19; // eax@37 | |
4829 ITEM_EQUIP_TYPE v20; // edi@40 | |
4830 int v21; // edx@41 | |
4831 int v22; // eax@42 | |
821 | 4832 PLAYER_SKILL_TYPE v23; // edi@45 |
0 | 4833 unsigned __int16 v24; // ax@45 |
4834 unsigned __int16 v25; // bx@45 | |
4835 unsigned int v26; // eax@45 | |
4836 unsigned __int8 v27; // sf@50 | |
4837 unsigned __int8 v28; // of@50 | |
4838 unsigned int v29; // eax@52 | |
4839 int v30; // eax@55 | |
4840 int v31; // eax@58 | |
4841 unsigned int v32; // eax@59 | |
4842 int v33; // eax@65 | |
4843 char v34; // si@65 | |
4844 ITEM_EQUIP_TYPE v35; // edi@69 | |
4845 int v36; // edx@70 | |
4846 int v37; // eax@71 | |
821 | 4847 PLAYER_SKILL_TYPE v38; // edi@74 |
0 | 4848 int v39; // eax@74 |
4849 int v40; // eax@89 | |
4850 char v41; // si@89 | |
4851 int v42; // eax@96 | |
821 | 4852 PLAYER_SKILL_TYPE v43; // edx@97 |
0 | 4853 int v44; // eax@97 |
4854 int v45; // eax@98 | |
4855 int v46; // eax@99 | |
4856 int v47; // eax@100 | |
4857 int v48; // eax@101 | |
4858 int v49; // eax@102 | |
4859 unsigned __int16 v50; // ax@113 | |
4860 char v51; // di@113 | |
4861 unsigned int v52; // eax@113 | |
4862 int v53; // edi@113 | |
4863 signed int i; // ecx@113 | |
4864 unsigned __int16 v55; // ax@118 | |
4865 char v56; // si@118 | |
4866 unsigned int v57; // eax@118 | |
4867 int v58; // esi@121 | |
4868 signed int j; // ecx@121 | |
1064 | 4869 int base_value; // edi@126 |
4870 int attrib_modif; // eax@126 | |
0 | 4871 signed int v62; // [sp-4h] [bp-30h]@26 |
4872 signed int v63; // [sp-4h] [bp-30h]@80 | |
4873 int v64; // [sp+Ch] [bp-20h]@104 | |
4874 int v65; // [sp+10h] [bp-1Ch]@104 | |
4875 int v66; // [sp+14h] [bp-18h]@104 | |
4876 int v67; // [sp+18h] [bp-14h]@104 | |
4877 int v68; // [sp+1Ch] [bp-10h]@69 | |
4878 PlayerEquipment *v69; // [sp+20h] [bp-Ch]@1 | |
1080 | 4879 int skill_bonus; // [sp+24h] [bp-8h]@1 |
0 | 4880 ITEM_EQUIP_TYPE v71; // [sp+28h] [bp-4h]@1 |
4881 int a1; // [sp+34h] [bp+8h]@21 | |
4882 int a1a; // [sp+34h] [bp+8h]@74 | |
4883 signed int a1b; // [sp+34h] [bp+8h]@94 | |
1064 | 4884 int multiplier; |
4885 int arm_bonus; | |
4886 int lvl_avl[4]; | |
0 | 4887 |
4888 v2 = this; | |
1080 | 4889 skill_bonus = 0; |
0 | 4890 v69 = 0; |
1064 | 4891 multiplier =0; |
4892 arm_bonus =0; | |
0 | 4893 v71 = (ITEM_EQUIP_TYPE)0; |
1064 | 4894 armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER); |
4895 v4 = armmaster_skill; | |
0 | 4896 v5 = 1; |
1064 | 4897 if ( armmaster_skill ) |
4898 { | |
4899 armaster_mastery = SkillToMastery(armmaster_skill); | |
0 | 4900 if ( a2 == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) |
4901 { | |
1064 | 4902 if ( armaster_mastery == 4 ) |
4903 multiplier =2; | |
4904 else if ( armaster_mastery == 3 ) | |
4905 multiplier =1; | |
4906 } | |
4907 else if ( a2 == CHARACTER_ATTRIBUTE_ATTACK ) | |
4908 { | |
4909 if ( armaster_mastery == 4 ) | |
4910 multiplier =2; | |
4911 else if ( armaster_mastery >= 2 ) | |
4912 multiplier =1; | |
4913 } | |
4914 arm_bonus=(armmaster_skill&0x3F)*multiplier; | |
4915 } | |
4916 | |
4917 | |
0 | 4918 if ( a2 == CHARACTER_ATTRIBUTE_HEALTH ) |
4919 { | |
1064 | 4920 base_value = pBaseHealthPerLevelByClass[classType]; |
4921 attrib_modif = GetBodybuilding(); | |
4922 return base_value * attrib_modif; | |
0 | 4923 } |
4924 if ( a2 == CHARACTER_ATTRIBUTE_MANA ) | |
4925 { | |
1064 | 4926 base_value = pBaseManaPerLevelByClass[classType]; |
4927 attrib_modif = GetMeditation(); | |
4928 return base_value * attrib_modif; | |
4929 } | |
4930 if ( a2 == CHARACTER_ATTRIBUTE_AC_BONUS ) | |
4931 { | |
4932 a1b = 0; | |
4933 v71 = (ITEM_EQUIP_TYPE)0; | |
4934 | |
4935 for (j=0; j<16; ++j) | |
4936 { | |
4937 if (pEquipment.pIndices[j]&&(!pOwnItems[ pEquipment.pIndices[j]].Broken())) | |
4938 { | |
4939 int curr_item =pOwnItems[pEquipment.pIndices[j]].uItemID; | |
4940 v44=pItemsTable->pItems[curr_item].uSkillType; | |
4941 switch (v44) | |
4942 { | |
4943 | |
4944 case PLAYER_SKILL_STAFF: | |
4945 | |
4946 lvl_avl[0]=0; | |
4947 lvl_avl[1]=1; | |
4948 lvl_avl[2]=0; | |
4949 lvl_avl[3]=0; | |
4950 break; | |
4951 case PLAYER_SKILL_SWORD: | |
4952 case PLAYER_SKILL_SPEAR: | |
4953 lvl_avl[0]=0; | |
4954 lvl_avl[1]=0; | |
4955 lvl_avl[2]=0; | |
4956 lvl_avl[3]=1; | |
4957 break; | |
4958 case PLAYER_SKILL_SHIELD: | |
4959 a1b = 1; | |
4960 lvl_avl[0]=1; | |
4961 lvl_avl[1]=0; | |
4962 lvl_avl[2]=1; | |
4963 lvl_avl[3]=0; | |
4964 break; | |
4965 case PLAYER_SKILL_LEATHER: | |
4966 v71 = (ITEM_EQUIP_TYPE)1; | |
4967 lvl_avl[0]=1; | |
4968 lvl_avl[1]=0; | |
4969 lvl_avl[2]=1; | |
4970 lvl_avl[3]=0; | |
4971 | |
4972 break; | |
4973 case PLAYER_SKILL_CHAIN: | |
4974 a1b = 1; | |
4975 lvl_avl[0]=1; | |
4976 lvl_avl[1]=0; | |
4977 lvl_avl[2]=0; | |
4978 lvl_avl[3]=0; | |
4979 break; | |
4980 case PLAYER_SKILL_PLATE: | |
4981 a1b = 1; | |
4982 lvl_avl[0]=1; | |
4983 lvl_avl[1]=0; | |
4984 lvl_avl[2]=0; | |
4985 lvl_avl[3]=0; | |
4986 break; | |
4987 default: | |
4988 continue; | |
4989 } | |
4990 | |
4991 v50= GetActualSkillLevel((PLAYER_SKILL_TYPE)v44); | |
4992 v51 = v50; | |
4993 v52 = SkillToMastery(v50); | |
4994 v53 = v51 & 0x3F; | |
4995 for ( i = 0; i < (signed int)v52; ++i ) | |
4996 { | |
4997 if ( lvl_avl[i] ) | |
1080 | 4998 skill_bonus += v53; |
1064 | 4999 } |
5000 | |
5001 } | |
5002 } | |
5003 | |
5004 lvl_avl[0]=1; | |
5005 lvl_avl[1]=1; | |
5006 lvl_avl[2]=1; | |
5007 lvl_avl[3]=0; | |
5008 | |
5009 v55 = GetActualSkillLevel(PLAYER_SKILL_DODGE); | |
5010 v56 = v55; | |
5011 v57 = SkillToMastery(v55); | |
5012 if ( !a1b && (!v71 || v57 == 4) ) | |
5013 { | |
5014 v58 = v56 & 0x3F; | |
5015 for ( j = 0; j < (signed int)v57; ++j ) | |
5016 { | |
1069 | 5017 if ( lvl_avl[j] ) |
1080 | 5018 skill_bonus += v58; |
1064 | 5019 } |
5020 } | |
1080 | 5021 return skill_bonus; |
1064 | 5022 |
5023 | |
5024 } | |
5025 | |
1080 | 5026 if (a2 == CHARACTER_ATTRIBUTE_ATTACK) |
5027 { | |
5028 | |
5029 if ( v2->IsUnarmed() == 1 ) | |
5030 { | |
5031 v33 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5032 v34 = v33; | |
5033 if ( !v33 ) | |
5034 return skill_bonus; | |
5035 if ( SkillToMastery(v33) >= 3 ) | |
5036 multiplier = 2; | |
5037 else | |
5038 multiplier=1; | |
5039 v30 = multiplier * (v34 & 0x3F); | |
5040 return arm_bonus + v30; | |
5041 } | |
5042 v35 = (ITEM_EQUIP_TYPE)0; | |
5043 v68 = 0; | |
5044 for (i=0; i<16 ; ++i) | |
5045 { | |
5046 if ( v2->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) | |
5047 { | |
5048 v37 = v2->pEquipment.pIndices[i]-1; | |
5049 if ( pItemsTable->pItems[v37].uEquipType <= EQUIP_MAIN_HAND) | |
5050 break; | |
5051 } | |
5052 } | |
5053 if ( i >= 16 ) | |
5054 return skill_bonus; | |
5055 | |
5056 v38 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v37].uSkillType; | |
5057 a1a = v2->GetActualSkillLevel(v38); | |
5058 v39= SkillToMastery(a1a); | |
5059 v71 = (ITEM_EQUIP_TYPE)0; | |
5060 switch (v38) | |
5061 { | |
5062 case PLAYER_SKILL_STAFF: | |
5063 v71 = (ITEM_EQUIP_TYPE)1; | |
5064 if ( v39 == 4 ) | |
5065 { | |
5066 v40 = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5067 v41 = v40; | |
5068 | |
5069 if ( v40 ) | |
5070 { | |
5071 if ( SkillToMastery(v40) >= 3 ) | |
5072 multiplier = 2; | |
5073 else | |
5074 multiplier=1; | |
5075 v68 = multiplier * (v41 & 0x3F); | |
5076 } | |
5077 } | |
5078 break; | |
5079 case PLAYER_SKILL_SWORD: | |
5080 case PLAYER_SKILL_DAGGER: | |
5081 case PLAYER_SKILL_AXE: | |
5082 case PLAYER_SKILL_SPEAR: | |
5083 case PLAYER_SKILL_MACE: | |
5084 v71 = (ITEM_EQUIP_TYPE)1; | |
5085 break; | |
5086 case PLAYER_SKILL_BLASTER: | |
5087 | |
5088 switch (v39) | |
5089 { | |
5090 case 0: multiplier=1; break; | |
5091 case 1: multiplier=3; break; | |
5092 case 3: multiplier=3; break; | |
5093 case 4: multiplier=5; break; | |
5094 } | |
5095 v5 = multiplier; | |
5096 return v5 * (a1a & 0x3F); | |
5097 break; | |
5098 } | |
5099 | |
5100 | |
5101 | |
5102 v30 = v68 + v71 * (a1a & 0x3F); | |
5103 return (int)((char *)v69 + v30); | |
5104 | |
5105 } | |
5106 | |
5107 | |
0 | 5108 if ( a2 != 9 ) |
5109 { | |
1080 | 5110 |
0 | 5111 if ( a2 <= CHARACTER_ATTRIBUTE_ATTACK ) |
1080 | 5112 return skill_bonus; |
0 | 5113 if ( a2 > CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) |
5114 { | |
5115 if ( a2 != CHARACTER_ATTRIBUTE_RANGED_ATTACK ) | |
1080 | 5116 return skill_bonus; |
0 | 5117 v71 = (ITEM_EQUIP_TYPE)0; |
5118 v9 = &v2->pEquipment; | |
5119 while ( 1 ) | |
5120 { | |
5121 if ( v2->HasItemEquipped(v71) ) | |
5122 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5123 v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[*(_DWORD *)v9].uItemID].uEquipType; |
118 | 5124 LOBYTE(v12) = this->GetActualSkillLevel(v11); |
0 | 5125 a1 = v12; |
5126 SkillToMastery(v12); | |
5127 v13 = v11 - 5; | |
5128 if ( !v13 ) | |
5129 return a1 & 0x3F; | |
5130 if ( v13 == 2 ) | |
5131 break; | |
5132 } | |
5133 v71 = (ITEM_EQUIP_TYPE)((int)v71 + 1); | |
5134 v9 = (PlayerEquipment *)((char *)v9 + 4); | |
5135 if ( (signed int)v71 >= 16 ) | |
1080 | 5136 return skill_bonus; |
0 | 5137 } |
5138 v14 = a1; | |
5139 v15 = 1; | |
5140 if ( (signed int)SkillToMastery(a1) >= 4 ) | |
5141 { | |
5142 v62 = 5; | |
5143 goto LABEL_31; | |
5144 } | |
5145 if ( (signed int)SkillToMastery(a1) >= 3 ) | |
5146 { | |
5147 v62 = 3; | |
5148 goto LABEL_31; | |
5149 } | |
5150 if ( (signed int)SkillToMastery(a1) < 2 ) | |
5151 goto LABEL_32; | |
5152 goto LABEL_30; | |
5153 } | |
5154 if ( v2->IsUnarmed() ) | |
5155 { | |
5156 LOBYTE(v18) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5157 v14 = v18; | |
5158 if ( !v18 ) | |
1080 | 5159 return skill_bonus; |
0 | 5160 v15 = 0; |
5161 v19 = SkillToMastery(v18); | |
5162 if ( (signed int)v19 < 3 ) | |
5163 { | |
5164 if ( (signed int)v19 >= 2 ) | |
5165 v15 = 1; | |
5166 LABEL_32: | |
5167 v16 = v14; | |
5168 return v15 * (v16 & 0x3F); | |
5169 } | |
5170 LABEL_30: | |
5171 v62 = 2; | |
5172 LABEL_31: | |
5173 v15 = v62; | |
5174 goto LABEL_32; | |
5175 } | |
5176 v20 = (ITEM_EQUIP_TYPE)0; | |
5177 while ( 1 ) | |
5178 { | |
5179 if ( v2->HasItemEquipped(v20) ) | |
5180 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
5181 v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID; |
0 | 5182 if ( pItemsTable->pItems[v22].uEquipType <= 1u ) |
5183 break; | |
5184 } | |
5185 v20 = (ITEM_EQUIP_TYPE)((int)v20 + 1); | |
5186 if ( (signed int)v20 >= 16 ) | |
1080 | 5187 return skill_bonus; |
0 | 5188 } |
5189 v71 = (ITEM_EQUIP_TYPE)0; | |
5190 v23 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v22].uSkillType; | |
5191 LOBYTE(v24) = v2->GetActualSkillLevel(v23); | |
5192 v25 = v24; | |
5193 v26 = SkillToMastery(v24); | |
5194 if ( !v23 ) | |
5195 { | |
5196 if ( (signed int)SkillToMastery(v25) >= 4 ) | |
5197 { | |
5198 LOBYTE(v31) = v2->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
5199 LOBYTE(v25) = v31; | |
5200 if ( v31 ) | |
5201 { | |
5202 v15 = 0; | |
5203 v32 = SkillToMastery(v31); | |
5204 if ( (signed int)v32 < 3 ) | |
5205 { | |
5206 if ( (signed int)v32 >= 2 ) | |
5207 v15 = 1; | |
5208 } | |
5209 else | |
5210 { | |
5211 v15 = 2; | |
5212 } | |
5213 v16 = v25; | |
5214 return v15 * (v16 & 0x3F); | |
5215 } | |
5216 } | |
5217 goto LABEL_55; | |
5218 } | |
5219 if ( v23 == PLAYER_SKILL_DAGGER ) | |
5220 { | |
5221 v29 = SkillToMastery(v25); | |
5222 v28 = __OFSUB__(v29, 4); | |
5223 v27 = ((v29 - 4) & 0x80000000u) != 0; | |
5224 } | |
5225 else | |
5226 { | |
5227 if ( v23 <= PLAYER_SKILL_DAGGER ) | |
5228 goto LABEL_55; | |
5229 if ( v23 > PLAYER_SKILL_SPEAR ) | |
5230 { | |
5231 if ( v23 == PLAYER_SKILL_MACE ) | |
5232 { | |
5233 v28 = __OFSUB__(v26, 2); | |
118 | 5234 v27 = v26 - 2 < 0; |
0 | 5235 goto LABEL_53; |
5236 } | |
5237 LABEL_55: | |
5238 v30 = v71 * (v25 & 0x3F); | |
5239 return (int)((char *)v69 + v30); | |
5240 } | |
5241 v28 = __OFSUB__(v26, 3); | |
118 | 5242 v27 = v26 - 3 < 0; |
0 | 5243 } |
5244 LABEL_53: | |
5245 if ( !(v27 ^ v28) ) | |
5246 v71 = (ITEM_EQUIP_TYPE)1; | |
5247 goto LABEL_55; | |
5248 } | |
1080 | 5249 |
5250 | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
5251 assert(false && "Unknown attribute!"); |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5252 return 0; |
0 | 5253 } |
5254 | |
5255 //----- (00490109) -------------------------------------------------------- | |
5256 // faces are: 0 1 2 3 human males | |
5257 // 4 5 6 7 human females | |
5258 // 8 9 elf males | |
5259 // 10 11 elf females | |
5260 // 12 13 dwarf males | |
5261 // 14 15 dwarf females | |
5262 // 16 17 goblin males | |
5263 // 18 19 goblin females | |
5264 // 20 lich male | |
5265 // 21 lich female | |
5266 // 22 underwater suits (unused) | |
5267 // 23 zombie male | |
5268 // 24 zombie female | |
5269 enum CHARACTER_RACE Player::GetRace() | |
5270 { | |
1014 | 5271 if ( uCurrentFace > 15 ) |
5272 { | |
5273 if ( uCurrentFace >= 16 && uCurrentFace <= 19 ) | |
0 | 5274 return CHARACTER_RACE_GOBLIN; |
5275 } | |
5276 else | |
5277 { | |
1014 | 5278 if ( uCurrentFace >= 12 ) |
0 | 5279 { |
5280 return CHARACTER_RACE_DWARF; | |
5281 } | |
5282 else | |
5283 { | |
1014 | 5284 |
5285 if ( uCurrentFace <= 7 ) | |
0 | 5286 { |
5287 return CHARACTER_RACE_HUMAN; | |
5288 } | |
5289 else | |
5290 { | |
1014 | 5291 if ( uCurrentFace <= 11 ) |
0 | 5292 return CHARACTER_RACE_ELF; |
5293 } | |
5294 } | |
5295 } | |
5296 return CHARACTER_RACE_HUMAN; | |
5297 } | |
5298 | |
5299 //----- (00490141) -------------------------------------------------------- | |
187 | 5300 PLAYER_SEX Player::GetSexByVoice() |
0 | 5301 { |
5302 signed int result; // eax@1 | |
5303 | |
5304 result = 0; | |
5305 switch ( this->uVoiceID ) | |
5306 { | |
5307 case 0u: | |
5308 case 1u: | |
5309 case 2u: | |
5310 case 3u: | |
5311 case 8u: | |
5312 case 9u: | |
5313 case 0xCu: | |
5314 case 0xDu: | |
5315 case 0x10u: | |
5316 case 0x11u: | |
5317 case 0x14u: | |
5318 case 0x17u: | |
187 | 5319 return SEX_MALE; |
5320 | |
0 | 5321 case 4u: |
5322 case 5u: | |
5323 case 6u: | |
5324 case 7u: | |
5325 case 0xAu: | |
5326 case 0xBu: | |
5327 case 0xEu: | |
5328 case 0xFu: | |
5329 case 0x12u: | |
5330 case 0x13u: | |
5331 case 0x15u: | |
5332 case 0x18u: | |
187 | 5333 return SEX_FEMALE; |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5334 } |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5335 assert(false); |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5336 return SEX_MALE; |
0 | 5337 } |
5338 | |
5339 //----- (00490188) -------------------------------------------------------- | |
5340 void Player::SetInitialStats() | |
5341 { | |
5342 auto v1 = GetRace(); | |
290 | 5343 uMight = StatTable[v1][0].uBaseValue; |
5344 uIntelligence = StatTable[v1][1].uBaseValue; | |
5345 uWillpower = StatTable[v1][2].uBaseValue; | |
5346 uEndurance = StatTable[v1][3].uBaseValue; | |
5347 uAccuracy = StatTable[v1][4].uBaseValue; | |
5348 uSpeed = StatTable[v1][5].uBaseValue; | |
5349 uLuck = StatTable[v1][6].uBaseValue; | |
0 | 5350 } |
5351 | |
5352 //----- (004901FC) -------------------------------------------------------- | |
1021 | 5353 void Player::SetSexByVoice() |
5354 { | |
5355 switch ( this->uVoiceID) | |
0 | 5356 { |
5357 case 0: | |
5358 case 1: | |
5359 case 2: | |
5360 case 3: | |
5361 case 8: | |
5362 case 9: | |
5363 case 0xC: | |
5364 case 0xD: | |
5365 case 0x10: | |
5366 case 0x11: | |
5367 case 0x14: | |
5368 case 0x17: | |
1021 | 5369 this->uSex = SEX_MALE; |
0 | 5370 break; |
5371 case 4: | |
5372 case 5: | |
5373 case 6: | |
5374 case 7: | |
5375 case 0xA: | |
5376 case 0xB: | |
5377 case 0xE: | |
5378 case 0xF: | |
5379 case 0x12: | |
5380 case 0x13: | |
5381 case 0x15: | |
5382 case 0x18: | |
1021 | 5383 this->uSex = SEX_FEMALE; |
0 | 5384 break; |
5385 default: | |
5386 break; | |
5387 } | |
1021 | 5388 |
0 | 5389 } |
5390 | |
5391 //----- (0049024A) -------------------------------------------------------- | |
135 | 5392 void Player::Reset(PLAYER_CLASS_TYPE cls) |
0 | 5393 { |
5394 sLevelModifier = 0; | |
5395 sAgeModifier = 0; | |
5396 | |
135 | 5397 classType = cls; |
0 | 5398 uLuckBonus = 0; |
5399 uSpeedBonus = 0; | |
5400 uAccuracyBonus = 0; | |
5401 uEnduranceBonus = 0; | |
5402 uWillpowerBonus = 0; | |
5403 uIntelligenceBonus = 0; | |
5404 uMightBonus = 0; | |
5405 uLevel = 1; | |
5406 uExperience = 251 + rand() % 100; | |
5407 uBirthYear = 1147 - rand() % 6; | |
5408 memset(pActiveSkills, 0, sizeof(pActiveSkills)); | |
484 | 5409 memset(_guilds_member_bits, 0, 64); |
0 | 5410 memset(&spellbook, 0, sizeof(PlayerSpells)); |
5411 | |
5412 for (uint i = 0; i < 37; ++i) | |
5413 { | |
135 | 5414 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) |
0 | 5415 continue; |
5416 | |
5417 pActiveSkills[i] = 1; | |
5418 | |
5419 switch (i) | |
5420 { | |
886 | 5421 case PLAYER_SKILL_FIRE: |
5422 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells | |
894 | 5423 |
5424 extern bool all_magic; | |
5425 if ( all_magic == true ) | |
5426 { | |
5427 pActiveSkills[PLAYER_SKILL_AIR] = 1; | |
5428 pActiveSkills[PLAYER_SKILL_WATER] = 1; | |
5429 pActiveSkills[PLAYER_SKILL_EARTH] = 1; | |
5430 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true; | |
5431 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true; | |
5432 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true; | |
5433 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true; | |
5434 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true; | |
5435 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true; | |
5436 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true; | |
5437 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true; | |
5438 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true; | |
5439 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true; | |
886 | 5440 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; |
569 | 5441 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true; |
5442 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true; | |
5443 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true; | |
5444 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true; | |
5445 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true; | |
5446 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true; | |
5447 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true; | |
5448 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true; | |
5449 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true; | |
5450 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true; | |
5451 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
5452 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true; | |
5453 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true; | |
5454 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true; | |
5455 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true; | |
5456 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true; | |
710 | 5457 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true; |
5458 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true; | |
5459 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true; | |
886 | 5460 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true; |
5461 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true; | |
894 | 5462 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; |
5463 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true; | |
5464 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true; | |
5465 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true; | |
5466 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true; | |
5467 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true; | |
5468 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true; | |
5469 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true; | |
5470 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true; | |
5471 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true; | |
5472 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true; | |
5473 } | |
486 | 5474 break; |
886 | 5475 case PLAYER_SKILL_AIR: |
5476 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true; | |
5477 break; | |
5478 case PLAYER_SKILL_WATER: | |
5479 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true; | |
5480 break; | |
5481 case PLAYER_SKILL_EARTH: | |
5482 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true; | |
5483 break; | |
5484 case PLAYER_SKILL_SPIRIT: | |
5485 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; | |
5486 break; | |
5487 case PLAYER_SKILL_MIND: | |
5488 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; | |
5489 break; | |
5490 case PLAYER_SKILL_BODY: | |
5491 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true; | |
894 | 5492 |
5493 if ( all_magic == true ) | |
5494 { | |
5495 pActiveSkills[PLAYER_SKILL_MIND] = 1; | |
5496 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1; | |
5497 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true; | |
5498 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true; | |
5499 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true; | |
5500 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true; | |
5501 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true; | |
5502 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true; | |
5503 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true; | |
5504 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; | |
5505 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; | |
5506 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; | |
924 | 5507 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; |
894 | 5508 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; |
5509 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; | |
5510 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; | |
5511 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true; | |
5512 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true; | |
5513 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true; | |
5514 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true; | |
5515 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; | |
5516 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; | |
5517 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; | |
924 | 5518 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; |
894 | 5519 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; |
5520 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; | |
5521 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; | |
5522 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true; | |
5523 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true; | |
5524 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true; | |
5525 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true; | |
5526 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true; | |
5527 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true; | |
5528 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true; | |
5529 } | |
569 | 5530 break; |
886 | 5531 case PLAYER_SKILL_LIGHT: |
5532 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true; | |
5533 break; | |
5534 case PLAYER_SKILL_DARK: | |
5535 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true; | |
5536 break; | |
0 | 5537 } |
5538 } | |
5539 | |
5540 sHealth = GetMaxHealth(); | |
5541 sMana = GetMaxMana(); | |
5542 } | |
5543 | |
5544 //----- (004903C9) -------------------------------------------------------- | |
821 | 5545 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) |
5546 { | |
1271
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5547 int counter; // edx@5 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5548 bool canBeInactive; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5549 unsigned char requiredValue; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5550 signed int offset; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5551 |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5552 if ( order <= 1 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5553 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5554 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5555 requiredValue = 2; // 2 - primary skill |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5556 offset = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5557 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5558 else if ( order <= 3 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5559 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5560 canBeInactive = false; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5561 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5562 offset = 2; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5563 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5564 else if ( order <= 12 ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5565 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5566 canBeInactive = true; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5567 requiredValue = 1; // 1 - available |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5568 offset = 4; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5569 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5570 else |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5571 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5572 return (PLAYER_SKILL_TYPE)37; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5573 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5574 counter = 0; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5575 for (int i = 0; i < 37; i++) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5576 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5577 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5578 { |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5579 if ( counter == order - offset ) |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5580 return (PLAYER_SKILL_TYPE)i; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5581 ++counter; |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5582 } |
5a3f48b370d5
Player::GetSkillIdxByOrder cleanup - extracting common branch bodies
Grumpy7
parents:
1270
diff
changeset
|
5583 } |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5584 |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
5585 assert(false); |
0 | 5586 } |
5587 | |
5588 | |
5589 | |
5590 //----- (0049048D) -------------------------------------------------------- | |
5591 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) | |
5592 void Player::DecreaseAttribute(int eAttribute) | |
5593 { | |
5594 int v2; // eax@1 | |
5595 int pBaseValue; // ecx@1 | |
5596 int pDroppedStep; // ebx@1 | |
5597 int pStep; // esi@1 | |
5598 unsigned __int16 result; // ax@7 | |
5599 int uMinValue; // [sp+Ch] [bp-4h]@1 | |
5600 | |
5601 v2 = eAttribute + 7 * GetRace(); | |
290 | 5602 pBaseValue = StatTable[0][v2].uBaseValue; |
5603 pDroppedStep = StatTable[0][v2].uDroppedStep; | |
0 | 5604 uMinValue = pBaseValue - 2; |
290 | 5605 pStep = StatTable[0][v2].uBaseStep; |
1272 | 5606 unsigned short* AttrToChange = nullptr; |
5607 switch ( eAttribute ) | |
5608 { | |
5609 case CHARACTER_ATTRIBUTE_STRENGTH: | |
5610 AttrToChange = &this->uMight; | |
5611 break; | |
5612 case CHARACTER_ATTRIBUTE_INTELLIGENCE: | |
5613 AttrToChange = &this->uIntelligence; | |
5614 break; | |
5615 case CHARACTER_ATTRIBUTE_WILLPOWER: | |
5616 AttrToChange = &this->uWillpower; | |
5617 break; | |
5618 case CHARACTER_ATTRIBUTE_ENDURANCE: | |
5619 AttrToChange = &this->uEndurance; | |
5620 break; | |
5621 case CHARACTER_ATTRIBUTE_ACCURACY: | |
5622 AttrToChange = &this->uAccuracy; | |
5623 break; | |
5624 case CHARACTER_ATTRIBUTE_SPEED: | |
5625 AttrToChange = &this->uSpeed; | |
5626 break; | |
5627 case CHARACTER_ATTRIBUTE_LUCK: | |
5628 AttrToChange = &this->uLuck; | |
5629 break; | |
5630 } | |
5631 if ( *AttrToChange <= pBaseValue ) | |
5632 pStep = pDroppedStep; | |
5633 if ( *AttrToChange - pStep >= uMinValue ) | |
5634 *AttrToChange -= pStep; | |
0 | 5635 } |
5636 | |
5637 //----- (004905F5) -------------------------------------------------------- | |
5638 //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) | |
1273 | 5639 void Player::IncreaseAttribute( int eAttribute ) |
5640 { | |
5641 int raceId; // eax@1 | |
5642 int maxValue; // ebx@1 | |
5643 signed int baseStep; // edi@1 | |
5644 signed int tmp; // eax@17 | |
0 | 5645 signed int result; // eax@18 |
1273 | 5646 int baseValue; // [sp+Ch] [bp-8h]@1 |
5647 signed int droppedStep; // [sp+10h] [bp-4h]@1 | |
5648 unsigned short* statToChange; | |
5649 | |
5650 raceId = GetRace(); | |
5651 maxValue = StatTable[raceId][eAttribute].uMaxValue; | |
5652 baseStep = StatTable[raceId][eAttribute].uBaseStep; | |
5653 baseValue = StatTable[raceId][eAttribute].uBaseValue; | |
5654 droppedStep = StatTable[raceId][eAttribute].uDroppedStep; | |
5655 PlayerCreation_GetUnspentAttributePointCount(); | |
5656 switch ( eAttribute ) | |
5657 { | |
5658 case 0: | |
5659 statToChange = &this->uMight; | |
5660 break; | |
5661 case 1: | |
5662 statToChange = &this->uIntelligence; | |
5663 break; | |
5664 case 2: | |
5665 statToChange = &this->uWillpower; | |
5666 break; | |
5667 case 3: | |
5668 statToChange = &this->uEndurance; | |
5669 break; | |
5670 case 4: | |
5671 statToChange = &this->uAccuracy; | |
5672 break; | |
5673 case 5: | |
5674 statToChange = &this->uSpeed; | |
5675 break; | |
5676 case 6: | |
5677 statToChange = &this->uLuck; | |
5678 default: | |
5679 assert(false); | |
5680 return; | |
5681 break; | |
5682 } | |
5683 if ( *statToChange < baseValue ) | |
5684 { | |
5685 tmp = baseStep; | |
5686 baseStep = droppedStep; | |
5687 droppedStep = tmp; | |
5688 } | |
5689 result = PlayerCreation_GetUnspentAttributePointCount(); | |
5690 if ( result >= droppedStep ) | |
5691 { | |
5692 if ( baseStep + *statToChange <= maxValue ) | |
5693 *statToChange += baseStep; | |
5694 } | |
0 | 5695 } |
5696 | |
5697 //----- (0049070F) -------------------------------------------------------- | |
5698 void Player::Zero() | |
5699 { | |
5700 this->sLevelModifier = 0; | |
5701 this->sACModifier = 0; | |
5702 this->uLuckBonus = 0; | |
5703 this->uAccuracyBonus = 0; | |
5704 this->uSpeedBonus = 0; | |
5705 this->uEnduranceBonus = 0; | |
5706 this->uWillpowerBonus = 0; | |
5707 this->uIntelligenceBonus = 0; | |
5708 this->uMightBonus = 0; | |
5709 this->field_100 = 0; | |
5710 this->field_FC = 0; | |
5711 this->field_F8 = 0; | |
5712 this->field_F4 = 0; | |
5713 this->field_F0 = 0; | |
5714 this->field_EC = 0; | |
5715 this->field_E8 = 0; | |
5716 this->field_E4 = 0; | |
5717 this->field_E0 = 0; | |
766 | 5718 memset(&this->sResFireBonus, 0, 0x16u); |
1274
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5719 this->field_1A97 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5720 this->_ranged_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5721 this->field_1A95 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5722 this->_ranged_atk_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5723 this->field_1A93 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5724 this->_melee_dmg_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5725 this->field_1A91 = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5726 this->_some_attack_bonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5727 this->_mana_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5728 this->uFullManaBonus = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5729 this->_health_related = 0; |
351bc06722f2
Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up
Grumpy7
parents:
1273
diff
changeset
|
5730 this->uFullHealthBonus = 0; |
0 | 5731 } |
5732 | |
5733 //----- (004907E7) -------------------------------------------------------- | |
299 | 5734 unsigned int Player::GetStatColor(int uStat) |
0 | 5735 { |
290 | 5736 int attribute_value; // edx@1 |
1393 | 5737 |
5738 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue; | |
0 | 5739 switch (uStat) |
5740 { | |
5741 case 0: attribute_value = uMight; break; | |
5742 case 1: attribute_value = uIntelligence; break; | |
5743 case 2: attribute_value = uWillpower; break; | |
5744 case 3: attribute_value = uEndurance; break; | |
290 | 5745 case 4: attribute_value = uAccuracy; break; |
5746 case 5: attribute_value = uSpeed; break; | |
0 | 5747 case 6: attribute_value = uLuck; break; |
5748 }; | |
5749 | |
1393 | 5750 if (attribute_value == base_attribute_value) |
5751 return ui_character_stat_default_color; | |
5752 else if (attribute_value > base_attribute_value) | |
5753 return ui_character_stat_buffed_color; | |
0 | 5754 else |
1393 | 5755 return ui_character_stat_debuffed_color; |
0 | 5756 } |
5757 | |
5758 //----- (004908A8) -------------------------------------------------------- | |
5759 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | |
5760 { | |
1014 | 5761 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) ) |
5762 { | |
1393 | 5763 pConditions[uCondition] = 0i64; |
1014 | 5764 return true; |
0 | 5765 } |
5766 else | |
1014 | 5767 return false; |
0 | 5768 } |
5769 | |
5770 //----- (004680ED) -------------------------------------------------------- | |
1019 | 5771 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3) |
1021 | 5772 { |
5773 Player *v3; // esi@1 | |
5774 signed int v5; // eax@17 | |
5775 int v8; // edx@39 | |
5776 char *v13; // eax@45 | |
5777 signed int v15; // edi@68 | |
5778 int v16; // edx@73 | |
5779 unsigned __int16 v17; // edi@73 | |
5780 unsigned int v18; // eax@73 | |
5781 const char *v22; // eax@84 | |
5782 int scroll_id; // esi@96 | |
5783 int v25; // eax@109 | |
5784 int v26; // eax@113 | |
5785 int new_mana_val; // edi@114 | |
5786 signed __int64 v28; // qax@120 | |
5787 __int64 v30; // edi@137 | |
5788 __int64 v32; // ST3C_4@137 | |
5789 __int64 v34; // ST34_4@137 | |
5790 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120 | |
5791 const char *v66; // [sp-4h] [bp-30h]@69 | |
5792 signed int v67; // [sp-4h] [bp-30h]@77 | |
5793 const char *v68; // [sp-4h] [bp-30h]@89 | |
5794 char v72; // [sp+20h] [bp-Ch]@68 | |
5795 signed int v73; // [sp+24h] [bp-8h]@1 | |
1032 | 5796 char* v74; // [sp+24h] [bp-8h]@23 |
1021 | 5797 Player *thisb; // [sp+28h] [bp-4h]@1 |
5798 unsigned int thisa; // [sp+28h] [bp-4h]@22 | |
5799 | |
5800 thisb = this; | |
5801 v3 = &pParty->pPlayers[player_num-1]; | |
5802 v73 = 1; | |
1340 | 5803 if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) |
1021 | 5804 return; |
5805 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) | |
0 | 5806 { |
1021 | 5807 if ( pParty->pPickedItem.uItemID == 160 ) |
5808 { | |
5809 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5810 } | |
5811 else if ( pParty->pPickedItem.uItemID == 161 ) | |
1019 | 5812 { |
1021 | 5813 new_mana_val = v3->sMana; |
5814 new_mana_val += 2; | |
5815 if ( new_mana_val > v3->GetMaxMana() ) | |
5816 new_mana_val = v3->GetMaxMana(); | |
5817 v3->PlaySound(SPEECH_36, 0); | |
5818 } | |
5819 else if ( pParty->pPickedItem.uItemID == 162 ) | |
5820 { | |
5821 pParty->pPlayers[player_num-1].Heal(2); | |
1019 | 5822 v3->PlaySound(SPEECH_36, 0); |
1021 | 5823 |
5824 } | |
5825 else | |
5826 { | |
5827 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
5828 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
|
5829 ShowStatusBarString(pTmpBuf.data(), 2); |
1021 | 5830 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
5831 return; | |
1019 | 5832 } |
1032 | 5833 pAudioPlayer->PlaySound((SoundID)211, 0, 0, -1, 0, 0, 0, 0); |
5834 | |
5835 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
5836 { | |
5837 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
5838 } | |
5839 if ( v73 ) | |
5840 { | |
5841 if ( pParty->bTurnBasedModeOn ) | |
5842 { | |
5843 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
5844 thisb->SetRecoveryTime(100); | |
5845 pTurnEngine->_40471C(); | |
5846 } | |
5847 else | |
5848 { | |
5849 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
5850 } | |
5851 } | |
5852 pMouse->RemoveHoldingItem(); | |
5853 return; | |
5854 | |
1021 | 5855 |
5856 } | |
5857 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) | |
0 | 5858 { |
1021 | 5859 switch ( pParty->pPickedItem.uItemID ) |
5860 { | |
5861 case 221: //Catalyst | |
5862 pParty->pPlayers[player_num-1].SetCondition(Condition_Poison1, 1); | |
5863 break; | |
5864 case 222: //Cure Wounds | |
5865 v25 = pParty->pPickedItem.uEnchantmentType + 10; | |
5866 pParty->pPlayers[player_num-1].Heal(v25); | |
5867 v3->PlaySound(SPEECH_36, 0); | |
5868 break; | |
5869 case 223: //Magic Potion | |
5870 v26 = pParty->pPickedItem.uEnchantmentType + 10; | |
5871 new_mana_val = v3->sMana; | |
5872 new_mana_val += v26; | |
5873 if ( new_mana_val > v3->GetMaxMana() ) | |
5874 new_mana_val = v3->GetMaxMana(); | |
5875 v3->PlaySound(SPEECH_36, 0); | |
5876 break; | |
5877 case 224: //Cure Weakness | |
5878 v3->pConditions[Condition_Weak] = 0i64; | |
5879 v3->PlaySound(SPEECH_36, 0); | |
5880 break; | |
5881 case 225: //Cure Disease | |
5882 v3->pConditions[Condition_Disease3] = 0i64; | |
5883 v3->pConditions[Condition_Disease2] = 0i64; | |
5884 v3->pConditions[Condition_Disease1] = 0i64; | |
5885 v3->PlaySound(SPEECH_36, 0); | |
5886 break; | |
5887 case 226: //Cure Poison | |
5888 v3->pConditions[Condition_Poison3] = 0i64; | |
5889 v3->pConditions[Condition_Poison2] = 0i64; | |
5890 v3->pConditions[Condition_Poison1] = 0i64; | |
5891 v3->PlaySound(SPEECH_36, 0); | |
5892 break; | |
5893 case 227: //Awaken | |
5894 v3->pConditions[Condition_Sleep] = 0i64; | |
5895 v3->PlaySound(SPEECH_36, 0); | |
5896 break; | |
5897 case 228: //Haste | |
5898 if ( !v3->pConditions[Condition_Weak] ) | |
5899 { | |
5900 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5901 v3->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5902 v3->PlaySound(SPEECH_36, 0); | |
5903 } | |
5904 break; | |
5905 case 229: //Heroism | |
5906 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5907 v3->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5908 v3->PlaySound(SPEECH_36, 0); | |
5909 break; | |
5910 case 230: //Bless | |
5911 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5912 v3->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5913 v3->PlaySound(SPEECH_36, 0); | |
5914 break; | |
5915 case 231: //Preservation | |
1032 | 5916 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5917 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5918 v3->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5919 v3->PlaySound(SPEECH_36, 0); | |
5920 break; | |
5921 case 232: //Shield | |
1032 | 5922 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5923 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5924 v3->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5925 v3->PlaySound(SPEECH_36, 0); | |
5926 break; | |
5927 case 234: //Stoneskin | |
5928 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | |
5929 v3->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | |
5930 v3->PlaySound(SPEECH_36, 0); | |
5931 break; | |
5932 case 235: //Water Breathing | |
5933 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | |
5934 v3->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | |
5935 break; | |
5936 case 237: //Remove Fear | |
5937 v3->pConditions[Condition_Fear] = 0i64; | |
5938 v3->PlaySound(SPEECH_36, 0); | |
5939 break; | |
5940 case 238: //Remove Curse | |
5941 v3->pConditions[Condition_Cursed] = 0i64; | |
5942 v3->PlaySound(SPEECH_36, 0); | |
5943 break; | |
5944 case 239: //Cure Insanity | |
5945 v3->pConditions[Condition_Insane] = 0i64; | |
5946 v3->PlaySound(SPEECH_36, 0); | |
5947 break; | |
5948 case 240: //Might Boost | |
1032 | 5949 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5950 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5951 v3->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5952 v3->PlaySound(SPEECH_36, 0); | |
5953 break; | |
5954 case 241: //Intellect Boost | |
1032 | 5955 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5956 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5957 v3->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5958 v3->PlaySound(SPEECH_36, 0); | |
5959 break; | |
5960 case 242: //Personality Boost | |
1032 | 5961 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5962 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5963 v3->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5964 v3->PlaySound(SPEECH_36, 0); | |
5965 break; | |
5966 case 243://Endurance Boost | |
1032 | 5967 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5968 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5969 v3->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5970 v3->PlaySound(SPEECH_36, 0); | |
5971 break; | |
5972 case 244: //Speed Boost | |
1032 | 5973 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5974 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5975 v3->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5976 v3->PlaySound(SPEECH_36, 0); | |
5977 break; | |
5978 case 245: //Accuracy Boost | |
1032 | 5979 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 5980 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
5981 v3->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
5982 v3->PlaySound(SPEECH_36, 0); | |
5983 break; | |
5984 case 251: //Cure Paralysis | |
5985 v3->pConditions[Condition_Paralyzed] = 0i64; | |
5986 v3->PlaySound(SPEECH_36, 0); | |
5987 break; | |
5988 case 252://Divine Restoration | |
5989 v30 = v3->pConditions[Condition_Dead]; | |
5990 v32 = v3->pConditions[Condition_Pertified]; | |
5991 v34 = v3->pConditions[Condition_Eradicated]; | |
5992 memset(&pParty->pPlayers[player_num-1].pConditions,0,sizeof(pConditions)); | |
5993 v3->pConditions[Condition_Dead] = v30; | |
5994 v3->pConditions[Condition_Pertified] = v32; | |
5995 v3->pConditions[Condition_Eradicated] = v34; | |
5996 v3->PlaySound(SPEECH_36, 0); | |
5997 break; | |
5998 case 253: //Divine Cure | |
5999 v25 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6000 pParty->pPlayers[player_num-1].Heal(v25); | |
6001 v3->PlaySound(SPEECH_36, 0); | |
6002 break; | |
6003 case 254: //Divine Power | |
6004 v26 = 5 * pParty->pPickedItem.uEnchantmentType; | |
6005 new_mana_val = v3->sMana; | |
6006 new_mana_val += v26; | |
6007 if ( new_mana_val > v3->GetMaxMana() ) | |
6008 new_mana_val = v3->GetMaxMana(); | |
6009 v3->PlaySound(SPEECH_36, 0); | |
6010 break; | |
6011 case 255: //Luck Boost | |
1032 | 6012 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6013 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6014 v3->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6015 v3->PlaySound(SPEECH_36, 0); | |
6016 break; | |
6017 case 256: //Fire Resistance | |
1032 | 6018 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6019 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6020 v3->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6021 v3->PlaySound(SPEECH_36, 0); | |
1032 | 6022 break; |
1021 | 6023 case 257: //Air Resistance |
1032 | 6024 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6025 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6026 v3->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6027 v3->PlaySound(SPEECH_36, 0); | |
6028 break; | |
6029 case 258: //Water Resistance | |
1032 | 6030 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6031 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6032 v3->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6033 v3->PlaySound(SPEECH_36, 0); | |
6034 break; | |
6035 case 259: //Earth Resistance | |
1032 | 6036 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6037 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6038 v3->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6039 v3->PlaySound(SPEECH_36, 0); | |
6040 break; | |
6041 case 260: //Mind Resistance | |
1032 | 6042 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6043 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6044 v3->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6045 v3->PlaySound(SPEECH_36, 0); | |
6046 break; | |
6047 case 261: //Body Resistance | |
1032 | 6048 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
1021 | 6049 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
6050 v3->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | |
6051 v3->PlaySound(SPEECH_36, 0); | |
6052 break; | |
6053 case 262: //Stone to Flesh | |
6054 v3->pConditions[Condition_Pertified] = 0i64; | |
6055 v3->PlaySound(SPEECH_36, 0); | |
6056 break; | |
6057 case 264: //Pure Luck | |
6058 if ( !v3->pure_luck_used ) | |
6059 { | |
6060 v3->uLuck += 50; | |
6061 v3->pure_luck_used = 1; | |
6062 } | |
6063 v3->PlaySound(SPEECH_36, 0); | |
6064 break; | |
6065 case 265: //Pure Speed | |
6066 if ( !v3->pure_speed_used ) | |
6067 { | |
6068 v3->uSpeed += 50; | |
6069 v3->pure_speed_used = 1; | |
6070 } | |
6071 v3->PlaySound(SPEECH_36, 0); | |
6072 break; | |
6073 case 266: //Pure Intellect | |
6074 if ( !v3->pure_intellect_used ) | |
6075 { | |
6076 v3->uIntelligence += 50; | |
6077 v3->pure_intellect_used = 1; | |
6078 } | |
6079 v3->PlaySound(SPEECH_36, 0); | |
6080 break; | |
6081 case 267: //Pure Endurance | |
6082 if ( !v3->pure_endurance_used ) | |
6083 { | |
6084 v3->uEndurance += 50; | |
6085 v3->pure_endurance_used = 1; | |
6086 } | |
6087 v3->PlaySound(SPEECH_36, 0); | |
6088 break; | |
6089 case 268: //Pure Personality | |
6090 if ( !v3->pure_willpower_used ) | |
6091 { | |
6092 v3->uWillpower += 50; | |
6093 v3->pure_willpower_used = 1; | |
6094 } | |
6095 v3->PlaySound(SPEECH_36, 0); | |
6096 break; | |
6097 case 269: //Pure Accuracy | |
6098 if ( !v3->pure_accuracy_used ) | |
6099 { | |
6100 v3->uAccuracy += 50; | |
6101 v3->pure_accuracy_used = 1; | |
6102 } | |
6103 v3->PlaySound(SPEECH_36, 0); | |
6104 break; | |
6105 case 270: //Pure Might | |
6106 if ( !v3->pure_might_used ) | |
6107 { | |
6108 v3->uMight += 50; | |
6109 v3->pure_might_used = 1; | |
6110 } | |
6111 v3->PlaySound(SPEECH_36, 0); | |
6112 break; | |
6113 case 271: //Rejuvenation | |
6114 v3->sAgeModifier = 0; | |
6115 v3->PlaySound(SPEECH_36, 0); | |
6116 break; | |
6117 | |
6118 default: | |
6119 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6120 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
|
6121 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 6122 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
6123 return; | |
1032 | 6124 } |
6125 pAudioPlayer->PlaySound((SoundID)210, 0, 0, -1, 0, 0, 0, 0); | |
6126 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6127 { | |
6128 if ( !v73 ) | |
6129 { | |
6130 pMouse->RemoveHoldingItem(); | |
6131 return; | |
6132 } | |
6133 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1021 | 6134 } |
1032 | 6135 if ( v73 ) |
6136 { | |
6137 if ( pParty->bTurnBasedModeOn ) | |
6138 { | |
6139 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6140 thisb->SetRecoveryTime(100); | |
6141 pTurnEngine->_40471C(); | |
6142 } | |
6143 else | |
6144 { | |
6145 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | |
6146 } | |
6147 } | |
6148 pMouse->RemoveHoldingItem(); | |
6149 return; | |
6150 | |
1021 | 6151 } |
6152 | |
6153 | |
6154 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) | |
6155 { | |
6156 | |
6157 | |
6158 if ( pCurrentScreen == SCREEN_CASTING ) | |
6159 return; | |
6160 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
6161 { | |
6162 | |
6163 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6164 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6165 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6166 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6167 return; |
6168 } | |
6169 if ( bUnderwater == 1 ) | |
6170 { | |
1032 | 6171 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!" |
6172 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
1021 | 6173 return; |
6174 } | |
6175 dword_50C9AC = 1; | |
6176 scroll_id = pParty->pPickedItem.uItemID - 299; | |
6177 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura | |
6178 { | |
6179 pMouse->RemoveHoldingItem(); | |
6180 pGUIWindow_CurrentMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
6181 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1021 | 6182 pCurrentScreen = SCREEN_GAME; |
6183 viewparams->bRedrawGameUI = 1; | |
6184 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); | |
6185 } | |
6186 else | |
6187 { | |
6188 _720984_unused = pParty->pPickedItem.uItemID; | |
6189 pMouse->RemoveHoldingItem(); | |
6190 pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); | |
6191 if ( pCurrentScreen && pGUIWindow_CurrentMenu | |
6192 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) | |
6193 { | |
6194 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6195 } | |
6196 } | |
6197 return; | |
6198 } | |
6199 | |
6200 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) | |
6201 | |
6202 { | |
6203 v15 = pParty->pPickedItem.uItemID - 400; | |
6204 v72 = v3->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; | |
6205 if ( v72 ) | |
6206 { | |
6207 v66 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6208 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
|
6209 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6210 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6211 return; |
6212 } | |
6213 if ( !pParty->pPlayers[player_num-1].CanAct() ) | |
6214 { | |
6215 v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6216 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
|
6217 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6218 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6219 return; |
6220 } | |
6221 v16 = v15 % 11 + 1; | |
6222 v17 = v3->pActiveSkills[v15 / 11 + 12]; | |
6223 v18 = SkillToMastery(v17) - 1; | |
1032 | 6224 switch (v18) |
6225 { | |
6226 case 0: v67 = 4; break; | |
6227 case 1: v67 = 7; break; | |
6228 case 2: v67 = 10; break; | |
6229 case 3: v67 = 11; break; | |
6230 default: | |
6231 v67 = player_num; | |
6232 } | |
6233 | |
6234 if ( v16 > v67 || !v17 ) | |
1021 | 6235 { |
1032 | 6236 v22 = pParty->pPickedItem.GetDisplayName(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6237 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
|
6238 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6239 v3->PlaySound((PlayerSpeech)20, 0); |
6240 return; | |
6241 } | |
6242 // v72 = 1; | |
6243 v3->PlaySound(SPEECH_21, 0); | |
6244 v73 = 0; | |
6245 | |
6246 | |
6247 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) | |
6248 { | |
6249 if ( !v73 ) | |
1021 | 6250 { |
1032 | 6251 pMouse->RemoveHoldingItem(); |
6252 return; | |
6253 } | |
6254 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
6255 } | |
6256 if ( v73 ) | |
6257 { | |
6258 if ( pParty->bTurnBasedModeOn ) | |
6259 { | |
6260 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100; | |
6261 thisb->SetRecoveryTime(100); | |
6262 pTurnEngine->_40471C(); | |
1021 | 6263 } |
6264 else | |
6265 { | |
1032 | 6266 thisb->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
1021 | 6267 } |
6268 } | |
1032 | 6269 pMouse->RemoveHoldingItem(); |
6270 return; | |
6271 | |
1021 | 6272 } |
6273 | |
6274 if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) | |
6275 | |
6276 { | |
6277 if ( pParty->pPlayers[player_num-1].CanAct() ) | |
6278 { | |
6279 CreateMsgScrollWindow(pParty->pPickedItem.uItemID); | |
1032 | 6280 v3->PlaySound(SPEECH_37, 0); |
1021 | 6281 return; |
6282 } | |
6283 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6284 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6285 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6286 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6287 return; |
6288 } | |
6289 else | |
6290 { | |
1019 | 6291 if ( pParty->pPickedItem.uItemID == 616 ) //Genie Lamp |
1021 | 6292 { |
6293 thisa = pParty->uCurrentMonthWeek + 1; | |
6294 if ( pParty->uCurrentMonth >= 7 ) | |
1032 | 6295 v74 = NULL; |
1021 | 6296 else |
6297 v74 = aAttributeNames[pParty->uCurrentMonth]; | |
6298 switch ( pParty->uCurrentMonth ) | |
6299 { | |
1019 | 6300 case 0: |
1021 | 6301 v3->uMight += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6302 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6303 break; |
1019 | 6304 case 1: |
1021 | 6305 v3->uIntelligence += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6306 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6307 break; |
1019 | 6308 case 2: |
1021 | 6309 v3->uWillpower += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6310 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6311 break; |
1019 | 6312 case 3: |
1021 | 6313 v3->uEndurance += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6314 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6315 break; |
1019 | 6316 case 4: |
1021 | 6317 v3->uAccuracy += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6318 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6319 break; |
1019 | 6320 case 5: |
1021 | 6321 v3->uSpeed += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6322 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6323 break; |
1019 | 6324 case 6: |
1021 | 6325 v3->uLuck += thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6326 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" |
1021 | 6327 break; |
1019 | 6328 case 7: |
1021 | 6329 party_finds_gold(1000 * thisa, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6330 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" |
1021 | 6331 break; |
1019 | 6332 case 8: |
1021 | 6333 Party::GiveFood(5 * thisa); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6334 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food" |
1021 | 6335 break; |
0 | 6336 case 9u: |
1021 | 6337 v3->uSkillPoints += 2 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6338 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]); |
1021 | 6339 break; |
1019 | 6340 case 10: |
1021 | 6341 v3->uExperience += 2500 * thisa; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6342 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]); |
1021 | 6343 break; |
1019 | 6344 case 11: |
1021 | 6345 v8 = rand() % 6; |
6346 switch (v8) | |
6347 { | |
6348 case 0: | |
6349 v3->sResFireBase += thisa; | |
6350 v13 = pGlobalTXT_LocalizationStrings[87]; | |
6351 break; | |
6352 case 1: | |
6353 v3->sResAirBase += thisa; | |
6354 v13 = pGlobalTXT_LocalizationStrings[6]; | |
6355 break; | |
6356 case 2: | |
6357 v3->sResWaterBase += thisa; | |
6358 v13 = pGlobalTXT_LocalizationStrings[240]; | |
6359 break; | |
6360 case 3: | |
6361 v3->sResEarthBase += thisa; | |
6362 v13 = pGlobalTXT_LocalizationStrings[70]; | |
6363 break; | |
6364 case 4: | |
6365 v3->sResMindBase += thisa; | |
6366 v13 = pGlobalTXT_LocalizationStrings[142]; | |
6367 break; | |
6368 case 5: | |
6369 v3->sResBodyBase += thisa; | |
6370 v13 = pGlobalTXT_LocalizationStrings[29]; | |
1019 | 6371 break; |
1021 | 6372 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6373 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
1021 | 6374 break; |
6375 | |
6376 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6377 ShowStatusBarString(pTmpBuf.data(), 2u); |
1021 | 6378 pMouse->RemoveHoldingItem(); |
6379 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
6380 v3->PlaySound(SPEECH_93, 0); | |
1032 | 6381 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6382 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
0 | 6383 { |
1021 | 6384 v3->SetCondition(Condition_Eradicated, 0); |
6385 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
0 | 6386 } |
1021 | 6387 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 ) |
6388 { | |
6389 v3->SetCondition(Condition_Dead, 0); | |
6390 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
6391 } | |
6392 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 ) | |
6393 { | |
6394 v3->SetCondition(Condition_Pertified, 0); | |
6395 pAudioPlayer->PlaySound((SoundID)215, 0, 0, -1, 0, 0, 0, 0); | |
6396 } | |
1019 | 6397 return; |
1021 | 6398 } |
6399 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple | |
6400 { | |
6401 Party::GiveFood(1u); | |
6402 pAudioPlayer->PlaySound((SoundID)(SOUND_PlayerCantCastSpell|0x2), 0, 0, -1, 0, 0, 0, 0); | |
6403 | |
6404 } | |
6405 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute | |
6406 { | |
6407 pAudioPlayer->PlaySound((SoundID)133, 0, 0, -1, 0, 0, 0, 0); | |
6408 return; | |
6409 } | |
6410 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes | |
6411 { | |
6412 pAudioPlayer->PlaySound((SoundID)134, 0, 0, -1, 0, 0, 0, 0); | |
6413 return; | |
6414 } | |
6415 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet | |
6416 { | |
6417 pAudioPlayer->PlaySound((SoundID)135, 0, 0, -1, 0, 0, 0, 0); | |
6418 return; | |
6419 } | |
1032 | 6420 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe |
1021 | 6421 { |
6422 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1); | |
1032 | 6423 v5 = PID(OBJECT_Player,player_num + 49); |
1021 | 6424 pAudioPlayer->PlaySound(SOUND_20001, v5, 0, -1, 0, 0, 0, 0); |
6425 v3->AddVariable(VAR_NumSkillPoints, 2); | |
6426 } | |
6427 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle | |
6428 { | |
6429 sub_44C28F_open_nwc_dungeon(); | |
6430 return; | |
6431 } | |
0 | 6432 else |
1021 | 6433 { |
6434 | |
6435 v68 = pParty->pPickedItem.GetDisplayName(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
6436 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
|
6437 ShowStatusBarString(pTmpBuf.data(), 2u); |
1032 | 6438 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
1021 | 6439 return; |
6440 } | |
1032 | 6441 |
0 | 6442 pMouse->RemoveHoldingItem(); |
6443 return; | |
6444 } | |
1021 | 6445 |
6446 } | |
0 | 6447 |
6448 //----- (00449BB4) -------------------------------------------------------- | |
484 | 6449 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) |
1033 | 6450 { |
0 | 6451 Player *v3; // esi@1 |
6452 signed int v4; // edi@1 | |
6453 unsigned int v5; // eax@8 | |
6454 int v6; // eax@9 | |
6455 enum CHARACTER_RACE v7; // eax@11 | |
6456 signed int v8; // eax@17 | |
6457 unsigned __int8 v9; // sf@17 | |
6458 unsigned __int8 v10; // of@17 | |
6459 int v11; // eax@19 | |
6460 unsigned int v12; // eax@20 | |
484 | 6461 unsigned int test_bit_value; // eax@25 |
6462 unsigned __int8 our_bit_value; // cl@25 | |
0 | 6463 signed int v15; // ecx@28 |
6464 ItemGen *v16; // eax@28 | |
6465 char v17; // zf@31 | |
6466 int v18; // edi@90 | |
6467 DDM_DLV_Header *v19; // eax@122 | |
6468 char v20; // cl@124 | |
6469 DDM_DLV_Header *v21; // eax@126 | |
6470 unsigned int v22; // edi@129 | |
100 | 6471 Player *v23; // esi@134 |
0 | 6472 ItemGen *v24; // ecx@135 |
6473 signed int v25; // edx@135 | |
6474 ITEM_EQUIP_TYPE v26; // ebx@155 | |
6475 char *v27; // edi@155 | |
6476 int v28; // ebx@161 | |
6477 int v29; // eax@161 | |
6478 | |
469 | 6479 v6 = 0; |
0 | 6480 v3 = this; |
6481 v4 = -1; | |
469 | 6482 if ( VarNum > VAR_AutoNotes ) |
6483 { | |
6484 switch ( VarNum ) | |
0 | 6485 { |
6486 case VAR_Invisible: | |
1167 | 6487 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) |
469 | 6488 return true; |
484 | 6489 return false; |
0 | 6490 case VAR_NumDeaths: |
6491 v4 = pParty->uNumDeaths; | |
469 | 6492 return v4 >= pValue; |
0 | 6493 case VAR_NumBounties: |
6494 v4 = pParty->uNumBountiesCollected; | |
469 | 6495 return v4 >= pValue; |
0 | 6496 case VAR_PrisonTerms: |
6497 v4 = pParty->uNumPrisonTerms; | |
469 | 6498 return v4 >= pValue; |
0 | 6499 case VAR_ArenaWinsPage: |
6500 v4 = (unsigned __int8)pParty->uNumArenaPageWins; | |
469 | 6501 return v4 >= pValue; |
0 | 6502 case VAR_ArenaWinsSquire: |
6503 v4 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
469 | 6504 return v4 >= pValue; |
0 | 6505 case VAR_ArenaWinsKnight: |
6506 v4 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
469 | 6507 return v4 >= pValue; |
0 | 6508 case VAR_ArenaWinsLord: |
6509 v4 = (unsigned __int8)pParty->uNumArenaLordWins; | |
469 | 6510 return v4 >= pValue; |
0 | 6511 case VAR_ReputationInCurrentLocation: |
6512 v19 = &pOutdoor->ddm; | |
6513 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6514 v19 = &pIndoor->dlv; | |
469 | 6515 v6 = v19->uReputation >= pValue; |
6516 return v6; | |
0 | 6517 case VAR_History_28|VAR_Sex: |
6518 v21 = &pOutdoor->ddm; | |
6519 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
6520 v21 = &pIndoor->dlv; | |
469 | 6521 v6 = v21->field_C_alert == pValue; |
0 | 6522 return v6; |
6523 case VAR_MonthEquals2|VAR_Sex: | |
6524 case VAR_MonthEquals2|VAR_Class: | |
6525 case VAR_Counter1: | |
6526 case VAR_Counter2: | |
6527 case VAR_Counter3: | |
6528 case VAR_Counter4: | |
6529 case VAR_Counter5: | |
6530 case VAR_Counter6: | |
6531 case VAR_Counter7: | |
6532 case VAR_Counter8: | |
469 | 6533 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
6534 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | |
6535 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
6536 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | |
6537 return true; | |
6538 return false; | |
0 | 6539 case VAR_NumSkillPoints: |
6540 v4 = this->uSkillPoints; | |
469 | 6541 return v4 >= pValue; |
0 | 6542 case VAR_CircusPrises: |
6543 v4 = 0; | |
100 | 6544 v23 = pParty->pPlayers;//[0].pInventoryItems; |
0 | 6545 do |
6546 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6547 v24 = v23->pInventoryItemList; |
0 | 6548 v25 = 138; |
6549 do | |
6550 { | |
6551 switch ( v24->uItemID ) | |
6552 { | |
6553 case 0x1D6u: | |
6554 ++v4; | |
6555 break; | |
6556 case 0x1D7u: | |
6557 v4 += 3; | |
6558 break; | |
6559 case 0x1DDu: | |
6560 v4 += 5; | |
6561 break; | |
6562 } | |
6563 ++v24; | |
6564 --v25; | |
6565 } | |
6566 while ( v25 ); | |
100 | 6567 ++v23; |
0 | 6568 } |
100 | 6569 while ( v23 <= &pParty->pPlayers[3] ); |
469 | 6570 return v4 >= pValue; |
0 | 6571 case VAR_MonthEquals2: |
469 | 6572 v6 = pParty->uCurrentMonth == pValue; |
6573 return v6; | |
0 | 6574 case VAR_IsFlying: |
6575 if ( pParty->bFlying | |
1167 | 6576 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
469 | 6577 return true; |
6578 return false; | |
0 | 6579 case VAR_HiredNPCHasSpeciality: |
469 | 6580 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); |
0 | 6581 return v6; |
6582 case VAR_NPCs2: | |
469 | 6583 return pNPCStats->pNewNPCData[pValue].Hired(); |
0 | 6584 case VAR_MonthEquals|VAR_CurrentSP: |
1033 | 6585 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
6586 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
484 | 6587 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
469 | 6588 return v4 >= pValue; |
6589 v4 = pValue; | |
6590 return v4 >= pValue; | |
0 | 6591 case VAR_ItemEquipped: |
6592 v26 = (ITEM_EQUIP_TYPE)0; | |
6593 v27 = (char *)&this->pEquipment; | |
6594 break; | |
6595 case VAR_GoldInBank: | |
6596 v4 = pParty->uNumGoldInBank; | |
469 | 6597 return v4 >= pValue; |
0 | 6598 case VAR_ThieverySkill|0x80: |
6599 v28 = GetActualMight(); | |
6600 v29 = v3->GetBaseStrength(); | |
6601 goto LABEL_168; | |
6602 case VAR_DisarmTrapSkill|0x80: | |
6603 v28 = GetActualIntelligence(); | |
6604 v29 = v3->GetBaseIntelligence(); | |
6605 goto LABEL_168; | |
6606 case VAR_MonthEquals: | |
6607 v28 = GetActualWillpower(); | |
6608 v29 = v3->GetBaseWillpower(); | |
6609 goto LABEL_168; | |
6610 case VAR_MonthEquals|VAR_Sex: | |
6611 v28 = GetActualEndurance(); | |
6612 v29 = v3->GetBaseEndurance(); | |
6613 goto LABEL_168; | |
6614 case VAR_IdentifyMonsterSkill|0x80: | |
6615 v28 = GetActualSpeed(); | |
6616 v29 = v3->GetBaseSpeed(); | |
6617 goto LABEL_168; | |
6618 case VAR_ArmsmasterSkill|0x80: | |
6619 v28 = GetActualAccuracy(); | |
6620 v29 = v3->GetBaseAccuracy(); | |
6621 goto LABEL_168; | |
6622 case VAR_MonthEquals|VAR_MaxHP: | |
6623 v28 = GetActualLuck(); | |
6624 v29 = v3->GetBaseLuck(); | |
6625 LABEL_168: | |
6626 v10 = __OFSUB__(v28, v29); | |
6627 v9 = v28 - v29 < 0; | |
6628 LABEL_169: | |
6629 if ( v9 ^ v10 ) | |
469 | 6630 return v4 >= pValue; |
6631 return true; | |
0 | 6632 default: |
469 | 6633 return v4 >= pValue; |
0 | 6634 } |
6635 while ( !v3->HasItemEquipped(v26) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6636 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) |
0 | 6637 { |
6638 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
6639 v27 += 4; | |
6640 if ( (signed int)v26 >= 16 ) | |
469 | 6641 return false; |
6642 } | |
6643 return true; | |
6644 } | |
6645 if ( VarNum == VAR_AutoNotes ) | |
0 | 6646 { |
1033 | 6647 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; |
6648 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | |
484 | 6649 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6650 return false; | |
6651 return true; | |
469 | 6652 } |
6653 if ( VarNum <= VAR_BaseLuck ) | |
6654 { | |
6655 if ( VarNum != VAR_BaseLuck ) | |
6656 { | |
6657 switch ( VarNum ) | |
0 | 6658 { |
6659 case VAR_Hour: | |
469 | 6660 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
6661 return true; | |
6662 return false; | |
0 | 6663 case VAR_DayOfYear: |
469 | 6664 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; |
6665 v6 = v5 == pValue; | |
6666 return v6; | |
0 | 6667 case VAR_DayOfWeek: |
469 | 6668 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; |
6669 v6 = v5 == pValue; | |
0 | 6670 return v6; |
6671 case VAR_Sex: | |
469 | 6672 if ( pValue == (CHARACTER_RACE)this->uSex ) |
6673 return true; | |
6674 return v4 >= pValue; | |
0 | 6675 case VAR_Class: |
135 | 6676 v7 = (CHARACTER_RACE)this->classType; |
469 | 6677 if ( pValue == v7 ) |
6678 return true; | |
6679 return v4 >= pValue; | |
0 | 6680 case VAR_Race: |
6681 v7 = GetRace(); | |
469 | 6682 if ( pValue == v7 ) |
6683 return true; | |
6684 return v4 >= pValue; | |
0 | 6685 case VAR_CurrentHP: |
6686 v4 = this->sHealth; | |
469 | 6687 return v4 >= pValue; |
0 | 6688 case VAR_MaxHP: |
6689 v8 = GetMaxHealth(); | |
6690 v10 = __OFSUB__(v3->sHealth, v8); | |
6691 v9 = v3->sHealth - v8 < 0; | |
6692 goto LABEL_169; | |
6693 case VAR_CurrentSP: | |
6694 v4 = this->sMana; | |
469 | 6695 return v4 >= pValue; |
0 | 6696 case VAR_MaxSP: |
6697 v11 = GetMaxMana(); | |
6698 v10 = __OFSUB__(v3->sMana, v11); | |
6699 v9 = v3->sMana - v11 < 0; | |
6700 goto LABEL_169; | |
6701 case VAR_ActualAC: | |
6702 v12 = GetActualAC(); | |
6703 goto _j_cmp_against_arg; | |
6704 case VAR_ACModifier: | |
6705 v4 = this->sACModifier; | |
469 | 6706 return v4 >= pValue; |
0 | 6707 case VAR_BaseLevel: |
6708 v4 = this->uLevel; | |
469 | 6709 return v4 >= pValue; |
0 | 6710 case VAR_LevelModifier: |
6711 v4 = this->sLevelModifier; | |
469 | 6712 return v4 >= pValue; |
0 | 6713 case VAR_Age: |
6714 v12 = GetActualAge(); | |
6715 goto _j_cmp_against_arg; | |
6716 case VAR_Award: | |
1033 | 6717 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
6718 our_bit_value = this->_guilds_member_bits[((signed __int16)pValue - 1) /8]; | |
484 | 6719 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) |
6720 return true; | |
6721 return false; | |
0 | 6722 case VAR_Experience: |
6723 v4 = LODWORD(this->uExperience); | |
469 | 6724 return v4 >= pValue; |
0 | 6725 case VAR_QBits_QuestsDone: |
484 | 6726 test_bit_value = 0x80u >> (pValue - 1) % 8; |
6727 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | |
6728 if ( test_bit_value & our_bit_value ) | |
478 | 6729 return true; |
6730 return false; | |
0 | 6731 case VAR_PlayerItemInHands: |
6732 v15 = 0; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
6733 v16 = v3->pInventoryItemList; |
0 | 6734 break; |
6735 case VAR_FixedGold: | |
6736 v4 = pParty->uNumGold; | |
469 | 6737 return v4 >= pValue; |
0 | 6738 case VAR_MightBonus: |
6739 v4 = this->uMightBonus; | |
469 | 6740 return v4 >= pValue; |
0 | 6741 case VAR_IntellectBonus: |
6742 v4 = this->uIntelligenceBonus; | |
469 | 6743 return v4 >= pValue; |
0 | 6744 case VAR_PersonalityBonus: |
6745 v4 = this->uWillpowerBonus; | |
469 | 6746 return v4 >= pValue; |
0 | 6747 case VAR_EnduranceBonus: |
6748 v4 = this->uEnduranceBonus; | |
469 | 6749 return v4 >= pValue; |
0 | 6750 case VAR_SpeedBonus: |
6751 v4 = this->uSpeedBonus; | |
469 | 6752 return v4 >= pValue; |
0 | 6753 case VAR_AccuracyBonus: |
6754 v4 = this->uAccuracyBonus; | |
469 | 6755 return v4 >= pValue; |
0 | 6756 case VAR_LuckBonus: |
6757 v4 = this->uLuckBonus; | |
469 | 6758 return v4 >= pValue; |
0 | 6759 case VAR_BaseMight: |
6760 v4 = this->uMight; | |
469 | 6761 return v4 >= pValue; |
0 | 6762 case VAR_BaseIntellect: |
6763 v4 = this->uIntelligence; | |
469 | 6764 return v4 >= pValue; |
0 | 6765 case VAR_BasePersonality: |
6766 v4 = this->uWillpower; | |
469 | 6767 return v4 >= pValue; |
0 | 6768 case VAR_BaseEndurance: |
6769 v4 = this->uEndurance; | |
469 | 6770 return v4 >= pValue; |
0 | 6771 case VAR_BaseSpeed: |
6772 v4 = this->uSpeed; | |
469 | 6773 return v4 >= pValue; |
0 | 6774 case VAR_BaseAccuracy: |
6775 v4 = this->uAccuracy; | |
469 | 6776 return v4 >= pValue; |
0 | 6777 case VAR_FixedFood: |
6778 v4 = pParty->uNumFoodRations; | |
469 | 6779 return v4 >= pValue; |
0 | 6780 default: |
469 | 6781 return v4 >= pValue; |
6782 } | |
6783 while ( v16->uItemID != pValue ) | |
0 | 6784 { |
6785 ++v15; | |
6786 ++v16; | |
6787 if ( v15 >= 138 ) | |
6788 { | |
469 | 6789 v6 = pParty->pPickedItem.uItemID == pValue; |
0 | 6790 return v6; |
6791 } | |
6792 } | |
469 | 6793 return true; |
0 | 6794 } |
6795 v4 = this->uLuck; | |
469 | 6796 return v4 >= pValue; |
6797 } | |
6798 if ( VarNum <= VAR_MagicResistance ) | |
6799 { | |
6800 if ( VarNum == VAR_MagicResistance ) | |
0 | 6801 { |
6802 v4 = this->sResMagicBase; | |
6803 } | |
6804 else | |
6805 { | |
469 | 6806 switch ( VarNum ) |
0 | 6807 { |
6808 case VAR_FireResistance: | |
6809 v4 = this->sResFireBase; | |
469 | 6810 return v4 >= pValue; |
0 | 6811 case VAR_AirResistance: |
6812 v4 = this->sResAirBase; | |
469 | 6813 return v4 >= pValue; |
0 | 6814 case VAR_WaterResistance: |
6815 v4 = this->sResWaterBase; | |
469 | 6816 return v4 >= pValue; |
0 | 6817 case VAR_EarthResistance: |
6818 v4 = this->sResEarthBase; | |
469 | 6819 return v4 >= pValue; |
0 | 6820 case VAR_SpiritResistance: |
6821 v4 = this->sResSpiritBase; | |
469 | 6822 return v4 >= pValue; |
0 | 6823 case VAR_MindResistance: |
6824 v4 = this->sResMindBase; | |
469 | 6825 return v4 >= pValue; |
0 | 6826 case VAR_BodyResistance: |
6827 v4 = this->sResBodyBase; | |
469 | 6828 return v4 >= pValue; |
0 | 6829 case VAR_LightResistance: |
6830 v4 = this->sResLightBase; | |
469 | 6831 return v4 >= pValue; |
0 | 6832 case VAR_DarkResistance: |
6833 v4 = this->sResDarkBase; | |
469 | 6834 return v4 >= pValue; |
0 | 6835 case VAR_ActualMight: |
6836 v12 = GetActualMight(); | |
6837 goto _j_cmp_against_arg; | |
6838 case VAR_ActualIntellect: | |
6839 v12 = GetActualIntelligence(); | |
6840 goto _j_cmp_against_arg; | |
6841 case VAR_ActualPersonality: | |
6842 v12 = GetActualWillpower(); | |
6843 goto _j_cmp_against_arg; | |
6844 case VAR_ActualEndurance: | |
6845 v12 = GetActualEndurance(); | |
6846 goto _j_cmp_against_arg; | |
6847 case VAR_ActualSpeed: | |
6848 v12 = GetActualSpeed(); | |
6849 goto _j_cmp_against_arg; | |
6850 case VAR_ActualAccuracy: | |
6851 v12 = GetActualAccuracy(); | |
6852 goto _j_cmp_against_arg; | |
6853 case VAR_ActualLuck: | |
6854 v12 = GetActualLuck(); | |
6855 _j_cmp_against_arg: | |
6856 v4 = v12; | |
6857 break; | |
6858 default: | |
469 | 6859 return v4 >= pValue; |
6860 } | |
6861 } | |
6862 return v4 >= pValue; | |
6863 } | |
6864 if ( VarNum <= VAR_DisarmTrapSkill ) | |
6865 { | |
6866 if ( VarNum != VAR_DisarmTrapSkill ) | |
6867 { | |
6868 if ( VarNum <= VAR_MindResistanceBonus ) | |
6869 { | |
6870 switch ( VarNum ) | |
0 | 6871 { |
6872 case VAR_MindResistanceBonus: | |
6873 v4 = this->sResMindBonus; | |
6874 break; | |
6875 case VAR_FireResistanceBonus: | |
6876 v4 = this->sResFireBonus; | |
6877 break; | |
6878 case VAR_AirResistanceBonus: | |
6879 v4 = this->sResAirBonus; | |
6880 break; | |
6881 case VAR_WaterResistanceBonus: | |
6882 v4 = this->sResWaterBonus; | |
6883 break; | |
6884 case VAR_EarthResistanceBonus: | |
6885 v4 = this->sResEarthBonus; | |
6886 break; | |
6887 case VAR_SpiritResistanceBonus: | |
6888 v4 = this->sResSpiritBonus; | |
6889 break; | |
6890 } | |
469 | 6891 return v4 >= pValue; |
6892 } | |
6893 if ( VarNum == VAR_BodyResistanceBonus ) | |
0 | 6894 { |
6895 v4 = this->sResBodyBonus; | |
469 | 6896 return v4 >= pValue; |
6897 } | |
6898 if ( VarNum == VAR_LightResistanceBonus ) | |
0 | 6899 { |
6900 v4 = this->sResLightBonus; | |
469 | 6901 return v4 >= pValue; |
6902 } | |
6903 if ( VarNum == VAR_DarkResistanceBonus ) | |
0 | 6904 { |
6905 v4 = this->sResDarkBonus; | |
469 | 6906 return v4 >= pValue; |
6907 } | |
6908 if ( VarNum == VAR_MagicResistanceBonus ) | |
0 | 6909 { |
6910 v4 = this->sResMagicBonus; | |
469 | 6911 return v4 >= pValue; |
6912 } | |
6913 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | |
6914 return v4 >= pValue; | |
0 | 6915 } |
6916 LABEL_90: | |
469 | 6917 v18 = *((short *)&this->pConditions[16] + VarNum); |
6918 if ( pValue <= 63 ) | |
0 | 6919 v4 = v18 & 0x3F; |
6920 else | |
469 | 6921 v4 = pValue & v18; |
6922 return v4 >= pValue; | |
6923 } | |
6924 if ( VarNum == 104 ) | |
0 | 6925 goto LABEL_90; |
469 | 6926 if ( (signed int)VarNum <= 104 ) |
6927 return v4 >= pValue; | |
6928 if ( (signed int)VarNum > 0x79 ) | |
6929 { | |
6930 if ( VarNum != 122 ) | |
6931 { | |
6932 if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) | |
6933 v4 = (unsigned __int8)byte_5E4C15[VarNum]; | |
6934 return v4 >= pValue; | |
0 | 6935 } |
6936 v4 = GetMajorConditionIdx(); | |
6937 if ( v4 != 18 ) | |
6938 { | |
469 | 6939 return v4 >= pValue; |
6940 } | |
6941 v4 = pValue; | |
6942 return v4 >= pValue; | |
6943 } | |
1072 | 6944 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); |
0 | 6945 } |
6946 | |
6947 | |
6948 //----- (0044A5CB) -------------------------------------------------------- | |
492 | 6949 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
6950 { | |
6951 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
|
6952 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
|
6953 unsigned int v5_unused; // edi@1 |
0 | 6954 unsigned int v6; // esi@13 |
6955 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
|
6956 signed int v8_unused; // eax@17 |
0 | 6957 ItemGen *v9; // ecx@17 |
6958 int v10; // eax@21 | |
6959 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
|
6960 Player *unused12; // ecx@44 |
0 | 6961 char *v13; // ecx@45 |
6962 Player *v14; // ecx@49 | |
6963 int v15; // ecx@86 | |
6964 int v16; // esi@106 | |
6965 char v17; // al@106 | |
6966 int v18; // eax@107 | |
6967 Player *v19; // ecx@112 | |
6968 Player *v20; // ecx@127 | |
6969 int v21; // eax@127 | |
6970 int v22; // eax@145 | |
6971 char v23; // zf@146 | |
6972 DDM_DLV_Header *v24; // ecx@148 | |
6973 signed int v25; // eax@172 | |
6974 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
|
6975 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
|
6976 int v28_unused; // [sp-4h] [bp-38h]@84 |
0 | 6977 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
|
6978 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
|
6979 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
|
6980 |
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
|
6981 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
|
6982 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
|
6983 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6984 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
|
6985 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6986 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
|
6987 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
|
6988 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6989 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
6990 assert(currPlayerId != -1); |
492 | 6991 if ( var_type > VAR_AutoNotes ) |
6992 { | |
6993 if ( var_type <= VAR_GoldInBank ) | |
6994 { | |
6995 if ( var_type == VAR_GoldInBank ) | |
6996 { | |
6997 pParty->uNumGoldInBank = var_value; | |
0 | 6998 return; |
6999 } | |
492 | 7000 if ( var_type <= VAR_Counter8 ) |
7001 { | |
7002 if ( (signed int)var_type >= 0xF5 ) | |
0 | 7003 { |
492 | 7004 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); |
7005 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7006 } |
7007 else | |
7008 { | |
492 | 7009 switch ( var_type ) |
0 | 7010 { |
7011 case VAR_MonthEquals|VAR_CurrentSP: | |
492 | 7012 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
0 | 7013 break; |
7014 case VAR_NPCs2: | |
7015 pParty->field_709 = 0; | |
492 | 7016 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
1035 | 7017 pParty->CountHirelings(); |
7018 viewparams->bRedrawGameUI = true; | |
0 | 7019 break; |
7020 case VAR_NumSkillPoints: | |
492 | 7021 this->uSkillPoints = var_value; |
0 | 7022 break; |
7023 } | |
7024 } | |
7025 return; | |
7026 } | |
492 | 7027 if ( var_type < VAR_Counter9 ) |
0 | 7028 return; |
492 | 7029 if ( (signed int)var_type <= 0x112 ) |
7030 { | |
7031 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7032 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7033 } |
7034 else | |
7035 { | |
492 | 7036 if ( var_type == VAR_ReputationInCurrentLocation ) |
0 | 7037 { |
7038 v24 = &pOutdoor->ddm; | |
7039 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7040 v24 = &pIndoor->dlv; | |
492 | 7041 v24->uReputation = var_value; |
7042 if ( var_value > 10000 ) | |
0 | 7043 v24->uReputation = 10000; |
7044 return; | |
7045 } | |
492 | 7046 if ( var_type <= VAR_ReputationInCurrentLocation |
7047 || var_type > VAR_History_28 | |
7048 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) | |
7049 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7050 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, |
492 | 7051 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7052 v23) ) |
7053 return; | |
7054 bFlashHistoryBook = 1; | |
7055 } | |
492 | 7056 v25 = 8 * currPlayerId + 400; |
862 | 7057 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
|
7058 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
0 | 7059 return; |
7060 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7061 switch ( var_type ) |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7062 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7063 case VAR_NumDeaths: |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7064 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
|
7065 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7066 case VAR_NumBounties: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7067 pParty->uNumBountiesCollected = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7068 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7069 case VAR_PrisonTerms: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7070 pParty->uNumPrisonTerms = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7071 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7072 case VAR_ArenaWinsPage: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7073 pParty->uNumArenaPageWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7074 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7075 case VAR_ArenaWinsSquire: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7076 pParty->uNumArenaSquireWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7077 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7078 case VAR_ArenaWinsKnight: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7079 pParty->uNumArenaKnightWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7080 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7081 case VAR_ArenaWinsLord: |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7082 pParty->uNumArenaLordWins = var_value; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7083 break; |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7084 } |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7085 return; |
0 | 7086 } |
492 | 7087 if ( var_type == VAR_AutoNotes ) |
7088 { | |
7089 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
|
7090 //&& (&dword_723718_autonote_related)[8 * a3] ) |
1310 | 7091 && pAutonoteTxt[var_value].pText ) |
492 | 7092 { |
7093 v20 = pPlayers[currPlayerId + 1]; | |
187 | 7094 v20->PlaySound(SPEECH_96, 0); |
1310 | 7095 v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; |
0 | 7096 bFlashAutonotesBook = 1; |
981 | 7097 _506568_autonote_type = v21; |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7098 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
0 | 7099 } |
492 | 7100 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7101 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7102 return; |
0 | 7103 } |
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
|
7104 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
|
7105 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7106 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
|
7107 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7108 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
|
7109 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
|
7110 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
|
7111 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
|
7112 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
|
7113 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
|
7114 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7115 v9 = NULL; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7116 for (int i = 0; i < 138; i++) |
0 | 7117 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
7118 v9 = &this->pInventoryItemList[i]; |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
7119 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
|
7120 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
|
7121 } |
1358
61010a655c94
a few itemID changed to their enum values + added a few new ones
Grumpy7
parents:
1357
diff
changeset
|
7122 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
|
7123 { |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7124 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
|
7125 *(int *)(v10 + 532) = 601; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7126 *(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
|
7127 } |
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
|
7128 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
|
7129 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
|
7130 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
|
7131 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
|
7132 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
|
7133 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
|
7134 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
|
7135 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
|
7136 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
|
7137 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
|
7138 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
|
7139 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
|
7140 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
|
7141 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
|
7142 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7143 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
|
7144 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
|
7145 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7146 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
|
7147 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7148 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
|
7149 this->uVoiceID = 20; |
0 | 7150 } |
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
|
7151 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
|
7152 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7153 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
|
7154 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
|
7155 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
|
7156 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
|
7157 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
|
7158 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
|
7159 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
|
7160 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
|
7161 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
|
7162 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
|
7163 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
|
7164 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
|
7165 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
|
7166 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
|
7167 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
|
7168 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
|
7169 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
|
7170 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
|
7171 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
|
7172 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
|
7173 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
|
7174 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
|
7175 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
|
7176 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
|
7177 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
|
7178 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
|
7179 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7180 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7181 //&& 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
|
7182 && 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
|
7183 { |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7184 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
|
7185 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7186 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
|
7187 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7188 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_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
|
7189 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
|
7190 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
|
7191 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
|
7192 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
|
7193 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
|
7194 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
|
7195 // && (&dword_722F10)[4 * a3] ) |
1310 | 7196 && pQuestTable[var_value] ) |
0 | 7197 { |
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
|
7198 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
|
7199 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
|
7200 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
|
7201 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7202 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
|
7203 } |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7204 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
|
7205 _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
|
7206 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
|
7207 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
|
7208 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
|
7209 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
|
7210 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
|
7211 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
|
7212 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
|
7213 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
|
7214 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
|
7215 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
|
7216 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
|
7217 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
|
7218 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
|
7219 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
|
7220 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
|
7221 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
|
7222 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
|
7223 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
|
7224 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
|
7225 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
|
7226 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
|
7227 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
|
7228 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
|
7229 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
|
7230 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
|
7231 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
|
7232 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
|
7233 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
|
7234 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
|
7235 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
|
7236 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
|
7237 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
|
7238 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
|
7239 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
|
7240 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
|
7241 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
|
7242 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
|
7243 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
|
7244 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
|
7245 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
|
7246 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
|
7247 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
|
7248 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
|
7249 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
|
7250 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
|
7251 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
|
7252 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7253 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
|
7254 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
|
7255 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
|
7256 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7257 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
|
7258 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
|
7259 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
|
7260 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7261 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
|
7262 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
|
7263 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
|
7264 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7265 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
|
7266 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
|
7267 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
|
7268 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7269 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
|
7270 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
|
7271 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
|
7272 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7273 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
|
7274 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
|
7275 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
|
7276 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7277 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
|
7278 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
|
7279 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
|
7280 } |
0 | 7281 LABEL_111: |
187 | 7282 v26 = SPEECH_91; |
0 | 7283 LABEL_112: |
492 | 7284 v19 = pPlayers[currPlayerId + 1]; |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7285 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
|
7286 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7287 PlaySoundBasedOnCondition(currPlayerId); |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7288 return; |
0 | 7289 } |
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
|
7290 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
|
7291 { |
492 | 7292 switch ( var_type ) |
0 | 7293 { |
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
|
7294 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
|
7295 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
|
7296 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
|
7297 goto LABEL_111; |
0 | 7298 case VAR_ActualIntellect: |
7299 LABEL_68: | |
492 | 7300 this->uIntelligenceBonus = (unsigned __int8)var_value; |
0 | 7301 goto LABEL_111; |
7302 case VAR_ActualPersonality: | |
7303 LABEL_69: | |
492 | 7304 this->uWillpowerBonus = (unsigned __int8)var_value; |
0 | 7305 goto LABEL_111; |
7306 case VAR_ActualEndurance: | |
7307 LABEL_70: | |
492 | 7308 this->uEnduranceBonus = (unsigned __int8)var_value; |
0 | 7309 goto LABEL_111; |
7310 case VAR_ActualSpeed: | |
7311 LABEL_71: | |
492 | 7312 this->uSpeedBonus = (unsigned __int8)var_value; |
0 | 7313 goto LABEL_111; |
7314 case VAR_ActualAccuracy: | |
7315 LABEL_72: | |
492 | 7316 this->uAccuracyBonus = (unsigned __int8)var_value; |
0 | 7317 goto LABEL_111; |
7318 case VAR_ActualLuck: | |
7319 LABEL_73: | |
492 | 7320 this->uLuckBonus = (unsigned __int8)var_value; |
0 | 7321 goto LABEL_111; |
7322 case VAR_FireResistance: | |
492 | 7323 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
|
7324 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7325 goto LABEL_112; |
0 | 7326 case VAR_AirResistance: |
492 | 7327 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
|
7328 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7329 goto LABEL_112; |
0 | 7330 case VAR_WaterResistance: |
492 | 7331 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
|
7332 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7333 goto LABEL_112; |
0 | 7334 case VAR_EarthResistance: |
492 | 7335 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
|
7336 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7337 goto LABEL_112; |
0 | 7338 case VAR_SpiritResistance: |
492 | 7339 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
|
7340 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7341 goto LABEL_112; |
0 | 7342 case VAR_MindResistance: |
492 | 7343 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
|
7344 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7345 goto LABEL_112; |
0 | 7346 case VAR_BodyResistance: |
492 | 7347 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
|
7348 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7349 goto LABEL_112; |
0 | 7350 case VAR_LightResistance: |
492 | 7351 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
|
7352 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7353 goto LABEL_112; |
0 | 7354 case VAR_DarkResistance: |
492 | 7355 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
|
7356 v26 = 92; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7357 goto LABEL_112; |
0 | 7358 case VAR_MagicResistance: |
492 | 7359 this->sResMagicBase = (unsigned __int8)var_value; |
0 | 7360 v26 = 92; |
7361 goto LABEL_112; | |
7362 default: | |
7363 return; | |
7364 } | |
7365 return; | |
7366 } | |
7367 HIWORD(v15) = 0; | |
492 | 7368 if ( var_type > VAR_DisarmTrapSkill ) |
7369 { | |
7370 if ( var_type != VAR_LearningSkill ) | |
7371 { | |
7372 if ( var_type <= VAR_LearningSkill ) | |
0 | 7373 return; |
492 | 7374 if ( var_type <= VAR_Eradicated ) |
7375 { | |
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
|
7376 this->SetCondition(var_type - 105, 1); |
0 | 7377 } |
7378 else | |
7379 { | |
492 | 7380 if ( var_type != VAR_MajorCondition ) |
0 | 7381 { |
492 | 7382 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
7383 byte_5E4C15[var_type] = var_value; | |
0 | 7384 return; |
7385 } | |
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
|
7386 memset(this, 0, 0xA0u); |
0 | 7387 } |
7388 } | |
7389 else | |
7390 { | |
1260
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7391 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
|
7392 v17 = *(char *)v16; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7393 if ( var_value <= VAR_BodyResistanceBonus ) |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7394 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7395 LOWORD(v15) = (unsigned __int8)var_value; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7396 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7397 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7398 else |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7399 { |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7400 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
|
7401 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7402 *(short *)v16 = v18; |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7403 } |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7404 LABEL_124: |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7405 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7406 PlaySoundBasedOnCondition(currPlayerId); |
dd70fc7eaf08
Player::SetVariable cleanup - preparing to remove LABEL_111 and LABEL_112
Grumpy7
parents:
1259
diff
changeset
|
7407 return; |
0 | 7408 } |
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
|
7409 if ( var_type <= VAR_MagicResistanceBonus ) |
492 | 7410 { |
7411 switch ( var_type ) | |
0 | 7412 { |
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
|
7413 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
|
7414 this->sResFireBonus = (unsigned __int8)var_value; |
0 | 7415 break; |
7416 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
|
7417 this->sResAirBonus = (unsigned __int8)var_value; |
0 | 7418 break; |
7419 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
|
7420 this->sResWaterBonus = (unsigned __int8)var_value; |
0 | 7421 break; |
7422 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
|
7423 this->sResEarthBonus = (unsigned __int8)var_value; |
0 | 7424 break; |
7425 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
|
7426 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
|
7427 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
|
7428 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
|
7429 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
|
7430 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
|
7431 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
|
7432 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
|
7433 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
|
7434 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
|
7435 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
|
7436 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
|
7437 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
|
7438 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
|
7439 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
|
7440 case VAR_PhysicalResistanceBonus: |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7441 assert("VAR_PhysicalResistanceBonus variable unsupported" && false); |
7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
Grumpy7
parents:
1213
diff
changeset
|
7442 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
|
7443 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
|
7444 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
|
7445 this->sResMagicBonus = (unsigned __int8)var_value; |
0 | 7446 break; |
7447 default: | |
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
|
7448 assert("Unexpected var_type" && false); |
0 | 7449 return; |
7450 break; | |
7451 } | |
7452 goto LABEL_111; | |
7453 } | |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7454 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
|
7455 { |
1258
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7456 return; |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7457 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7458 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7459 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7460 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7461 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7462 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
|
7463 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7464 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
|
7465 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
|
7466 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
|
7467 } |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7468 |
eb1a22f7dfef
Player::SetVariable cleanup - removed some labels at the cost of 2 extra small functions
Grumpy7
parents:
1251
diff
changeset
|
7469 //----- (new function) -------------------------------------------------------- |
1259
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7470 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
|
7471 { |
d6e5b6b76612
Player::SetVariable cleanup - removing unused variables and function calls with them, some case shuffling
Grumpy7
parents:
1258
diff
changeset
|
7472 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
|
7473 } |
0 | 7474 |
7475 //----- (0044AFFB) -------------------------------------------------------- | |
310 | 7476 void Player::AddVariable(enum VariableType var_type, signed int val) |
0 | 7477 { |
7478 char v3; // bl@1 | |
7479 Player *v4; // esi@1 | |
7480 signed int uPlayerIdx; // edi@1 | |
7481 int v6; // eax@15 | |
7482 unsigned int v7; // esi@18 | |
7483 int *v8; // ebx@21 | |
7484 int v9; // eax@22 | |
7485 signed int v10; // eax@24 | |
7486 int v11; // eax@27 | |
7487 __int16 *v12; // esi@28 | |
7488 Player *v13; // ecx@34 | |
7489 Player *v14; // ecx@36 | |
7490 char *v15; // ecx@37 | |
7491 unsigned __int8 v16; // cf@38 | |
7492 Player *v17; // ecx@42 | |
7493 __int16 *v18; // esi@53 | |
7494 __int16 *v19; // esi@62 | |
7495 char *v20; // esi@107 | |
7496 __int16 v21; // dx@107 | |
7497 int v22; // ecx@107 | |
7498 Player *v23; // ecx@132 | |
7499 int v24; // eax@132 | |
7500 int v25; // eax@150 | |
7501 char v26; // zf@151 | |
7502 DDM_DLV_Header *v27; // eax@153 | |
7503 signed int v28; // eax@176 | |
7504 int v29; // [sp-8h] [bp-40h]@84 | |
310 | 7505 // signed int v30; // [sp-4h] [bp-3Ch]@4 |
0 | 7506 int v31; // [sp-4h] [bp-3Ch]@84 |
7507 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | |
7508 unsigned int v33; // [sp+30h] [bp-8h]@34 | |
7509 char v34; // [sp+37h] [bp-1h]@1 | |
7510 | |
7511 auto Dst = this; | |
7512 v3 = 0; | |
7513 v34 = 0; | |
7514 v4 = Dst; | |
7515 uPlayerIdx = 0; | |
7516 if ( Dst == pPlayers[2] ) | |
7517 uPlayerIdx = 1; | |
310 | 7518 else if ( Dst == pPlayers[3] ) |
7519 uPlayerIdx = 2; | |
7520 else if ( Dst == pPlayers[4] ) | |
7521 uPlayerIdx = 3; | |
7522 | |
7523 if ( var_type <= VAR_AutoNotes ) | |
7524 { | |
7525 if ( var_type != VAR_AutoNotes ) | |
7526 { | |
7527 if ( var_type <= VAR_ActualMight ) | |
7528 { | |
7529 if ( var_type != VAR_ActualMight ) | |
0 | 7530 { |
310 | 7531 switch ( var_type ) |
0 | 7532 { |
7533 case VAR_RandomGold: | |
7534 if ( !val ) | |
7535 val = 1; | |
7536 v6 = rand(); | |
7537 party_finds_gold(v6 % val + 1, 1); | |
7538 GameUI_DrawFoodAndGold(); | |
7539 return; | |
7540 case VAR_RandomFood: | |
7541 if ( !val ) | |
7542 val = 1; | |
7543 v7 = rand() % val + 1; | |
7544 Party::GiveFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7545 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
|
7546 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7547 GameUI_DrawFoodAndGold(); |
7548 goto _play_sound; | |
7549 case VAR_Sex: | |
7550 Dst->uSex = (PLAYER_SEX)val; | |
7551 goto _play_anim_and_exit; | |
7552 case VAR_Class: | |
135 | 7553 Dst->classType = (PLAYER_CLASS_TYPE)val; |
0 | 7554 goto _play_anim_and_exit; |
7555 case VAR_CurrentHP: | |
7556 v8 = &Dst->sHealth; | |
7557 *v8 += val; | |
7558 if ( Dst->sHealth <= Dst->GetMaxHealth() ) | |
7559 goto _play_anim_and_exit; | |
7560 v9 = v4->GetMaxHealth(); | |
7561 goto LABEL_23; | |
7562 case VAR_MaxHP: | |
7563 v10 = Dst->GetMaxHealth(); | |
7564 v4->_health_related = 0; | |
7565 v4->uFullHealthBonus = 0; | |
7566 v4->sHealth = v10; | |
7567 return; | |
7568 case VAR_CurrentSP: | |
7569 v8 = &Dst->sMana; | |
7570 *v8 += val; | |
7571 if ( Dst->sMana > GetMaxMana() ) | |
7572 { | |
7573 v9 = v4->GetMaxMana(); | |
7574 LABEL_23: | |
7575 *v8 = v9; | |
7576 } | |
7577 goto _play_anim_and_exit; | |
7578 case VAR_MaxSP: | |
7579 v11 = GetMaxMana(); | |
7580 v4->_mana_related = 0; | |
7581 v4->uFullManaBonus = 0; | |
7582 v4->sMana = v11; | |
7583 return; | |
7584 case VAR_ACModifier: | |
7585 v12 = &Dst->sACModifier; | |
7586 goto LABEL_29; | |
7587 case VAR_BaseLevel: | |
7588 v12 = (__int16 *)&Dst->uLevel; | |
7589 goto LABEL_29; | |
7590 case VAR_LevelModifier: | |
7591 v12 = &Dst->sLevelModifier; | |
7592 LABEL_29: | |
7593 *v12 += val; | |
7594 if ( *v12 > 255 ) | |
7595 *v12 = 255; | |
7596 goto _play_anim_and_exit; | |
7597 case VAR_Age: | |
7598 Dst->sAgeModifier += val; | |
7599 return; | |
7600 case VAR_Award: | |
7601 v13 = pPlayers[uPlayerIdx + 1]; | |
521 | 7602 if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_guilds_member_bits, val) |
7603 | |
492 | 7604 && pAwards[val].pText ) |
0 | 7605 { |
7606 v14 = pPlayers[uPlayerIdx + 1]; | |
7607 v34 = 1; | |
7608 v3 = 1; | |
187 | 7609 v14->PlaySound(SPEECH_96, 0); |
0 | 7610 } |
735 | 7611 v15 = (char *)v4->_guilds_member_bits; |
0 | 7612 goto LABEL_44; |
7613 case VAR_Experience: | |
7614 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | |
7615 LODWORD(Dst->uExperience) += val; | |
7616 HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16; | |
7617 if ( (signed __int64)Dst->uExperience > 4000000000i64 ) | |
7618 Dst->uExperience = 4000000000i64; | |
7619 goto _play_anim_and_exit; | |
7620 case VAR_QBits_QuestsDone: | |
484 | 7621 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
|
7622 //&& (&dword_722F10)[4 * val] ) |
1310 | 7623 && pQuestTable[val] ) |
0 | 7624 { |
501 | 7625 //v17 = pPlayers[uPlayerIdx + 1]; |
0 | 7626 bFlashQuestBook = 1; |
7627 v34 = 1; | |
7628 v3 = 1; | |
501 | 7629 pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0); |
0 | 7630 } |
484 | 7631 v15 = (char *)pParty->_quest_bits; |
0 | 7632 LABEL_44: |
7633 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | |
7634 goto LABEL_173; | |
7635 case VAR_PlayerItemInHands: | |
7636 item.Reset(); | |
7637 item.Reset(); | |
7638 item.uAttributes = 1; | |
7639 item.uItemID = val; | |
7640 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) | |
484 | 7641 pParty->pIsArtifactFound[val-500] = 1; |
0 | 7642 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) |
7643 { | |
7644 item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; | |
7645 item.uMaxCharges = LOBYTE(item.uNumCharges); | |
7646 } | |
7647 pParty->SetHoldingItem(&item); | |
7648 return; | |
7649 case VAR_FixedGold: | |
7650 party_finds_gold(val, 1); | |
7651 return; | |
7652 case VAR_BaseMight: | |
7653 v18 = (__int16 *)&Dst->uMight; | |
7654 goto LABEL_82; | |
7655 case VAR_BaseIntellect: | |
7656 v18 = (__int16 *)&Dst->uIntelligence; | |
7657 goto LABEL_82; | |
7658 case VAR_BasePersonality: | |
7659 v18 = (__int16 *)&Dst->uWillpower; | |
7660 goto LABEL_82; | |
7661 case VAR_BaseEndurance: | |
7662 v18 = (__int16 *)&Dst->uEndurance; | |
7663 goto LABEL_82; | |
7664 case VAR_BaseSpeed: | |
7665 v18 = (__int16 *)&Dst->uSpeed; | |
7666 goto LABEL_82; | |
7667 case VAR_BaseAccuracy: | |
7668 v18 = (__int16 *)&Dst->uAccuracy; | |
7669 goto LABEL_82; | |
7670 case VAR_BaseLuck: | |
7671 v18 = (__int16 *)&Dst->uLuck; | |
7672 goto LABEL_82; | |
7673 case VAR_FixedFood: | |
7674 Party::GiveFood(val); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7675 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
7676 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 7677 if ( pParty->uNumFoodRations > 0xFFFF ) |
7678 Party::SetFood(0xFFFFu); | |
7679 goto _play_sound; | |
7680 case VAR_MightBonus: | |
7681 goto LABEL_62; | |
7682 case VAR_IntellectBonus: | |
7683 goto LABEL_66; | |
7684 case VAR_PersonalityBonus: | |
7685 goto LABEL_67; | |
7686 case VAR_EnduranceBonus: | |
7687 goto LABEL_68; | |
7688 case VAR_SpeedBonus: | |
7689 goto LABEL_69; | |
7690 case VAR_AccuracyBonus: | |
7691 goto LABEL_70; | |
7692 case VAR_LuckBonus: | |
7693 goto LABEL_71; | |
7694 default: | |
7695 return; | |
7696 } | |
7697 return; | |
7698 } | |
7699 LABEL_62: | |
7700 v19 = (__int16 *)&Dst->uMightBonus; | |
7701 goto LABEL_113; | |
7702 } | |
310 | 7703 if ( var_type <= VAR_FireResistanceBonus ) |
7704 { | |
7705 if ( var_type != VAR_FireResistanceBonus ) | |
0 | 7706 { |
310 | 7707 switch ( var_type ) |
0 | 7708 { |
7709 case VAR_ActualIntellect: | |
7710 LABEL_66: | |
7711 v19 = (__int16 *)&Dst->uIntelligenceBonus; | |
7712 goto LABEL_113; | |
7713 case VAR_ActualPersonality: | |
7714 LABEL_67: | |
7715 v19 = (__int16 *)&Dst->uWillpowerBonus; | |
7716 goto LABEL_113; | |
7717 case VAR_ActualEndurance: | |
7718 LABEL_68: | |
7719 v19 = (__int16 *)&Dst->uEnduranceBonus; | |
7720 goto LABEL_113; | |
7721 case VAR_ActualSpeed: | |
7722 LABEL_69: | |
7723 v19 = (__int16 *)&Dst->uSpeedBonus; | |
7724 goto LABEL_113; | |
7725 case VAR_ActualAccuracy: | |
7726 LABEL_70: | |
7727 v19 = (__int16 *)&Dst->uAccuracyBonus; | |
7728 goto LABEL_113; | |
7729 case VAR_ActualLuck: | |
7730 LABEL_71: | |
7731 v19 = (__int16 *)&Dst->uLuckBonus; | |
7732 goto LABEL_113; | |
7733 case VAR_FireResistance: | |
7734 v18 = &Dst->sResFireBase; | |
7735 goto LABEL_82; | |
7736 case VAR_AirResistance: | |
7737 v18 = &Dst->sResAirBase; | |
7738 goto LABEL_82; | |
7739 case VAR_WaterResistance: | |
7740 v18 = &Dst->sResWaterBase; | |
7741 goto LABEL_82; | |
7742 case VAR_EarthResistance: | |
7743 v18 = &Dst->sResEarthBase; | |
7744 goto LABEL_82; | |
7745 case VAR_SpiritResistance: | |
7746 v18 = &Dst->sResSpiritBase; | |
7747 goto LABEL_82; | |
7748 case VAR_MindResistance: | |
7749 v18 = &Dst->sResMindBase; | |
7750 goto LABEL_82; | |
7751 case VAR_BodyResistance: | |
7752 v18 = &Dst->sResBodyBase; | |
7753 goto LABEL_82; | |
7754 case VAR_LightResistance: | |
7755 v18 = &Dst->sResLightBase; | |
7756 goto LABEL_82; | |
7757 case VAR_DarkResistance: | |
7758 v18 = &Dst->sResDarkBase; | |
7759 goto LABEL_82; | |
7760 case VAR_MagicResistance: | |
7761 v18 = &Dst->sResMagicBase; | |
7762 LABEL_82: | |
7763 *v18 += val; | |
7764 if ( *v18 > 255 ) | |
7765 *v18 = 255; | |
7766 v31 = 0; | |
7767 v29 = 92; | |
7768 goto LABEL_116; | |
7769 default: | |
7770 return; | |
7771 } | |
7772 return; | |
7773 } | |
7774 v19 = &Dst->sResFireBonus; | |
7775 LABEL_113: | |
7776 *v19 += val; | |
7777 if ( *v19 > 255 ) | |
7778 *v19 = 255; | |
7779 v31 = 0; | |
187 | 7780 v29 = SPEECH_91; |
0 | 7781 LABEL_116: |
7782 v3 = 1; | |
187 | 7783 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
0 | 7784 goto _play_anim_and_maybe_sound; |
7785 } | |
310 | 7786 if ( var_type <= VAR_DisarmTrapSkill ) |
7787 { | |
7788 if ( var_type != VAR_DisarmTrapSkill ) | |
0 | 7789 { |
310 | 7790 if ( var_type <= VAR_BodyResistanceBonus ) |
0 | 7791 { |
310 | 7792 switch ( var_type ) |
0 | 7793 { |
7794 case VAR_BodyResistanceBonus: | |
7795 v19 = &Dst->sResBodyBonus; | |
7796 break; | |
7797 case VAR_AirResistanceBonus: | |
7798 v19 = &Dst->sResAirBonus; | |
7799 break; | |
7800 case VAR_WaterResistanceBonus: | |
7801 v19 = &Dst->sResWaterBonus; | |
7802 break; | |
7803 case VAR_EarthResistanceBonus: | |
7804 v19 = &Dst->sResEarthBonus; | |
7805 break; | |
7806 case VAR_SpiritResistanceBonus: | |
7807 v19 = &Dst->sResSpiritBonus; | |
7808 break; | |
7809 default: | |
310 | 7810 if ( var_type != 62 ) |
0 | 7811 return; |
7812 v19 = &Dst->sResMindBonus; | |
7813 break; | |
7814 } | |
7815 goto LABEL_113; | |
7816 } | |
310 | 7817 if ( var_type == VAR_LightResistanceBonus ) |
0 | 7818 { |
7819 v19 = &Dst->sResLightBonus; | |
7820 goto LABEL_113; | |
7821 } | |
310 | 7822 if ( var_type == VAR_DarkResistanceBonus ) |
0 | 7823 { |
7824 v19 = &Dst->sResDarkBonus; | |
7825 goto LABEL_113; | |
7826 } | |
310 | 7827 if ( var_type == VAR_MagicResistanceBonus ) |
0 | 7828 { |
7829 v19 = &Dst->sResMagicBonus; | |
7830 goto LABEL_113; | |
7831 } | |
310 | 7832 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) |
0 | 7833 return; |
7834 } | |
7835 goto LABEL_106; | |
7836 } | |
310 | 7837 if ( var_type == VAR_LearningSkill ) |
0 | 7838 { |
7839 LABEL_106: | |
7840 if ( val <= VAR_BodyResistanceBonus ) | |
7841 { | |
310 | 7842 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; |
0 | 7843 } |
7844 else | |
7845 { | |
310 | 7846 v20 = (char *)&Dst->pConditions[16] + 2 * var_type; |
0 | 7847 v21 = *(short *)v20; |
7848 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); | |
7849 if ( v22 > 60 ) | |
7850 LOWORD(v22) = 60; | |
7851 LOBYTE(v21) = v21 & 0xC0; | |
7852 *(short *)v20 = v22 | v21; | |
7853 } | |
7854 goto _play_anim_and_exit; | |
7855 } | |
310 | 7856 if ( var_type <= VAR_LearningSkill ) |
0 | 7857 return; |
310 | 7858 if ( var_type <= VAR_Eradicated ) |
7859 { | |
7860 Dst->SetCondition(var_type - 105, 0); | |
0 | 7861 } |
7862 else | |
7863 { | |
310 | 7864 if ( var_type != VAR_MajorCondition ) |
0 | 7865 { |
310 | 7866 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
0 | 7867 { |
310 | 7868 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) |
7869 byte_5E4C15[var_type] += val; | |
0 | 7870 else |
310 | 7871 byte_5E4C15[var_type] = -1; |
0 | 7872 } |
7873 return; | |
7874 } | |
7875 memset(Dst, 0, 0xA0u); | |
7876 } | |
7877 _play_anim_and_exit: | |
7878 v3 = 1; | |
7879 _play_anim_and_maybe_sound: | |
7880 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | |
7881 _maybe_play_sound: | |
7882 if ( v3 != 1 ) | |
7883 return; | |
7884 goto _play_sound; | |
7885 } | |
7886 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
|
7887 //&& (&dword_723718_autonote_related)[8 * val] ) |
1310 | 7888 && pAutonoteTxt[val].pText ) |
0 | 7889 { |
7890 v23 = pPlayers[uPlayerIdx + 1]; | |
7891 v34 = 1; | |
187 | 7892 v23->PlaySound(SPEECH_96, 0); |
1310 | 7893 v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; |
0 | 7894 bFlashAutonotesBook = 1; |
981 | 7895 _506568_autonote_type = v24; |
0 | 7896 } |
7897 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | |
7898 v3 = 1; | |
7899 LABEL_173: | |
7900 if ( v34 != 1 ) | |
7901 goto _maybe_play_sound; | |
7902 goto _play_anim_and_maybe_sound; | |
7903 } | |
310 | 7904 if ( var_type > VAR_GoldInBank ) |
7905 { | |
7906 if ( var_type == 307 ) | |
0 | 7907 { |
7908 pParty->uNumDeaths += val; | |
7909 goto LABEL_173; | |
7910 } | |
310 | 7911 switch ( var_type ) |
0 | 7912 { |
7913 case 308: | |
7914 pParty->uNumBountiesCollected += val; | |
7915 break; | |
7916 case 309: | |
7917 pParty->uNumPrisonTerms += val; | |
7918 break; | |
7919 case 310: | |
7920 pParty->uNumArenaPageWins += val; | |
7921 break; | |
7922 case 311: | |
7923 pParty->uNumArenaSquireWins += val; | |
7924 break; | |
7925 case 312: | |
7926 pParty->uNumArenaKnightWins += val; | |
7927 break; | |
7928 case 313: | |
7929 pParty->uNumArenaLordWins += val; | |
7930 break; | |
7931 } | |
7932 } | |
7933 else | |
7934 { | |
310 | 7935 if ( var_type == VAR_GoldInBank ) |
0 | 7936 { |
7937 pParty->uNumGoldInBank += val; | |
7938 return; | |
7939 } | |
310 | 7940 if ( var_type <= VAR_Counter8 ) |
7941 { | |
7942 if ( (signed int)var_type >= 245 ) | |
7943 { | |
7944 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); | |
7945 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); | |
0 | 7946 } |
7947 else | |
7948 { | |
310 | 7949 switch ( var_type ) |
0 | 7950 { |
7951 case VAR_MonthEquals|VAR_CurrentSP: | |
7952 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | |
7953 break; | |
7954 case VAR_NPCs2: | |
7955 pParty->field_709 = 0; | |
7956 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | |
1035 | 7957 pParty->CountHirelings(); |
7958 viewparams->bRedrawGameUI = true; | |
0 | 7959 break; |
7960 case VAR_NumSkillPoints: | |
7961 Dst->uSkillPoints += val; | |
7962 break; | |
7963 } | |
7964 } | |
7965 return; | |
7966 } | |
310 | 7967 if ( var_type < VAR_Counter9 ) |
0 | 7968 return; |
310 | 7969 if ( (signed int)var_type <= 274 ) |
7970 { | |
7971 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); | |
7972 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); | |
0 | 7973 goto _play_sound; |
7974 } | |
310 | 7975 if ( var_type != VAR_ReputationInCurrentLocation ) |
7976 { | |
7977 if ( var_type <= VAR_ReputationInCurrentLocation | |
7978 || var_type > VAR_History_28 | |
7979 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) | |
7980 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), | |
233 | 7981 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, |
310 | 7982 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), |
0 | 7983 v26) ) |
7984 return; | |
7985 bFlashHistoryBook = 1; | |
7986 _play_sound: | |
7987 v28 = 8 * uPlayerIdx + 400; | |
862 | 7988 LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112); |
0 | 7989 pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0); |
7990 return; | |
7991 } | |
7992 v27 = &pOutdoor->ddm; | |
7993 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
7994 v27 = &pIndoor->dlv; | |
7995 v27->uReputation += val; | |
7996 if ( v27->uReputation > 10000 ) | |
7997 v27->uReputation = 10000; | |
7998 } | |
7999 } | |
8000 // 506568: using guessed type int dword_506568; | |
8001 // 507948: using guessed type char bFlashHistoryBook; | |
8002 // 507949: using guessed type char bFlashAutonotesBook; | |
8003 // 50794A: using guessed type char bFlashQuestBook; | |
8004 // 72371C: using guessed type int dword_72371C[]; | |
8005 // 723E80: using guessed type int dword_723E80_award_related[]; | |
8006 | |
8007 | |
8008 | |
8009 | |
8010 //----- (0044B9C4) -------------------------------------------------------- | |
501 | 8011 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) |
0 | 8012 { |
8013 unsigned int v3; // ebx@1 | |
8014 signed int v4; // esi@1 | |
501 | 8015 bool result; // eax@8 |
0 | 8016 int v6; // esi@11 |
8017 int v7; // edi@14 | |
8018 signed int v8; // eax@17 | |
8019 char *v9; // eax@20 | |
8020 char v10; // sf@20 | |
8021 char *v11; // ecx@26 | |
8022 char *v12; // ecx@27 | |
8023 __int64 v13; // qax@27 | |
8024 unsigned __int8 v14; // cf@27 | |
501 | 8025 int *v15; // edx@29 |
0 | 8026 char *v16; // eax@90 |
8027 char *v17; // ecx@94 | |
501 | 8028 int v18; // esi@97 |
0 | 8029 signed int v19; // edx@97 |
8030 char *v20; // ecx@98 | |
8031 int v21; // eax@100 | |
8032 __int16 v22; // dx@112 | |
8033 int v23; // [sp-8h] [bp-14h]@45 | |
8034 signed int v24; // [sp-4h] [bp-10h]@4 | |
8035 int v25; // [sp-4h] [bp-10h]@45 | |
8036 | |
8037 v3 = 0; | |
605 | 8038 v4 = uActiveCharacter - 1; |
501 | 8039 result = false; |
8040 if ( (signed int)VarNum > 222 ) | |
8041 { | |
8042 if ( (signed int)VarNum <= 307 ) | |
8043 { | |
8044 if ( VarNum == 307 ) | |
8045 { | |
8046 pParty->uNumDeaths -= (unsigned int)pValue; | |
8047 return pValue; | |
8048 } | |
8049 if ( VarNum == 223 ) | |
0 | 8050 { |
8051 v11 = (char *)pParty->_autonote_bits; | |
501 | 8052 v22 = (short)pValue - 1; |
0 | 8053 } |
8054 else | |
8055 { | |
501 | 8056 if ( VarNum != 231 ) |
0 | 8057 { |
501 | 8058 switch ( VarNum ) |
0 | 8059 { |
8060 case 232: | |
501 | 8061 VarNum = (VariableType)0; |
1094 | 8062 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); |
501 | 8063 result = (bool) pValue; |
8064 dword_5B65CC = 0; | |
8065 if ( (int)VarNum == pValue ) | |
0 | 8066 { |
501 | 8067 dword_5B65CC = (int)pValue; |
0 | 8068 } |
8069 else | |
8070 { | |
8071 pParty->field_709 = 0; | |
501 | 8072 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
1035 | 8073 pParty->CountHirelings(); |
8074 viewparams->bRedrawGameUI = true; | |
0 | 8075 } |
8076 break; | |
8077 case 241: | |
8078 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
8079 { | |
8080 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | |
605 | 8081 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) |
0 | 8082 { |
605 | 8083 if ( *((void **)v20 + 4) == (void *)pValue ) |
0 | 8084 { |
8085 v21 = *(int *)v20; | |
8086 if ( (char)*(int *)v20 < 0 ) | |
8087 { | |
8088 LOBYTE(v21) = v21 & 0x7F; | |
8089 *(int *)v20 = v21; | |
8090 } | |
8091 } | |
8092 v20 += 76; | |
8093 } | |
8094 } | |
605 | 8095 if ( pParty->pHirelings[0].uProfession == pValue ) |
0 | 8096 memset(pParty->pHirelings, 0, 0x4Cu); |
605 | 8097 if ( pParty->pHirelings[1].uProfession == pValue ) |
0 | 8098 memset(&pParty->pHirelings[1], 0, 0x4Cu); |
8099 pParty->field_709 = 0; | |
1035 | 8100 pParty->CountHirelings(); |
0 | 8101 break; |
8102 case 243: | |
8103 v17 = (char *)&this->uSkillPoints; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8104 result = *v17 != NULL; |
501 | 8105 if ( (unsigned int)pValue <= *(int *)v17 ) |
8106 { | |
8107 *(int *)v17 -= (int)pValue; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8108 result = (v17 != NULL); |
501 | 8109 } |
0 | 8110 else |
8111 *(int *)v17 = 0; | |
8112 break; | |
8113 case 275: | |
8114 v16 = (char *)&pOutdoor->ddm; | |
8115 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
8116 v16 = (char *)&pIndoor->dlv; | |
501 | 8117 *((int *)v16 + 2) -= (int)pValue; |
0 | 8118 if ( *((int *)v16 + 2) < -10000 ) |
8119 *((int *)v16 + 2) = -10000; | |
8120 break; | |
8121 case 306: | |
501 | 8122 result = VarNum - 306; |
8123 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | |
8124 { | |
8125 result = (bool)pValue; | |
8126 pParty->uNumGoldInBank -= (unsigned int)pValue; | |
605 | 8127 } |
0 | 8128 else |
8129 LABEL_88: | |
8130 dword_5B65C4 = 1; | |
8131 break; | |
8132 } | |
501 | 8133 return result; |
0 | 8134 } |
8135 v11 = this->field_1A50; | |
501 | 8136 v22 = (signed __int16)pValue; |
0 | 8137 } |
8138 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
501 | 8139 return result; |
8140 } | |
8141 switch ( VarNum ) | |
0 | 8142 { |
8143 case 308: | |
501 | 8144 result = (bool)pValue; |
8145 pParty->uNumBountiesCollected -= (unsigned int)pValue; | |
0 | 8146 break; |
8147 case 309: | |
501 | 8148 result = (bool)pValue; |
8149 pParty->uNumPrisonTerms -= (int)pValue; | |
0 | 8150 break; |
8151 case 310: | |
501 | 8152 result = (bool)pValue; |
8153 pParty->uNumArenaPageWins -= (char)pValue; | |
0 | 8154 break; |
8155 case 311: | |
501 | 8156 result = (bool)pValue; |
8157 pParty->uNumArenaSquireWins -= (char)pValue; | |
0 | 8158 break; |
8159 case 312: | |
501 | 8160 result = (bool)pValue; |
8161 pParty->uNumArenaKnightWins -= (char)pValue; | |
0 | 8162 break; |
8163 case 313: | |
501 | 8164 result = (bool)pValue; |
8165 pParty->uNumArenaLordWins -= (char)pValue; | |
0 | 8166 break; |
8167 } | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1097
diff
changeset
|
8168 assert(false && "Function not returning any value!"); |
0 | 8169 } |
8170 else | |
8171 { | |
501 | 8172 if ( (signed int)VarNum >= 123 ) |
8173 { | |
8174 byte_5E4C15[VarNum] -= (char)pValue; | |
0 | 8175 } |
8176 else | |
8177 { | |
501 | 8178 switch ( VarNum ) |
0 | 8179 { |
8180 case VAR_RandomGold: | |
501 | 8181 v6 = rand() % (signed int)pValue + 1; |
0 | 8182 if ( v6 > pParty->uNumGold ) |
8183 v6 = pParty->uNumGold; | |
8184 Party::TakeGold(v6); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8185 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8186 ShowStatusBarString(pTmpBuf.data(), 2); |
0 | 8187 GameUI_DrawFoodAndGold(); |
501 | 8188 return result; |
0 | 8189 case VAR_RandomFood: |
501 | 8190 v7 = rand() % (signed int)pValue + 1; |
0 | 8191 if ( v7 > pParty->uNumFoodRations ) |
8192 v7 = pParty->uNumFoodRations; | |
8193 Party::TakeFood(v7); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8194 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1167
diff
changeset
|
8195 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 8196 GameUI_DrawFoodAndGold(); |
605 | 8197 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8198 v8 = 8 * v4 + 400; | |
862 | 8199 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8200 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 8201 return result; |
0 | 8202 case VAR_CurrentHP: |
1036 | 8203 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
605 | 8204 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8205 v8 = 8 * v4 + 400; | |
862 | 8206 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8207 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8208 return result; | |
0 | 8209 case VAR_CurrentSP: |
8210 v9 = (char *)&this->sMana; | |
501 | 8211 v10 = this->sMana - (signed int)pValue < 0; |
8212 *(int *)v9 -= (int)pValue; | |
0 | 8213 if ( v10 ) |
8214 *(int *)v9 = 0; | |
605 | 8215 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8216 v8 = 8 * v4 + 400; | |
862 | 8217 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8218 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8219 return result; | |
0 | 8220 case VAR_ACModifier: |
501 | 8221 this->sACModifier -= (unsigned __int8)pValue; |
605 | 8222 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8223 v8 = 8 * v4 + 400; | |
862 | 8224 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8225 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8226 return result; | |
0 | 8227 case VAR_BaseLevel: |
501 | 8228 this->uLevel -= (unsigned __int8)pValue; |
605 | 8229 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8230 v8 = 8 * v4 + 400; | |
862 | 8231 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8232 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8233 return result; | |
0 | 8234 case VAR_LevelModifier: |
501 | 8235 this->sLevelModifier -= (unsigned __int8)pValue; |
605 | 8236 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8237 v8 = 8 * v4 + 400; | |
862 | 8238 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8239 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8240 return result; | |
0 | 8241 case VAR_Age: |
501 | 8242 this->sAgeModifier -= (signed __int16)pValue; |
8243 return result; | |
0 | 8244 case VAR_Award: |
605 | 8245 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, (signed __int16)pValue, 0); |
8246 return result; | |
0 | 8247 case VAR_Experience: |
8248 v12 = (char *)&this->uExperience; | |
501 | 8249 v13 = (signed int)pValue; |
8250 v14 = *(int *)v12 < (unsigned int)pValue; | |
8251 *(int *)v12 -= (int)pValue; | |
0 | 8252 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
605 | 8253 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8254 v8 = 8 * v4 + 400; | |
862 | 8255 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8256 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8257 return result; | |
0 | 8258 case VAR_QBits_QuestsDone: |
501 | 8259 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
187 | 8260 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
501 | 8261 return true; |
0 | 8262 case VAR_PlayerItemInHands: |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8263 v15 = this->pInventoryMatrix; |
0 | 8264 break; |
8265 case VAR_FixedGold: | |
501 | 8266 if ( (unsigned int)pValue > pParty->uNumGold ) |
0 | 8267 goto LABEL_88; |
501 | 8268 Party::TakeGold((unsigned int)pValue); |
8269 return result; | |
0 | 8270 case VAR_MightBonus: |
8271 case VAR_ActualMight: | |
501 | 8272 this->uMightBonus -= (unsigned __int16)pValue; |
605 | 8273 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8274 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8275 v8 = 8 * v4 + 400; | |
862 | 8276 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8277 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8278 return result; | |
0 | 8279 case VAR_IntellectBonus: |
8280 case VAR_ActualIntellect: | |
501 | 8281 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
605 | 8282 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8283 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8284 v8 = 8 * v4 + 400; | |
862 | 8285 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8286 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8287 return result; | |
0 | 8288 case VAR_PersonalityBonus: |
8289 case VAR_ActualPersonality: | |
501 | 8290 this->uWillpowerBonus -= (unsigned __int16)pValue; |
605 | 8291 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8292 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8293 v8 = 8 * v4 + 400; | |
862 | 8294 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8295 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8296 return result; | |
0 | 8297 case VAR_EnduranceBonus: |
8298 case VAR_ActualEndurance: | |
501 | 8299 this->uEnduranceBonus -= (unsigned __int16)pValue; |
605 | 8300 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8301 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8302 v8 = 8 * v4 + 400; | |
862 | 8303 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8304 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8305 return result; | |
0 | 8306 case VAR_SpeedBonus: |
8307 case VAR_ActualSpeed: | |
501 | 8308 this->uSpeedBonus -= (unsigned __int16)pValue; |
605 | 8309 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8310 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8311 v8 = 8 * v4 + 400; | |
862 | 8312 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8313 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8314 return result; | |
0 | 8315 case VAR_AccuracyBonus: |
8316 case VAR_ActualAccuracy: | |
501 | 8317 this->uAccuracyBonus -= (unsigned __int16)pValue; |
605 | 8318 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8319 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8320 v8 = 8 * v4 + 400; | |
862 | 8321 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8322 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8323 return result; | |
0 | 8324 case VAR_LuckBonus: |
8325 case VAR_ActualLuck: | |
501 | 8326 this->uLuckBonus -= (unsigned __int16)pValue; |
605 | 8327 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8328 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8329 v8 = 8 * v4 + 400; | |
862 | 8330 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8331 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8332 return result; | |
0 | 8333 case VAR_BaseMight: |
501 | 8334 this->uMight -= (unsigned __int16)pValue; |
605 | 8335 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8336 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8337 v8 = 8 * v4 + 400; | |
862 | 8338 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8339 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8340 return result; | |
0 | 8341 case VAR_BaseIntellect: |
501 | 8342 this->uIntelligence -= (unsigned __int16)pValue; |
605 | 8343 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8344 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8345 v8 = 8 * v4 + 400; | |
862 | 8346 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8347 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8348 return result; | |
0 | 8349 case VAR_BasePersonality: |
501 | 8350 this->uWillpower -= (unsigned __int16)pValue; |
605 | 8351 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8352 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8353 v8 = 8 * v4 + 400; | |
862 | 8354 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8355 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8356 return result; | |
0 | 8357 case VAR_BaseEndurance: |
501 | 8358 this->uEndurance -= (unsigned __int16)pValue; |
605 | 8359 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8360 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8361 v8 = 8 * v4 + 400; | |
862 | 8362 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8363 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8364 return result; | |
0 | 8365 case VAR_BaseSpeed: |
501 | 8366 this->uSpeed -= (unsigned __int16)pValue; |
605 | 8367 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8368 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8369 v8 = 8 * v4 + 400; | |
862 | 8370 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8371 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8372 return result; | |
0 | 8373 case VAR_BaseAccuracy: |
501 | 8374 this->uAccuracy -= (unsigned __int16)pValue; |
605 | 8375 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8376 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8377 v8 = 8 * v4 + 400; | |
862 | 8378 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8379 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8380 return result; | |
0 | 8381 case VAR_BaseLuck: |
501 | 8382 this->uLuck -= (unsigned __int16)pValue; |
605 | 8383 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8384 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8385 v8 = 8 * v4 + 400; | |
862 | 8386 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8387 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8388 return result; | |
0 | 8389 case VAR_FireResistance: |
501 | 8390 this->sResFireBase -= (signed __int16)pValue; |
605 | 8391 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8392 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8393 v8 = 8 * v4 + 400; | |
862 | 8394 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8395 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8396 return result; | |
0 | 8397 case VAR_AirResistance: |
501 | 8398 this->sResAirBase -= (signed __int16)pValue; |
605 | 8399 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8400 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8401 v8 = 8 * v4 + 400; | |
862 | 8402 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8403 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8404 return result; | |
0 | 8405 case VAR_WaterResistance: |
501 | 8406 this->sResWaterBase -= (signed __int16)pValue; |
605 | 8407 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8408 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8409 v8 = 8 * v4 + 400; | |
862 | 8410 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8411 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8412 return result; | |
0 | 8413 case VAR_EarthResistance: |
501 | 8414 this->sResEarthBase -= (signed __int16)pValue; |
605 | 8415 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8416 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8417 v8 = 8 * v4 + 400; | |
862 | 8418 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8419 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8420 return result; | |
0 | 8421 case VAR_SpiritResistance: |
501 | 8422 this->sResSpiritBase -= (signed __int16)pValue; |
605 | 8423 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8424 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8425 v8 = 8 * v4 + 400; | |
862 | 8426 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8427 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8428 return result; | |
0 | 8429 case VAR_MindResistance: |
501 | 8430 this->sResMindBase -= (signed __int16)pValue; |
605 | 8431 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8432 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8433 v8 = 8 * v4 + 400; | |
862 | 8434 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8435 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8436 return result; | |
0 | 8437 case VAR_BodyResistance: |
501 | 8438 this->sResBodyBase -= (signed __int16)pValue; |
605 | 8439 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8440 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8441 v8 = 8 * v4 + 400; | |
862 | 8442 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8443 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8444 return result; | |
0 | 8445 case VAR_LightResistance: |
501 | 8446 this->sResLightBase -= (signed __int16)pValue; |
605 | 8447 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8448 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8449 v8 = 8 * v4 + 400; | |
862 | 8450 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8451 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8452 return result; | |
0 | 8453 case VAR_DarkResistance: |
501 | 8454 this->sResDarkBase -= (signed __int16)pValue; |
605 | 8455 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8456 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8457 v8 = 8 * v4 + 400; | |
862 | 8458 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8459 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8460 return result; | |
0 | 8461 case VAR_MagicResistance: |
501 | 8462 this->sResMagicBase -= (signed __int16)pValue; |
605 | 8463 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8464 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8465 v8 = 8 * v4 + 400; | |
862 | 8466 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8467 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8468 return result; | |
0 | 8469 case VAR_FireResistanceBonus: |
501 | 8470 this->sResFireBonus -= (signed __int16)pValue; |
605 | 8471 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8472 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8473 v8 = 8 * v4 + 400; | |
862 | 8474 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8475 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8476 return result; | |
0 | 8477 case VAR_AirResistanceBonus: |
501 | 8478 this->sResAirBonus -= (signed __int16)pValue; |
605 | 8479 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); |
8480 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8481 v8 = 8 * v4 + 400; | |
862 | 8482 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8483 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8484 return result; | |
0 | 8485 case VAR_WaterResistanceBonus: |
501 | 8486 this->sResWaterBonus -= (signed __int16)pValue; |
605 | 8487 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8488 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8489 v8 = 8 * v4 + 400; | |
862 | 8490 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8491 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8492 return result; | |
0 | 8493 case VAR_EarthResistanceBonus: |
501 | 8494 this->sResEarthBonus -= (signed __int16)pValue; |
605 | 8495 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8496 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8497 v8 = 8 * v4 + 400; | |
862 | 8498 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8499 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8500 return result; | |
0 | 8501 case VAR_SpiritResistanceBonus: |
501 | 8502 this->sResSpiritBonus -= (signed __int16)pValue; |
605 | 8503 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8504 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8505 v8 = 8 * v4 + 400; | |
862 | 8506 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8507 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8508 return result; | |
0 | 8509 case VAR_MindResistanceBonus: |
501 | 8510 this->sResMindBonus -= (signed __int16)pValue; |
605 | 8511 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8512 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8513 v8 = 8 * v4 + 400; | |
862 | 8514 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8515 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8516 return result; | |
0 | 8517 case VAR_BodyResistanceBonus: |
501 | 8518 this->sResBodyBonus -= (signed __int16)pValue; |
605 | 8519 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8520 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8521 v8 = 8 * v4 + 400; | |
862 | 8522 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8523 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8524 return result; | |
0 | 8525 case VAR_LightResistanceBonus: |
501 | 8526 this->sResLightBonus -= (signed __int16)pValue; |
605 | 8527 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8528 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8529 v8 = 8 * v4 + 400; | |
862 | 8530 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8531 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8532 return result; | |
0 | 8533 case VAR_DarkResistanceBonus: |
501 | 8534 this->sResDarkBonus -= (signed __int16)pValue; |
605 | 8535 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); |
8536 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); | |
8537 v8 = 8 * v4 + 400; | |
862 | 8538 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8539 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8540 return result; | |
0 | 8541 case VAR_MagicResistanceBonus: |
501 | 8542 this->sResMagicBonus -= (signed __int16)pValue; |
0 | 8543 v25 = 0; |
187 | 8544 v23 = SPEECH_91; |
8545 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); | |
605 | 8546 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8547 v8 = 8 * v4 + 400; | |
862 | 8548 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8549 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8550 return result; | |
0 | 8551 case VAR_FixedFood: |
501 | 8552 Party::TakeFood((unsigned int)pValue); |
605 | 8553 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8554 v8 = 8 * v4 + 400; | |
862 | 8555 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8556 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8557 return result; | |
0 | 8558 case VAR_StaffSkill: |
8559 case VAR_SwordSkill: | |
8560 case VAR_DaggerSkill: | |
8561 case VAR_AxeSkill: | |
8562 case VAR_SpearSkill: | |
8563 case VAR_BowSkill: | |
8564 case VAR_MaceSkill: | |
8565 case VAR_BlasterSkill: | |
8566 case VAR_ShieldSkill: | |
8567 case VAR_LeatherSkill: | |
8568 case VAR_SkillChain: | |
8569 case VAR_PlateSkill: | |
8570 case VAR_FireSkill: | |
8571 case VAR_AirSkill: | |
8572 case VAR_WaterSkill: | |
8573 case VAR_EarthSkill: | |
8574 case VAR_SpiritSkill: | |
8575 case VAR_MindSkill: | |
8576 case VAR_BodySkill: | |
8577 case VAR_LightSkill: | |
8578 case VAR_DarkSkill: | |
8579 case VAR_IdentifyItemSkill: | |
8580 case VAR_MerchantSkill: | |
8581 case VAR_RepairSkill: | |
8582 case VAR_BodybuildingSkill: | |
8583 case VAR_MeditationSkill: | |
8584 case VAR_PerceptionSkill: | |
8585 case VAR_DiplomacySkill: | |
8586 case VAR_DisarmTrapSkill: | |
8587 case VAR_LearningSkill: | |
501 | 8588 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; |
605 | 8589 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8590 v8 = 8 * v4 + 400; | |
862 | 8591 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
605 | 8592 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
8593 return result; | |
0 | 8594 case VAR_Cursed: |
8595 case VAR_Weak: | |
8596 case VAR_Asleep: | |
8597 case VAR_Afraid: | |
8598 case VAR_Drunk: | |
8599 case VAR_Insane: | |
8600 case VAR_PoisonedGreen: | |
8601 case VAR_DiseasedGreen: | |
8602 case VAR_PoisonedYellow: | |
8603 case VAR_DiseasedYellow: | |
8604 case VAR_PoisonedRed: | |
8605 case VAR_DiseasedRed: | |
8606 case VAR_Paralyzed: | |
8607 case VAR_Unconsious: | |
8608 case VAR_Dead: | |
8609 case VAR_Stoned: | |
8610 case VAR_Eradicated: | |
1071 | 8611 //*((int *)this + 2 * VarNum - 210) = 0; |
8612 //*((int *)this + 2 * result - 209) = 0; | |
8613 this->pConditions[VarNum] = 0; | |
0 | 8614 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); |
8615 v8 = 8 * v4 + 400; | |
862 | 8616 LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); |
0 | 8617 pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); |
501 | 8618 return result; |
605 | 8619 default: |
8620 return result; | |
8621 } | |
8622 for (v3 = 1; v3 < 126; v3++) | |
8623 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8624 if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) |
0 | 8625 { |
605 | 8626 RemoveItemAtInventoryIndex(v3); |
501 | 8627 return true; |
0 | 8628 } |
605 | 8629 } |
501 | 8630 if ( pParty->pPickedItem.uItemID == pValue ) |
8631 { | |
605 | 8632 pMouse->RemoveHoldingItem(); |
8633 return true; | |
8634 } | |
8635 return false; | |
0 | 8636 } |
8637 } | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8638 |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8639 assert(false); |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
8640 return false; |
0 | 8641 } |
8642 // 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
|
8643 // 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
|
8644 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8645 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8646 //----- (00467E7F) -------------------------------------------------------- |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8647 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
|
8648 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8649 //unsigned int v1; // esi@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8650 int v2; // ebx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8651 Player *v3; // eax@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8652 int v4; // edx@1 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8653 int v5; // esi@2 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8654 //int v6; // eax@2 |
1365
b691c96d8e06
Player::FindFreeInventorySlot and Player::CreateItemInInventory refactoring
Grumpy7
parents:
1363
diff
changeset
|
8655 int v7; // eax@3 |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8656 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
|
8657 //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
|
8658 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
|
8659 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
|
8660 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8661 |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8662 _this.Reset(); |
1374 | 8663 v2 = pEquipTypeToBodyAnchor[uEquipType]; |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8664 v3 = pPlayers[uActiveCharacter]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8665 v11 = (int *)&v3->pEquipment.pIndices[v2]; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8666 v4 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8667 v10 = *v11; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8668 if ( v10 ) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8669 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8670 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8671 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
|
8672 *(char *)(v5 + 556) = 0; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8673 pParty->pPickedItem.Reset(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8674 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8675 _this.uBodyAnchor = v2 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8676 memcpy((void *)(v5 + 532), &_this, 0x24u); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8677 *v11 = v10; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8678 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8679 else |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8680 { |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8681 v7 = v3->FindFreeInventoryListSlot(); |
1276
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8682 if (v7 >= 0) |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8683 { |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8684 pParty->pPickedItem.uBodyAnchor = v2 + 1; |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8685 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
|
8686 *v11 = v7 + 1; |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8687 pMouse->RemoveHoldingItem(); |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8688 } |
f11651288371
changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
Grumpy7
parents:
1275
diff
changeset
|
8689 } |
1295 | 8690 } |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8691 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
8692 |
1295 | 8693 //----- (0049387A) -------------------------------------------------------- |
8694 int CycleCharacter(unsigned int _this) | |
8695 { | |
8696 signed int result; // eax@1 | |
8697 signed int v2; // ecx@2 | |
8698 signed int v3; // ecx@8 | |
8699 | |
8700 result = uActiveCharacter; | |
8701 if ( _this ) | |
8702 { | |
8703 v2 = 0; | |
8704 while ( 1 ) | |
8705 { | |
8706 --result; | |
8707 if ( result < 1 ) | |
8708 result = 4; | |
8709 if ( !pPlayers[result]->uTimeToRecovery ) | |
8710 break; | |
8711 ++v2; | |
8712 if ( v2 >= 4 ) | |
8713 return uActiveCharacter; | |
8714 } | |
8715 } | |
8716 else | |
8717 { | |
8718 v3 = 0; | |
8719 while ( 1 ) | |
8720 { | |
8721 ++result; | |
8722 if ( result > 4 ) | |
8723 result = 1; | |
8724 if ( !pPlayers[result]->uTimeToRecovery ) | |
8725 break; | |
8726 ++v3; | |
8727 if ( v3 >= 4 ) | |
8728 return uActiveCharacter; | |
8729 } | |
8730 } | |
8731 return result; | |
1297 | 8732 } |
8733 //----- (0043EE77) -------------------------------------------------------- | |
8734 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
8735 { | |
8736 bool result; // eax@0 | |
8737 Player *v2; // edx@3 | |
8738 int v3; // ecx@3 | |
8739 Player **pPlayers; // esi@8 | |
1424 | 8740 //bool item_flag; |
1297 | 8741 Player *v6; // edx@9 |
8742 | |
1424 | 8743 //if ( a1 < 1 || a1 > 4 ) |
8744 //{ | |
8745 //if ( !a1 ) | |
8746 //{ | |
8747 //pPlayers = &::pPlayers[1]; | |
8748 //v5 = 604; | |
8749 //while ( 1 ) | |
8750 assert ( a1 > 0 && a1 < 5 ); | |
8751 for ( uint i = 1; i < (signed int)&qword_A750D8; ++i ) | |
8752 { | |
8753 //item_flag = Player_has_item(604, *pPlayers, 0); | |
8754 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | |
8755 return false; | |
8756 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used | |
8757 //result = ::pPlayers[i]->pEquipment.uArmor; | |
8758 if ( !::pPlayers[i]->pEquipment.uArmor ) | |
8759 return false; | |
8760 //result *= 9; | |
8761 if ( *(int *)&::pPlayers[i]->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * 9 + 5] != 604 ) | |
8762 return false; | |
8763 //++pPlayers; | |
8764 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
8765 //return true; | |
8766 } | |
8767 return true; | |
8768 } | |
8769 //return false; | |
8770 //} | |
8771 //result = Player_has_item(604u, ::pPlayers[a1], 0); | |
8772 //__debugbreak(); // player.cpp(8764): warning C4700: uninitialized local variable 'v2' used | |
8773 //__debugbreak(); // player.cpp(8764): warning C4700: uninitialized local variable 'v3' used | |
8774 //if ( !result | |
8775 // || (result = v2->pEquipment.uArmor) == 0 | |
8776 // || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) ) | |
8777 //{ | |
8778 //LABEL_6: | |
8779 //LOBYTE(result) = 0; | |
8780 // return false; | |
8781 //} | |
8782 //LABEL_13: | |
8783 //LOBYTE(result) = 1; | |
8784 //return true; | |
8785 //} | |
1297 | 8786 //----- (0043EE15) -------------------------------------------------------- |
8787 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) | |
8788 { | |
8789 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | |
8790 { | |
8791 for ( uint i = 0; i < 126; ++i ) | |
8792 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8793 if ( pPlayer->pInventoryMatrix[i] > 0 ) |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8794 { |
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8795 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) |
1297 | 8796 return true; |
8797 } | |
8798 } | |
8799 for ( uint i = 0; i < 16; ++i ) | |
8800 { | |
8801 if ( pPlayer->pEquipment.pIndices[i] ) | |
8802 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
8803 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
1297 | 8804 return true; |
8805 } | |
8806 } | |
8807 } | |
8808 return false; | |
8809 } | |
8810 //----- (0043EDB9) -------------------------------------------------------- | |
8811 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) | |
8812 { | |
8813 unsigned int pNum; // ebp@1 | |
8814 Player **pPlayer; // ebx@1 | |
8815 Player *pPlayer2; // esi@2 | |
8816 enum CHARACTER_RACE pRace; // edi@2 | |
8817 bool pSex; // eax@2 | |
8818 char v6; // zf@7 | |
8819 | |
8820 //pPlayer = &pPlayers[1]; | |
8821 /*pNum = a1; | |
8822 | |
8823 while ( 1 ) | |
8824 { | |
8825 pPlayer2 = *pPlayer; | |
8826 pRace = pPlayer2->GetRace(); | |
8827 pSex = pPlayer2->GetSexByVoice(); | |
8828 if ( !pRace ) | |
8829 break; | |
8830 if ( pRace == 1 || pRace == 2 ) | |
8831 break; | |
8832 if ( !pSex && pNum == 2 )// | |
8833 //goto LABEL_15; | |
8834 { | |
8835 pSex = 1; | |
8836 return pSex; | |
8837 } | |
8838 v6 = pNum == 3;// | |
8839 LABEL_11: | |
8840 if ( v6 ) | |
8841 //goto LABEL_15; | |
8842 { | |
8843 pSex = 1; | |
8844 return pSex; | |
8845 } | |
8846 ++pPlayer; | |
8847 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
8848 { | |
8849 pSex = 0; | |
8850 return pSex; | |
8851 } | |
8852 } | |
8853 if ( pSex || pNum ) | |
8854 { | |
8855 v6 = pNum == 1; | |
8856 goto LABEL_11; | |
8857 } | |
8858 //LABEL_15: | |
8859 pSex = 1; | |
8860 return pSex;*/ | |
8861 for (uint i = 1; i <= 4; ++i) | |
8862 { | |
8863 pRace = pPlayers[i]->GetRace(); | |
8864 pSex = pPlayers[i]->GetSexByVoice(); | |
8865 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
8866 return 1; | |
8867 } | |
8868 return 0; | |
8869 } | |
8870 //----- (0043ED6F) -------------------------------------------------------- | |
8871 bool _43ED6F_check_party_races(bool a1) | |
8872 { | |
8873 bool v6; // zf@5 | |
8874 | |
8875 for (uint i = 0; i < 4; ++i) | |
8876 { | |
8877 auto player = pParty->pPlayers + i; | |
8878 auto race = player->GetRace(); | |
8879 | |
8880 if (race != CHARACTER_RACE_HUMAN && | |
8881 race != CHARACTER_RACE_ELF && | |
8882 race != CHARACTER_RACE_GOBLIN) | |
8883 v6 = a1 == 1; | |
8884 else | |
8885 v6 = !a1; | |
8886 | |
8887 if (v6) | |
8888 return true; | |
8889 } | |
8890 return false; | |
8891 } | |
8892 //----- (00439FCB) -------------------------------------------------------- | |
8893 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
8894 { | |
8895 signed int v4; // esi@1 | |
8896 unsigned int v5; // ecx@1 | |
8897 Player *v6; // ebx@3 | |
8898 Actor *v7; // esi@3 | |
8899 unsigned int v8; // eax@4 | |
8900 char *v9; // eax@5 | |
8901 signed int v10; // eax@6 | |
8902 int v11; // edx@8 | |
8903 int v12; // edx@9 | |
8904 int v13; // edx@10 | |
8905 int v14; // edx@16 | |
8906 int v15; // edx@17 | |
8907 int v16; // edx@18 | |
8908 enum SoundID v17; // eax@24 | |
8909 int v18; // eax@26 | |
8910 unsigned __int8 v19; // zf@26 | |
8911 unsigned __int8 v20; // sf@26 | |
8912 unsigned __int16 v21; // ax@29 | |
8913 signed int v22; // edi@36 | |
8914 int v23; // eax@38 | |
8915 signed int v24; // eax@44 | |
8916 unsigned __int16 v25; // cx@47 | |
8917 signed int v26; // eax@49 | |
8918 int v27; // eax@54 | |
8919 float v28; // ST18_4@58 | |
8920 double v29; // st7@58 | |
8921 float v30; // ST08_4@58 | |
8922 double v31; // st7@58 | |
8923 float v32; // ST04_4@58 | |
8924 float v33; // ST00_4@58 | |
8925 int v34; // edi@61 | |
8926 int v35; // eax@70 | |
8927 double v36; // st7@70 | |
8928 SpriteObject *v37; // ebx@77 | |
8929 int v38; // edi@77 | |
8930 int v39; // esi@77 | |
8931 int v40; // eax@77 | |
8932 int v41; // eax@77 | |
8933 int v42; // eax@78 | |
8934 Player *v43; // eax@81 | |
8935 Actor *v44; // esi@82 | |
8936 Player *v45; // edi@84 | |
8937 unsigned __int16 v46; // ax@84 | |
8938 int v47; // ebx@105 | |
8939 int v48; // eax@107 | |
8940 unsigned __int16 v49; // ax@116 | |
8941 int v50; // ebx@123 | |
8942 unsigned __int16 v51; // ax@124 | |
8943 char v52; // bl@124 | |
8944 int v53; // eax@128 | |
8945 signed int v54; // eax@134 | |
8946 unsigned __int16 v55; // cx@137 | |
8947 signed int v56; // eax@139 | |
8948 int v57; // eax@144 | |
8949 float v58; // ST18_4@148 | |
8950 double v59; // st7@148 | |
8951 float v60; // ST08_4@148 | |
8952 double v61; // st7@148 | |
8953 float v62; // ST04_4@148 | |
8954 float v63; // ST00_4@148 | |
8955 int v64; // ebx@151 | |
8956 int v65; // eax@161 | |
8957 double v66; // st7@161 | |
8958 signed int v67; // ecx@164 | |
8959 signed int v68; // eax@170 | |
8960 int v69; // ecx@170 | |
8961 int v70; // eax@171 | |
8962 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
8963 int v72; // [sp+30h] [bp-24h]@164 | |
8964 double v73; // [sp+40h] [bp-14h]@72 | |
8965 signed int v74; // [sp+44h] [bp-10h]@1 | |
8966 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
8967 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
8968 int v77; // [sp+50h] [bp-4h]@26 | |
8969 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
8970 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
8971 | |
8972 v4 = PID_ID(uObjID); | |
8973 v5 = PID_TYPE(uObjID) - 2; | |
8974 v74 = a2; | |
8975 uActorID = v4; | |
8976 if ( v5 ) | |
8977 { | |
8978 if ( v5 != 1 | |
8979 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
8980 v75 = v6->sHealth, | |
8981 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
8982 return; | |
8983 v8 = v6->pEquipment.uArmor; | |
8984 if ( !v8 | |
8985 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
8986 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
8987 || v10 > 11 ) | |
8988 { | |
8989 v14 = rand() % 4; | |
8990 if ( !v14 ) | |
8991 { | |
8992 v71 = (SoundID)108; | |
8993 goto LABEL_24; | |
8994 } | |
8995 v15 = v14 - 1; | |
8996 if ( !v15 ) | |
8997 { | |
8998 v71 = (SoundID)109; | |
8999 goto LABEL_24; | |
9000 } | |
9001 v16 = v15 - 1; | |
9002 if ( !v16 ) | |
9003 { | |
9004 v71 = (SoundID)110; | |
9005 goto LABEL_24; | |
9006 } | |
9007 if ( v16 == 1 ) | |
9008 { | |
9009 v71 = (SoundID)44; | |
9010 goto LABEL_24; | |
9011 } | |
9012 } | |
9013 else | |
9014 { | |
9015 v11 = rand() % 4; | |
9016 if ( !v11 ) | |
9017 { | |
9018 v71 = (SoundID)105; | |
9019 goto LABEL_24; | |
9020 } | |
9021 v12 = v11 - 1; | |
9022 if ( !v12 ) | |
9023 { | |
9024 v71 = (SoundID)106; | |
9025 goto LABEL_24; | |
9026 } | |
9027 v13 = v12 - 1; | |
9028 if ( !v13 ) | |
9029 { | |
9030 v71 = (SoundID)107; | |
9031 goto LABEL_24; | |
9032 } | |
9033 if ( v13 == 1 ) | |
9034 { | |
9035 v71 = (SoundID)45; | |
9036 LABEL_24: | |
9037 v17 = v71; | |
9038 goto LABEL_26; | |
9039 } | |
9040 } | |
9041 v17 = (SoundID)a4; | |
9042 LABEL_26: | |
9043 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | |
9044 v18 = Actor::_43B3E0_CalcDamage(v7, v74); | |
9045 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
9046 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
9047 v77 = v18; | |
9048 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
9049 { | |
9050 v21 = v7->pActorBuffs[3].uPower; | |
9051 if ( v21 ) | |
9052 v77 /= (signed int)v21; | |
9053 } | |
9054 if ( v74 ) | |
9055 { | |
9056 if ( v74 == 1 ) | |
9057 { | |
9058 v22 = v7->pMonsterInfo.uAttack2Type; | |
9059 } | |
9060 else | |
9061 { | |
9062 if ( v74 == 2 ) | |
9063 { | |
9064 v23 = v7->pMonsterInfo.uSpell1ID; | |
9065 } | |
9066 else | |
9067 { | |
9068 if ( v74 != 3 ) | |
9069 { | |
9070 if ( v74 == 4 ) | |
9071 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
9072 else | |
9073 v22 = 4; | |
9074 goto LABEL_43; | |
9075 } | |
9076 v23 = v7->pMonsterInfo.uSpell2ID; | |
9077 } | |
9078 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
9079 } | |
9080 } | |
9081 else | |
9082 { | |
9083 v22 = v7->pMonsterInfo.uAttack1Type; | |
9084 } | |
9085 LABEL_43: | |
9086 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
9087 { | |
9088 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); | |
9089 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
9090 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
9091 { | |
9092 v25 = v7->uAIState; | |
9093 if ( v25 != 5 ) | |
9094 { | |
9095 if ( v25 != 4 ) | |
9096 { | |
9097 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
9098 v7->sCurrentHP -= v26; | |
9099 if ( v26 ) | |
9100 { | |
9101 if ( v7->sCurrentHP >= 1 ) | |
9102 { | |
9103 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
9104 Actor::AggroSurroundingPeasants(uActorID, 1); | |
9105 } | |
9106 else | |
9107 { | |
9108 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
9109 { | |
9110 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
9111 v74 = v27; | |
9112 if ( pRenderer->pRenderD3D ) | |
9113 { | |
9114 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
9115 { | |
9116 v28 = (double)v74; | |
9117 v74 = v7->vPosition.z; | |
9118 v29 = (double)v74; | |
9119 v74 = v7->vPosition.y; | |
9120 v30 = v29; | |
9121 v31 = (double)v74; | |
9122 v74 = v7->vPosition.x; | |
9123 v32 = v31; | |
9124 v33 = (double)v74; | |
9125 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
9126 } | |
9127 } | |
9128 } | |
9129 Actor::Die(uActorID); | |
9130 Actor::ApplyFineForKillingPeasant(uActorID); | |
9131 Actor::AggroSurroundingPeasants(uActorID, 1); | |
9132 if ( v7->pMonsterInfo.uExp ) | |
9133 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); | |
9134 v34 = SPEECH_51; | |
9135 if ( rand() % 100 < 20 ) | |
9136 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
9137 v6->PlaySound((PlayerSpeech)v34, 0); | |
9138 } | |
9139 } | |
9140 } | |
9141 } | |
9142 } | |
9143 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
9144 && v7->pMonsterInfo.uSpecialAttack | |
9145 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
9146 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
9147 } | |
9148 if ( !pParty->bTurnBasedModeOn ) | |
9149 { | |
9150 v35 = v6->GetActualEndurance(); | |
9151 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
9152 v6->SetRecoveryTime((signed __int64)v36); | |
9153 } | |
9154 if ( v77 ) | |
9155 { | |
9156 v73 = (double)(signed int)v75; | |
9157 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
9158 { | |
9159 if ( v6->sHealth > 0 ) | |
9160 { | |
9161 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
9162 v6->PlaySound(SPEECH_48, 0); | |
9163 } | |
9164 } | |
9165 } | |
9166 viewparams->bRedrawGameUI = 1; | |
9167 return; | |
9168 } | |
9169 v37 = &pSpriteObjects[uActorID]; | |
9170 v38 = PID_TYPE(v37->spell_caster_pid); | |
9171 v39 = PID_ID(v37->spell_caster_pid); | |
9172 v40 = PID_TYPE(v37->spell_caster_pid); | |
9173 uActorID = PID_ID(v37->spell_caster_pid); | |
9174 v41 = v40 - 2; | |
9175 if ( !v41 ) | |
9176 goto LABEL_80; | |
9177 v42 = v41 - 1; | |
9178 if ( !v42 ) | |
9179 { | |
9180 v44 = &pActors[v39]; | |
9181 if ( a4 == -1 ) | |
9182 a4 = stru_50C198.which_player_would_attack(v44); | |
9183 v45 = &pParty->pPlayers[a4]; | |
9184 v77 = Actor::_43B3E0_CalcDamage(v44, v74); | |
9185 v46 = v37->uType; | |
9186 if ( v37->uType == 545 ) | |
9187 { | |
9188 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); | |
9189 v52 = v51; | |
9190 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
9191 { | |
9192 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); | |
9193 ShowStatusBarString(pTmpBuf.data(), 2u); | |
9194 v45->PlaySound(SPEECH_6, 0); | |
9195 return; | |
9196 } | |
9197 } | |
9198 else | |
9199 { | |
9200 if ( v46 != 555 | |
9201 && v46 != 510 | |
9202 && v46 != 500 | |
9203 && v46 != 515 | |
9204 && v46 != 505 | |
9205 && v46 != 530 | |
9206 && v46 != 525 | |
9207 && v46 != 520 | |
9208 && v46 != 535 | |
9209 && v46 != 540 ) | |
9210 goto LABEL_115; | |
9211 } | |
9212 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) | |
9213 return; | |
9214 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) | |
9215 v77 >>= 1; | |
9216 if ( v45->HasEnchantedItemEquipped(36) ) | |
9217 v77 >>= 1; | |
9218 if ( v45->HasEnchantedItemEquipped(69) ) | |
9219 v77 >>= 1; | |
9220 if ( v45->HasItemEquipped(EQUIP_ARMOUR) | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
9221 && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) |
1297 | 9222 v77 >>= 1; |
9223 v75 = 0; | |
9224 v47 = (int)&v45->pEquipment; | |
9225 do | |
9226 { | |
9227 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) | |
9228 { | |
9229 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
9230 if ( v48 == 520 ) | |
9231 v77 >>= 1; | |
9232 if ( v48 == 531 ) | |
9233 v77 >>= 1; | |
9234 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) | |
9235 v77 >>= 1; | |
9236 } | |
9237 ++v75; | |
9238 v47 += 4; | |
9239 } | |
9240 while ( (signed int)v75 <= 1 ); | |
9241 LABEL_115: | |
9242 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
9243 { | |
9244 v49 = v44->pActorBuffs[3].uPower; | |
9245 if ( v49 ) | |
9246 v77 /= (signed int)v49; | |
9247 } | |
9248 if ( !v74 ) | |
9249 { | |
9250 v50 = v44->pMonsterInfo.uAttack1Type; | |
9251 goto LABEL_133; | |
9252 } | |
9253 if ( v74 == 1 ) | |
9254 { | |
9255 v50 = v44->pMonsterInfo.uAttack2Type; | |
9256 goto LABEL_133; | |
9257 } | |
9258 if ( v74 == 2 ) | |
9259 { | |
9260 v53 = v44->pMonsterInfo.uSpell1ID; | |
9261 } | |
9262 else | |
9263 { | |
9264 if ( v74 != 3 ) | |
9265 { | |
9266 if ( v74 == 4 ) | |
9267 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
9268 else | |
9269 v50 = 4; | |
9270 LABEL_133: | |
9271 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
9272 { | |
9273 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); | |
9274 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
9275 { | |
9276 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
9277 { | |
9278 v55 = v44->uAIState; | |
9279 if ( v55 != 5 ) | |
9280 { | |
9281 if ( v55 != 4 ) | |
9282 { | |
9283 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
9284 v44->sCurrentHP -= v56; | |
9285 if ( v56 ) | |
9286 { | |
9287 if ( v44->sCurrentHP >= 1 ) | |
9288 { | |
9289 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); | |
9290 Actor::AggroSurroundingPeasants(uActorID, 1); | |
9291 } | |
9292 else | |
9293 { | |
9294 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
9295 { | |
9296 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
9297 v75 = v57; | |
9298 if ( pRenderer->pRenderD3D ) | |
9299 { | |
9300 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
9301 { | |
9302 v58 = (double)(signed int)v75; | |
9303 v75 = v44->vPosition.z; | |
9304 v59 = (double)(signed int)v75; | |
9305 v75 = v44->vPosition.y; | |
9306 v60 = v59; | |
9307 v61 = (double)(signed int)v75; | |
9308 v75 = v44->vPosition.x; | |
9309 v62 = v61; | |
9310 v63 = (double)(signed int)v75; | |
9311 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
9312 } | |
9313 } | |
9314 } | |
9315 Actor::Die(uActorID); | |
9316 Actor::ApplyFineForKillingPeasant(uActorID); | |
9317 Actor::AggroSurroundingPeasants(uActorID, 1); | |
9318 if ( v44->pMonsterInfo.uExp ) | |
9319 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); | |
9320 v64 = SPEECH_51; | |
9321 if ( rand() % 100 < 20 ) | |
9322 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
9323 v45->PlaySound((PlayerSpeech)v64, 0); | |
9324 } | |
9325 } | |
9326 } | |
9327 } | |
9328 } | |
9329 } | |
9330 } | |
9331 if ( !v74 | |
9332 && !(dword_6BE368_debug_settings_2 & 0x10) | |
9333 && v44->pMonsterInfo.uSpecialAttack | |
9334 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
9335 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); | |
9336 if ( !pParty->bTurnBasedModeOn ) | |
9337 { | |
9338 v65 = v45->GetActualEndurance(); | |
9339 v66 = (double)(20 - v45->GetParameterBonus(v65)) | |
9340 * flt_6BE3A4_debug_recmod1 | |
9341 * 2.133333333333333; | |
9342 v45->SetRecoveryTime((signed __int64)v66); | |
9343 } | |
9344 return; | |
9345 } | |
9346 v53 = v44->pMonsterInfo.uSpell2ID; | |
9347 } | |
9348 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
9349 goto LABEL_133; | |
9350 } | |
9351 if ( v42 != 1 ) | |
9352 return; | |
9353 LABEL_80: | |
9354 if ( a4 != -1 ) | |
9355 { | |
9356 v43 = &pParty->pPlayers[a4]; | |
9357 LABEL_168: | |
9358 a4b = v43; | |
9359 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | |
9360 { | |
9361 v70 = v43->GetMaxHealth(); | |
9362 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); | |
9363 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
9364 } | |
9365 else | |
9366 { | |
9367 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
9368 v69 = 0; | |
9369 } | |
9370 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); | |
9371 if ( v38 == OBJECT_Player && !qword_A750D8 ) | |
9372 { | |
9373 qword_A750D8 = 256i64; | |
1406 | 9374 PlayerSpeechID = SPEECH_44; |
1407 | 9375 uSpeakingCharacter = uActorID + 1; |
1297 | 9376 } |
9377 return; | |
9378 } | |
9379 v74 = 0; | |
9380 a4a = 1; | |
9381 do | |
9382 { | |
9383 if ( pPlayers[a4a]->CanAct() ) | |
9384 { | |
9385 v67 = v74++; | |
9386 *(&v72 + v67) = a4a; | |
9387 } | |
9388 ++a4a; | |
9389 } | |
9390 while ( a4a <= 4 ); | |
9391 if ( v74 ) | |
9392 { | |
9393 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | |
9394 goto LABEL_168; | |
9395 } | |
9396 } | |
9397 //----- (00421EA6) -------------------------------------------------------- | |
9398 void __cdecl OnInventoryLeftClick() | |
9399 { | |
9400 Player *v0; // ebx@1 | |
9401 signed int v1; // eax@2 | |
9402 signed int v2; // ecx@2 | |
9403 int v3; // eax@2 | |
9404 char v4; // sf@2 | |
9405 int v5; // eax@2 | |
9406 unsigned int v6; // eax@7 | |
9407 unsigned int v7; // esi@12 | |
9408 unsigned int v8; // eax@12 | |
9409 unsigned int v9; // eax@16 | |
9410 unsigned int v10; // eax@18 | |
9411 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
9412 POINT a2; // [sp+30h] [bp-18h]@4 | |
9413 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
9414 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
9415 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
9416 int a4; // [sp+44h] [bp-4h]@2 | |
9417 | |
9418 v0 = pPlayers[uActiveCharacter]; | |
9419 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | |
9420 { | |
9421 pMouse->GetClickPos(&pX, &pY); | |
9422 pY = pY - 17; | |
9423 v2 =pX - 14; | |
9424 pX = v2; | |
9425 v3 = 14 * (pY >> 5); | |
9426 v2 >>= 5; | |
9427 v4 = v2 + v3 < 0; | |
9428 v5 = v2 + v3; | |
9429 a4 = v5; | |
9430 if ( !v4 ) | |
9431 { | |
9432 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | |
9433 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
9434 { | |
9435 if ( unk_50C9A0 ) | |
9436 { | |
9437 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
9438 if ( v6 ) | |
9439 { | |
9440 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
9441 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
9442 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
9443 *((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
|
9444 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; |
1297 | 9445 unk_50C9A0 = 0; |
9446 if ( pMessageQueue_50CBD0->uNumMessages ) | |
9447 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
9448 pMouse->SetCursorBitmap("MICON1"); | |
9449 dword_50C9D0 = 113; | |
9450 dword_50C9D4 = 0; | |
9451 dword_50C9D8 = 256; | |
9452 } | |
9453 return; | |
9454 } | |
9455 if ( ptr_50C9A4 ) | |
9456 return; | |
9457 v7 = pParty->pPickedItem.uItemID; | |
9458 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
9459 if ( !v7 ) | |
9460 { | |
9461 if ( !v8 ) | |
9462 return; | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
9463 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); |
1297 | 9464 v0->RemoveItemAtInventoryIndex(a4); |
9465 v9 = pParty->pPickedItem.uItemID; | |
9466 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
9467 return; | |
9468 } | |
9469 v13 = v8; | |
9470 if ( v8 ) | |
9471 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
9472 a2.y = (LONG)&v0->pInventoryItemList[v8-1]; |
1297 | 9473 memcpy(&this_, (const void *)a2.y, sizeof(this_)); |
9474 v0->RemoveItemAtInventoryIndex(a4); | |
9475 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
9476 if ( !pX ) | |
9477 { | |
9478 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
9479 if ( !pX ) | |
9480 { | |
1383
0a4254e80036
Player::PutItemArInventoryIndex, Player::RemoveItemAtInventoryIndex cleanup, slightly simplified
Grumpy7
parents:
1382
diff
changeset
|
9481 v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); |
1297 | 9482 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); |
9483 return; | |
9484 } | |
9485 } | |
9486 v9 = this_.uItemID; | |
9487 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
9488 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
9489 return; | |
9490 } | |
9491 v10 = v0->AddItem(a4, v7); | |
9492 pX = v10; | |
9493 if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
9494 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1383
diff
changeset
|
9495 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); |
1297 | 9496 pMouse->RemoveHoldingItem(); |
9497 } | |
9498 } | |
9499 } | |
9500 } | |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9501 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9502 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9503 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9504 bool Player::IsWeak() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9505 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9506 return pConditions[Condition_Weak] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9507 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9508 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9509 bool Player::IsDead() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9510 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9511 return pConditions[Condition_Dead] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9512 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9513 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9514 bool Player::IsEradicated() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9515 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9516 return pConditions[Condition_Eradicated] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9517 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9518 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9519 bool Player::IsZombie() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9520 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9521 return pConditions[Condition_Zombie] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9522 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9523 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9524 bool Player::IsCursed() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9525 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9526 return pConditions[Condition_Cursed] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9527 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9528 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9529 bool Player::IsPertified() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9530 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9531 return pConditions[Condition_Pertified] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9532 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9533 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9534 bool Player::IsUnconcious() |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9535 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9536 return pConditions[Condition_Unconcious] != 0; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9537 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9538 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9539 bool Player::IsAsleep() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9540 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9541 return pConditions[Condition_Sleep] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9542 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9543 |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9544 bool Player::IsParalyzed() |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9545 { |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9546 return pConditions[Condition_Paralyzed] != 0; |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9547 } |
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9548 |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9549 void Player::SetCursed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9550 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9551 pConditions[Condition_Cursed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9552 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9553 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9554 void Player::SetWeak( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9555 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9556 pConditions[Condition_Weak] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9557 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9558 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9559 void Player::SetAsleep( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9560 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9561 pConditions[Condition_Sleep] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9562 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9563 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9564 void Player::SetAfraid( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9565 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9566 pConditions[Condition_Fear] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9567 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9568 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9569 void Player::SetDrunk( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9570 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9571 pConditions[Condition_Drunk] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9572 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9573 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9574 void Player::SetInsane( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9575 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9576 pConditions[Condition_Insane] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9577 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9578 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9579 void Player::SetPoison1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9580 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9581 pConditions[Condition_Poison1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9582 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9583 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9584 void Player::SetDisease1( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9585 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9586 pConditions[Condition_Disease1] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9587 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9588 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9589 void Player::SetPoison2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9590 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9591 pConditions[Condition_Poison2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9592 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9593 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9594 void Player::SetDisease2( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9595 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9596 pConditions[Condition_Disease2] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9597 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9598 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9599 void Player::SetPoison3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9600 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9601 pConditions[Condition_Poison3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9602 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9603 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9604 void Player::SetDisease3( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9605 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9606 pConditions[Condition_Disease3] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9607 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9608 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9609 void Player::SetParalyzed( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9610 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9611 pConditions[Condition_Paralyzed] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9612 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9613 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9614 void Player::SetUnconcious( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9615 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9616 pConditions[Condition_Unconcious] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9617 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9618 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9619 void Player::SetDead( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9620 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9621 pConditions[Condition_Dead] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9622 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9623 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9624 void Player::SetPertified( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9625 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9626 pConditions[Condition_Pertified] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9627 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9628 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9629 void Player::SetEradicated( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9630 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9631 pConditions[Condition_Eradicated] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9632 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9633 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9634 void Player::SetZombie( bool state ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9635 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9636 pConditions[Condition_Zombie] = state; |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9637 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9638 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9639 void Player::SetCondWeakWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9640 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9641 SetCondition(Condition_Weak, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9642 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9643 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9644 void Player::SetCondInsaneWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9645 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9646 SetCondition(Condition_Insane, blockable); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9647 } |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9648 |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9649 void Player::SetCondDeadWithBlockCheck( int blockable ) |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9650 { |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1360
diff
changeset
|
9651 SetCondition(Condition_Dead, blockable); |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1361
diff
changeset
|
9652 } |