annotate Engine/Objects/Player.cpp @ 2556:91c75d202d30

Shooting bow sound & stats word wrap (bugfix submitted by default8p)
author a.parshin
date Thu, 14 May 2015 11:03:14 +0200
parents f2a8ed07e921
children 30eb6dcac768
rev   line source
2498
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7 #include "Engine/Engine.h"
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
8
2498
Ritor1
parents:
diff changeset
9 #include "stru6.h"
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11 #include "Player.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
12 #include "../Tables/PlayerFrameTable.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
13 #include "Media/Audio/AudioPlayer.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
14 #include "../Party.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
15 #include "../LOD.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
16 #include "GUI/GUIWindow.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
17 #include "../Graphics/Viewport.h"
2498
Ritor1
parents:
diff changeset
18 #include "Actor.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
19 #include "IO/Mouse.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
20 #include "../TurnEngine/TurnEngine.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
21 #include "../Events.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
22 #include "../Events2D.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
23 #include "../Graphics/Outdoor.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
24 #include "../Tables/StorylineTextTable.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
25 #include "../Autonotes.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
26 #include "../Awards.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
27 #include "../texts.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
28
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
29 #include "../stru123.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
30 #include "../stru298.h"
2498
Ritor1
parents:
diff changeset
31 #include "ObjectList.h"
Ritor1
parents:
diff changeset
32 #include "SpriteObject.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
33 #include "../Graphics/DecalBuilder.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
34 #include "../Spells/CastSpellInfo.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
35 #include "../OurMath.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
36 #include "..\..\GUI\UI\UIPartyCreation.h"
2498
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40
Ritor1
parents:
diff changeset
41 NZIArray<struct Player *, 5> pPlayers;
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 /* 381 */
Ritor1
parents:
diff changeset
45 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
46 struct PlayerCreation_AttributeProps
Ritor1
parents:
diff changeset
47 {
Ritor1
parents:
diff changeset
48 unsigned __int8 uBaseValue;
Ritor1
parents:
diff changeset
49 char uMaxValue;
Ritor1
parents:
diff changeset
50 char uDroppedStep;
Ritor1
parents:
diff changeset
51 char uBaseStep;
Ritor1
parents:
diff changeset
52 };
Ritor1
parents:
diff changeset
53 #pragma pack(pop)
Ritor1
parents:
diff changeset
54
Ritor1
parents:
diff changeset
55
Ritor1
parents:
diff changeset
56 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60 #pragma pack(pop)
Ritor1
parents:
diff changeset
61 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0
Ritor1
parents:
diff changeset
62 {
Ritor1
parents:
diff changeset
63 {{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},},
Ritor1
parents:
diff changeset
64 {{ 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},},
Ritor1
parents:
diff changeset
65 {{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},},
Ritor1
parents:
diff changeset
66 {{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}}
Ritor1
parents:
diff changeset
67 };
Ritor1
parents:
diff changeset
68
Ritor1
parents:
diff changeset
69
Ritor1
parents:
diff changeset
70
Ritor1
parents:
diff changeset
71 std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; //dword_4EDEA0 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one
Ritor1
parents:
diff changeset
72 std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100, 200}; //dword_4EDEB4
Ritor1
parents:
diff changeset
73 std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; //dword_4EDEC4 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one
Ritor1
parents:
diff changeset
74
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76
Ritor1
parents:
diff changeset
77 // available skills per class ( 9 classes X 37 skills )
Ritor1
parents:
diff changeset
78 // 0 - not available
Ritor1
parents:
diff changeset
79 // 1 - available
Ritor1
parents:
diff changeset
80 // 2 - primary skill
Ritor1
parents:
diff changeset
81 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820
Ritor1
parents:
diff changeset
82 {
Ritor1
parents:
diff changeset
83 {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},
Ritor1
parents:
diff changeset
84 {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},
Ritor1
parents:
diff changeset
85 {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},
Ritor1
parents:
diff changeset
86 {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},
Ritor1
parents:
diff changeset
87 {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},
Ritor1
parents:
diff changeset
88 {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},
Ritor1
parents:
diff changeset
89 {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},
Ritor1
parents:
diff changeset
90 {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},
Ritor1
parents:
diff changeset
91 {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
Ritor1
parents:
diff changeset
92 };
Ritor1
parents:
diff changeset
93
Ritor1
parents:
diff changeset
94
Ritor1
parents:
diff changeset
95 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 1, // EQUIP_SINGLE_HANDED
Ritor1
parents:
diff changeset
98 1, // EQUIP_TWO_HANDED
Ritor1
parents:
diff changeset
99 2, // EQUIP_BOW
Ritor1
parents:
diff changeset
100 3, // EQUIP_ARMOUR
Ritor1
parents:
diff changeset
101 0, // EQUIP_SHIELD
Ritor1
parents:
diff changeset
102 4, // EQUIP_HELMET
Ritor1
parents:
diff changeset
103 5, // EQUIP_BELT
Ritor1
parents:
diff changeset
104 6, // EQUIP_CLOAK
Ritor1
parents:
diff changeset
105 7, // EQUIP_GAUNTLETS
Ritor1
parents:
diff changeset
106 8, // EQUIP_BOOTS
Ritor1
parents:
diff changeset
107 10, // EQUIP_RING
Ritor1
parents:
diff changeset
108 9, // EQUIP_AMULET
Ritor1
parents:
diff changeset
109 1, // EQUIP_WAND
Ritor1
parents:
diff changeset
110 0, // EQUIP_REAGENT
Ritor1
parents:
diff changeset
111 0, // EQUIP_POTION
Ritor1
parents:
diff changeset
112 0, // EQUIP_SPELL_SCROLL
Ritor1
parents:
diff changeset
113 0, // EQUIP_BOOK
Ritor1
parents:
diff changeset
114 0, // EQUIP_MESSAGE_SCROLL
Ritor1
parents:
diff changeset
115 0, // EQUIP_GOLD
Ritor1
parents:
diff changeset
116 0, // EQUIP_GEM
Ritor1
parents:
diff changeset
117 0 // EQUIP_NONE
Ritor1
parents:
diff changeset
118 };
Ritor1
parents:
diff changeset
119
Ritor1
parents:
diff changeset
120
Ritor1
parents:
diff changeset
121 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0};
Ritor1
parents:
diff changeset
122 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0};
Ritor1
parents:
diff changeset
123 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};
Ritor1
parents:
diff changeset
124 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};
Ritor1
parents:
diff changeset
125
Ritor1
parents:
diff changeset
126 unsigned char pConditionAttributeModifier[7][19] =
Ritor1
parents:
diff changeset
127 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might
Ritor1
parents:
diff changeset
128 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence
Ritor1
parents:
diff changeset
129 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower
Ritor1
parents:
diff changeset
130 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance
Ritor1
parents:
diff changeset
131 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy
Ritor1
parents:
diff changeset
132 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed
Ritor1
parents:
diff changeset
133 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck
Ritor1
parents:
diff changeset
134
Ritor1
parents:
diff changeset
135 unsigned char pAgingAttributeModifier[7][4] =
Ritor1
parents:
diff changeset
136 {{100, 75, 40, 10}, //Might
Ritor1
parents:
diff changeset
137 {100, 150, 100, 10}, //Intelligence
Ritor1
parents:
diff changeset
138 {100, 150, 100, 10}, //Willpower
Ritor1
parents:
diff changeset
139 {100, 75, 40, 10}, //Endurance
Ritor1
parents:
diff changeset
140 {100, 100, 40, 10}, //Accuracy
Ritor1
parents:
diff changeset
141 {100, 100, 40, 10}, //Speed
Ritor1
parents:
diff changeset
142 {100, 100, 100, 100}}; //Luck
Ritor1
parents:
diff changeset
143
Ritor1
parents:
diff changeset
144 unsigned int pAgeingTable[4] = {50, 100, 150, 0xFFFF};
Ritor1
parents:
diff changeset
145
Ritor1
parents:
diff changeset
146 std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}};
Ritor1
parents:
diff changeset
147
Ritor1
parents:
diff changeset
148 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175,
Ritor1
parents:
diff changeset
149 150, 125, 100, 75, 50, 40, 35, 30, 25, 21,
Ritor1
parents:
diff changeset
150 19, 17, 15, 13, 11, 9, 7, 5, 3, 0};
Ritor1
parents:
diff changeset
151 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};
Ritor1
parents:
diff changeset
152
Ritor1
parents:
diff changeset
153
Ritor1
parents:
diff changeset
154 unsigned short base_recovery_times_per_weapon_type[12] =
Ritor1
parents:
diff changeset
155 {
Ritor1
parents:
diff changeset
156 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill
Ritor1
parents:
diff changeset
157 90, // PLAYER_SKILL_SWORD && Unarmed with skill
Ritor1
parents:
diff changeset
158 60, // PLAYER_SKILL_DAGGER
Ritor1
parents:
diff changeset
159 100, // PLAYER_SKILL_AXE
Ritor1
parents:
diff changeset
160 80, // PLAYER_SKILL_SPEAR
Ritor1
parents:
diff changeset
161 100, // PLAYER_SKILL_BOW
Ritor1
parents:
diff changeset
162 80, // PLAYER_SKILL_MACE
Ritor1
parents:
diff changeset
163 30, // PLAYER_SKILL_BLASTER
Ritor1
parents:
diff changeset
164 10, // PLAYER_SKILL_SHIELD
Ritor1
parents:
diff changeset
165 10, // PLAYER_SKILL_LEATHER
Ritor1
parents:
diff changeset
166 20, // PLAYER_SKILL_CHAIN
Ritor1
parents:
diff changeset
167 30 // PLAYER_SKILL_PLATE
Ritor1
parents:
diff changeset
168 };
Ritor1
parents:
diff changeset
169
Ritor1
parents:
diff changeset
170 //----- (00490913) --------------------------------------------------------
Ritor1
parents:
diff changeset
171 int PlayerCreation_GetUnspentAttributePointCount()
Ritor1
parents:
diff changeset
172 {
Ritor1
parents:
diff changeset
173 signed int v0; // edi@1
Ritor1
parents:
diff changeset
174 int raceId; // ebx@2
Ritor1
parents:
diff changeset
175 signed int v4; // eax@17
Ritor1
parents:
diff changeset
176 int v5; // edx@18
Ritor1
parents:
diff changeset
177 signed int v6; // ecx@18
Ritor1
parents:
diff changeset
178 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
179
Ritor1
parents:
diff changeset
180 remainingStatPoints = 50;
Ritor1
parents:
diff changeset
181 v0 = 50;
Ritor1
parents:
diff changeset
182 for (int playerNum = 0; playerNum < 4; playerNum++)
Ritor1
parents:
diff changeset
183 {
Ritor1
parents:
diff changeset
184 raceId = pParty->pPlayers[playerNum].GetRace();
Ritor1
parents:
diff changeset
185 for (int statNum = 0; statNum <= 6; statNum++)
Ritor1
parents:
diff changeset
186 {
Ritor1
parents:
diff changeset
187 switch ( statNum )
Ritor1
parents:
diff changeset
188 {
Ritor1
parents:
diff changeset
189 case 0:
Ritor1
parents:
diff changeset
190 v0 = pParty->pPlayers[playerNum].uMight;
Ritor1
parents:
diff changeset
191 break;
Ritor1
parents:
diff changeset
192 case 1:
Ritor1
parents:
diff changeset
193 v0 = pParty->pPlayers[playerNum].uIntelligence;
Ritor1
parents:
diff changeset
194 break;
Ritor1
parents:
diff changeset
195 case 2:
Ritor1
parents:
diff changeset
196 v0 = pParty->pPlayers[playerNum].uWillpower;
Ritor1
parents:
diff changeset
197 break;
Ritor1
parents:
diff changeset
198 case 3:
Ritor1
parents:
diff changeset
199 v0 = pParty->pPlayers[playerNum].uEndurance;
Ritor1
parents:
diff changeset
200 break;
Ritor1
parents:
diff changeset
201 case 4:
Ritor1
parents:
diff changeset
202 v0 = pParty->pPlayers[playerNum].uAccuracy;
Ritor1
parents:
diff changeset
203 break;
Ritor1
parents:
diff changeset
204 case 5:
Ritor1
parents:
diff changeset
205 v0 = pParty->pPlayers[playerNum].uSpeed;
Ritor1
parents:
diff changeset
206 break;
Ritor1
parents:
diff changeset
207 case 6:
Ritor1
parents:
diff changeset
208 v0 = pParty->pPlayers[playerNum].uLuck;
Ritor1
parents:
diff changeset
209 break;
Ritor1
parents:
diff changeset
210 }
Ritor1
parents:
diff changeset
211 v4 = StatTable[raceId][statNum].uBaseValue;
Ritor1
parents:
diff changeset
212 if ( v0 >= v4 )
Ritor1
parents:
diff changeset
213 {
Ritor1
parents:
diff changeset
214 v5 = StatTable[raceId][statNum].uDroppedStep;
Ritor1
parents:
diff changeset
215 v6 = StatTable[raceId][statNum].uBaseStep;
Ritor1
parents:
diff changeset
216 }
Ritor1
parents:
diff changeset
217 else
Ritor1
parents:
diff changeset
218 {
Ritor1
parents:
diff changeset
219 v5 = StatTable[raceId][statNum].uBaseStep;
Ritor1
parents:
diff changeset
220 v6 = StatTable[raceId][statNum].uDroppedStep;
Ritor1
parents:
diff changeset
221 }
Ritor1
parents:
diff changeset
222 remainingStatPoints += v5 * (v4 - v0) / v6;
Ritor1
parents:
diff changeset
223 }
Ritor1
parents:
diff changeset
224 }
Ritor1
parents:
diff changeset
225 return remainingStatPoints;
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227
Ritor1
parents:
diff changeset
228 //----- (00427730) --------------------------------------------------------
Ritor1
parents:
diff changeset
229 bool Player::CanCastSpell(unsigned int uRequiredMana)
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 if (sMana >= (signed int)uRequiredMana)
Ritor1
parents:
diff changeset
232 {
Ritor1
parents:
diff changeset
233 sMana -= (signed int)uRequiredMana;
Ritor1
parents:
diff changeset
234 return true;
Ritor1
parents:
diff changeset
235 }
Ritor1
parents:
diff changeset
236
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
237 pAudioPlayer->PlaySound(SOUND_spellfail0201, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
238 return false;
Ritor1
parents:
diff changeset
239 }
Ritor1
parents:
diff changeset
240
Ritor1
parents:
diff changeset
241 //----- (004BE2DD) --------------------------------------------------------
Ritor1
parents:
diff changeset
242 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx )
Ritor1
parents:
diff changeset
243 {
Ritor1
parents:
diff changeset
244 float v6; // ST04_4@1
Ritor1
parents:
diff changeset
245 signed int item_value; // eax@1
Ritor1
parents:
diff changeset
246 signed int sell_price; // ebx@1
Ritor1
parents:
diff changeset
247
Ritor1
parents:
diff changeset
248 item_value =pOwnItems[item_index].GetValue();
Ritor1
parents:
diff changeset
249 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier;
Ritor1
parents:
diff changeset
250 sell_price = GetPriceSell(item_value, v6);
Ritor1
parents:
diff changeset
251 if ( pOwnItems[item_index].IsBroken() )
Ritor1
parents:
diff changeset
252 sell_price = 1;
Ritor1
parents:
diff changeset
253 if ( sell_price < 1 )
Ritor1
parents:
diff changeset
254 sell_price = 1;
Ritor1
parents:
diff changeset
255 RemoveItemAtInventoryIndex(inventory_idnx);
Ritor1
parents:
diff changeset
256 Party::SetGold(pParty->uNumGold + sell_price);
Ritor1
parents:
diff changeset
257 }
Ritor1
parents:
diff changeset
258
Ritor1
parents:
diff changeset
259 //----- (0043EEF3) --------------------------------------------------------
Ritor1
parents:
diff changeset
260 bool Player::NothingOrJustBlastersEquipped()
Ritor1
parents:
diff changeset
261 {
Ritor1
parents:
diff changeset
262 signed int item_idx; // esi@1
Ritor1
parents:
diff changeset
263 signed int item_id; // esi@1
Ritor1
parents:
diff changeset
264 for (int i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
265 {
Ritor1
parents:
diff changeset
266 item_idx = pEquipment.pIndices[i];
Ritor1
parents:
diff changeset
267 if (item_idx)
Ritor1
parents:
diff changeset
268 {
Ritor1
parents:
diff changeset
269 item_id = pOwnItems[item_idx - 1].uItemID;
Ritor1
parents:
diff changeset
270 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle
Ritor1
parents:
diff changeset
271 return false;
Ritor1
parents:
diff changeset
272 }
Ritor1
parents:
diff changeset
273 }
Ritor1
parents:
diff changeset
274 return true;
Ritor1
parents:
diff changeset
275 }
Ritor1
parents:
diff changeset
276
Ritor1
parents:
diff changeset
277 //----- (004B8040) --------------------------------------------------------
Ritor1
parents:
diff changeset
278 int Player::GetConditionDayOfWeek( unsigned int uCondition )
Ritor1
parents:
diff changeset
279 {
Ritor1
parents:
diff changeset
280 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1;
Ritor1
parents:
diff changeset
281 }
Ritor1
parents:
diff changeset
282
Ritor1
parents:
diff changeset
283 //----- (004B807C) --------------------------------------------------------
Ritor1
parents:
diff changeset
284 int Player::GetTempleHealCostModifier(float a2)
Ritor1
parents:
diff changeset
285 {
Ritor1
parents:
diff changeset
286 unsigned int conditionIdx; // eax@1
Ritor1
parents:
diff changeset
287 int conditionTimeMultiplier; // esi@1
Ritor1
parents:
diff changeset
288 int v6; // eax@8
Ritor1
parents:
diff changeset
289 signed int result; // qax@13
Ritor1
parents:
diff changeset
290 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4
Ritor1
parents:
diff changeset
291
Ritor1
parents:
diff changeset
292 conditionIdx = GetMajorConditionIdx();
Ritor1
parents:
diff changeset
293 if ( conditionIdx >= 14 && conditionIdx <= 16)
Ritor1
parents:
diff changeset
294 {
Ritor1
parents:
diff changeset
295 if ( conditionIdx <= 15 )
Ritor1
parents:
diff changeset
296 baseConditionMultiplier = 5;
Ritor1
parents:
diff changeset
297 else //if ( conditionIdx == 16 )
Ritor1
parents:
diff changeset
298 baseConditionMultiplier = 10;
Ritor1
parents:
diff changeset
299 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx);
Ritor1
parents:
diff changeset
300 }
Ritor1
parents:
diff changeset
301 else
Ritor1
parents:
diff changeset
302 {
Ritor1
parents:
diff changeset
303 conditionTimeMultiplier = 1;
Ritor1
parents:
diff changeset
304 baseConditionMultiplier = 1;
Ritor1
parents:
diff changeset
305 if (conditionIdx < 14)
Ritor1
parents:
diff changeset
306 {
Ritor1
parents:
diff changeset
307 for (int i = 0; i <= 13; i++)
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 v6 = GetConditionDayOfWeek(i);
Ritor1
parents:
diff changeset
310 if ( v6 > conditionTimeMultiplier )
Ritor1
parents:
diff changeset
311 conditionTimeMultiplier = v6;
Ritor1
parents:
diff changeset
312 }
Ritor1
parents:
diff changeset
313 }
Ritor1
parents:
diff changeset
314 }
Ritor1
parents:
diff changeset
315 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2);
Ritor1
parents:
diff changeset
316 if ( result < 1 )
Ritor1
parents:
diff changeset
317 result = 1;
Ritor1
parents:
diff changeset
318 return result;
Ritor1
parents:
diff changeset
319 }
Ritor1
parents:
diff changeset
320
Ritor1
parents:
diff changeset
321 //----- (004B8102) --------------------------------------------------------
Ritor1
parents:
diff changeset
322 int Player::GetPriceSell(int uRealValue, float price_multiplier)
Ritor1
parents:
diff changeset
323 {
Ritor1
parents:
diff changeset
324 signed int v3; // esi@1
Ritor1
parents:
diff changeset
325 signed int result; // eax@3
Ritor1
parents:
diff changeset
326
Ritor1
parents:
diff changeset
327 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100);
Ritor1
parents:
diff changeset
328 if ( v3 > uRealValue )
Ritor1
parents:
diff changeset
329 v3 = uRealValue;
Ritor1
parents:
diff changeset
330 result = 1;
Ritor1
parents:
diff changeset
331 if ( v3 >= 1 )
Ritor1
parents:
diff changeset
332 result = v3;
Ritor1
parents:
diff changeset
333 return result;
Ritor1
parents:
diff changeset
334 }
Ritor1
parents:
diff changeset
335
Ritor1
parents:
diff changeset
336 //----- (004B8142) --------------------------------------------------------
Ritor1
parents:
diff changeset
337 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
Ritor1
parents:
diff changeset
338 {
Ritor1
parents:
diff changeset
339 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
Ritor1
parents:
diff changeset
340
Ritor1
parents:
diff changeset
341 if (price < uRealValue)
Ritor1
parents:
diff changeset
342 price = uRealValue;
Ritor1
parents:
diff changeset
343 return price;
Ritor1
parents:
diff changeset
344 }
Ritor1
parents:
diff changeset
345
Ritor1
parents:
diff changeset
346 //----- (004B8179) --------------------------------------------------------
Ritor1
parents:
diff changeset
347 int Player::GetPriceIdentification(float a2)
Ritor1
parents:
diff changeset
348 {
Ritor1
parents:
diff changeset
349 signed int v2; // esi@1
Ritor1
parents:
diff changeset
350 int v3; // ecx@1
Ritor1
parents:
diff changeset
351 signed int result; // eax@3
Ritor1
parents:
diff changeset
352
Ritor1
parents:
diff changeset
353 v2 = (signed int)(a2 * 50.0);
Ritor1
parents:
diff changeset
354 v3 = v2 * (100 - GetMerchant()) / 100;
Ritor1
parents:
diff changeset
355 if ( v3 < v2 / 3 )
Ritor1
parents:
diff changeset
356 v3 = v2 / 3;
Ritor1
parents:
diff changeset
357 result = 1;
Ritor1
parents:
diff changeset
358 if ( v3 >= 1 )
Ritor1
parents:
diff changeset
359 result = v3;
Ritor1
parents:
diff changeset
360 return result;
Ritor1
parents:
diff changeset
361 }
Ritor1
parents:
diff changeset
362
Ritor1
parents:
diff changeset
363 //----- (004B81C3) --------------------------------------------------------
Ritor1
parents:
diff changeset
364 int Player::GetPriceRepair(int a2, float a3)
Ritor1
parents:
diff changeset
365 {
Ritor1
parents:
diff changeset
366 signed int v3; // esi@1
Ritor1
parents:
diff changeset
367 int v4; // ecx@1
Ritor1
parents:
diff changeset
368 signed int result; // eax@3
Ritor1
parents:
diff changeset
369
Ritor1
parents:
diff changeset
370 v3 = (signed int)((double)a2 / (6.0 - a3));
Ritor1
parents:
diff changeset
371 v4 = v3 * (100 - GetMerchant()) / 100;
Ritor1
parents:
diff changeset
372 if ( v4 < v3 / 3 )
Ritor1
parents:
diff changeset
373 v4 = v3 / 3;
Ritor1
parents:
diff changeset
374 result = 1;
Ritor1
parents:
diff changeset
375 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
376 result = v4;
Ritor1
parents:
diff changeset
377 return result;
Ritor1
parents:
diff changeset
378 }
Ritor1
parents:
diff changeset
379
Ritor1
parents:
diff changeset
380 //----- (004B8213) --------------------------------------------------------
Ritor1
parents:
diff changeset
381 int Player::GetBaseSellingPrice(int a2, float a3)
Ritor1
parents:
diff changeset
382 {
Ritor1
parents:
diff changeset
383 signed int v3; // qax@1
Ritor1
parents:
diff changeset
384
Ritor1
parents:
diff changeset
385 v3 = (signed int)((double)a2 / (a3 + 2.0));
Ritor1
parents:
diff changeset
386 if ( v3 < 1 )
Ritor1
parents:
diff changeset
387 v3 = 1;
Ritor1
parents:
diff changeset
388 return v3;
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390
Ritor1
parents:
diff changeset
391 //----- (004B8233) --------------------------------------------------------
Ritor1
parents:
diff changeset
392 int Player::GetBaseBuyingPrice(int a2, float a3)
Ritor1
parents:
diff changeset
393 {
Ritor1
parents:
diff changeset
394 signed int v3; // qax@1
Ritor1
parents:
diff changeset
395
Ritor1
parents:
diff changeset
396 v3 = (signed int)((double)a2 * a3);
Ritor1
parents:
diff changeset
397 if ( v3 < 1 )
Ritor1
parents:
diff changeset
398 v3 = 1;
Ritor1
parents:
diff changeset
399 return v3;
Ritor1
parents:
diff changeset
400 }
Ritor1
parents:
diff changeset
401
Ritor1
parents:
diff changeset
402 //----- (004B824B) --------------------------------------------------------
Ritor1
parents:
diff changeset
403 int Player::GetBaseIdentifyPrice(float a2)
Ritor1
parents:
diff changeset
404 {
Ritor1
parents:
diff changeset
405 signed int v2; // qax@1
Ritor1
parents:
diff changeset
406
Ritor1
parents:
diff changeset
407 v2 = (signed int)(a2 * 50.0);
Ritor1
parents:
diff changeset
408 if ( v2 < 1 )
Ritor1
parents:
diff changeset
409 v2 = 1;
Ritor1
parents:
diff changeset
410 return v2;
Ritor1
parents:
diff changeset
411 }
Ritor1
parents:
diff changeset
412
Ritor1
parents:
diff changeset
413 //----- (004B8265) --------------------------------------------------------
Ritor1
parents:
diff changeset
414 int Player::GetBaseRepairPrice(int a2, float a3)
Ritor1
parents:
diff changeset
415 {
Ritor1
parents:
diff changeset
416 signed int v3; // qax@1
Ritor1
parents:
diff changeset
417
Ritor1
parents:
diff changeset
418 v3 = (signed int)((double)a2 / (6.0 - a3));
Ritor1
parents:
diff changeset
419 if ( v3 < 1 )
Ritor1
parents:
diff changeset
420 v3 = 1;
Ritor1
parents:
diff changeset
421 return v3;
Ritor1
parents:
diff changeset
422 }
Ritor1
parents:
diff changeset
423
Ritor1
parents:
diff changeset
424 //----- (004B6FF9) --------------------------------------------------------
Ritor1
parents:
diff changeset
425 bool Player::IsPlayerHealableByTemple()
Ritor1
parents:
diff changeset
426 {
Ritor1
parents:
diff changeset
427 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good)
Ritor1
parents:
diff changeset
428 return false;
Ritor1
parents:
diff changeset
429 else
Ritor1
parents:
diff changeset
430 {
Ritor1
parents:
diff changeset
431 if (GetMajorConditionIdx() == Condition_Zombie)
Ritor1
parents:
diff changeset
432 {
Ritor1
parents:
diff changeset
433 if (((signed int)window_SpeakInHouse->ptr_1C == 78 || (signed int)window_SpeakInHouse->ptr_1C == 81 || (signed int)window_SpeakInHouse->ptr_1C == 82))
Ritor1
parents:
diff changeset
434 return false;
Ritor1
parents:
diff changeset
435 else
Ritor1
parents:
diff changeset
436 return true;
Ritor1
parents:
diff changeset
437 }
Ritor1
parents:
diff changeset
438 else
Ritor1
parents:
diff changeset
439 return true;
Ritor1
parents:
diff changeset
440 }
Ritor1
parents:
diff changeset
441 }
Ritor1
parents:
diff changeset
442
Ritor1
parents:
diff changeset
443 //----- (00421E75) --------------------------------------------------------
Ritor1
parents:
diff changeset
444 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index)
Ritor1
parents:
diff changeset
445 {
Ritor1
parents:
diff changeset
446 int item_idx; // eax@1
Ritor1
parents:
diff changeset
447 int inv_index; // eax@3
Ritor1
parents:
diff changeset
448
Ritor1
parents:
diff changeset
449 item_idx = *pitem_index;
Ritor1
parents:
diff changeset
450 if ( item_idx >125 || item_idx < 0 )
Ritor1
parents:
diff changeset
451 return 0;
Ritor1
parents:
diff changeset
452 inv_index = this->pInventoryMatrix[item_idx];
Ritor1
parents:
diff changeset
453 if ( inv_index < 0 )
Ritor1
parents:
diff changeset
454 {
Ritor1
parents:
diff changeset
455 *pitem_index = -1 - inv_index;
Ritor1
parents:
diff changeset
456 inv_index = this->pInventoryMatrix[-1 - inv_index];
Ritor1
parents:
diff changeset
457 }
Ritor1
parents:
diff changeset
458 return inv_index;
Ritor1
parents:
diff changeset
459 }
Ritor1
parents:
diff changeset
460
Ritor1
parents:
diff changeset
461 //----- (004160CA) --------------------------------------------------------
Ritor1
parents:
diff changeset
462 void Player::ItemsEnchant( int enchant_count )
Ritor1
parents:
diff changeset
463 {
Ritor1
parents:
diff changeset
464 int avalible_items; // ebx@1
Ritor1
parents:
diff changeset
465 int i; // edx@8
Ritor1
parents:
diff changeset
466 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1
Ritor1
parents:
diff changeset
467
Ritor1
parents:
diff changeset
468 avalible_items = 0;
Ritor1
parents:
diff changeset
469 memset (item_index_tabl,0,sizeof(item_index_tabl));
Ritor1
parents:
diff changeset
470
Ritor1
parents:
diff changeset
471 for (i = 0; i < 138; ++i)
Ritor1
parents:
diff changeset
472 {
Ritor1
parents:
diff changeset
473 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134))
Ritor1
parents:
diff changeset
474 item_index_tabl[avalible_items++] = i;
Ritor1
parents:
diff changeset
475 }
Ritor1
parents:
diff changeset
476
Ritor1
parents:
diff changeset
477 if ( avalible_items )
Ritor1
parents:
diff changeset
478 {
Ritor1
parents:
diff changeset
479 if ( enchant_count )
Ritor1
parents:
diff changeset
480 {
Ritor1
parents:
diff changeset
481 for ( i = 0; i < enchant_count; ++i )
Ritor1
parents:
diff changeset
482 {
Ritor1
parents:
diff changeset
483 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_HARDENED))
Ritor1
parents:
diff changeset
484 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_HARDENED;
Ritor1
parents:
diff changeset
485 }
Ritor1
parents:
diff changeset
486 }
Ritor1
parents:
diff changeset
487 else
Ritor1
parents:
diff changeset
488 {
Ritor1
parents:
diff changeset
489 for ( i = 0; i < avalible_items; ++i )
Ritor1
parents:
diff changeset
490 {
Ritor1
parents:
diff changeset
491 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_HARDENED;
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493 }
Ritor1
parents:
diff changeset
494 }
Ritor1
parents:
diff changeset
495 }
Ritor1
parents:
diff changeset
496
Ritor1
parents:
diff changeset
497 //----- (004948B1) --------------------------------------------------------
Ritor1
parents:
diff changeset
498 void Player::PlaySound(PlayerSpeech speech, int a3)
Ritor1
parents:
diff changeset
499 {
Ritor1
parents:
diff changeset
500 signed int speechCount = 0; // esi@4
Ritor1
parents:
diff changeset
501 signed int expressionCount = 0; // esi@4
Ritor1
parents:
diff changeset
502 int pickedVariant; // esi@10
Ritor1
parents:
diff changeset
503 CHARACTER_EXPRESSION_ID expression; // ebx@17
Ritor1
parents:
diff changeset
504 signed int pSoundID; // ecx@19
Ritor1
parents:
diff changeset
505 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7
Ritor1
parents:
diff changeset
506 int expressionVariantArray[5];
Ritor1
parents:
diff changeset
507 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4
Ritor1
parents:
diff changeset
508 unsigned int expressionDuration = 0;
Ritor1
parents:
diff changeset
509
Ritor1
parents:
diff changeset
510 pickedSoundID = 0;
Ritor1
parents:
diff changeset
511 if (uVoicesVolumeMultiplier)
Ritor1
parents:
diff changeset
512 {
Ritor1
parents:
diff changeset
513 for (int i = 0; i < 2; i++)
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 if ( SoundSetAction[speech][i] )
Ritor1
parents:
diff changeset
516 {
Ritor1
parents:
diff changeset
517 speechVariantArray[speechCount] = SoundSetAction[speech][i];
Ritor1
parents:
diff changeset
518 speechCount++;
Ritor1
parents:
diff changeset
519 }
Ritor1
parents:
diff changeset
520 }
Ritor1
parents:
diff changeset
521 if ( speechCount )
Ritor1
parents:
diff changeset
522 {
Ritor1
parents:
diff changeset
523 pickedVariant = speechVariantArray[rand() % speechCount];
Ritor1
parents:
diff changeset
524 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID];
Ritor1
parents:
diff changeset
525 if (numberOfSubvariants > 0)
Ritor1
parents:
diff changeset
526 {
Ritor1
parents:
diff changeset
527 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998;
Ritor1
parents:
diff changeset
528 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0);
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531 }
Ritor1
parents:
diff changeset
532
Ritor1
parents:
diff changeset
533 for (int i = 0; i < 5; i++)
Ritor1
parents:
diff changeset
534 {
Ritor1
parents:
diff changeset
535 if ( SoundSetAction[speech][i + 3] )
Ritor1
parents:
diff changeset
536 {
Ritor1
parents:
diff changeset
537 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3];
Ritor1
parents:
diff changeset
538 expressionCount++;
Ritor1
parents:
diff changeset
539 }
Ritor1
parents:
diff changeset
540 }
Ritor1
parents:
diff changeset
541 if ( expressionCount )
Ritor1
parents:
diff changeset
542 {
Ritor1
parents:
diff changeset
543 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount];
Ritor1
parents:
diff changeset
544 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID )
Ritor1
parents:
diff changeset
545 {
Ritor1
parents:
diff changeset
546 pSoundID = 0;
Ritor1
parents:
diff changeset
547 if ( pSoundList->sNumSounds )
Ritor1
parents:
diff changeset
548 {
Ritor1
parents:
diff changeset
549 for (int i = 0; i < pSoundList->sNumSounds; i++)
Ritor1
parents:
diff changeset
550 {
Ritor1
parents:
diff changeset
551 if (pSoundList->pSL_Sounds[i].uSoundID == pickedSoundID)
Ritor1
parents:
diff changeset
552 pSoundID = i;
Ritor1
parents:
diff changeset
553 }
Ritor1
parents:
diff changeset
554 }
Ritor1
parents:
diff changeset
555 if ( pSoundList->pSL_Sounds[pSoundID].pSoundData[0] )
Ritor1
parents:
diff changeset
556 expressionDuration = (sLastTrackLengthMS << 7) / 1000;
Ritor1
parents:
diff changeset
557 }
Ritor1
parents:
diff changeset
558 PlayEmotion(expression, expressionDuration);
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560 }
Ritor1
parents:
diff changeset
561 // 4948B1: using guessed type int var_1C[5];
Ritor1
parents:
diff changeset
562
Ritor1
parents:
diff changeset
563 //----- (00494A25) --------------------------------------------------------
Ritor1
parents:
diff changeset
564 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3)
Ritor1
parents:
diff changeset
565 {
Ritor1
parents:
diff changeset
566 unsigned int v3 = expression;
Ritor1
parents:
diff changeset
567 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED)
Ritor1
parents:
diff changeset
568 {
Ritor1
parents:
diff changeset
569 return;
Ritor1
parents:
diff changeset
570 }
Ritor1
parents:
diff changeset
571 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING)
Ritor1
parents:
diff changeset
572 {
Ritor1
parents:
diff changeset
573 return;
Ritor1
parents:
diff changeset
574 }
Ritor1
parents:
diff changeset
575 else
Ritor1
parents:
diff changeset
576 {
Ritor1
parents:
diff changeset
577 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING)
Ritor1
parents:
diff changeset
578 {
Ritor1
parents:
diff changeset
579 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))
Ritor1
parents:
diff changeset
580 {
Ritor1
parents:
diff changeset
581 return;
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 }
Ritor1
parents:
diff changeset
585 this->uExpressionTimePassed = 0;
Ritor1
parents:
diff changeset
586 if ( !a3 )
Ritor1
parents:
diff changeset
587 {
Ritor1
parents:
diff changeset
588 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength;
Ritor1
parents:
diff changeset
589 }
Ritor1
parents:
diff changeset
590 else
Ritor1
parents:
diff changeset
591 {
Ritor1
parents:
diff changeset
592 this->uExpressionTimeLength = 0;
Ritor1
parents:
diff changeset
593 }
Ritor1
parents:
diff changeset
594 expression = new_expression;
Ritor1
parents:
diff changeset
595 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
596 }
Ritor1
parents:
diff changeset
597
Ritor1
parents:
diff changeset
598 //----- (0049327B) --------------------------------------------------------
Ritor1
parents:
diff changeset
599 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 )
Ritor1
parents:
diff changeset
600 {
Ritor1
parents:
diff changeset
601 if ( this->classType == uClass )
Ritor1
parents:
diff changeset
602 {
Ritor1
parents:
diff changeset
603 return true;
Ritor1
parents:
diff changeset
604 }
Ritor1
parents:
diff changeset
605 else
Ritor1
parents:
diff changeset
606 {
Ritor1
parents:
diff changeset
607 if (!a3)
Ritor1
parents:
diff changeset
608 {
Ritor1
parents:
diff changeset
609 return false;
Ritor1
parents:
diff changeset
610 }
Ritor1
parents:
diff changeset
611 switch ( uClass )
Ritor1
parents:
diff changeset
612 {
Ritor1
parents:
diff changeset
613 case 0x1Au:
Ritor1
parents:
diff changeset
614 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65));
Ritor1
parents:
diff changeset
615 case 0x1Bu:
Ritor1
parents:
diff changeset
616 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67));
Ritor1
parents:
diff changeset
617 case 0x22u:
Ritor1
parents:
diff changeset
618 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77));
Ritor1
parents:
diff changeset
619 case 0x23u:
Ritor1
parents:
diff changeset
620 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79));
Ritor1
parents:
diff changeset
621 break;
Ritor1
parents:
diff changeset
622 default:
Ritor1
parents:
diff changeset
623 Error("Should not be able to get here (%u)", uClass);
Ritor1
parents:
diff changeset
624 break;
Ritor1
parents:
diff changeset
625 }
Ritor1
parents:
diff changeset
626 return false;
Ritor1
parents:
diff changeset
627 }
Ritor1
parents:
diff changeset
628 }
Ritor1
parents:
diff changeset
629
Ritor1
parents:
diff changeset
630
Ritor1
parents:
diff changeset
631 //----- (00492C0B) --------------------------------------------------------
Ritor1
parents:
diff changeset
632 bool Player::CanAct()
Ritor1
parents:
diff changeset
633 {
Ritor1
parents:
diff changeset
634 if ( this->IsAsleep() || this->IsParalyzed() ||
Ritor1
parents:
diff changeset
635 this->IsUnconcious() || this->IsDead() ||
Ritor1
parents:
diff changeset
636 this->IsPertified() || this->IsEradicated() )
Ritor1
parents:
diff changeset
637 return false;
Ritor1
parents:
diff changeset
638 else
Ritor1
parents:
diff changeset
639 return true;
Ritor1
parents:
diff changeset
640 }
Ritor1
parents:
diff changeset
641
Ritor1
parents:
diff changeset
642 //----- (00492C40) --------------------------------------------------------
Ritor1
parents:
diff changeset
643 bool Player::CanSteal()
Ritor1
parents:
diff changeset
644 {
Ritor1
parents:
diff changeset
645 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0;
Ritor1
parents:
diff changeset
646 }
Ritor1
parents:
diff changeset
647
Ritor1
parents:
diff changeset
648 //----- (00492C4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
649 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID)
Ritor1
parents:
diff changeset
650 {
Ritor1
parents:
diff changeset
651 switch (uItemID)
Ritor1
parents:
diff changeset
652 {
Ritor1
parents:
diff changeset
653 case ITEM_RELIC_ETHRICS_STAFF:
Ritor1
parents:
diff changeset
654 case ITEM_RELIC_OLD_NICK:
Ritor1
parents:
diff changeset
655 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break;
Ritor1
parents:
diff changeset
656 case ITEM_RELIC_TALEDONS_HELM:
Ritor1
parents:
diff changeset
657 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break;
Ritor1
parents:
diff changeset
658 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break;
Ritor1
parents:
diff changeset
659 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break;
Ritor1
parents:
diff changeset
660 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break;
Ritor1
parents:
diff changeset
661 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break;
Ritor1
parents:
diff changeset
662 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break;
Ritor1
parents:
diff changeset
663 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break;
Ritor1
parents:
diff changeset
664 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break;
Ritor1
parents:
diff changeset
665 default: return 1; break;
Ritor1
parents:
diff changeset
666 }
Ritor1
parents:
diff changeset
667 }
Ritor1
parents:
diff changeset
668
Ritor1
parents:
diff changeset
669 //----- (00492D65) --------------------------------------------------------
Ritor1
parents:
diff changeset
670 void Player::SetCondition( unsigned int uConditionIdx, int a3 )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 signed int player_sex; // ecx@77
Ritor1
parents:
diff changeset
673 signed int remainig_player; // ebx@82
Ritor1
parents:
diff changeset
674 int players_before; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
675 int players_after; // [sp+20h] [bp+Ch]@82
Ritor1
parents:
diff changeset
676
Ritor1
parents:
diff changeset
677 if ( pConditions[uConditionIdx] )
Ritor1
parents:
diff changeset
678 return;
Ritor1
parents:
diff changeset
679
Ritor1
parents:
diff changeset
680 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3))
Ritor1
parents:
diff changeset
681 {
Ritor1
parents:
diff changeset
682 return;
Ritor1
parents:
diff changeset
683 }
Ritor1
parents:
diff changeset
684
Ritor1
parents:
diff changeset
685 switch ( uConditionIdx )
Ritor1
parents:
diff changeset
686 {
Ritor1
parents:
diff changeset
687 case Condition_Cursed: PlaySound(SPEECH_30, 0); break;
Ritor1
parents:
diff changeset
688 case Condition_Weak: PlaySound(SPEECH_25, 0); break;
Ritor1
parents:
diff changeset
689 case Condition_Sleep: break; //nosound
Ritor1
parents:
diff changeset
690 case Condition_Fear: PlaySound(SPEECH_26, 0); break;
Ritor1
parents:
diff changeset
691 case Condition_Drunk: PlaySound(SPEECH_31, 0); break;
Ritor1
parents:
diff changeset
692 case Condition_Insane: PlaySound(SPEECH_29, 0); break;
Ritor1
parents:
diff changeset
693 case Condition_Poison_Weak:
Ritor1
parents:
diff changeset
694 case Condition_Poison_Medium:
Ritor1
parents:
diff changeset
695 case Condition_Poison_Severe: PlaySound(SPEECH_27, 0); break;
Ritor1
parents:
diff changeset
696 case Condition_Disease_Weak:
Ritor1
parents:
diff changeset
697 case Condition_Disease_Medium:
Ritor1
parents:
diff changeset
698 case Condition_Disease_Severe: PlaySound(SPEECH_28, 0);break;
Ritor1
parents:
diff changeset
699 case Condition_Paralyzed: break; //nosound
Ritor1
parents:
diff changeset
700 case Condition_Unconcious:
Ritor1
parents:
diff changeset
701 PlaySound(SPEECH_32, 0);
Ritor1
parents:
diff changeset
702 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
703 sHealth = 0;
Ritor1
parents:
diff changeset
704 break;
Ritor1
parents:
diff changeset
705 case Condition_Dead:
Ritor1
parents:
diff changeset
706 PlaySound(SPEECH_33, 0);
Ritor1
parents:
diff changeset
707 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
708 sHealth = 0;
Ritor1
parents:
diff changeset
709 if ( sMana > 0 )
Ritor1
parents:
diff changeset
710 sMana = 0;
Ritor1
parents:
diff changeset
711 break;
Ritor1
parents:
diff changeset
712 case Condition_Pertified:
Ritor1
parents:
diff changeset
713 PlaySound(SPEECH_34, 0);
Ritor1
parents:
diff changeset
714 break;
Ritor1
parents:
diff changeset
715 case Condition_Eradicated:
Ritor1
parents:
diff changeset
716 PlaySound(SPEECH_35, 0);
Ritor1
parents:
diff changeset
717 if (sHealth > 0 )
Ritor1
parents:
diff changeset
718 sHealth = 0;
Ritor1
parents:
diff changeset
719 if ( sMana > 0 )
Ritor1
parents:
diff changeset
720 sMana = 0;
Ritor1
parents:
diff changeset
721 break;
Ritor1
parents:
diff changeset
722 case Condition_Zombie:
Ritor1
parents:
diff changeset
723 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead())
Ritor1
parents:
diff changeset
724 return;
Ritor1
parents:
diff changeset
725 pConditions.fill(0);
Ritor1
parents:
diff changeset
726 sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
727 sMana = 0;
Ritor1
parents:
diff changeset
728 player_sex = 0;
Ritor1
parents:
diff changeset
729 uPrevFace = uCurrentFace;
Ritor1
parents:
diff changeset
730 uPrevVoiceID = uVoiceID;
Ritor1
parents:
diff changeset
731 if (IsMale())
Ritor1
parents:
diff changeset
732 {
Ritor1
parents:
diff changeset
733 uCurrentFace = 23;
Ritor1
parents:
diff changeset
734 uVoiceID = 23;
Ritor1
parents:
diff changeset
735 }
Ritor1
parents:
diff changeset
736 else
Ritor1
parents:
diff changeset
737 {
Ritor1
parents:
diff changeset
738 uCurrentFace = 24;
Ritor1
parents:
diff changeset
739 uVoiceID = 24;
Ritor1
parents:
diff changeset
740 }
Ritor1
parents:
diff changeset
741 PlaySound(SPEECH_99, 0);
Ritor1
parents:
diff changeset
742 break;
Ritor1
parents:
diff changeset
743 }
Ritor1
parents:
diff changeset
744
Ritor1
parents:
diff changeset
745 players_before = 0;
Ritor1
parents:
diff changeset
746 for (int i = 1; i < 5; ++i)
Ritor1
parents:
diff changeset
747 {
Ritor1
parents:
diff changeset
748 if ( pPlayers[i]->CanAct() )
Ritor1
parents:
diff changeset
749 ++players_before;
Ritor1
parents:
diff changeset
750 }
Ritor1
parents:
diff changeset
751
Ritor1
parents:
diff changeset
752 pConditions[uConditionIdx] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
753
Ritor1
parents:
diff changeset
754 remainig_player = 0;
Ritor1
parents:
diff changeset
755 players_after = 0;
Ritor1
parents:
diff changeset
756 for (int i = 1; i < 5; ++i)
Ritor1
parents:
diff changeset
757 {
Ritor1
parents:
diff changeset
758 if ( pPlayers[i]->CanAct() )
Ritor1
parents:
diff changeset
759 {
Ritor1
parents:
diff changeset
760 remainig_player = i;
Ritor1
parents:
diff changeset
761 ++players_after;
Ritor1
parents:
diff changeset
762 }
Ritor1
parents:
diff changeset
763 }
Ritor1
parents:
diff changeset
764 if (( players_before == 2 ) && ( players_after == 1 ))
Ritor1
parents:
diff changeset
765 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);//ñêîðåå âñåãî îáíàä¸æûâàþùèé âîçãëàñ ïîñëåäíåãî
Ritor1
parents:
diff changeset
766 return;
Ritor1
parents:
diff changeset
767 }
Ritor1
parents:
diff changeset
768
Ritor1
parents:
diff changeset
769 //----- (00492528) --------------------------------------------------------
Ritor1
parents:
diff changeset
770 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
Ritor1
parents:
diff changeset
771 {
Ritor1
parents:
diff changeset
772 Texture *texture; // esi@1
Ritor1
parents:
diff changeset
773 unsigned int slotWidth; // ebx@1
Ritor1
parents:
diff changeset
774 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1
Ritor1
parents:
diff changeset
775
Ritor1
parents:
diff changeset
776 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
777 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth);
Ritor1
parents:
diff changeset
778 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight);
Ritor1
parents:
diff changeset
779 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
780 {
Ritor1
parents:
diff changeset
781 texture->Release();
Ritor1
parents:
diff changeset
782 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
783 }
Ritor1
parents:
diff changeset
784 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions");
Ritor1
parents:
diff changeset
785 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT )
Ritor1
parents:
diff changeset
786 {
Ritor1
parents:
diff changeset
787 for (unsigned int x = 0; x < slotWidth; x++)
Ritor1
parents:
diff changeset
788 {
Ritor1
parents:
diff changeset
789 for (unsigned int y = 0; y < slotHeight; y++)
Ritor1
parents:
diff changeset
790 {
Ritor1
parents:
diff changeset
791 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0)
Ritor1
parents:
diff changeset
792 {
Ritor1
parents:
diff changeset
793 return false;
Ritor1
parents:
diff changeset
794 }
Ritor1
parents:
diff changeset
795 }
Ritor1
parents:
diff changeset
796 }
Ritor1
parents:
diff changeset
797 return true;
Ritor1
parents:
diff changeset
798 }
Ritor1
parents:
diff changeset
799 return false;
Ritor1
parents:
diff changeset
800 }
Ritor1
parents:
diff changeset
801 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
802
Ritor1
parents:
diff changeset
803 //----- (004925E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
804 int Player::FindFreeInventoryListSlot()
Ritor1
parents:
diff changeset
805 {
Ritor1
parents:
diff changeset
806 for (int i = 0; i < 126; i++ )
Ritor1
parents:
diff changeset
807 {
Ritor1
parents:
diff changeset
808 if (pInventoryItemList[i].uItemID == 0)
Ritor1
parents:
diff changeset
809 {
Ritor1
parents:
diff changeset
810 return i;
Ritor1
parents:
diff changeset
811 }
Ritor1
parents:
diff changeset
812 }
Ritor1
parents:
diff changeset
813 return -1;
Ritor1
parents:
diff changeset
814 }
Ritor1
parents:
diff changeset
815
Ritor1
parents:
diff changeset
816 //----- (00492600) --------------------------------------------------------
Ritor1
parents:
diff changeset
817 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID)
Ritor1
parents:
diff changeset
818 {
Ritor1
parents:
diff changeset
819 int result; // eax@8
Ritor1
parents:
diff changeset
820 signed int freeSlot; // [sp+8h] [bp-4h]@4
Ritor1
parents:
diff changeset
821
Ritor1
parents:
diff changeset
822 freeSlot = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
823 if ( freeSlot == -1 )
Ritor1
parents:
diff changeset
824 {
Ritor1
parents:
diff changeset
825 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
826 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
Ritor1
parents:
diff changeset
827 return 0;
Ritor1
parents:
diff changeset
828 }
Ritor1
parents:
diff changeset
829 else
Ritor1
parents:
diff changeset
830 {
Ritor1
parents:
diff changeset
831 PutItemArInventoryIndex(uItemID, freeSlot, uSlot);
Ritor1
parents:
diff changeset
832 result = freeSlot + 1;
Ritor1
parents:
diff changeset
833 this->pInventoryItemList[freeSlot].uItemID = uItemID;
Ritor1
parents:
diff changeset
834 }
Ritor1
parents:
diff changeset
835 return result;
Ritor1
parents:
diff changeset
836 }
Ritor1
parents:
diff changeset
837 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
838
Ritor1
parents:
diff changeset
839 //----- (00492700) --------------------------------------------------------
Ritor1
parents:
diff changeset
840 int Player::HasSkill(unsigned int uSkillType)
Ritor1
parents:
diff changeset
841 {
Ritor1
parents:
diff changeset
842 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] )
Ritor1
parents:
diff changeset
843 {
Ritor1
parents:
diff changeset
844 return 1;
Ritor1
parents:
diff changeset
845 }
Ritor1
parents:
diff changeset
846 else
Ritor1
parents:
diff changeset
847 {
Ritor1
parents:
diff changeset
848 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName);
Ritor1
parents:
diff changeset
849 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
850 return 0;
Ritor1
parents:
diff changeset
851 }
Ritor1
parents:
diff changeset
852 }
Ritor1
parents:
diff changeset
853
Ritor1
parents:
diff changeset
854 //----- (00492745) --------------------------------------------------------
Ritor1
parents:
diff changeset
855 void Player::WearItem( unsigned int uItemID )
Ritor1
parents:
diff changeset
856 {
Ritor1
parents:
diff changeset
857 int item_body_anch; // edi@6
Ritor1
parents:
diff changeset
858 int item_indx;
Ritor1
parents:
diff changeset
859 item_indx = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
860
Ritor1
parents:
diff changeset
861 if ( item_indx != -1 )
Ritor1
parents:
diff changeset
862 {
Ritor1
parents:
diff changeset
863 pInventoryItemList[item_indx].uItemID = uItemID;
Ritor1
parents:
diff changeset
864 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType];
Ritor1
parents:
diff changeset
865 pEquipment.pIndices[item_body_anch] = item_indx + 1;
Ritor1
parents:
diff changeset
866 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1;
Ritor1
parents:
diff changeset
867 }
Ritor1
parents:
diff changeset
868 }
Ritor1
parents:
diff changeset
869
Ritor1
parents:
diff changeset
870 //----- (004927A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
871 int Player::AddItem(int index, unsigned int uItemID)
Ritor1
parents:
diff changeset
872 {
Ritor1
parents:
diff changeset
873 if ( index == -1 )
Ritor1
parents:
diff changeset
874 {
Ritor1
parents:
diff changeset
875 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++)
Ritor1
parents:
diff changeset
876 {
Ritor1
parents:
diff changeset
877 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++)
Ritor1
parents:
diff changeset
878 {
Ritor1
parents:
diff changeset
879 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) )
Ritor1
parents:
diff changeset
880 {
Ritor1
parents:
diff changeset
881 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID);
Ritor1
parents:
diff changeset
882 }
Ritor1
parents:
diff changeset
883 }
Ritor1
parents:
diff changeset
884 }
Ritor1
parents:
diff changeset
885 return 0;
Ritor1
parents:
diff changeset
886 }
Ritor1
parents:
diff changeset
887 if ( !CanFitItem(index, uItemID) )
Ritor1
parents:
diff changeset
888 {
Ritor1
parents:
diff changeset
889 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
890 return 0;
Ritor1
parents:
diff changeset
891 }
Ritor1
parents:
diff changeset
892 return CreateItemInInventory(index, uItemID);
Ritor1
parents:
diff changeset
893 }
Ritor1
parents:
diff changeset
894
Ritor1
parents:
diff changeset
895 //----- (00492826) --------------------------------------------------------
Ritor1
parents:
diff changeset
896 int Player::AddItem2(int index, ItemGen *Src)
Ritor1
parents:
diff changeset
897 {
Ritor1
parents:
diff changeset
898 pItemsTable->SetSpecialBonus(Src);
Ritor1
parents:
diff changeset
899
Ritor1
parents:
diff changeset
900 if ( index == -1 )
Ritor1
parents:
diff changeset
901 {
Ritor1
parents:
diff changeset
902 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++)
Ritor1
parents:
diff changeset
903 {
Ritor1
parents:
diff changeset
904 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array.
Ritor1
parents:
diff changeset
905 {
Ritor1
parents:
diff changeset
906 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) )
Ritor1
parents:
diff changeset
907 {
Ritor1
parents:
diff changeset
908 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src);
Ritor1
parents:
diff changeset
909 }
Ritor1
parents:
diff changeset
910 }
Ritor1
parents:
diff changeset
911 }
Ritor1
parents:
diff changeset
912 return 0;
Ritor1
parents:
diff changeset
913 }
Ritor1
parents:
diff changeset
914 if ( !CanFitItem(index, Src->uItemID) )
Ritor1
parents:
diff changeset
915 return 0;
Ritor1
parents:
diff changeset
916 return CreateItemInInventory2(index, Src);
Ritor1
parents:
diff changeset
917 }
Ritor1
parents:
diff changeset
918
Ritor1
parents:
diff changeset
919 //----- (0049289C) --------------------------------------------------------
Ritor1
parents:
diff changeset
920 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src )
Ritor1
parents:
diff changeset
921 {
Ritor1
parents:
diff changeset
922 signed int freeSlot; // ebx@1
Ritor1
parents:
diff changeset
923 int result; // eax@6
Ritor1
parents:
diff changeset
924
Ritor1
parents:
diff changeset
925 freeSlot = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
926 if ( freeSlot == -1 )
Ritor1
parents:
diff changeset
927 {
Ritor1
parents:
diff changeset
928 result = 0;
Ritor1
parents:
diff changeset
929 }
Ritor1
parents:
diff changeset
930 else
Ritor1
parents:
diff changeset
931 {
Ritor1
parents:
diff changeset
932 PutItemArInventoryIndex(Src->uItemID, freeSlot, index);
Ritor1
parents:
diff changeset
933 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen));
Ritor1
parents:
diff changeset
934 result = freeSlot + 1;
Ritor1
parents:
diff changeset
935 }
Ritor1
parents:
diff changeset
936 return result;
Ritor1
parents:
diff changeset
937 }
Ritor1
parents:
diff changeset
938 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
939
Ritor1
parents:
diff changeset
940 //----- (0049298B) --------------------------------------------------------
Ritor1
parents:
diff changeset
941 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID
Ritor1
parents:
diff changeset
942 {
Ritor1
parents:
diff changeset
943 Texture *item_texture; // esi@1
Ritor1
parents:
diff changeset
944 int *pInvPos; // esi@4
Ritor1
parents:
diff changeset
945 unsigned int slot_width; // [sp+Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
946 unsigned int slot_height; // [sp+18h] [bp+8h]@1
Ritor1
parents:
diff changeset
947
Ritor1
parents:
diff changeset
948 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
949 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
Ritor1
parents:
diff changeset
950 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
Ritor1
parents:
diff changeset
951 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
952 {
Ritor1
parents:
diff changeset
953 item_texture->Release();
Ritor1
parents:
diff changeset
954 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
955 }
Ritor1
parents:
diff changeset
956 if ( slot_width > 0 )
Ritor1
parents:
diff changeset
957 {
Ritor1
parents:
diff changeset
958 pInvPos = &pInventoryMatrix[index];
Ritor1
parents:
diff changeset
959 for (unsigned int i = 0; i < slot_height; i++)
Ritor1
parents:
diff changeset
960 {
Ritor1
parents:
diff changeset
961 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
Ritor1
parents:
diff changeset
962 pInvPos += INVETORYSLOTSWIDTH;
Ritor1
parents:
diff changeset
963 }
Ritor1
parents:
diff changeset
964 }
Ritor1
parents:
diff changeset
965 pInventoryMatrix[index] = itemListPos + 1;
Ritor1
parents:
diff changeset
966 }
Ritor1
parents:
diff changeset
967
Ritor1
parents:
diff changeset
968 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
969
Ritor1
parents:
diff changeset
970 //----- (00492A36) --------------------------------------------------------
Ritor1
parents:
diff changeset
971 void Player::RemoveItemAtInventoryIndex( unsigned int index )
Ritor1
parents:
diff changeset
972 {
Ritor1
parents:
diff changeset
973 ItemGen *item_in_slot; // ecx@1
Ritor1
parents:
diff changeset
974 Texture *item_texture; // esi@1
Ritor1
parents:
diff changeset
975 unsigned int slot_height; // ebp@1
Ritor1
parents:
diff changeset
976 int *pInvPos; // edx@4
Ritor1
parents:
diff changeset
977 unsigned int slot_width; // [sp+14h] [bp+4h]@1
Ritor1
parents:
diff changeset
978
Ritor1
parents:
diff changeset
979 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1];
Ritor1
parents:
diff changeset
980 item_texture = pIcons_LOD->LoadTexturePtr(item_in_slot->GetIconName(), TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
981 item_in_slot->Reset();
Ritor1
parents:
diff changeset
982 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
Ritor1
parents:
diff changeset
983 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
Ritor1
parents:
diff changeset
984 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
985 {
Ritor1
parents:
diff changeset
986 item_texture->Release();
Ritor1
parents:
diff changeset
987 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
988 }
Ritor1
parents:
diff changeset
989 if ( slot_width > 0 )
Ritor1
parents:
diff changeset
990 {
Ritor1
parents:
diff changeset
991 pInvPos = &pInventoryMatrix[index];
Ritor1
parents:
diff changeset
992 for (unsigned int i = 0; i < slot_height; i++)
Ritor1
parents:
diff changeset
993 {
Ritor1
parents:
diff changeset
994 memset32(pInvPos, 0, slot_width);
Ritor1
parents:
diff changeset
995 pInvPos += INVETORYSLOTSWIDTH;
Ritor1
parents:
diff changeset
996 }
Ritor1
parents:
diff changeset
997 }
Ritor1
parents:
diff changeset
998 }
Ritor1
parents:
diff changeset
999 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
1000
Ritor1
parents:
diff changeset
1001 //----- (00490EEE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1002 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff
Ritor1
parents:
diff changeset
1003 {
Ritor1
parents:
diff changeset
1004 unsigned int idemId; // edx@1
Ritor1
parents:
diff changeset
1005 signed int equipType; // esi@1
Ritor1
parents:
diff changeset
1006 float multiplier; // ST04_4@26
Ritor1
parents:
diff changeset
1007 int price; // edi@26
Ritor1
parents:
diff changeset
1008 int merchantLevel; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
1009 int itemValue;
Ritor1
parents:
diff changeset
1010
Ritor1
parents:
diff changeset
1011 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
Ritor1
parents:
diff changeset
1012 idemId = pItem->uItemID;
Ritor1
parents:
diff changeset
1013 equipType = pItem->GetItemEquipType();
Ritor1
parents:
diff changeset
1014 itemValue = pItem->GetValue();
Ritor1
parents:
diff changeset
1015
Ritor1
parents:
diff changeset
1016 switch (building_type)
Ritor1
parents:
diff changeset
1017 {
Ritor1
parents:
diff changeset
1018 case BuildingType_WeaponShop:
Ritor1
parents:
diff changeset
1019 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1020 return 5;
Ritor1
parents:
diff changeset
1021 if (equipType > EQUIP_BOW)
Ritor1
parents:
diff changeset
1022 return 4;
Ritor1
parents:
diff changeset
1023 break;
Ritor1
parents:
diff changeset
1024 case BuildingType_ArmorShop:
Ritor1
parents:
diff changeset
1025 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1026 return 5;
Ritor1
parents:
diff changeset
1027 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS)
Ritor1
parents:
diff changeset
1028 return 4;
Ritor1
parents:
diff changeset
1029 break;
Ritor1
parents:
diff changeset
1030 case BuildingType_MagicShop:
Ritor1
parents:
diff changeset
1031 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1032 return 5;
Ritor1
parents:
diff changeset
1033 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC )
Ritor1
parents:
diff changeset
1034 return 4;
Ritor1
parents:
diff changeset
1035 break;
Ritor1
parents:
diff changeset
1036 case BuildingType_AlchemistShop:
Ritor1
parents:
diff changeset
1037 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE)
Ritor1
parents:
diff changeset
1038 return 5;
Ritor1
parents:
diff changeset
1039 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL))
Ritor1
parents:
diff changeset
1040 return 4;
Ritor1
parents:
diff changeset
1041 break;
Ritor1
parents:
diff changeset
1042 default:
Ritor1
parents:
diff changeset
1043 Error("(%u)", building_type);
Ritor1
parents:
diff changeset
1044 break;
Ritor1
parents:
diff changeset
1045 }
Ritor1
parents:
diff changeset
1046 if (pItem->IsStolen())
Ritor1
parents:
diff changeset
1047 return 6;
Ritor1
parents:
diff changeset
1048
Ritor1
parents:
diff changeset
1049 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier;
Ritor1
parents:
diff changeset
1050 switch (ShopMenuType)
Ritor1
parents:
diff changeset
1051 {
Ritor1
parents:
diff changeset
1052 case 2:
Ritor1
parents:
diff changeset
1053 price = GetBuyingPrice(itemValue, multiplier);
Ritor1
parents:
diff changeset
1054 break;
Ritor1
parents:
diff changeset
1055 case 3:
Ritor1
parents:
diff changeset
1056 if (pItem->IsBroken())
Ritor1
parents:
diff changeset
1057 price = 1;
Ritor1
parents:
diff changeset
1058 else
Ritor1
parents:
diff changeset
1059 price = this->GetPriceSell(itemValue, multiplier);
Ritor1
parents:
diff changeset
1060 break;
Ritor1
parents:
diff changeset
1061 case 4:
Ritor1
parents:
diff changeset
1062 price = this->GetPriceIdentification(multiplier);
Ritor1
parents:
diff changeset
1063 break;
Ritor1
parents:
diff changeset
1064 case 5:
Ritor1
parents:
diff changeset
1065 price = this->GetPriceRepair(itemValue, multiplier);
Ritor1
parents:
diff changeset
1066 break;
Ritor1
parents:
diff changeset
1067 default:
Ritor1
parents:
diff changeset
1068 Error("(%u)", ShopMenuType);
Ritor1
parents:
diff changeset
1069 break;
Ritor1
parents:
diff changeset
1070 }
Ritor1
parents:
diff changeset
1071 if ( merchantLevel )
Ritor1
parents:
diff changeset
1072 {
Ritor1
parents:
diff changeset
1073 if (price == itemValue)
Ritor1
parents:
diff changeset
1074 {
Ritor1
parents:
diff changeset
1075 return 3;
Ritor1
parents:
diff changeset
1076 }
Ritor1
parents:
diff changeset
1077 else
Ritor1
parents:
diff changeset
1078 {
Ritor1
parents:
diff changeset
1079 return 2;
Ritor1
parents:
diff changeset
1080 }
Ritor1
parents:
diff changeset
1081 }
Ritor1
parents:
diff changeset
1082 else
Ritor1
parents:
diff changeset
1083 {
Ritor1
parents:
diff changeset
1084 return 1;
Ritor1
parents:
diff changeset
1085 }
Ritor1
parents:
diff changeset
1086 }
Ritor1
parents:
diff changeset
1087
Ritor1
parents:
diff changeset
1088 //----- (0049107D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1089 int Player::GetBodybuilding()
Ritor1
parents:
diff changeset
1090 {
Ritor1
parents:
diff changeset
1091 int v1; // al@1
Ritor1
parents:
diff changeset
1092
Ritor1
parents:
diff changeset
1093 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING);
Ritor1
parents:
diff changeset
1094 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1095 return multiplier * (v1 & 0x3F);
Ritor1
parents:
diff changeset
1096 }
Ritor1
parents:
diff changeset
1097
Ritor1
parents:
diff changeset
1098 //----- (004910A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
1099 int Player::GetMeditation()
Ritor1
parents:
diff changeset
1100 {
Ritor1
parents:
diff changeset
1101 int v1; // al@1
Ritor1
parents:
diff changeset
1102
Ritor1
parents:
diff changeset
1103 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION);
Ritor1
parents:
diff changeset
1104 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1105 return multiplier * (v1 & 0x3F);
Ritor1
parents:
diff changeset
1106 }
Ritor1
parents:
diff changeset
1107
Ritor1
parents:
diff changeset
1108 //----- (004910D3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1109 bool Player::CanIdentify( ItemGen *pItem )
Ritor1
parents:
diff changeset
1110 {
Ritor1
parents:
diff changeset
1111 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1112 int v5; // edi@7
Ritor1
parents:
diff changeset
1113 if (CheckHiredNPCSpeciality(Scholar))
Ritor1
parents:
diff changeset
1114 return true;
Ritor1
parents:
diff changeset
1115
Ritor1
parents:
diff changeset
1116 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID);
Ritor1
parents:
diff changeset
1117 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1118 return true;
Ritor1
parents:
diff changeset
1119
Ritor1
parents:
diff changeset
1120 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1121 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1122 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
Ritor1
parents:
diff changeset
1123 }
Ritor1
parents:
diff changeset
1124
Ritor1
parents:
diff changeset
1125 //----- (00491151) --------------------------------------------------------
Ritor1
parents:
diff changeset
1126 bool Player::CanRepair( ItemGen *pItem )
Ritor1
parents:
diff changeset
1127 {
Ritor1
parents:
diff changeset
1128 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1129 int v5; // edi@7
Ritor1
parents:
diff changeset
1130
Ritor1
parents:
diff changeset
1131 ITEM_EQUIP_TYPE equipType = pItem->GetItemEquipType();
Ritor1
parents:
diff changeset
1132 if (CheckHiredNPCSpeciality(Smith) && equipType <= 2 ||
Ritor1
parents:
diff changeset
1133 CheckHiredNPCSpeciality(Armorer) && equipType >= 3 && equipType <= 9 ||
Ritor1
parents:
diff changeset
1134 CheckHiredNPCSpeciality(Alchemist) && equipType >= 9 )
Ritor1
parents:
diff changeset
1135 return true;
Ritor1
parents:
diff changeset
1136
Ritor1
parents:
diff changeset
1137 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR);
Ritor1
parents:
diff changeset
1138 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1139 return true;
Ritor1
parents:
diff changeset
1140
Ritor1
parents:
diff changeset
1141 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1142 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1143 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
Ritor1
parents:
diff changeset
1144 }
Ritor1
parents:
diff changeset
1145
Ritor1
parents:
diff changeset
1146 //----- (004911F3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1147 int Player::GetMerchant()
Ritor1
parents:
diff changeset
1148 {
Ritor1
parents:
diff changeset
1149 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1150 int v5; // edi@1
Ritor1
parents:
diff changeset
1151 int v7; // eax@3
Ritor1
parents:
diff changeset
1152
Ritor1
parents:
diff changeset
1153 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
Ritor1
parents:
diff changeset
1154 if ( SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1155 return 10000;
Ritor1
parents:
diff changeset
1156
Ritor1
parents:
diff changeset
1157 v7 = pParty->GetPartyReputation();
Ritor1
parents:
diff changeset
1158 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1159 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1160 if (v5 == 0)
Ritor1
parents:
diff changeset
1161 {
Ritor1
parents:
diff changeset
1162 return -v7;
Ritor1
parents:
diff changeset
1163 }
Ritor1
parents:
diff changeset
1164 return v5 - v7 + 7;
Ritor1
parents:
diff changeset
1165 }
Ritor1
parents:
diff changeset
1166
Ritor1
parents:
diff changeset
1167 //----- (0049125A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1168 int Player::GetPerception()
Ritor1
parents:
diff changeset
1169 {
Ritor1
parents:
diff changeset
1170 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1171 int v5; // edi@1
Ritor1
parents:
diff changeset
1172
Ritor1
parents:
diff changeset
1173 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION);
Ritor1
parents:
diff changeset
1174 if ( SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1175 return 10000;
Ritor1
parents:
diff changeset
1176
Ritor1
parents:
diff changeset
1177 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1178 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1179 return v5;
Ritor1
parents:
diff changeset
1180 }
Ritor1
parents:
diff changeset
1181
Ritor1
parents:
diff changeset
1182 //----- (004912B0) --------------------------------------------------------
Ritor1
parents:
diff changeset
1183 int Player::GetDisarmTrap()
Ritor1
parents:
diff changeset
1184 {
Ritor1
parents:
diff changeset
1185 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1186 int v5; // edi@1
Ritor1
parents:
diff changeset
1187
Ritor1
parents:
diff changeset
1188 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM);
Ritor1
parents:
diff changeset
1189 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1190 return 10000;
Ritor1
parents:
diff changeset
1191
Ritor1
parents:
diff changeset
1192 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1193 if ( HasEnchantedItemEquipped(35) ) //only the real skill level is supposed to be added again, not the multiplied value
Ritor1
parents:
diff changeset
1194 multiplier++;
Ritor1
parents:
diff changeset
1195 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1196 return v5;
Ritor1
parents:
diff changeset
1197 }
Ritor1
parents:
diff changeset
1198
Ritor1
parents:
diff changeset
1199 //----- (00491317) --------------------------------------------------------
Ritor1
parents:
diff changeset
1200 char Player::GetLearningPercent()
Ritor1
parents:
diff changeset
1201 {
Ritor1
parents:
diff changeset
1202 int v2; // eax@1
Ritor1
parents:
diff changeset
1203
Ritor1
parents:
diff changeset
1204 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING);
Ritor1
parents:
diff changeset
1205 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1206 return multiplier * v2 + 9;
Ritor1
parents:
diff changeset
1207 }
Ritor1
parents:
diff changeset
1208
Ritor1
parents:
diff changeset
1209 //----- (0048C6AF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1210 Player::Player()
Ritor1
parents:
diff changeset
1211 {
Ritor1
parents:
diff changeset
1212 memset(&pEquipment, 0, sizeof(PlayerEquipment));
Ritor1
parents:
diff changeset
1213 pInventoryMatrix.fill(0);
Ritor1
parents:
diff changeset
1214 for (uint i = 0; i < 126; ++i)
Ritor1
parents:
diff changeset
1215 pInventoryItemList[i].Reset();
Ritor1
parents:
diff changeset
1216 for (uint i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1217 pEquippedItems[i].Reset();
Ritor1
parents:
diff changeset
1218
Ritor1
parents:
diff changeset
1219
Ritor1
parents:
diff changeset
1220 for (uint i = 0; i < 24; ++i)
Ritor1
parents:
diff changeset
1221 {
Ritor1
parents:
diff changeset
1222 pPlayerBuffs[i].uSkill = 0;
Ritor1
parents:
diff changeset
1223 pPlayerBuffs[i].uSkill = 0;
Ritor1
parents:
diff changeset
1224 pPlayerBuffs[i].uPower = 0;
Ritor1
parents:
diff changeset
1225 pPlayerBuffs[i].uExpireTime = 0;
Ritor1
parents:
diff changeset
1226 pPlayerBuffs[i].uCaster = 0;
Ritor1
parents:
diff changeset
1227 pPlayerBuffs[i].uFlags = 0;
Ritor1
parents:
diff changeset
1228 }
Ritor1
parents:
diff changeset
1229
Ritor1
parents:
diff changeset
1230 pName[0] = 0;
Ritor1
parents:
diff changeset
1231 uCurrentFace = 0;
Ritor1
parents:
diff changeset
1232 uVoiceID = 0;
Ritor1
parents:
diff changeset
1233 pConditions.fill(0);
Ritor1
parents:
diff changeset
1234
Ritor1
parents:
diff changeset
1235 field_BB = 0;
Ritor1
parents:
diff changeset
1236
Ritor1
parents:
diff changeset
1237 uMight = uMightBonus = 0;
Ritor1
parents:
diff changeset
1238 uIntelligence = uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
1239 uWillpower = uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
1240 uEndurance = uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
1241 uSpeed = uSpeedBonus = 0;
Ritor1
parents:
diff changeset
1242 uAccuracy = uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
1243 uLuck = uLuckBonus = 0;
Ritor1
parents:
diff changeset
1244 uLevel = sLevelModifier = 0;
Ritor1
parents:
diff changeset
1245 sAgeModifier = 0;
Ritor1
parents:
diff changeset
1246 sACModifier = 0;
Ritor1
parents:
diff changeset
1247
Ritor1
parents:
diff changeset
1248 // memset(field_1F5, 0, 30);
Ritor1
parents:
diff changeset
1249 pure_luck_used=0;
Ritor1
parents:
diff changeset
1250 pure_speed_used=0;
Ritor1
parents:
diff changeset
1251 pure_intellect_used=0;
Ritor1
parents:
diff changeset
1252 pure_endurance_used=0;
Ritor1
parents:
diff changeset
1253 pure_willpower_used=0;
Ritor1
parents:
diff changeset
1254 pure_accuracy_used=0;
Ritor1
parents:
diff changeset
1255 pure_might_used=0;
Ritor1
parents:
diff changeset
1256
Ritor1
parents:
diff changeset
1257 sResFireBase = sResFireBonus = 0;
Ritor1
parents:
diff changeset
1258 sResAirBase = sResAirBonus = 0;
Ritor1
parents:
diff changeset
1259 sResWaterBase = sResWaterBonus = 0;
Ritor1
parents:
diff changeset
1260 sResEarthBase = sResEarthBonus = 0;
Ritor1
parents:
diff changeset
1261 sResMagicBase = sResMagicBonus = 0;
Ritor1
parents:
diff changeset
1262 sResSpiritBase = sResSpiritBonus = 0;
Ritor1
parents:
diff changeset
1263 sResMindBase = sResMindBonus = 0;
Ritor1
parents:
diff changeset
1264 sResBodyBase = sResBodyBonus = 0;
Ritor1
parents:
diff changeset
1265 sResLightBase = sResLightBonus = 0;
Ritor1
parents:
diff changeset
1266 sResDarkBase = sResDarkBonus = 0;
Ritor1
parents:
diff changeset
1267
Ritor1
parents:
diff changeset
1268 uTimeToRecovery = 0;
Ritor1
parents:
diff changeset
1269
Ritor1
parents:
diff changeset
1270 uSkillPoints = 0;
Ritor1
parents:
diff changeset
1271
Ritor1
parents:
diff changeset
1272 sHealth = 0;
Ritor1
parents:
diff changeset
1273 uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
1274 _health_related = 0;
Ritor1
parents:
diff changeset
1275
Ritor1
parents:
diff changeset
1276 sMana = 0;
Ritor1
parents:
diff changeset
1277 uFullManaBonus = 0;
Ritor1
parents:
diff changeset
1278 _mana_related = 0;
Ritor1
parents:
diff changeset
1279
Ritor1
parents:
diff changeset
1280 uQuickSpell = 0;
Ritor1
parents:
diff changeset
1281 memset(pInstalledBeacons.data(), 0, 5 * sizeof(LloydBeacon));
Ritor1
parents:
diff changeset
1282
Ritor1
parents:
diff changeset
1283 _some_attack_bonus = 0;
Ritor1
parents:
diff changeset
1284 field_1A91 = 0;
Ritor1
parents:
diff changeset
1285 _melee_dmg_bonus = 0;
Ritor1
parents:
diff changeset
1286 field_1A93 = 0;
Ritor1
parents:
diff changeset
1287 _ranged_atk_bonus = 0;
Ritor1
parents:
diff changeset
1288 field_1A95 = 0;
Ritor1
parents:
diff changeset
1289 _ranged_dmg_bonus = 0;
Ritor1
parents:
diff changeset
1290 field_1A97 = 0;
Ritor1
parents:
diff changeset
1291
Ritor1
parents:
diff changeset
1292 expression = CHARACTER_EXPRESSION_INVALID;
Ritor1
parents:
diff changeset
1293 uExpressionTimePassed = 0;
Ritor1
parents:
diff changeset
1294 uExpressionTimeLength = 0;
Ritor1
parents:
diff changeset
1295
Ritor1
parents:
diff changeset
1296 uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
1297 uNumArmageddonCasts = 0;
Ritor1
parents:
diff changeset
1298 uNumFireSpikeCasts = 0;
Ritor1
parents:
diff changeset
1299
Ritor1
parents:
diff changeset
1300 memset(field_1988, 0, sizeof(field_1988));
Ritor1
parents:
diff changeset
1301 memset(playerEventBits, 0, sizeof(playerEventBits));
Ritor1
parents:
diff changeset
1302
Ritor1
parents:
diff changeset
1303 field_E0 = 0;
Ritor1
parents:
diff changeset
1304 field_E4 = 0;
Ritor1
parents:
diff changeset
1305 field_E8 = 0;
Ritor1
parents:
diff changeset
1306 field_EC = 0;
Ritor1
parents:
diff changeset
1307 field_F0 = 0;
Ritor1
parents:
diff changeset
1308 field_F4 = 0;
Ritor1
parents:
diff changeset
1309 field_F8 = 0;
Ritor1
parents:
diff changeset
1310 field_FC = 0;
Ritor1
parents:
diff changeset
1311 field_100 = 0;
Ritor1
parents:
diff changeset
1312 field_104 = 0;
Ritor1
parents:
diff changeset
1313
Ritor1
parents:
diff changeset
1314 _expression21_animtime = 0;
Ritor1
parents:
diff changeset
1315 _expression21_frameset = 0;
Ritor1
parents:
diff changeset
1316
Ritor1
parents:
diff changeset
1317 lastOpenedSpellbookPage = 0;
Ritor1
parents:
diff changeset
1318 }
Ritor1
parents:
diff changeset
1319
Ritor1
parents:
diff changeset
1320
Ritor1
parents:
diff changeset
1321 //----- (0048C855) --------------------------------------------------------
Ritor1
parents:
diff changeset
1322 int Player::GetBaseStrength()
Ritor1
parents:
diff changeset
1323 {
Ritor1
parents:
diff changeset
1324 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH);
Ritor1
parents:
diff changeset
1325 }
Ritor1
parents:
diff changeset
1326
Ritor1
parents:
diff changeset
1327 //----- (0048C86C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1328 int Player::GetBaseIntelligence()
Ritor1
parents:
diff changeset
1329 {
Ritor1
parents:
diff changeset
1330 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE);
Ritor1
parents:
diff changeset
1331 }
Ritor1
parents:
diff changeset
1332
Ritor1
parents:
diff changeset
1333 //----- (0048C883) --------------------------------------------------------
Ritor1
parents:
diff changeset
1334 int Player::GetBaseWillpower()
Ritor1
parents:
diff changeset
1335 {
Ritor1
parents:
diff changeset
1336 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER);
Ritor1
parents:
diff changeset
1337 }
Ritor1
parents:
diff changeset
1338
Ritor1
parents:
diff changeset
1339 //----- (0048C89A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1340 int Player::GetBaseEndurance()
Ritor1
parents:
diff changeset
1341 {
Ritor1
parents:
diff changeset
1342 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE);
Ritor1
parents:
diff changeset
1343 }
Ritor1
parents:
diff changeset
1344
Ritor1
parents:
diff changeset
1345 //----- (0048C8B1) --------------------------------------------------------
Ritor1
parents:
diff changeset
1346 int Player::GetBaseAccuracy()
Ritor1
parents:
diff changeset
1347 {
Ritor1
parents:
diff changeset
1348 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY);
Ritor1
parents:
diff changeset
1349 }
Ritor1
parents:
diff changeset
1350
Ritor1
parents:
diff changeset
1351 //----- (0048C8C8) --------------------------------------------------------
Ritor1
parents:
diff changeset
1352 int Player::GetBaseSpeed()
Ritor1
parents:
diff changeset
1353 {
Ritor1
parents:
diff changeset
1354 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED);
Ritor1
parents:
diff changeset
1355 }
Ritor1
parents:
diff changeset
1356
Ritor1
parents:
diff changeset
1357 //----- (0048C8DF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1358 int Player::GetBaseLuck()
Ritor1
parents:
diff changeset
1359 {
Ritor1
parents:
diff changeset
1360 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK);
Ritor1
parents:
diff changeset
1361 }
Ritor1
parents:
diff changeset
1362
Ritor1
parents:
diff changeset
1363 //----- (0048C8F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1364 int Player::GetBaseLevel()
Ritor1
parents:
diff changeset
1365 {
Ritor1
parents:
diff changeset
1366 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
Ritor1
parents:
diff changeset
1367 }
Ritor1
parents:
diff changeset
1368
Ritor1
parents:
diff changeset
1369 //----- (0048C90D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1370 int Player::GetActualLevel()
Ritor1
parents:
diff changeset
1371 {
Ritor1
parents:
diff changeset
1372 return uLevel + sLevelModifier +
Ritor1
parents:
diff changeset
1373 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) +
Ritor1
parents:
diff changeset
1374 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
Ritor1
parents:
diff changeset
1375 }
Ritor1
parents:
diff changeset
1376
Ritor1
parents:
diff changeset
1377 //----- (0048C93C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1378 int Player::GetActualMight()
Ritor1
parents:
diff changeset
1379 {
Ritor1
parents:
diff changeset
1380 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus);
Ritor1
parents:
diff changeset
1381 }
Ritor1
parents:
diff changeset
1382
Ritor1
parents:
diff changeset
1383 //----- (0048C9C2) --------------------------------------------------------
Ritor1
parents:
diff changeset
1384 int Player::GetActualIntelligence()
Ritor1
parents:
diff changeset
1385 {
Ritor1
parents:
diff changeset
1386 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus);
Ritor1
parents:
diff changeset
1387 }
Ritor1
parents:
diff changeset
1388
Ritor1
parents:
diff changeset
1389 //----- (0048CA3F) --------------------------------------------------------
Ritor1
parents:
diff changeset
1390 int Player::GetActualWillpower()
Ritor1
parents:
diff changeset
1391 {
Ritor1
parents:
diff changeset
1392 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus);
Ritor1
parents:
diff changeset
1393 }
Ritor1
parents:
diff changeset
1394
Ritor1
parents:
diff changeset
1395 //----- (0048CABC) --------------------------------------------------------
Ritor1
parents:
diff changeset
1396 int Player::GetActualEndurance()
Ritor1
parents:
diff changeset
1397 {
Ritor1
parents:
diff changeset
1398 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus);
Ritor1
parents:
diff changeset
1399 }
Ritor1
parents:
diff changeset
1400
Ritor1
parents:
diff changeset
1401 //----- (0048CB39) --------------------------------------------------------
Ritor1
parents:
diff changeset
1402 int Player::GetActualAccuracy()
Ritor1
parents:
diff changeset
1403 {
Ritor1
parents:
diff changeset
1404 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus);
Ritor1
parents:
diff changeset
1405 }
Ritor1
parents:
diff changeset
1406
Ritor1
parents:
diff changeset
1407 //----- (0048CBB6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1408 int Player::GetActualSpeed()
Ritor1
parents:
diff changeset
1409 {
Ritor1
parents:
diff changeset
1410 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus);
Ritor1
parents:
diff changeset
1411 }
Ritor1
parents:
diff changeset
1412
Ritor1
parents:
diff changeset
1413 //----- (0048CC33) --------------------------------------------------------
Ritor1
parents:
diff changeset
1414 int Player::GetActualLuck()
Ritor1
parents:
diff changeset
1415 {
Ritor1
parents:
diff changeset
1416 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1417
Ritor1
parents:
diff changeset
1418 npc_luck_bonus = 0;
Ritor1
parents:
diff changeset
1419 if ( CheckHiredNPCSpeciality(Fool) )
Ritor1
parents:
diff changeset
1420 npc_luck_bonus = 5;
Ritor1
parents:
diff changeset
1421 if ( CheckHiredNPCSpeciality(ChimneySweep) )
Ritor1
parents:
diff changeset
1422 npc_luck_bonus += 20;
Ritor1
parents:
diff changeset
1423 if ( CheckHiredNPCSpeciality(Psychic) )
Ritor1
parents:
diff changeset
1424 npc_luck_bonus += 10;
Ritor1
parents:
diff changeset
1425
Ritor1
parents:
diff changeset
1426 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus)
Ritor1
parents:
diff changeset
1427 + npc_luck_bonus;
Ritor1
parents:
diff changeset
1428 }
Ritor1
parents:
diff changeset
1429
Ritor1
parents:
diff changeset
1430 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
1431 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::* attrValue, unsigned short Player::* attrBonus )
Ritor1
parents:
diff changeset
1432 {
Ritor1
parents:
diff changeset
1433 uint uActualAge = this->sAgeModifier + GetBaseAge();
Ritor1
parents:
diff changeset
1434 uint uAgeingMultiplier = 100;
Ritor1
parents:
diff changeset
1435 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1436 {
Ritor1
parents:
diff changeset
1437 if (uActualAge >= pAgeingTable[i])
Ritor1
parents:
diff changeset
1438 uAgeingMultiplier = pAgingAttributeModifier[attrId][i];
Ritor1
parents:
diff changeset
1439 else
Ritor1
parents:
diff changeset
1440 break;
Ritor1
parents:
diff changeset
1441 }
Ritor1
parents:
diff changeset
1442
Ritor1
parents:
diff changeset
1443 uchar uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
1444 int magicBonus = GetMagicalBonus(attrId);
Ritor1
parents:
diff changeset
1445 int itemBonus = GetItemsBonus(attrId);
Ritor1
parents:
diff changeset
1446 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100
Ritor1
parents:
diff changeset
1447 + magicBonus
Ritor1
parents:
diff changeset
1448 + itemBonus
Ritor1
parents:
diff changeset
1449 + this->*attrBonus;
Ritor1
parents:
diff changeset
1450 }
Ritor1
parents:
diff changeset
1451
Ritor1
parents:
diff changeset
1452 //----- (0048CCF5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1453 int Player::GetActualAttack( bool a2 )
Ritor1
parents:
diff changeset
1454 {
Ritor1
parents:
diff changeset
1455 int v3; // eax@1
Ritor1
parents:
diff changeset
1456 int v4; // edi@1
Ritor1
parents:
diff changeset
1457 int v5; // ebx@1
Ritor1
parents:
diff changeset
1458 int v6; // ebp@1
Ritor1
parents:
diff changeset
1459
Ritor1
parents:
diff changeset
1460 v3 = GetActualAccuracy();
Ritor1
parents:
diff changeset
1461 v4 = GetParameterBonus(v3);
Ritor1
parents:
diff changeset
1462 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK);
Ritor1
parents:
diff changeset
1463 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2);
Ritor1
parents:
diff changeset
1464 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + this->_some_attack_bonus;
Ritor1
parents:
diff changeset
1465 }
Ritor1
parents:
diff changeset
1466
Ritor1
parents:
diff changeset
1467 //----- (0048CD45) --------------------------------------------------------
Ritor1
parents:
diff changeset
1468 int Player::GetMeleeDamageMinimal()
Ritor1
parents:
diff changeset
1469 {
Ritor1
parents:
diff changeset
1470 int v2; // eax@1
Ritor1
parents:
diff changeset
1471 int v3; // esi@1
Ritor1
parents:
diff changeset
1472 int v4; // esi@1
Ritor1
parents:
diff changeset
1473 int v5; // esi@1
Ritor1
parents:
diff changeset
1474 signed int result; // eax@1
Ritor1
parents:
diff changeset
1475
Ritor1
parents:
diff changeset
1476 v2 = GetActualMight();
Ritor1
parents:
diff changeset
1477 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
1478 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN) + v3;
Ritor1
parents:
diff changeset
1479 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
Ritor1
parents:
diff changeset
1480 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
Ritor1
parents:
diff changeset
1481 if ( result < 1 )
Ritor1
parents:
diff changeset
1482 result = 1;
Ritor1
parents:
diff changeset
1483 return result;
Ritor1
parents:
diff changeset
1484 }
Ritor1
parents:
diff changeset
1485
Ritor1
parents:
diff changeset
1486 //----- (0048CD90) --------------------------------------------------------
Ritor1
parents:
diff changeset
1487 int Player::GetMeleeDamageMaximal()
Ritor1
parents:
diff changeset
1488 {
Ritor1
parents:
diff changeset
1489 int v2; // eax@1
Ritor1
parents:
diff changeset
1490 int v3; // esi@1
Ritor1
parents:
diff changeset
1491 int v4; // esi@1
Ritor1
parents:
diff changeset
1492 int v5; // esi@1
Ritor1
parents:
diff changeset
1493 int v6; // esi@1
Ritor1
parents:
diff changeset
1494 signed int result; // eax@1
Ritor1
parents:
diff changeset
1495
Ritor1
parents:
diff changeset
1496 v2 = GetActualMight();
Ritor1
parents:
diff changeset
1497 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
1498 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX) + v3;
Ritor1
parents:
diff changeset
1499 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
Ritor1
parents:
diff changeset
1500 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
Ritor1
parents:
diff changeset
1501 result = 1;
Ritor1
parents:
diff changeset
1502 if ( v6 >= 1 )
Ritor1
parents:
diff changeset
1503 result = v6;
Ritor1
parents:
diff changeset
1504 return result;
Ritor1
parents:
diff changeset
1505 }
Ritor1
parents:
diff changeset
1506
Ritor1
parents:
diff changeset
1507 //----- (0048CDDB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1508 int Player::CalculateMeleeDamageTo( bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID )
Ritor1
parents:
diff changeset
1509 {
Ritor1
parents:
diff changeset
1510 int dmgSum; // esi@62
Ritor1
parents:
diff changeset
1511 signed int result; // eax@64
Ritor1
parents:
diff changeset
1512 int mainWpnDmg; // [sp+18h] [bp-8h]@1
Ritor1
parents:
diff changeset
1513 int offHndWpnDmg; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1514
Ritor1
parents:
diff changeset
1515 offHndWpnDmg = 0;
Ritor1
parents:
diff changeset
1516 mainWpnDmg = 0;
Ritor1
parents:
diff changeset
1517 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
1518 {
Ritor1
parents:
diff changeset
1519 mainWpnDmg = rand() % 3 + 1;
Ritor1
parents:
diff changeset
1520 }
Ritor1
parents:
diff changeset
1521 else
Ritor1
parents:
diff changeset
1522 {
Ritor1
parents:
diff changeset
1523 if ( HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
1524 {
Ritor1
parents:
diff changeset
1525 ItemGen *mainHandItemGen = this->GetMainHandItem();
Ritor1
parents:
diff changeset
1526 int itemId = mainHandItemGen->uItemID;
Ritor1
parents:
diff changeset
1527 bool addOneDice = false;
Ritor1
parents:
diff changeset
1528 if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield )
Ritor1
parents:
diff changeset
1529 addOneDice = true;
Ritor1
parents:
diff changeset
1530 mainWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(mainHandItemGen, uTargetActorID, addOneDice);
Ritor1
parents:
diff changeset
1531 }
Ritor1
parents:
diff changeset
1532 if ( !ignoreOffhand )
Ritor1
parents:
diff changeset
1533 {
Ritor1
parents:
diff changeset
1534 if ( this->HasItemEquipped(EQUIP_SINGLE_HANDED) )
Ritor1
parents:
diff changeset
1535 {
Ritor1
parents:
diff changeset
1536 ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1];
Ritor1
parents:
diff changeset
1537 if ( offHandItemGen->GetItemEquipType() != EQUIP_SHIELD )
Ritor1
parents:
diff changeset
1538 {
Ritor1
parents:
diff changeset
1539 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false);
Ritor1
parents:
diff changeset
1540 }
Ritor1
parents:
diff changeset
1541 }
Ritor1
parents:
diff changeset
1542 }
Ritor1
parents:
diff changeset
1543 }
Ritor1
parents:
diff changeset
1544 dmgSum = mainWpnDmg + offHndWpnDmg;
Ritor1
parents:
diff changeset
1545 if ( !ignoreSkillBonus )
Ritor1
parents:
diff changeset
1546 {
Ritor1
parents:
diff changeset
1547 int might = GetActualMight();
Ritor1
parents:
diff changeset
1548 int mightBonus = GetParameterBonus(might);
Ritor1
parents:
diff changeset
1549 int mightAndSkillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightBonus;
Ritor1
parents:
diff changeset
1550 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus;
Ritor1
parents:
diff changeset
1551 }
Ritor1
parents:
diff changeset
1552 result = 1;
Ritor1
parents:
diff changeset
1553 if ( dmgSum >= 1 )
Ritor1
parents:
diff changeset
1554 result = dmgSum;
Ritor1
parents:
diff changeset
1555 return result;
Ritor1
parents:
diff changeset
1556 }
Ritor1
parents:
diff changeset
1557
Ritor1
parents:
diff changeset
1558
Ritor1
parents:
diff changeset
1559 int Player::CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice )
Ritor1
parents:
diff changeset
1560 {
Ritor1
parents:
diff changeset
1561 int itemId = weapon->uItemID;
Ritor1
parents:
diff changeset
1562 int diceCount = pItemsTable->pItems[itemId].uDamageDice;
Ritor1
parents:
diff changeset
1563 if (addOneDice)
Ritor1
parents:
diff changeset
1564 {
Ritor1
parents:
diff changeset
1565 diceCount++;
Ritor1
parents:
diff changeset
1566 }
Ritor1
parents:
diff changeset
1567 int diceSides = pItemsTable->pItems[itemId].uDamageRoll;
Ritor1
parents:
diff changeset
1568 int diceResult = 0;
Ritor1
parents:
diff changeset
1569 for (int i = 0; i < diceCount; i++)
Ritor1
parents:
diff changeset
1570 {
Ritor1
parents:
diff changeset
1571 diceResult += rand() % diceSides + 1;
Ritor1
parents:
diff changeset
1572 }
Ritor1
parents:
diff changeset
1573 int totalDmg = pItemsTable->pItems[itemId].uDamageMod + diceResult;
Ritor1
parents:
diff changeset
1574 if ( uTargetActorID > 0)
Ritor1
parents:
diff changeset
1575 {
Ritor1
parents:
diff changeset
1576 int enchType = weapon->uSpecEnchantmentType;
Ritor1
parents:
diff changeset
1577 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE) )
Ritor1
parents:
diff changeset
1578 {
Ritor1
parents:
diff changeset
1579 totalDmg *= 2;
Ritor1
parents:
diff changeset
1580 }
Ritor1
parents:
diff changeset
1581 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET))
Ritor1
parents:
diff changeset
1582 {
Ritor1
parents:
diff changeset
1583 totalDmg *= 2;
Ritor1
parents:
diff changeset
1584 }
Ritor1
parents:
diff changeset
1585 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET))
Ritor1
parents:
diff changeset
1586 {
Ritor1
parents:
diff changeset
1587 totalDmg *= 2;
Ritor1
parents:
diff changeset
1588 }
Ritor1
parents:
diff changeset
1589 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_ELF) && ( enchType == 63 || itemId == ITEM_RELIC_OLD_NICK))
Ritor1
parents:
diff changeset
1590 {
Ritor1
parents:
diff changeset
1591 totalDmg *= 2;
Ritor1
parents:
diff changeset
1592 }
Ritor1
parents:
diff changeset
1593 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 ))
Ritor1
parents:
diff changeset
1594 {
Ritor1
parents:
diff changeset
1595 totalDmg *= 2;
Ritor1
parents:
diff changeset
1596 }
Ritor1
parents:
diff changeset
1597 }
Ritor1
parents:
diff changeset
1598 if ( (signed int)SkillToMastery(this->pActiveSkills[PLAYER_SKILL_DAGGER]) >= 3
Ritor1
parents:
diff changeset
1599 && pItemsTable->pItems[itemId].uSkillType == 2
Ritor1
parents:
diff changeset
1600 && rand() % 100 < 10 )
Ritor1
parents:
diff changeset
1601 totalDmg *= 3;
Ritor1
parents:
diff changeset
1602 return totalDmg;
Ritor1
parents:
diff changeset
1603 }
Ritor1
parents:
diff changeset
1604
Ritor1
parents:
diff changeset
1605
Ritor1
parents:
diff changeset
1606 //----- (0048D0B9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1607 int Player::GetRangedAttack()
Ritor1
parents:
diff changeset
1608 {
Ritor1
parents:
diff changeset
1609 int v3; // edi@3
Ritor1
parents:
diff changeset
1610 //int v4; // eax@4
Ritor1
parents:
diff changeset
1611 //int v5; // edi@4
Ritor1
parents:
diff changeset
1612 int v6; // edi@4
Ritor1
parents:
diff changeset
1613 int v7; // edi@4
Ritor1
parents:
diff changeset
1614
Ritor1
parents:
diff changeset
1615 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1616 if ( mainHandItem != nullptr && ( mainHandItem->uItemID < ITEM_BLASTER || mainHandItem->uItemID > ITEM_LASER_RIFLE ))
Ritor1
parents:
diff changeset
1617 {
Ritor1
parents:
diff changeset
1618 //v4 = GetActualAccuracy();
Ritor1
parents:
diff changeset
1619 //v5 = GetParameterBonus(GetActualAccuracy());
Ritor1
parents:
diff changeset
1620 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + GetParameterBonus(GetActualAccuracy());
Ritor1
parents:
diff changeset
1621 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6;
Ritor1
parents:
diff changeset
1622 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7;
Ritor1
parents:
diff changeset
1623 }
Ritor1
parents:
diff changeset
1624 else
Ritor1
parents:
diff changeset
1625 {
Ritor1
parents:
diff changeset
1626 v3 = GetActualAttack(true);
Ritor1
parents:
diff changeset
1627 }
Ritor1
parents:
diff changeset
1628 return v3;
Ritor1
parents:
diff changeset
1629 }
Ritor1
parents:
diff changeset
1630
Ritor1
parents:
diff changeset
1631 //----- (0048D124) --------------------------------------------------------
Ritor1
parents:
diff changeset
1632 int Player::GetRangedDamageMin()
Ritor1
parents:
diff changeset
1633 {
Ritor1
parents:
diff changeset
1634 int v2; // edi@1
Ritor1
parents:
diff changeset
1635 int v3; // edi@1
Ritor1
parents:
diff changeset
1636 int v4; // edi@1
Ritor1
parents:
diff changeset
1637 int result; // eax@6
Ritor1
parents:
diff changeset
1638
Ritor1
parents:
diff changeset
1639 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN);
Ritor1
parents:
diff changeset
1640 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
Ritor1
parents:
diff changeset
1641 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
Ritor1
parents:
diff changeset
1642 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
1643 result = v4;
Ritor1
parents:
diff changeset
1644 else
Ritor1
parents:
diff changeset
1645 result = 0;
Ritor1
parents:
diff changeset
1646 return result;
Ritor1
parents:
diff changeset
1647 }
Ritor1
parents:
diff changeset
1648
Ritor1
parents:
diff changeset
1649 //----- (0048D191) --------------------------------------------------------
Ritor1
parents:
diff changeset
1650 int Player::GetRangedDamageMax()
Ritor1
parents:
diff changeset
1651 {
Ritor1
parents:
diff changeset
1652 int v2; // edi@1
Ritor1
parents:
diff changeset
1653 int v3; // edi@1
Ritor1
parents:
diff changeset
1654 int v4; // edi@1
Ritor1
parents:
diff changeset
1655 int result; // eax@6
Ritor1
parents:
diff changeset
1656
Ritor1
parents:
diff changeset
1657 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX);
Ritor1
parents:
diff changeset
1658 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
Ritor1
parents:
diff changeset
1659 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
Ritor1
parents:
diff changeset
1660 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
1661 result = v4;
Ritor1
parents:
diff changeset
1662 else
Ritor1
parents:
diff changeset
1663 result = 0;
Ritor1
parents:
diff changeset
1664 return result;
Ritor1
parents:
diff changeset
1665 }
Ritor1
parents:
diff changeset
1666
Ritor1
parents:
diff changeset
1667 //----- (0048D1FE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1668 int Player::CalculateRangedDamageTo( int a2 )
Ritor1
parents:
diff changeset
1669 {
Ritor1
parents:
diff changeset
1670 ItemGen *v4; // ebx@2
Ritor1
parents:
diff changeset
1671 unsigned int v5; // edi@2
Ritor1
parents:
diff changeset
1672 int v9; // esi@5
Ritor1
parents:
diff changeset
1673 int v10; // ebx@6
Ritor1
parents:
diff changeset
1674 signed int v15; // [sp+8h] [bp-Ch]@2
Ritor1
parents:
diff changeset
1675 int v17; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1676
Ritor1
parents:
diff changeset
1677 v17 = 0;
Ritor1
parents:
diff changeset
1678 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
1679 return 0;
Ritor1
parents:
diff changeset
1680 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1];
Ritor1
parents:
diff changeset
1681 v5 = v4->uItemID;
Ritor1
parents:
diff changeset
1682 v15 = pItemsTable->pItems[v5].uDamageRoll;
Ritor1
parents:
diff changeset
1683 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ )
Ritor1
parents:
diff changeset
1684 {
Ritor1
parents:
diff changeset
1685 int v7 = rand() % v15;
Ritor1
parents:
diff changeset
1686 v17 += v7 + 1;
Ritor1
parents:
diff changeset
1687 }
Ritor1
parents:
diff changeset
1688 v9 = pItemsTable->pItems[v5].uDamageMod + v17;
Ritor1
parents:
diff changeset
1689 if ( a2 )
Ritor1
parents:
diff changeset
1690 {
Ritor1
parents:
diff changeset
1691 v10 = v4->uSpecEnchantmentType;
Ritor1
parents:
diff changeset
1692 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD))
Ritor1
parents:
diff changeset
1693 {
Ritor1
parents:
diff changeset
1694 v9 *= 2;
Ritor1
parents:
diff changeset
1695 }
Ritor1
parents:
diff changeset
1696 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN))
Ritor1
parents:
diff changeset
1697 {
Ritor1
parents:
diff changeset
1698 v9 *= 2;
Ritor1
parents:
diff changeset
1699 }
Ritor1
parents:
diff changeset
1700 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON))
Ritor1
parents:
diff changeset
1701 {
Ritor1
parents:
diff changeset
1702 v9 *= 2;
Ritor1
parents:
diff changeset
1703 }
Ritor1
parents:
diff changeset
1704 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF))
Ritor1
parents:
diff changeset
1705 {
Ritor1
parents:
diff changeset
1706 v9 *= 2;
Ritor1
parents:
diff changeset
1707 }
Ritor1
parents:
diff changeset
1708 }
Ritor1
parents:
diff changeset
1709 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS);
Ritor1
parents:
diff changeset
1710 }
Ritor1
parents:
diff changeset
1711
Ritor1
parents:
diff changeset
1712 //----- (0048D2EA) --------------------------------------------------------
Ritor1
parents:
diff changeset
1713 char *Player::GetMeleeDamageString()
Ritor1
parents:
diff changeset
1714 {
Ritor1
parents:
diff changeset
1715 int min_damage; // edi@3
Ritor1
parents:
diff changeset
1716 int max_damage; // eax@3
Ritor1
parents:
diff changeset
1717
Ritor1
parents:
diff changeset
1718 static char player__getmeleedamagestring_static_buff[40]; // idb
Ritor1
parents:
diff changeset
1719
Ritor1
parents:
diff changeset
1720 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1721
Ritor1
parents:
diff changeset
1722 if (mainHandItem != nullptr && ( mainHandItem->uItemID >= 135 ) && ( mainHandItem->uItemID <= 159 ))
Ritor1
parents:
diff changeset
1723 {
Ritor1
parents:
diff changeset
1724 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
Ritor1
parents:
diff changeset
1725 return player__getmeleedamagestring_static_buff;
Ritor1
parents:
diff changeset
1726 }
Ritor1
parents:
diff changeset
1727 else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE))
Ritor1
parents:
diff changeset
1728 {
Ritor1
parents:
diff changeset
1729 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
Ritor1
parents:
diff changeset
1730 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
Ritor1
parents:
diff changeset
1731 }
Ritor1
parents:
diff changeset
1732 else
Ritor1
parents:
diff changeset
1733 {
Ritor1
parents:
diff changeset
1734 min_damage = GetMeleeDamageMinimal();
Ritor1
parents:
diff changeset
1735 max_damage = GetMeleeDamageMaximal();
Ritor1
parents:
diff changeset
1736 }
Ritor1
parents:
diff changeset
1737 if ( min_damage == max_damage )
Ritor1
parents:
diff changeset
1738 {
Ritor1
parents:
diff changeset
1739 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage);
Ritor1
parents:
diff changeset
1740 }
Ritor1
parents:
diff changeset
1741 else
Ritor1
parents:
diff changeset
1742 {
Ritor1
parents:
diff changeset
1743 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage);
Ritor1
parents:
diff changeset
1744 }
Ritor1
parents:
diff changeset
1745 return player__getmeleedamagestring_static_buff;
Ritor1
parents:
diff changeset
1746 }
Ritor1
parents:
diff changeset
1747
Ritor1
parents:
diff changeset
1748 //----- (0048D396) --------------------------------------------------------
Ritor1
parents:
diff changeset
1749 char *Player::GetRangedDamageString()
Ritor1
parents:
diff changeset
1750 {
Ritor1
parents:
diff changeset
1751 int min_damage; // edi@3
Ritor1
parents:
diff changeset
1752 int max_damage; // eax@3
Ritor1
parents:
diff changeset
1753
Ritor1
parents:
diff changeset
1754 static char player__getrangeddamagestring_static_buff[40]; // idb
Ritor1
parents:
diff changeset
1755
Ritor1
parents:
diff changeset
1756 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1757
Ritor1
parents:
diff changeset
1758 if (mainHandItem != nullptr && ( mainHandItem->uItemID >= 135 ) && ( mainHandItem->uItemID <= 159 ))
Ritor1
parents:
diff changeset
1759 {
Ritor1
parents:
diff changeset
1760 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
Ritor1
parents:
diff changeset
1761 return player__getrangeddamagestring_static_buff;
Ritor1
parents:
diff changeset
1762 }
Ritor1
parents:
diff changeset
1763 else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE))
Ritor1
parents:
diff changeset
1764 {
Ritor1
parents:
diff changeset
1765 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
Ritor1
parents:
diff changeset
1766 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
Ritor1
parents:
diff changeset
1767 }
Ritor1
parents:
diff changeset
1768 else
Ritor1
parents:
diff changeset
1769 {
Ritor1
parents:
diff changeset
1770 min_damage = GetRangedDamageMin();
Ritor1
parents:
diff changeset
1771 max_damage = GetRangedDamageMax();
Ritor1
parents:
diff changeset
1772 }
Ritor1
parents:
diff changeset
1773 if ( max_damage > 0)
Ritor1
parents:
diff changeset
1774 {
Ritor1
parents:
diff changeset
1775 if ( min_damage == max_damage )
Ritor1
parents:
diff changeset
1776 {
Ritor1
parents:
diff changeset
1777 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage);
Ritor1
parents:
diff changeset
1778 }
Ritor1
parents:
diff changeset
1779 else
Ritor1
parents:
diff changeset
1780 {
Ritor1
parents:
diff changeset
1781 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage);
Ritor1
parents:
diff changeset
1782 }
Ritor1
parents:
diff changeset
1783 }
Ritor1
parents:
diff changeset
1784 else
Ritor1
parents:
diff changeset
1785 {
Ritor1
parents:
diff changeset
1786 strcpy(player__getrangeddamagestring_static_buff, "N/A");
Ritor1
parents:
diff changeset
1787 }
Ritor1
parents:
diff changeset
1788 return player__getrangeddamagestring_static_buff;
Ritor1
parents:
diff changeset
1789 }
Ritor1
parents:
diff changeset
1790
Ritor1
parents:
diff changeset
1791 //----- (0048D45A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1792 bool Player::CanTrainToNextLevel()
Ritor1
parents:
diff changeset
1793 {
Ritor1
parents:
diff changeset
1794 int lvl = this->uLevel + 1;
Ritor1
parents:
diff changeset
1795 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000);
Ritor1
parents:
diff changeset
1796 return this->uExperience >= neededExp;
Ritor1
parents:
diff changeset
1797 }
Ritor1
parents:
diff changeset
1798
Ritor1
parents:
diff changeset
1799 //----- (0048D498) --------------------------------------------------------
Ritor1
parents:
diff changeset
1800 unsigned int Player::GetExperienceDisplayColor()
Ritor1
parents:
diff changeset
1801 {
Ritor1
parents:
diff changeset
1802 if ( CanTrainToNextLevel() )
Ritor1
parents:
diff changeset
1803 return ui_character_bonus_text_color;
Ritor1
parents:
diff changeset
1804 else
Ritor1
parents:
diff changeset
1805 return ui_character_default_text_color;
Ritor1
parents:
diff changeset
1806 }
Ritor1
parents:
diff changeset
1807
Ritor1
parents:
diff changeset
1808 //----- (0048D4B3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1809 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg )
Ritor1
parents:
diff changeset
1810 {
Ritor1
parents:
diff changeset
1811 int resist_value; // edi@8
Ritor1
parents:
diff changeset
1812 int player_luck; // eax@21
Ritor1
parents:
diff changeset
1813 signed int res_rand_divider; // ebx@2
Ritor1
parents:
diff changeset
1814 int armor_skill; // eax@29
Ritor1
parents:
diff changeset
1815
Ritor1
parents:
diff changeset
1816 if ( classType == PLAYER_CLASS_LICH && (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND || dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY || dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT )) //TODO: determine if spirit resistance should be handled by body res. modifier
Ritor1
parents:
diff changeset
1817 return 0;
Ritor1
parents:
diff changeset
1818
Ritor1
parents:
diff changeset
1819 resist_value = 0;
Ritor1
parents:
diff changeset
1820 switch(dmg_type)
Ritor1
parents:
diff changeset
1821 {
Ritor1
parents:
diff changeset
1822 case DMGT_FIRE: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); break;
Ritor1
parents:
diff changeset
1823 case DMGT_ELECTR: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); break;
Ritor1
parents:
diff changeset
1824 case DMGT_COLD: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); break;
Ritor1
parents:
diff changeset
1825 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break;
Ritor1
parents:
diff changeset
1826
Ritor1
parents:
diff changeset
1827 case DMGT_SPIRIT: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_SPIRIT);break;
Ritor1
parents:
diff changeset
1828 case DMGT_MIND: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); break;
Ritor1
parents:
diff changeset
1829 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break;
Ritor1
parents:
diff changeset
1830 }
Ritor1
parents:
diff changeset
1831
Ritor1
parents:
diff changeset
1832 player_luck = GetActualLuck();
Ritor1
parents:
diff changeset
1833 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30;
Ritor1
parents:
diff changeset
1834
Ritor1
parents:
diff changeset
1835 if ( GetParameterBonus(player_luck) + resist_value > 0 )
Ritor1
parents:
diff changeset
1836 {
Ritor1
parents:
diff changeset
1837 for (int i = 0; i < 4; i++)
Ritor1
parents:
diff changeset
1838 {
Ritor1
parents:
diff changeset
1839 if ( rand() % res_rand_divider >= 30 )
Ritor1
parents:
diff changeset
1840 dmg >>= 1;
Ritor1
parents:
diff changeset
1841 else
Ritor1
parents:
diff changeset
1842 break;
Ritor1
parents:
diff changeset
1843 }
Ritor1
parents:
diff changeset
1844 }
Ritor1
parents:
diff changeset
1845 ItemGen* equippedArmor = GetArmorItem();
Ritor1
parents:
diff changeset
1846 if (( dmg_type == DMGT_PHISYCAL ) && ( equippedArmor != nullptr ))
Ritor1
parents:
diff changeset
1847 {
Ritor1
parents:
diff changeset
1848 if (!equippedArmor->IsBroken())
Ritor1
parents:
diff changeset
1849 {
Ritor1
parents:
diff changeset
1850 armor_skill = equippedArmor->GetPlayerSkillType();
Ritor1
parents:
diff changeset
1851 if ( armor_skill==PLAYER_SKILL_PLATE )
Ritor1
parents:
diff changeset
1852 {
Ritor1
parents:
diff changeset
1853 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 )
Ritor1
parents:
diff changeset
1854 return dmg / 2;
Ritor1
parents:
diff changeset
1855 }
Ritor1
parents:
diff changeset
1856 if (armor_skill==PLAYER_SKILL_CHAIN )
Ritor1
parents:
diff changeset
1857 {
Ritor1
parents:
diff changeset
1858 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4)
Ritor1
parents:
diff changeset
1859 return dmg * 2 / 3;
Ritor1
parents:
diff changeset
1860 }
Ritor1
parents:
diff changeset
1861 }
Ritor1
parents:
diff changeset
1862 }
Ritor1
parents:
diff changeset
1863 return dmg;
Ritor1
parents:
diff changeset
1864 }
Ritor1
parents:
diff changeset
1865
Ritor1
parents:
diff changeset
1866 //----- (0048D62C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1867 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot)
Ritor1
parents:
diff changeset
1868 {
Ritor1
parents:
diff changeset
1869 return GetNthEquippedIndexItem(uEquipSlot)->GetItemEquipType();
Ritor1
parents:
diff changeset
1870 }
Ritor1
parents:
diff changeset
1871
Ritor1
parents:
diff changeset
1872 //----- (0048D651) --------------------------------------------------------
Ritor1
parents:
diff changeset
1873 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot)
Ritor1
parents:
diff changeset
1874 {
Ritor1
parents:
diff changeset
1875 return (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(uEquipSlot)->GetPlayerSkillType();
Ritor1
parents:
diff changeset
1876 }
Ritor1
parents:
diff changeset
1877
Ritor1
parents:
diff changeset
1878 //----- (0048D676) --------------------------------------------------------
Ritor1
parents:
diff changeset
1879 bool Player::IsUnarmed()
Ritor1
parents:
diff changeset
1880 {
Ritor1
parents:
diff changeset
1881 return !HasItemEquipped(EQUIP_TWO_HANDED) &&
Ritor1
parents:
diff changeset
1882 (!HasItemEquipped(EQUIP_SINGLE_HANDED) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD);
Ritor1
parents:
diff changeset
1883 }
Ritor1
parents:
diff changeset
1884
Ritor1
parents:
diff changeset
1885 //----- (0048D6AA) --------------------------------------------------------
Ritor1
parents:
diff changeset
1886 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex)
Ritor1
parents:
diff changeset
1887 {
Ritor1
parents:
diff changeset
1888 uint i = pEquipment.pIndices[uEquipIndex];
Ritor1
parents:
diff changeset
1889 if (i)
Ritor1
parents:
diff changeset
1890 return !pOwnItems[i - 1].IsBroken();
Ritor1
parents:
diff changeset
1891 else
Ritor1
parents:
diff changeset
1892 return false;
Ritor1
parents:
diff changeset
1893 }
Ritor1
parents:
diff changeset
1894
Ritor1
parents:
diff changeset
1895 //----- (0048D6D0) --------------------------------------------------------
Ritor1
parents:
diff changeset
1896 bool Player::HasEnchantedItemEquipped(int uEnchantment)
Ritor1
parents:
diff changeset
1897 {
Ritor1
parents:
diff changeset
1898 for (uint i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
1899 {
Ritor1
parents:
diff changeset
1900 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
Ritor1
parents:
diff changeset
1901 GetNthEquippedIndexItem(i)->uSpecEnchantmentType == uEnchantment)
Ritor1
parents:
diff changeset
1902 return true;
Ritor1
parents:
diff changeset
1903 }
Ritor1
parents:
diff changeset
1904 return false;
Ritor1
parents:
diff changeset
1905 }
Ritor1
parents:
diff changeset
1906
Ritor1
parents:
diff changeset
1907 //----- (0048D709) --------------------------------------------------------
Ritor1
parents:
diff changeset
1908 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type )
Ritor1
parents:
diff changeset
1909 {
Ritor1
parents:
diff changeset
1910 return ( HasItemEquipped(equip_type) && GetNthEquippedIndexItem(equip_type)->uItemID == item_id );
Ritor1
parents:
diff changeset
1911 }
Ritor1
parents:
diff changeset
1912
Ritor1
parents:
diff changeset
1913 bool Player::WearsItemAnyWhere(int item_id)
Ritor1
parents:
diff changeset
1914 {
Ritor1
parents:
diff changeset
1915 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
1916 {
Ritor1
parents:
diff changeset
1917 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i))
Ritor1
parents:
diff changeset
1918 {
Ritor1
parents:
diff changeset
1919 return true;
Ritor1
parents:
diff changeset
1920 }
Ritor1
parents:
diff changeset
1921 }
Ritor1
parents:
diff changeset
1922 return false;
Ritor1
parents:
diff changeset
1923 }
Ritor1
parents:
diff changeset
1924
Ritor1
parents:
diff changeset
1925 //----- (0048D76C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1926 int Player::StealFromShop( ItemGen *itemToSteal, int extraStealDifficulty, int reputation, int a5, int *fineIfFailed ) //returns an int, but is the return value is compared to zero, so might change to bool
Ritor1
parents:
diff changeset
1927 {
Ritor1
parents:
diff changeset
1928 unsigned __int16 v6; // cx@8
Ritor1
parents:
diff changeset
1929 int v7; // edi@8
Ritor1
parents:
diff changeset
1930 unsigned int v8; // ebx@8
Ritor1
parents:
diff changeset
1931 unsigned int itemvalue; // esi@8
Ritor1
parents:
diff changeset
1932 int v10; // eax@8
Ritor1
parents:
diff changeset
1933 int currMaxItemValue; // edi@12
Ritor1
parents:
diff changeset
1934
Ritor1
parents:
diff changeset
1935 if ( !itemToSteal
Ritor1
parents:
diff changeset
1936 || this->IsEradicated()
Ritor1
parents:
diff changeset
1937 || this->IsDead()
Ritor1
parents:
diff changeset
1938 || this->IsPertified()
Ritor1
parents:
diff changeset
1939 || this->IsDrunk()
Ritor1
parents:
diff changeset
1940 || this->IsUnconcious()
Ritor1
parents:
diff changeset
1941 || this->IsAsleep() )
Ritor1
parents:
diff changeset
1942 {
Ritor1
parents:
diff changeset
1943 return 0;
Ritor1
parents:
diff changeset
1944 }
Ritor1
parents:
diff changeset
1945 else
Ritor1
parents:
diff changeset
1946 {
Ritor1
parents:
diff changeset
1947 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING];
Ritor1
parents:
diff changeset
1948 v7 = v6 & 0x3F;
Ritor1
parents:
diff changeset
1949 v8 = SkillToMastery(v6);
Ritor1
parents:
diff changeset
1950 itemvalue = itemToSteal->GetValue();
Ritor1
parents:
diff changeset
1951 v10 = itemToSteal->GetItemEquipType();
Ritor1
parents:
diff changeset
1952 if ( v10 == EQUIP_SINGLE_HANDED || v10 == EQUIP_TWO_HANDED || v10 == EQUIP_BOW )
Ritor1
parents:
diff changeset
1953 itemvalue *= 3;
Ritor1
parents:
diff changeset
1954 currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8];
Ritor1
parents:
diff changeset
1955 *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue;
Ritor1
parents:
diff changeset
1956 if (a5)
Ritor1
parents:
diff changeset
1957 {
Ritor1
parents:
diff changeset
1958 *fineIfFailed += 500;
Ritor1
parents:
diff changeset
1959 }
Ritor1
parents:
diff changeset
1960 if ( rand() % 100 >= 5 )
Ritor1
parents:
diff changeset
1961 {
Ritor1
parents:
diff changeset
1962 if ( *fineIfFailed > currMaxItemValue )
Ritor1
parents:
diff changeset
1963 if (*fineIfFailed - currMaxItemValue < 500)
Ritor1
parents:
diff changeset
1964 {
Ritor1
parents:
diff changeset
1965 return 1;
Ritor1
parents:
diff changeset
1966 }
Ritor1
parents:
diff changeset
1967 else
Ritor1
parents:
diff changeset
1968 {
Ritor1
parents:
diff changeset
1969 return 0;
Ritor1
parents:
diff changeset
1970 }
Ritor1
parents:
diff changeset
1971 else
Ritor1
parents:
diff changeset
1972 return 2;
Ritor1
parents:
diff changeset
1973 }
Ritor1
parents:
diff changeset
1974 else
Ritor1
parents:
diff changeset
1975 {
Ritor1
parents:
diff changeset
1976 return 0;
Ritor1
parents:
diff changeset
1977 }
Ritor1
parents:
diff changeset
1978 }
Ritor1
parents:
diff changeset
1979 }
Ritor1
parents:
diff changeset
1980
Ritor1
parents:
diff changeset
1981 //----- (0048D88B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1982 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation)
Ritor1
parents:
diff changeset
1983 {
Ritor1
parents:
diff changeset
1984 Actor *actroPtr; // edi@1
Ritor1
parents:
diff changeset
1985 int v7; // ebx@10
Ritor1
parents:
diff changeset
1986 unsigned int stealingMastery; // esi@10
Ritor1
parents:
diff changeset
1987 int fineIfFailed; // esi@10
Ritor1
parents:
diff changeset
1988 int v11; // eax@13
Ritor1
parents:
diff changeset
1989 bool HasFullItemSlots; // ebx@15
Ritor1
parents:
diff changeset
1990 unsigned __int16 carriedItemId; // si@21
Ritor1
parents:
diff changeset
1991 unsigned int enchBonusSum; // esi@31
Ritor1
parents:
diff changeset
1992 int *enchTypePtr; // eax@34
Ritor1
parents:
diff changeset
1993 ItemGen tempItem; // [sp+8h] [bp-34h]@15
Ritor1
parents:
diff changeset
1994 int currMaxItemValue;
Ritor1
parents:
diff changeset
1995
Ritor1
parents:
diff changeset
1996 actroPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
1997 if ( !actroPtr
Ritor1
parents:
diff changeset
1998 || this->IsEradicated()
Ritor1
parents:
diff changeset
1999 || this->IsDead()
Ritor1
parents:
diff changeset
2000 || this->IsPertified()
Ritor1
parents:
diff changeset
2001 || this->IsDrunk()
Ritor1
parents:
diff changeset
2002 || this->IsUnconcious()
Ritor1
parents:
diff changeset
2003 || this->IsAsleep() )
Ritor1
parents:
diff changeset
2004 {
Ritor1
parents:
diff changeset
2005 return 0;
Ritor1
parents:
diff changeset
2006 }
Ritor1
parents:
diff changeset
2007 if ( !actroPtr->ActorHasItem() )
Ritor1
parents:
diff changeset
2008 actroPtr->SetRandomGoldIfTheresNoItem();
Ritor1
parents:
diff changeset
2009 unsigned __int16 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING];
Ritor1
parents:
diff changeset
2010 v7 = v6 & 0x3F;
Ritor1
parents:
diff changeset
2011 stealingMastery = SkillToMastery(v6);
Ritor1
parents:
diff changeset
2012 int v30 = StealingMasteryBonuses[stealingMastery];
Ritor1
parents:
diff changeset
2013 int v29 = StealingRandomBonuses[rand() % 5];
Ritor1
parents:
diff changeset
2014 fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation);
Ritor1
parents:
diff changeset
2015 currMaxItemValue = v29 + v7 * v30;
Ritor1
parents:
diff changeset
2016 if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->ActorEnemy() )
Ritor1
parents:
diff changeset
2017 {
Ritor1
parents:
diff changeset
2018 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
2019 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName);//"%s was caught stealing!"
Ritor1
parents:
diff changeset
2020 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2021 return 0;
Ritor1
parents:
diff changeset
2022 }
Ritor1
parents:
diff changeset
2023 else
Ritor1
parents:
diff changeset
2024 {
Ritor1
parents:
diff changeset
2025 v11 = rand();
Ritor1
parents:
diff changeset
2026 if ( v11 % 100 >= 70 ) //stealing gold
Ritor1
parents:
diff changeset
2027 {
Ritor1
parents:
diff changeset
2028 enchBonusSum = 0;
Ritor1
parents:
diff changeset
2029 for (int i = 0; i < v7; i++)
Ritor1
parents:
diff changeset
2030 enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1;
Ritor1
parents:
diff changeset
2031 if ( actroPtr->ActorHasItems[3].GetItemEquipType() != EQUIP_GOLD )
Ritor1
parents:
diff changeset
2032 return 2;
Ritor1
parents:
diff changeset
2033 enchTypePtr = &actroPtr->ActorHasItems[3].uSpecEnchantmentType;
Ritor1
parents:
diff changeset
2034 if ( (int)enchBonusSum >= *enchTypePtr )
Ritor1
parents:
diff changeset
2035 {
Ritor1
parents:
diff changeset
2036 actroPtr->ActorHasItems[3].uItemID = 0;
Ritor1
parents:
diff changeset
2037 *enchTypePtr = 0;
Ritor1
parents:
diff changeset
2038 }
Ritor1
parents:
diff changeset
2039 else
Ritor1
parents:
diff changeset
2040 *enchTypePtr -= enchBonusSum;
Ritor1
parents:
diff changeset
2041 if ( enchBonusSum )
Ritor1
parents:
diff changeset
2042 {
Ritor1
parents:
diff changeset
2043 pParty->PartyFindsGold(enchBonusSum, 2);
Ritor1
parents:
diff changeset
2044 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], this->pName, enchBonusSum); //%stole %d gold
Ritor1
parents:
diff changeset
2045 }
Ritor1
parents:
diff changeset
2046 else
Ritor1
parents:
diff changeset
2047 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything
Ritor1
parents:
diff changeset
2048 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2049 return 2;
Ritor1
parents:
diff changeset
2050 }
Ritor1
parents:
diff changeset
2051 else if ( v11 % 100 >= 40 ) //stealing an item
Ritor1
parents:
diff changeset
2052 {
Ritor1
parents:
diff changeset
2053 tempItem.Reset();
Ritor1
parents:
diff changeset
2054 HasFullItemSlots = false;
Ritor1
parents:
diff changeset
2055 int i;
Ritor1
parents:
diff changeset
2056 for (i = 0; i < 4; i++)
Ritor1
parents:
diff changeset
2057 {
Ritor1
parents:
diff changeset
2058 if ( actroPtr->ActorHasItems[i].uItemID != 0 && actroPtr->ActorHasItems[i].GetItemEquipType() != EQUIP_GOLD )
Ritor1
parents:
diff changeset
2059 break;
Ritor1
parents:
diff changeset
2060 }
Ritor1
parents:
diff changeset
2061 if (i == 4)
Ritor1
parents:
diff changeset
2062 HasFullItemSlots = true;
Ritor1
parents:
diff changeset
2063 carriedItemId = actroPtr->uCarriedItemID;
Ritor1
parents:
diff changeset
2064 if ( carriedItemId != 0 || HasFullItemSlots )
Ritor1
parents:
diff changeset
2065 {
Ritor1
parents:
diff changeset
2066 tempItem.Reset();
Ritor1
parents:
diff changeset
2067 if ( carriedItemId != 0 )
Ritor1
parents:
diff changeset
2068 {
Ritor1
parents:
diff changeset
2069 actroPtr->uCarriedItemID = 0;
Ritor1
parents:
diff changeset
2070 tempItem.uItemID = carriedItemId;
Ritor1
parents:
diff changeset
2071 if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_WAND )
Ritor1
parents:
diff changeset
2072 tempItem.uNumCharges = rand() % 6 + pItemsTable->pItems[carriedItemId].uDamageMod + 1;
Ritor1
parents:
diff changeset
2073 else if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_POTION && carriedItemId != ITEM_POTION_BOTTLE)
Ritor1
parents:
diff changeset
2074 tempItem.uEnchantmentType = 2 * rand() % 4 + 2;
Ritor1
parents:
diff changeset
2075 }
Ritor1
parents:
diff changeset
2076 else
Ritor1
parents:
diff changeset
2077 {
Ritor1
parents:
diff changeset
2078 ItemGen* itemToSteal = &actroPtr->ActorHasItems[rand() % 4];
Ritor1
parents:
diff changeset
2079 memcpy(&tempItem, itemToSteal, sizeof(tempItem));
Ritor1
parents:
diff changeset
2080 itemToSteal->Reset();
Ritor1
parents:
diff changeset
2081 carriedItemId = tempItem.uItemID;
Ritor1
parents:
diff changeset
2082 }
Ritor1
parents:
diff changeset
2083 if (carriedItemId != 0) // looks odd in current context, but avoids accessing zeroth element of pItemsTable->pItems
Ritor1
parents:
diff changeset
2084 {
Ritor1
parents:
diff changeset
2085 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
2086 sprintf(
Ritor1
parents:
diff changeset
2087 pTmpBuf2.data(),
Ritor1
parents:
diff changeset
2088 pGlobalTXT_LocalizationStrings[304], // Official //TODO: add a normal "%d stole %d" message
Ritor1
parents:
diff changeset
2089 this->pName,
Ritor1
parents:
diff changeset
2090 pItemsTable->pItems[carriedItemId].pUnidentifiedName);
Ritor1
parents:
diff changeset
2091 ShowStatusBarString(pTmpBuf2.data(), 2u);
Ritor1
parents:
diff changeset
2092 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
2093 memcpy(&pParty->pPickedItem, &tempItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
2094 pMouse->SetCursorBitmapFromItemID(carriedItemId);
Ritor1
parents:
diff changeset
2095 return 2;
Ritor1
parents:
diff changeset
2096 }
Ritor1
parents:
diff changeset
2097 }
Ritor1
parents:
diff changeset
2098 }
Ritor1
parents:
diff changeset
2099 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything
Ritor1
parents:
diff changeset
2100 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2101 return 2;
Ritor1
parents:
diff changeset
2102 }
Ritor1
parents:
diff changeset
2103 }
Ritor1
parents:
diff changeset
2104 // 4EDEA0: using guessed type int dword_4EDEA0[];
Ritor1
parents:
diff changeset
2105 // 4EDEB4: using guessed type int dword_4EDEB4[];
Ritor1
parents:
diff changeset
2106 // 4EDEC4: using guessed type int dword_4EDEC4[];
Ritor1
parents:
diff changeset
2107
Ritor1
parents:
diff changeset
2108 //----- (0048DBB9) --------------------------------------------------------
Ritor1
parents:
diff changeset
2109 void Player::Heal(int amount)
Ritor1
parents:
diff changeset
2110 {
Ritor1
parents:
diff changeset
2111 signed int max_health; // eax@3
Ritor1
parents:
diff changeset
2112
Ritor1
parents:
diff changeset
2113 if ( !IsEradicated() && !IsDead() )
Ritor1
parents:
diff changeset
2114 {
Ritor1
parents:
diff changeset
2115 max_health = GetMaxHealth();
Ritor1
parents:
diff changeset
2116 if ( IsZombie() )
Ritor1
parents:
diff changeset
2117 max_health /= 2;
Ritor1
parents:
diff changeset
2118 sHealth += amount;
Ritor1
parents:
diff changeset
2119 if ( sHealth > max_health )
Ritor1
parents:
diff changeset
2120 sHealth = max_health;
Ritor1
parents:
diff changeset
2121 if ( IsUnconcious() )
Ritor1
parents:
diff changeset
2122 {
Ritor1
parents:
diff changeset
2123 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
2124 {
Ritor1
parents:
diff changeset
2125 SetUnconcious(false);
Ritor1
parents:
diff changeset
2126 }
Ritor1
parents:
diff changeset
2127 }
Ritor1
parents:
diff changeset
2128 }
Ritor1
parents:
diff changeset
2129 }
Ritor1
parents:
diff changeset
2130
Ritor1
parents:
diff changeset
2131 //----- (0048DC1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
2132 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type )
Ritor1
parents:
diff changeset
2133 {
Ritor1
parents:
diff changeset
2134 signed int recieved_dmg; // eax@1
Ritor1
parents:
diff changeset
2135 bool broke_armor;
Ritor1
parents:
diff changeset
2136
Ritor1
parents:
diff changeset
2137 SetAsleep(false);
Ritor1
parents:
diff changeset
2138 recieved_dmg = CalculateIncommingDamage(dmg_type, amount);
Ritor1
parents:
diff changeset
2139 sHealth -= recieved_dmg;
Ritor1
parents:
diff changeset
2140 broke_armor = sHealth <= -10;
Ritor1
parents:
diff changeset
2141 if ( sHealth < 1 ) //
Ritor1
parents:
diff changeset
2142 {
Ritor1
parents:
diff changeset
2143 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1)
Ritor1
parents:
diff changeset
2144 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2145 {
Ritor1
parents:
diff changeset
2146 SetCondUnconsciousWithBlockCheck(false);
Ritor1
parents:
diff changeset
2147 }
Ritor1
parents:
diff changeset
2148 else
Ritor1
parents:
diff changeset
2149 {
Ritor1
parents:
diff changeset
2150 SetCondDeadWithBlockCheck(false);
Ritor1
parents:
diff changeset
2151 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
2152 sHealth = 0;
Ritor1
parents:
diff changeset
2153 }
Ritor1
parents:
diff changeset
2154 if (broke_armor )
Ritor1
parents:
diff changeset
2155 {
Ritor1
parents:
diff changeset
2156 ItemGen* equippedArmor = GetArmorItem();
Ritor1
parents:
diff changeset
2157 if ( equippedArmor != nullptr )
Ritor1
parents:
diff changeset
2158 {
Ritor1
parents:
diff changeset
2159 if ( !(equippedArmor->uAttributes & ITEM_HARDENED))
Ritor1
parents:
diff changeset
2160 {
Ritor1
parents:
diff changeset
2161 equippedArmor->SetBroken();
Ritor1
parents:
diff changeset
2162 }
Ritor1
parents:
diff changeset
2163 }
Ritor1
parents:
diff changeset
2164 }
Ritor1
parents:
diff changeset
2165 }
Ritor1
parents:
diff changeset
2166 if ( recieved_dmg && CanAct() )
Ritor1
parents:
diff changeset
2167 PlaySound(SPEECH_24, 0);
Ritor1
parents:
diff changeset
2168 return recieved_dmg;
Ritor1
parents:
diff changeset
2169 }
Ritor1
parents:
diff changeset
2170
Ritor1
parents:
diff changeset
2171 //----- (0048DCF6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2172 int Player::ReceiveSpecialAttackEffect( int attType, struct Actor *pActor )
Ritor1
parents:
diff changeset
2173 {
Ritor1
parents:
diff changeset
2174 SPECIAL_ATTACK_TYPE attTypeCast = (SPECIAL_ATTACK_TYPE) attType;
Ritor1
parents:
diff changeset
2175 signed int v3; // edi@1
Ritor1
parents:
diff changeset
2176 signed int v4; // ebx@1
Ritor1
parents:
diff changeset
2177 int v6; // eax@2
Ritor1
parents:
diff changeset
2178 int v8; // eax@8
Ritor1
parents:
diff changeset
2179 int v10; // eax@8
Ritor1
parents:
diff changeset
2180 int v11; // ebx@8
Ritor1
parents:
diff changeset
2181 ItemGen *v13; // eax@9
Ritor1
parents:
diff changeset
2182 int v22; // eax@49
Ritor1
parents:
diff changeset
2183 signed int v23; // ebx@49
Ritor1
parents:
diff changeset
2184 void *v27; // ecx@76
Ritor1
parents:
diff changeset
2185 char v46[140]; // [sp+Ch] [bp-94h]@13
Ritor1
parents:
diff changeset
2186 unsigned int v47; // [sp+98h] [bp-8h]@1
Ritor1
parents:
diff changeset
2187 ItemGen* v48; // [sp+9Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
2188
Ritor1
parents:
diff changeset
2189 v4 = 0;
Ritor1
parents:
diff changeset
2190 v47 = 0;
Ritor1
parents:
diff changeset
2191 v48 = nullptr;
Ritor1
parents:
diff changeset
2192 switch ( attTypeCast )
Ritor1
parents:
diff changeset
2193 {
Ritor1
parents:
diff changeset
2194 case SPECIAL_ATTACK_CURSE:
Ritor1
parents:
diff changeset
2195 v6 = GetActualWillpower();
Ritor1
parents:
diff changeset
2196 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2197 break;
Ritor1
parents:
diff changeset
2198 case SPECIAL_ATTACK_WEAK:
Ritor1
parents:
diff changeset
2199 case SPECIAL_ATTACK_SLEEP:
Ritor1
parents:
diff changeset
2200 case SPECIAL_ATTACK_DRUNK:
Ritor1
parents:
diff changeset
2201 case SPECIAL_ATTACK_DISEASE_WEAK:
Ritor1
parents:
diff changeset
2202 case SPECIAL_ATTACK_DISEASE_MEDIUM:
Ritor1
parents:
diff changeset
2203 case SPECIAL_ATTACK_DISEASE_SEVERE:
Ritor1
parents:
diff changeset
2204 case SPECIAL_ATTACK_UNCONSCIOUS:
Ritor1
parents:
diff changeset
2205 case SPECIAL_ATTACK_AGING:
Ritor1
parents:
diff changeset
2206 v6 = GetActualEndurance();
Ritor1
parents:
diff changeset
2207 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2208 break;
Ritor1
parents:
diff changeset
2209 case SPECIAL_ATTACK_INSANE:
Ritor1
parents:
diff changeset
2210 case SPECIAL_ATTACK_PARALYZED:
Ritor1
parents:
diff changeset
2211 case SPECIAL_ATTACK_FEAR:
Ritor1
parents:
diff changeset
2212 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
Ritor1
parents:
diff changeset
2213 break;
Ritor1
parents:
diff changeset
2214 case SPECIAL_ATTACK_PETRIFIED:
Ritor1
parents:
diff changeset
2215 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
Ritor1
parents:
diff changeset
2216 break;
Ritor1
parents:
diff changeset
2217 case SPECIAL_ATTACK_POISON_WEAK:
Ritor1
parents:
diff changeset
2218 case SPECIAL_ATTACK_POISON_MEDIUM:
Ritor1
parents:
diff changeset
2219 case SPECIAL_ATTACK_POISON_SEVERE:
Ritor1
parents:
diff changeset
2220 case SPECIAL_ATTACK_DEAD:
Ritor1
parents:
diff changeset
2221 case SPECIAL_ATTACK_ERADICATED:
Ritor1
parents:
diff changeset
2222 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
Ritor1
parents:
diff changeset
2223 break;
Ritor1
parents:
diff changeset
2224 case SPECIAL_ATTACK_MANA_DRAIN:
Ritor1
parents:
diff changeset
2225 v8 = GetActualWillpower();
Ritor1
parents:
diff changeset
2226 v10 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2227 v11 = (GetParameterBonus(v10) + GetParameterBonus(v8)) / 2;
Ritor1
parents:
diff changeset
2228 break;
Ritor1
parents:
diff changeset
2229 case SPECIAL_ATTACK_BREAK_ANY:
Ritor1
parents:
diff changeset
2230 for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
2231 {
Ritor1
parents:
diff changeset
2232 v13 = &this->pInventoryItemList[i];
Ritor1
parents:
diff changeset
2233 if ( v13->uItemID > 0 && v13->uItemID <= 134 && !v13->IsBroken())
Ritor1
parents:
diff changeset
2234 v46[v4++] = i;
Ritor1
parents:
diff changeset
2235 }
Ritor1
parents:
diff changeset
2236 if ( !v4 )
Ritor1
parents:
diff changeset
2237 return 0;
Ritor1
parents:
diff changeset
2238 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2239 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2240 break;
Ritor1
parents:
diff changeset
2241 case SPECIAL_ATTACK_BREAK_ARMOR:
Ritor1
parents:
diff changeset
2242 for (int i = 0; i < 16; i++ )
Ritor1
parents:
diff changeset
2243 {
Ritor1
parents:
diff changeset
2244 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2245 {
Ritor1
parents:
diff changeset
2246 if ( i == EQUIP_ARMOUR )
Ritor1
parents:
diff changeset
2247 v46[v4++] = this->pEquipment.uArmor - 1;
Ritor1
parents:
diff changeset
2248 if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD )
Ritor1
parents:
diff changeset
2249 v46[v4++] = this->pEquipment.pIndices[i] - 1;
Ritor1
parents:
diff changeset
2250 }
Ritor1
parents:
diff changeset
2251 }
Ritor1
parents:
diff changeset
2252 if ( !v4 )
Ritor1
parents:
diff changeset
2253 return 0;
Ritor1
parents:
diff changeset
2254 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2255 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2256 break;
Ritor1
parents:
diff changeset
2257 case SPECIAL_ATTACK_BREAK_WEAPON:
Ritor1
parents:
diff changeset
2258 for (int i = 0; i < 16; i++ )
Ritor1
parents:
diff changeset
2259 {
Ritor1
parents:
diff changeset
2260 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2261 {
Ritor1
parents:
diff changeset
2262 if ( i == EQUIP_BOW )
Ritor1
parents:
diff changeset
2263 v46[v4++] = LOBYTE(this->pEquipment.uBow) - 1;
Ritor1
parents:
diff changeset
2264 if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED)
Ritor1
parents:
diff changeset
2265 && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SINGLE_HANDED || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
2266 v46[v4++] = this->pEquipment.pIndices[i] - 1;
Ritor1
parents:
diff changeset
2267 }
Ritor1
parents:
diff changeset
2268 }
Ritor1
parents:
diff changeset
2269 if ( !v4 )
Ritor1
parents:
diff changeset
2270 return 0;
Ritor1
parents:
diff changeset
2271 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2272 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2273 break;
Ritor1
parents:
diff changeset
2274 case SPECIAL_ATTACK_STEAL:
Ritor1
parents:
diff changeset
2275 for ( int i = 0; i < 126; i++ )
Ritor1
parents:
diff changeset
2276 {
Ritor1
parents:
diff changeset
2277 int ItemPosInList = this->pInventoryMatrix[i];
Ritor1
parents:
diff changeset
2278 if (ItemPosInList > 0)
Ritor1
parents:
diff changeset
2279 {
Ritor1
parents:
diff changeset
2280 ItemGen* v21 = &this->pInventoryItemList[ItemPosInList - 1];
Ritor1
parents:
diff changeset
2281 if ( v21->uItemID > 0 && v21->uItemID <= 134 )
Ritor1
parents:
diff changeset
2282 {
Ritor1
parents:
diff changeset
2283 v46[v4++] = i;
Ritor1
parents:
diff changeset
2284 }
Ritor1
parents:
diff changeset
2285 }
Ritor1
parents:
diff changeset
2286 }
Ritor1
parents:
diff changeset
2287 if ( !v4 )
Ritor1
parents:
diff changeset
2288 return 0;
Ritor1
parents:
diff changeset
2289 v47 = v46[rand() % v4];
Ritor1
parents:
diff changeset
2290 v6 = GetActualAccuracy();
Ritor1
parents:
diff changeset
2291 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2292 break;
Ritor1
parents:
diff changeset
2293 default:
Ritor1
parents:
diff changeset
2294 v11 = 0;
Ritor1
parents:
diff changeset
2295 break;
Ritor1
parents:
diff changeset
2296 }
Ritor1
parents:
diff changeset
2297 v22 = GetActualLuck();
Ritor1
parents:
diff changeset
2298 v23 = GetParameterBonus(v22) + v11 + 30;
Ritor1
parents:
diff changeset
2299 if ( rand() % v23 >= 30 )
Ritor1
parents:
diff changeset
2300 {
Ritor1
parents:
diff changeset
2301 return 0;
Ritor1
parents:
diff changeset
2302 }
Ritor1
parents:
diff changeset
2303 else
Ritor1
parents:
diff changeset
2304 {
Ritor1
parents:
diff changeset
2305 for ( v3 = 0; v3 < 4; v3++ )
Ritor1
parents:
diff changeset
2306 {
Ritor1
parents:
diff changeset
2307 if ( this == pPlayers[v3 + 1] )
Ritor1
parents:
diff changeset
2308 break;
Ritor1
parents:
diff changeset
2309 }
Ritor1
parents:
diff changeset
2310
Ritor1
parents:
diff changeset
2311 switch ( attTypeCast )
Ritor1
parents:
diff changeset
2312 {
Ritor1
parents:
diff changeset
2313 case SPECIAL_ATTACK_CURSE:
Ritor1
parents:
diff changeset
2314 SetCondition(Condition_Cursed, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2315 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2316 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2317 return 1;
Ritor1
parents:
diff changeset
2318 break;
Ritor1
parents:
diff changeset
2319 case SPECIAL_ATTACK_WEAK:
Ritor1
parents:
diff changeset
2320 SetCondition(Condition_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2321 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2322 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2323 return 1;
Ritor1
parents:
diff changeset
2324 break;
Ritor1
parents:
diff changeset
2325 case SPECIAL_ATTACK_SLEEP:
Ritor1
parents:
diff changeset
2326 SetCondition(Condition_Sleep, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2327 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2328 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2329 return 1;
Ritor1
parents:
diff changeset
2330 break;
Ritor1
parents:
diff changeset
2331 case SPECIAL_ATTACK_DRUNK:
Ritor1
parents:
diff changeset
2332 SetCondition(Condition_Drunk, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2333 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2334 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2335 return 1;
Ritor1
parents:
diff changeset
2336 break;
Ritor1
parents:
diff changeset
2337 case SPECIAL_ATTACK_INSANE:
Ritor1
parents:
diff changeset
2338 SetCondition(Condition_Insane, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2339 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2340 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2341 return 1;
Ritor1
parents:
diff changeset
2342 break;
Ritor1
parents:
diff changeset
2343 case SPECIAL_ATTACK_POISON_WEAK:
Ritor1
parents:
diff changeset
2344 SetCondition(Condition_Poison_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2345 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2346 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2347 return 1;
Ritor1
parents:
diff changeset
2348 break;
Ritor1
parents:
diff changeset
2349 case SPECIAL_ATTACK_POISON_MEDIUM:
Ritor1
parents:
diff changeset
2350 SetCondition(Condition_Poison_Medium, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2351 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2352 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2353 return 1;
Ritor1
parents:
diff changeset
2354 break;
Ritor1
parents:
diff changeset
2355 case SPECIAL_ATTACK_POISON_SEVERE:
Ritor1
parents:
diff changeset
2356 SetCondition(Condition_Poison_Severe, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2357 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2358 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2359 return 1;
Ritor1
parents:
diff changeset
2360 break;
Ritor1
parents:
diff changeset
2361 case SPECIAL_ATTACK_DISEASE_WEAK:
Ritor1
parents:
diff changeset
2362 SetCondition(Condition_Disease_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2363 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2364 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2365 return 1;
Ritor1
parents:
diff changeset
2366 break;
Ritor1
parents:
diff changeset
2367 case SPECIAL_ATTACK_DISEASE_MEDIUM:
Ritor1
parents:
diff changeset
2368 SetCondition(Condition_Disease_Medium, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2369 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2370 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2371 return 1;
Ritor1
parents:
diff changeset
2372 break;
Ritor1
parents:
diff changeset
2373 case SPECIAL_ATTACK_DISEASE_SEVERE:
Ritor1
parents:
diff changeset
2374 SetCondition(Condition_Disease_Severe, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2375 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2376 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2377 return 1;
Ritor1
parents:
diff changeset
2378 break;
Ritor1
parents:
diff changeset
2379 case SPECIAL_ATTACK_PARALYZED:
Ritor1
parents:
diff changeset
2380 SetCondition(Condition_Paralyzed, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2381 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2382 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2383 return 1;
Ritor1
parents:
diff changeset
2384 break;
Ritor1
parents:
diff changeset
2385 case SPECIAL_ATTACK_UNCONSCIOUS:
Ritor1
parents:
diff changeset
2386 SetCondition(Condition_Unconcious, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2387 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2388 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2389 return 1;
Ritor1
parents:
diff changeset
2390 break;
Ritor1
parents:
diff changeset
2391 case SPECIAL_ATTACK_DEAD:
Ritor1
parents:
diff changeset
2392 SetCondition(Condition_Dead, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2393 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2394 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2395 return 1;
Ritor1
parents:
diff changeset
2396 break;
Ritor1
parents:
diff changeset
2397 case SPECIAL_ATTACK_PETRIFIED:
Ritor1
parents:
diff changeset
2398 SetCondition(Condition_Pertified, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2399 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2400 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2401 return 1;
Ritor1
parents:
diff changeset
2402 break;
Ritor1
parents:
diff changeset
2403 case SPECIAL_ATTACK_ERADICATED:
Ritor1
parents:
diff changeset
2404 SetCondition(Condition_Eradicated, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2405 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2406 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2407 return 1;
Ritor1
parents:
diff changeset
2408 break;
Ritor1
parents:
diff changeset
2409 case SPECIAL_ATTACK_BREAK_ANY:
Ritor1
parents:
diff changeset
2410 case SPECIAL_ATTACK_BREAK_ARMOR:
Ritor1
parents:
diff changeset
2411 case SPECIAL_ATTACK_BREAK_WEAPON:
Ritor1
parents:
diff changeset
2412 if ( !(v48->uAttributes & ITEM_HARDENED) )
Ritor1
parents:
diff changeset
2413 {
Ritor1
parents:
diff changeset
2414 PlaySound(SPEECH_40, 0);
Ritor1
parents:
diff changeset
2415 v48->SetBroken();
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2416 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
2417 }
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2418 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2419 return 1;
Ritor1
parents:
diff changeset
2420 break;
Ritor1
parents:
diff changeset
2421 case SPECIAL_ATTACK_STEAL:
Ritor1
parents:
diff changeset
2422 PlaySound(SPEECH_40, 0);
Ritor1
parents:
diff changeset
2423 v27 = pActor->ActorHasItems;
Ritor1
parents:
diff changeset
2424 if ( pActor->ActorHasItems[0].uItemID )
Ritor1
parents:
diff changeset
2425 {
Ritor1
parents:
diff changeset
2426 v27 = &pActor->ActorHasItems[1];
Ritor1
parents:
diff changeset
2427 if ( pActor->ActorHasItems[1].uItemID )
Ritor1
parents:
diff changeset
2428 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2429 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2430 return 1;
Ritor1
parents:
diff changeset
2431 }
Ritor1
parents:
diff changeset
2432 }
Ritor1
parents:
diff changeset
2433 memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u);
Ritor1
parents:
diff changeset
2434 RemoveItemAtInventoryIndex(v47);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2435 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2436 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2437 return 1;
Ritor1
parents:
diff changeset
2438 break;
Ritor1
parents:
diff changeset
2439 case SPECIAL_ATTACK_AGING:
Ritor1
parents:
diff changeset
2440 PlaySound(SPEECH_42, 0);
Ritor1
parents:
diff changeset
2441 ++this->sAgeModifier;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2442 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2443 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2444 return 1;
Ritor1
parents:
diff changeset
2445 break;
Ritor1
parents:
diff changeset
2446 case SPECIAL_ATTACK_MANA_DRAIN:
Ritor1
parents:
diff changeset
2447 PlaySound(SPEECH_41, 0);
Ritor1
parents:
diff changeset
2448 this->sMana = 0;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2449 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2450 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2451 return 1;
Ritor1
parents:
diff changeset
2452 break;
Ritor1
parents:
diff changeset
2453 case SPECIAL_ATTACK_FEAR:
Ritor1
parents:
diff changeset
2454 SetCondition(Condition_Fear, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2455 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2456 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2457 return 1;
Ritor1
parents:
diff changeset
2458 break;
Ritor1
parents:
diff changeset
2459 default:
Ritor1
parents:
diff changeset
2460 return 0;
Ritor1
parents:
diff changeset
2461 }
Ritor1
parents:
diff changeset
2462 }
Ritor1
parents:
diff changeset
2463 }
Ritor1
parents:
diff changeset
2464
Ritor1
parents:
diff changeset
2465 // 48DCF6: using guessed type char var_94[140];
Ritor1
parents:
diff changeset
2466
Ritor1
parents:
diff changeset
2467 //----- (0048E1A3) --------------------------------------------------------
Ritor1
parents:
diff changeset
2468 unsigned int Player::GetSpellSchool(unsigned int uSpellID)
Ritor1
parents:
diff changeset
2469 {
Ritor1
parents:
diff changeset
2470 return pSpellStats->pInfos[uSpellID].uSchool;
Ritor1
parents:
diff changeset
2471 }
Ritor1
parents:
diff changeset
2472
Ritor1
parents:
diff changeset
2473 //----- (0048E1B5) --------------------------------------------------------
Ritor1
parents:
diff changeset
2474 int Player::GetAttackRecoveryTime(bool bRangedAttack)
Ritor1
parents:
diff changeset
2475 {
Ritor1
parents:
diff changeset
2476 ItemGen *weapon = nullptr;
Ritor1
parents:
diff changeset
2477 uint weapon_recovery = base_recovery_times_per_weapon_type[0];
Ritor1
parents:
diff changeset
2478 if (bRangedAttack)
Ritor1
parents:
diff changeset
2479 {
Ritor1
parents:
diff changeset
2480 if ( HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
2481 {
Ritor1
parents:
diff changeset
2482 weapon = GetBowItem();
Ritor1
parents:
diff changeset
2483 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2484 }
Ritor1
parents:
diff changeset
2485 }
Ritor1
parents:
diff changeset
2486 else if ( IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
2487 {
Ritor1
parents:
diff changeset
2488 weapon_recovery = base_recovery_times_per_weapon_type[1];
Ritor1
parents:
diff changeset
2489 }
Ritor1
parents:
diff changeset
2490 else if ( HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
2491 {
Ritor1
parents:
diff changeset
2492 weapon = GetMainHandItem();
Ritor1
parents:
diff changeset
2493 if (weapon->GetItemEquipType() == EQUIP_WAND)
Ritor1
parents:
diff changeset
2494 {
Ritor1
parents:
diff changeset
2495 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
Ritor1
parents:
diff changeset
2496 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now
Ritor1
parents:
diff changeset
2497 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery;
Ritor1
parents:
diff changeset
2498 }
Ritor1
parents:
diff changeset
2499 else
Ritor1
parents:
diff changeset
2500 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2501 }
Ritor1
parents:
diff changeset
2502 if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) != EQUIP_SHIELD)
Ritor1
parents:
diff changeset
2503 // ADD: shield check because shield recovery is added later and can be accidentally doubled
Ritor1
parents:
diff changeset
2504 {
Ritor1
parents:
diff changeset
2505 if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery)
Ritor1
parents:
diff changeset
2506 {
Ritor1
parents:
diff changeset
2507 weapon = GetOffHandItem();
Ritor1
parents:
diff changeset
2508 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2509 }
Ritor1
parents:
diff changeset
2510 }
Ritor1
parents:
diff changeset
2511
Ritor1
parents:
diff changeset
2512 uint armour_recovery = 0;
Ritor1
parents:
diff changeset
2513 if ( HasItemEquipped(EQUIP_ARMOUR) )
Ritor1
parents:
diff changeset
2514 {
Ritor1
parents:
diff changeset
2515 uchar armour_skill_type = GetArmorItem()->GetPlayerSkillType();
Ritor1
parents:
diff changeset
2516 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type];
Ritor1
parents:
diff changeset
2517 float multiplier;
Ritor1
parents:
diff changeset
2518
Ritor1
parents:
diff changeset
2519 if (armour_skill_type == PLAYER_SKILL_LEATHER)
Ritor1
parents:
diff changeset
2520 {
Ritor1
parents:
diff changeset
2521 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0, 0, 0);
Ritor1
parents:
diff changeset
2522 }
Ritor1
parents:
diff changeset
2523 else if (armour_skill_type == PLAYER_SKILL_CHAIN)
Ritor1
parents:
diff changeset
2524 {
Ritor1
parents:
diff changeset
2525 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0, 0);
Ritor1
parents:
diff changeset
2526 }
Ritor1
parents:
diff changeset
2527 else if (armour_skill_type == PLAYER_SKILL_PLATE)
Ritor1
parents:
diff changeset
2528 {
Ritor1
parents:
diff changeset
2529 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0.5f, 0);
Ritor1
parents:
diff changeset
2530 }
Ritor1
parents:
diff changeset
2531 else
Ritor1
parents:
diff changeset
2532 {
Ritor1
parents:
diff changeset
2533 Error("Unknown armour type"); // what kind of armour is that?
Ritor1
parents:
diff changeset
2534 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f);
Ritor1
parents:
diff changeset
2535 }
Ritor1
parents:
diff changeset
2536
Ritor1
parents:
diff changeset
2537 armour_recovery = (uint)(base_armour_recovery * multiplier);
Ritor1
parents:
diff changeset
2538 }
Ritor1
parents:
diff changeset
2539
Ritor1
parents:
diff changeset
2540 uint shield_recovery = 0;
Ritor1
parents:
diff changeset
2541 if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) == EQUIP_SHIELD)
Ritor1
parents:
diff changeset
2542 {
Ritor1
parents:
diff changeset
2543 uchar skill_type = GetOffHandItem()->GetPlayerSkillType();
Ritor1
parents:
diff changeset
2544
Ritor1
parents:
diff changeset
2545 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type];
Ritor1
parents:
diff changeset
2546 float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0);
Ritor1
parents:
diff changeset
2547 shield_recovery = (uint)(shield_base_recovery * multiplier);
Ritor1
parents:
diff changeset
2548 }
Ritor1
parents:
diff changeset
2549
Ritor1
parents:
diff changeset
2550 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()),
Ritor1
parents:
diff changeset
2551 sword_axe_bow_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2552 bool shooting_laser = false;
Ritor1
parents:
diff changeset
2553 if (weapon != nullptr)
Ritor1
parents:
diff changeset
2554 {
Ritor1
parents:
diff changeset
2555 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) &&
Ritor1
parents:
diff changeset
2556 (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD || weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE || weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW) )
Ritor1
parents:
diff changeset
2557 {
Ritor1
parents:
diff changeset
2558 if (SkillToMastery(pActiveSkills[weapon->GetPlayerSkillType()]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery
Ritor1
parents:
diff changeset
2559 sword_axe_bow_recovery_reduction = pActiveSkills[weapon->GetPlayerSkillType()] & 0x3F;
Ritor1
parents:
diff changeset
2560 }
Ritor1
parents:
diff changeset
2561 if (weapon->GetPlayerSkillType() == PLAYER_SKILL_BLASTER)
Ritor1
parents:
diff changeset
2562 shooting_laser = true;
Ritor1
parents:
diff changeset
2563 }
Ritor1
parents:
diff changeset
2564
Ritor1
parents:
diff changeset
2565 uint armsmaster_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2566 if (!bRangedAttack && !shooting_laser)
Ritor1
parents:
diff changeset
2567 {
Ritor1
parents:
diff changeset
2568 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER))
Ritor1
parents:
diff changeset
2569 {
Ritor1
parents:
diff changeset
2570 armsmaster_recovery_reduction = armsmaster_level & 0x3F;
Ritor1
parents:
diff changeset
2571 if (SkillToMastery(armsmaster_level) >= 4)
Ritor1
parents:
diff changeset
2572 armsmaster_recovery_reduction *= 2;
Ritor1
parents:
diff changeset
2573 }
Ritor1
parents:
diff changeset
2574 }
Ritor1
parents:
diff changeset
2575
Ritor1
parents:
diff changeset
2576 uint hasteRecoveryReduction = 0;
Ritor1
parents:
diff changeset
2577 if (pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2578 hasteRecoveryReduction = 25;
Ritor1
parents:
diff changeset
2579
Ritor1
parents:
diff changeset
2580 uint weapon_enchantment_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2581 if ( weapon )
Ritor1
parents:
diff changeset
2582 {
Ritor1
parents:
diff changeset
2583 if (weapon->uSpecEnchantmentType == 59 ||
Ritor1
parents:
diff changeset
2584 weapon->uSpecEnchantmentType == 41 ||
Ritor1
parents:
diff changeset
2585 weapon->uSpecEnchantmentType == 500)
Ritor1
parents:
diff changeset
2586 weapon_enchantment_recovery_reduction = 20;
Ritor1
parents:
diff changeset
2587 }
Ritor1
parents:
diff changeset
2588
Ritor1
parents:
diff changeset
2589 int recovery = weapon_recovery +
Ritor1
parents:
diff changeset
2590 armour_recovery +
Ritor1
parents:
diff changeset
2591 shield_recovery
Ritor1
parents:
diff changeset
2592 - armsmaster_recovery_reduction
Ritor1
parents:
diff changeset
2593 - weapon_enchantment_recovery_reduction
Ritor1
parents:
diff changeset
2594 - hasteRecoveryReduction
Ritor1
parents:
diff changeset
2595 - sword_axe_bow_recovery_reduction
Ritor1
parents:
diff changeset
2596 - player_speed_recovery_reduction;
Ritor1
parents:
diff changeset
2597
Ritor1
parents:
diff changeset
2598 if (recovery < 0)
Ritor1
parents:
diff changeset
2599 recovery = 0;
Ritor1
parents:
diff changeset
2600 return recovery;
Ritor1
parents:
diff changeset
2601 }
Ritor1
parents:
diff changeset
2602
Ritor1
parents:
diff changeset
2603
Ritor1
parents:
diff changeset
2604 //----- new --------------------------------------------------------
Ritor1
parents:
diff changeset
2605 float Player::GetArmorRecoveryMultiplierFromSkillLevel( unsigned char armour_skill_type, float mult1, float mult2, float mult3, float mult4 )
Ritor1
parents:
diff changeset
2606 {
Ritor1
parents:
diff changeset
2607 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]);
Ritor1
parents:
diff changeset
2608 switch (skill_mastery)
Ritor1
parents:
diff changeset
2609 {
Ritor1
parents:
diff changeset
2610 case 1: return mult1; break;
Ritor1
parents:
diff changeset
2611 case 2: return mult2; break;
Ritor1
parents:
diff changeset
2612 case 3: return mult3; break;
Ritor1
parents:
diff changeset
2613 case 4: return mult4; break;
Ritor1
parents:
diff changeset
2614 }
Ritor1
parents:
diff changeset
2615 Error("Unexpected input value: %d", armour_skill_type);
Ritor1
parents:
diff changeset
2616 return 0;
Ritor1
parents:
diff changeset
2617 }
Ritor1
parents:
diff changeset
2618
Ritor1
parents:
diff changeset
2619 //----- (0048E4F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
2620 int Player::GetMaxHealth()
Ritor1
parents:
diff changeset
2621 {
Ritor1
parents:
diff changeset
2622 int v3; // esi@1
Ritor1
parents:
diff changeset
2623 int v4; // esi@1
Ritor1
parents:
diff changeset
2624 int v6; // esi@1
Ritor1
parents:
diff changeset
2625
Ritor1
parents:
diff changeset
2626 v3 = GetParameterBonus(GetActualEndurance());
Ritor1
parents:
diff changeset
2627 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3);
Ritor1
parents:
diff changeset
2628 v6 = uFullHealthBonus
Ritor1
parents:
diff changeset
2629 + pBaseHealthByClass[classType / 4]
Ritor1
parents:
diff changeset
2630 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH)
Ritor1
parents:
diff changeset
2631 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH) + v4;
Ritor1
parents:
diff changeset
2632 return max(1, v6);
Ritor1
parents:
diff changeset
2633 }
Ritor1
parents:
diff changeset
2634
Ritor1
parents:
diff changeset
2635 //----- (0048E565) --------------------------------------------------------
Ritor1
parents:
diff changeset
2636 int Player::GetMaxMana()
Ritor1
parents:
diff changeset
2637 {
Ritor1
parents:
diff changeset
2638 int v2; // eax@2
Ritor1
parents:
diff changeset
2639 int v3; // esi@4
Ritor1
parents:
diff changeset
2640 int v4; // eax@5
Ritor1
parents:
diff changeset
2641 int v5; // esi@5
Ritor1
parents:
diff changeset
2642 int v6; // eax@5
Ritor1
parents:
diff changeset
2643 int v7; // esi@6
Ritor1
parents:
diff changeset
2644 int v8; // esi@6
Ritor1
parents:
diff changeset
2645 int v9; // esi@6
Ritor1
parents:
diff changeset
2646
Ritor1
parents:
diff changeset
2647 switch (classType)
Ritor1
parents:
diff changeset
2648 {
Ritor1
parents:
diff changeset
2649 case PLAYER_CLASS_ROGUE:
Ritor1
parents:
diff changeset
2650 case PLAYER_CLASS_SPY:
Ritor1
parents:
diff changeset
2651 case PLAYER_CLASS_ASSASSIN:
Ritor1
parents:
diff changeset
2652 case PLAYER_CLASS_ARCHER:
Ritor1
parents:
diff changeset
2653 case PLAYER_CLASS_WARRIOR_MAGE:
Ritor1
parents:
diff changeset
2654 case PLAYER_CLASS_MASTER_ARCHER:
Ritor1
parents:
diff changeset
2655 case PLAYER_CLASS_SNIPER:
Ritor1
parents:
diff changeset
2656 case PLAYER_CLASS_SORCERER:
Ritor1
parents:
diff changeset
2657 case PLAYER_CLASS_WIZARD:
Ritor1
parents:
diff changeset
2658 case PLAYER_CLASS_ARCHMAGE:
Ritor1
parents:
diff changeset
2659 case PLAYER_CLASS_LICH:
Ritor1
parents:
diff changeset
2660 v2 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2661 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2662 break;
Ritor1
parents:
diff changeset
2663 case PLAYER_CLASS_INITIATE:
Ritor1
parents:
diff changeset
2664 case PLAYER_CLASS_MASTER:
Ritor1
parents:
diff changeset
2665 case PLAYER_CLASS_NINJA:
Ritor1
parents:
diff changeset
2666 case PLAYER_CLASS_PALADIN:
Ritor1
parents:
diff changeset
2667 case PLAYER_CLASS_CRUSADER:
Ritor1
parents:
diff changeset
2668 case PLAYER_CLASS_HERO:
Ritor1
parents:
diff changeset
2669 case PLAYER_CLASS_VILLIAN:
Ritor1
parents:
diff changeset
2670 case PLAYER_CLASS_CLERIC:
Ritor1
parents:
diff changeset
2671 case PLAYER_CLASS_PRIEST:
Ritor1
parents:
diff changeset
2672 case PLAYER_CLASS_PRIEST_OF_SUN:
Ritor1
parents:
diff changeset
2673 case PLAYER_CLASS_PRIEST_OF_MOON:
Ritor1
parents:
diff changeset
2674 v2 = GetActualWillpower();
Ritor1
parents:
diff changeset
2675 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2676 break;
Ritor1
parents:
diff changeset
2677 case PLAYER_CLASS_HUNTER:
Ritor1
parents:
diff changeset
2678 case PLAYER_CLASS_RANGER_LORD:
Ritor1
parents:
diff changeset
2679 case PLAYER_CLASS_BOUNTY_HUNTER:
Ritor1
parents:
diff changeset
2680 case PLAYER_CLASS_DRUID:
Ritor1
parents:
diff changeset
2681 case PLAYER_CLASS_GREAT_DRUID:
Ritor1
parents:
diff changeset
2682 case PLAYER_CLASS_ARCH_DRUID:
Ritor1
parents:
diff changeset
2683 case PLAYER_CLASS_WARLOCK:
Ritor1
parents:
diff changeset
2684 v4 = GetActualWillpower();
Ritor1
parents:
diff changeset
2685 v5 = GetParameterBonus(v4);
Ritor1
parents:
diff changeset
2686 v6 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2687 v3 = GetParameterBonus(v6) + v5;
Ritor1
parents:
diff changeset
2688 break;
Ritor1
parents:
diff changeset
2689 default:
Ritor1
parents:
diff changeset
2690 return 0;
Ritor1
parents:
diff changeset
2691 break;
Ritor1
parents:
diff changeset
2692 }
Ritor1
parents:
diff changeset
2693 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
Ritor1
parents:
diff changeset
2694 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA) + v7;
Ritor1
parents:
diff changeset
2695 v9 = uFullManaBonus
Ritor1
parents:
diff changeset
2696 + pBaseManaByClass[classType / 4]
Ritor1
parents:
diff changeset
2697 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA)
Ritor1
parents:
diff changeset
2698 + v8;
Ritor1
parents:
diff changeset
2699 return max(0,v9);
Ritor1
parents:
diff changeset
2700 }
Ritor1
parents:
diff changeset
2701
Ritor1
parents:
diff changeset
2702 //----- (0048E656) --------------------------------------------------------
Ritor1
parents:
diff changeset
2703 int Player::GetBaseAC()
Ritor1
parents:
diff changeset
2704 {
Ritor1
parents:
diff changeset
2705 int v2; // eax@1
Ritor1
parents:
diff changeset
2706 int v3; // esi@1
Ritor1
parents:
diff changeset
2707 int v4; // esi@1
Ritor1
parents:
diff changeset
2708 int v5; // esi@1
Ritor1
parents:
diff changeset
2709
Ritor1
parents:
diff changeset
2710 v2 = GetActualSpeed();
Ritor1
parents:
diff changeset
2711 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2712 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
Ritor1
parents:
diff changeset
2713 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
Ritor1
parents:
diff changeset
2714 return max(0, v5);
Ritor1
parents:
diff changeset
2715 }
Ritor1
parents:
diff changeset
2716
Ritor1
parents:
diff changeset
2717 //----- (0048E68F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2718 int Player::GetActualAC()
Ritor1
parents:
diff changeset
2719 {
Ritor1
parents:
diff changeset
2720 int v2; // eax@1
Ritor1
parents:
diff changeset
2721 int v3; // esi@1
Ritor1
parents:
diff changeset
2722 int v4; // esi@1
Ritor1
parents:
diff changeset
2723 int v5; // esi@1
Ritor1
parents:
diff changeset
2724 int v6; // esi@1
Ritor1
parents:
diff changeset
2725
Ritor1
parents:
diff changeset
2726 v2 = GetActualSpeed();
Ritor1
parents:
diff changeset
2727 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2728 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
Ritor1
parents:
diff changeset
2729 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
Ritor1
parents:
diff changeset
2730 v6 = this->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5;
Ritor1
parents:
diff changeset
2731 return max(0, v6);
Ritor1
parents:
diff changeset
2732 }
Ritor1
parents:
diff changeset
2733
Ritor1
parents:
diff changeset
2734 //----- (0048E6DC) --------------------------------------------------------
Ritor1
parents:
diff changeset
2735 unsigned int Player::GetBaseAge()
Ritor1
parents:
diff changeset
2736 {
Ritor1
parents:
diff changeset
2737 return (unsigned int)(((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year);
Ritor1
parents:
diff changeset
2738 }
Ritor1
parents:
diff changeset
2739
Ritor1
parents:
diff changeset
2740 //----- (0048E72C) --------------------------------------------------------
Ritor1
parents:
diff changeset
2741 unsigned int Player::GetActualAge()
Ritor1
parents:
diff changeset
2742 {
Ritor1
parents:
diff changeset
2743 return this->sAgeModifier + GetBaseAge();
Ritor1
parents:
diff changeset
2744 }
Ritor1
parents:
diff changeset
2745
Ritor1
parents:
diff changeset
2746 //----- (0048E73F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2747 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
2748 {
Ritor1
parents:
diff changeset
2749 int v7; // esi@20
Ritor1
parents:
diff changeset
2750 int racialBonus = 0;
Ritor1
parents:
diff changeset
2751 __int16* resStat;
Ritor1
parents:
diff changeset
2752 int result;
Ritor1
parents:
diff changeset
2753
Ritor1
parents:
diff changeset
2754 switch (a2)
Ritor1
parents:
diff changeset
2755 {
Ritor1
parents:
diff changeset
2756 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
2757 resStat = &sResFireBase;
Ritor1
parents:
diff changeset
2758 if (IsRaceGoblin())
Ritor1
parents:
diff changeset
2759 racialBonus = 5;
Ritor1
parents:
diff changeset
2760 break;
Ritor1
parents:
diff changeset
2761 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
2762 resStat = &sResAirBase;
Ritor1
parents:
diff changeset
2763 if (IsRaceGoblin())
Ritor1
parents:
diff changeset
2764 racialBonus = 5;
Ritor1
parents:
diff changeset
2765 break;
Ritor1
parents:
diff changeset
2766 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
2767 resStat = &sResWaterBase;
Ritor1
parents:
diff changeset
2768 if (IsRaceDwarf())
Ritor1
parents:
diff changeset
2769 racialBonus = 5;
Ritor1
parents:
diff changeset
2770 break;
Ritor1
parents:
diff changeset
2771 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
2772 resStat = &sResEarthBase;
Ritor1
parents:
diff changeset
2773 if (IsRaceDwarf())
Ritor1
parents:
diff changeset
2774 racialBonus = 5;
Ritor1
parents:
diff changeset
2775 break;
Ritor1
parents:
diff changeset
2776 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
2777 resStat = &sResMindBase;
Ritor1
parents:
diff changeset
2778 if (IsRaceElf())
Ritor1
parents:
diff changeset
2779 racialBonus = 10;
Ritor1
parents:
diff changeset
2780 break;
Ritor1
parents:
diff changeset
2781 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
2782 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
2783 resStat = &sResBodyBase;
Ritor1
parents:
diff changeset
2784 if (IsRaceHuman())
Ritor1
parents:
diff changeset
2785 racialBonus = 5;
Ritor1
parents:
diff changeset
2786 break;
Ritor1
parents:
diff changeset
2787 default:
Ritor1
parents:
diff changeset
2788 Error("Unknown attribute");
Ritor1
parents:
diff changeset
2789 }
Ritor1
parents:
diff changeset
2790 v7 = GetItemsBonus(a2) + racialBonus;
Ritor1
parents:
diff changeset
2791 result = v7 + *resStat;
Ritor1
parents:
diff changeset
2792 if ( classType == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
2793 {
Ritor1
parents:
diff changeset
2794 if ( result > 200 )
Ritor1
parents:
diff changeset
2795 result = 200;
Ritor1
parents:
diff changeset
2796 }
Ritor1
parents:
diff changeset
2797 return result;
Ritor1
parents:
diff changeset
2798 }
Ritor1
parents:
diff changeset
2799
Ritor1
parents:
diff changeset
2800 //----- (0048E7D0) --------------------------------------------------------
Ritor1
parents:
diff changeset
2801 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
2802 {
Ritor1
parents:
diff changeset
2803 signed int v10 = 0; // [sp+14h] [bp-4h]@1
Ritor1
parents:
diff changeset
2804 __int16* resStat;
Ritor1
parents:
diff changeset
2805 int result;
Ritor1
parents:
diff changeset
2806 int baseRes;
Ritor1
parents:
diff changeset
2807
Ritor1
parents:
diff changeset
2808 int leatherArmorSkillLevel = GetActualSkillLevel(PLAYER_SKILL_LEATHER);
Ritor1
parents:
diff changeset
2809 if ( CheckHiredNPCSpeciality(Enchanter) )
Ritor1
parents:
diff changeset
2810 v10 = 20;
Ritor1
parents:
diff changeset
2811 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE
Ritor1
parents:
diff changeset
2812 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR
Ritor1
parents:
diff changeset
2813 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER
Ritor1
parents:
diff changeset
2814 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH)
Ritor1
parents:
diff changeset
2815 && SkillToMastery(leatherArmorSkillLevel) == 4
Ritor1
parents:
diff changeset
2816 && HasItemEquipped(EQUIP_ARMOUR)
Ritor1
parents:
diff changeset
2817 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER )
Ritor1
parents:
diff changeset
2818 v10 += leatherArmorSkillLevel & 0x3F;
Ritor1
parents:
diff changeset
2819 switch (a2)
Ritor1
parents:
diff changeset
2820 {
Ritor1
parents:
diff changeset
2821 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
2822 resStat = &sResFireBonus;
Ritor1
parents:
diff changeset
2823 break;
Ritor1
parents:
diff changeset
2824 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
2825 resStat = &sResAirBonus;
Ritor1
parents:
diff changeset
2826 break;
Ritor1
parents:
diff changeset
2827 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
2828 resStat = &sResWaterBonus;
Ritor1
parents:
diff changeset
2829 break;
Ritor1
parents:
diff changeset
2830 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
2831 resStat = &sResEarthBonus;
Ritor1
parents:
diff changeset
2832 break;
Ritor1
parents:
diff changeset
2833 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
2834 resStat = &sResMindBonus;
Ritor1
parents:
diff changeset
2835 break;
Ritor1
parents:
diff changeset
2836 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
2837 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
2838 resStat = &sResBodyBonus;
Ritor1
parents:
diff changeset
2839 break;
Ritor1
parents:
diff changeset
2840 default: Error("Unexpected attribute");
Ritor1
parents:
diff changeset
2841 }
Ritor1
parents:
diff changeset
2842 baseRes = GetBaseResistance(a2);
Ritor1
parents:
diff changeset
2843 result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat);
Ritor1
parents:
diff changeset
2844 if ( classType == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
2845 {
Ritor1
parents:
diff changeset
2846 if ( result > 200 )
Ritor1
parents:
diff changeset
2847 result = 200;
Ritor1
parents:
diff changeset
2848 }
Ritor1
parents:
diff changeset
2849 return result;
Ritor1
parents:
diff changeset
2850 }
Ritor1
parents:
diff changeset
2851
Ritor1
parents:
diff changeset
2852 //----- (0048E8F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
2853 bool Player::Recover(int dt)
Ritor1
parents:
diff changeset
2854 {
Ritor1
parents:
diff changeset
2855 int v3; // qax@1
Ritor1
parents:
diff changeset
2856
Ritor1
parents:
diff changeset
2857 v3 = (int)(dt * GetSpecialItemBonus(17) * 0.01 + dt);
Ritor1
parents:
diff changeset
2858
Ritor1
parents:
diff changeset
2859 //Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery);
Ritor1
parents:
diff changeset
2860
Ritor1
parents:
diff changeset
2861 if (uTimeToRecovery > v3)
Ritor1
parents:
diff changeset
2862 {
Ritor1
parents:
diff changeset
2863 uTimeToRecovery -= v3;
Ritor1
parents:
diff changeset
2864 return true;
Ritor1
parents:
diff changeset
2865 }
Ritor1
parents:
diff changeset
2866 else
Ritor1
parents:
diff changeset
2867 {
Ritor1
parents:
diff changeset
2868 uTimeToRecovery = 0;
Ritor1
parents:
diff changeset
2869 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
2870 if (!uActiveCharacter)
Ritor1
parents:
diff changeset
2871 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2872 return false;
Ritor1
parents:
diff changeset
2873 }
Ritor1
parents:
diff changeset
2874 }
Ritor1
parents:
diff changeset
2875
Ritor1
parents:
diff changeset
2876 //----- (0048E96A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2877 void Player::SetRecoveryTime(signed int rec)
Ritor1
parents:
diff changeset
2878 {
Ritor1
parents:
diff changeset
2879 Assert(rec >= 0);
Ritor1
parents:
diff changeset
2880
Ritor1
parents:
diff changeset
2881 if (rec > uTimeToRecovery)
Ritor1
parents:
diff changeset
2882 uTimeToRecovery = rec;
Ritor1
parents:
diff changeset
2883
Ritor1
parents:
diff changeset
2884 if (uActiveCharacter != 0 && pPlayers[uActiveCharacter] == this && !some_active_character)
Ritor1
parents:
diff changeset
2885 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2886
Ritor1
parents:
diff changeset
2887 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
2888 }
Ritor1
parents:
diff changeset
2889 // 50C0C4: using guessed type int some_active_character;
Ritor1
parents:
diff changeset
2890
Ritor1
parents:
diff changeset
2891 //----- (0048E9B7) --------------------------------------------------------
Ritor1
parents:
diff changeset
2892 void Player::RandomizeName()
Ritor1
parents:
diff changeset
2893 {
Ritor1
parents:
diff changeset
2894 if (!uExpressionTimePassed)
Ritor1
parents:
diff changeset
2895 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]);
Ritor1
parents:
diff changeset
2896 }
Ritor1
parents:
diff changeset
2897
Ritor1
parents:
diff changeset
2898 //----- (0048E9F4) --------------------------------------------------------
Ritor1
parents:
diff changeset
2899 unsigned int Player::GetMajorConditionIdx()
Ritor1
parents:
diff changeset
2900 {
Ritor1
parents:
diff changeset
2901 for (uint i = 0; i < 18; ++i)
Ritor1
parents:
diff changeset
2902 if (pConditions[pConditionImportancyTable[i]] != 0)
Ritor1
parents:
diff changeset
2903 return pConditionImportancyTable[i];
Ritor1
parents:
diff changeset
2904
Ritor1
parents:
diff changeset
2905 return 18;
Ritor1
parents:
diff changeset
2906 }
Ritor1
parents:
diff changeset
2907
Ritor1
parents:
diff changeset
2908 //----- (0048EA1B) --------------------------------------------------------
Ritor1
parents:
diff changeset
2909 int Player::GetParameterBonus( int player_parameter )
Ritor1
parents:
diff changeset
2910 {
Ritor1
parents:
diff changeset
2911 int i; // eax@1
Ritor1
parents:
diff changeset
2912 i = 0;
Ritor1
parents:
diff changeset
2913 while (param_to_bonus_table[i])
Ritor1
parents:
diff changeset
2914 {
Ritor1
parents:
diff changeset
2915 if (player_parameter >= param_to_bonus_table[i])
Ritor1
parents:
diff changeset
2916 break;
Ritor1
parents:
diff changeset
2917 ++i;
Ritor1
parents:
diff changeset
2918 }
Ritor1
parents:
diff changeset
2919 return parameter_to_bonus_value[i];
Ritor1
parents:
diff changeset
2920 }
Ritor1
parents:
diff changeset
2921
Ritor1
parents:
diff changeset
2922 //----- (0048EA46) --------------------------------------------------------
Ritor1
parents:
diff changeset
2923 int Player::GetSpecialItemBonus( int enchantmentId )
Ritor1
parents:
diff changeset
2924 {
Ritor1
parents:
diff changeset
2925 for (int i = EQUIP_SINGLE_HANDED; i < EQUIP_BOOK; ++i )
Ritor1
parents:
diff changeset
2926 {
Ritor1
parents:
diff changeset
2927 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2928 {
Ritor1
parents:
diff changeset
2929 if (enchantmentId == 17)
Ritor1
parents:
diff changeset
2930 {
Ritor1
parents:
diff changeset
2931 if ((GetNthEquippedIndexItem(i)->uSpecEnchantmentType == 17) || (GetNthEquippedIndexItem(i)->uItemID == 533)) //Elven Chainmail+Increases rate of Recovery
Ritor1
parents:
diff changeset
2932 return 50;
Ritor1
parents:
diff changeset
2933 }
Ritor1
parents:
diff changeset
2934 if (enchantmentId == 24)
Ritor1
parents:
diff changeset
2935 {
Ritor1
parents:
diff changeset
2936 if (GetNthEquippedIndexItem(i)->uSpecEnchantmentType == 24) //Increased Knockback.
Ritor1
parents:
diff changeset
2937 return 5;
Ritor1
parents:
diff changeset
2938 }
Ritor1
parents:
diff changeset
2939 }
Ritor1
parents:
diff changeset
2940 }
Ritor1
parents:
diff changeset
2941 return 0;
Ritor1
parents:
diff changeset
2942 }
Ritor1
parents:
diff changeset
2943
Ritor1
parents:
diff changeset
2944 //----- (0048EAAE) --------------------------------------------------------
Ritor1
parents:
diff changeset
2945 int Player::GetItemsBonus( enum CHARACTER_ATTRIBUTE_TYPE attr, bool getOnlyMainHandDmg /*= false*/ )
Ritor1
parents:
diff changeset
2946 {
Ritor1
parents:
diff changeset
2947 int v5; // edi@1
Ritor1
parents:
diff changeset
2948 int v9; // eax@49
Ritor1
parents:
diff changeset
2949 int v14; // ecx@58
Ritor1
parents:
diff changeset
2950 int v15; // eax@58
Ritor1
parents:
diff changeset
2951 int v17; // eax@62
Ritor1
parents:
diff changeset
2952 int v22; // eax@76
Ritor1
parents:
diff changeset
2953 int v25; // ecx@80
Ritor1
parents:
diff changeset
2954 int v26; // edi@80
Ritor1
parents:
diff changeset
2955 int v32; // eax@98
Ritor1
parents:
diff changeset
2956 int v56; // eax@365
Ritor1
parents:
diff changeset
2957 signed int v58; // [sp-4h] [bp-20h]@10
Ritor1
parents:
diff changeset
2958 int v61; // [sp+10h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2959 int v62; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
2960 ItemGen *currEquippedItem; // [sp+20h] [bp+4h]@101
Ritor1
parents:
diff changeset
2961 bool no_skills;
Ritor1
parents:
diff changeset
2962
Ritor1
parents:
diff changeset
2963 v5 = 0;
Ritor1
parents:
diff changeset
2964 v62 = 0;
Ritor1
parents:
diff changeset
2965 v61 = 0;
Ritor1
parents:
diff changeset
2966
Ritor1
parents:
diff changeset
2967 no_skills=false;
Ritor1
parents:
diff changeset
2968 switch (attr)
Ritor1
parents:
diff changeset
2969 {
Ritor1
parents:
diff changeset
2970 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break;
Ritor1
parents:
diff changeset
2971 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break;
Ritor1
parents:
diff changeset
2972 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break;
Ritor1
parents:
diff changeset
2973 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break;
Ritor1
parents:
diff changeset
2974 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break;
Ritor1
parents:
diff changeset
2975 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break;
Ritor1
parents:
diff changeset
2976 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break;
Ritor1
parents:
diff changeset
2977 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break;
Ritor1
parents:
diff changeset
2978 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break;
Ritor1
parents:
diff changeset
2979 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break;
Ritor1
parents:
diff changeset
2980 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break;
Ritor1
parents:
diff changeset
2981 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break;
Ritor1
parents:
diff changeset
2982 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break;
Ritor1
parents:
diff changeset
2983 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break;
Ritor1
parents:
diff changeset
2984 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break;
Ritor1
parents:
diff changeset
2985 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break;
Ritor1
parents:
diff changeset
2986 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break;
Ritor1
parents:
diff changeset
2987 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break;
Ritor1
parents:
diff changeset
2988 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break;
Ritor1
parents:
diff changeset
2989 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break;
Ritor1
parents:
diff changeset
2990 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break;
Ritor1
parents:
diff changeset
2991 default:
Ritor1
parents:
diff changeset
2992 no_skills=true;
Ritor1
parents:
diff changeset
2993 }
Ritor1
parents:
diff changeset
2994 if (!no_skills)
Ritor1
parents:
diff changeset
2995 {
Ritor1
parents:
diff changeset
2996 if ( !this->pActiveSkills[v58] )
Ritor1
parents:
diff changeset
2997 return 0;
Ritor1
parents:
diff changeset
2998 }
Ritor1
parents:
diff changeset
2999
Ritor1
parents:
diff changeset
3000 switch(attr) //TODO would be nice to move these into separate functions
Ritor1
parents:
diff changeset
3001 {
Ritor1
parents:
diff changeset
3002 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS:
Ritor1
parents:
diff changeset
3003 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3004 if ( HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3005 v5 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3006 return v5;
Ritor1
parents:
diff changeset
3007 break;
Ritor1
parents:
diff changeset
3008
Ritor1
parents:
diff changeset
3009 case CHARACTER_ATTRIBUTE_RANGED_DMG_MIN:
Ritor1
parents:
diff changeset
3010 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3011 return 0;
Ritor1
parents:
diff changeset
3012 v5 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3013 v56 = GetBowItem()->GetDamageDice();
Ritor1
parents:
diff changeset
3014 return v5 + v56;
Ritor1
parents:
diff changeset
3015 break;
Ritor1
parents:
diff changeset
3016
Ritor1
parents:
diff changeset
3017 case CHARACTER_ATTRIBUTE_RANGED_DMG_MAX:
Ritor1
parents:
diff changeset
3018 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3019 return 0;
Ritor1
parents:
diff changeset
3020 v5 = GetBowItem()->GetDamageDice() * GetBowItem()->GetDamageRoll();
Ritor1
parents:
diff changeset
3021 v56 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3022 return v5 + v56;
Ritor1
parents:
diff changeset
3023
Ritor1
parents:
diff changeset
3024 case CHARACTER_ATTRIBUTE_LEVEL:
Ritor1
parents:
diff changeset
3025 if ( !Player::HasEnchantedItemEquipped(25) )
Ritor1
parents:
diff changeset
3026 return 0;
Ritor1
parents:
diff changeset
3027 return 5;
Ritor1
parents:
diff changeset
3028 break;
Ritor1
parents:
diff changeset
3029
Ritor1
parents:
diff changeset
3030 case CHARACTER_ATTRIBUTE_MELEE_DMG_MAX:
Ritor1
parents:
diff changeset
3031 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3032 {
Ritor1
parents:
diff changeset
3033 return 3;
Ritor1
parents:
diff changeset
3034 }
Ritor1
parents:
diff changeset
3035 else
Ritor1
parents:
diff changeset
3036 {
Ritor1
parents:
diff changeset
3037 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3038 {
Ritor1
parents:
diff changeset
3039 v22 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3040 if ( v22 >= 0 && v22 <= 2)
Ritor1
parents:
diff changeset
3041 {
Ritor1
parents:
diff changeset
3042 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
3043 v26 = mainHandItem->GetDamageRoll();
Ritor1
parents:
diff changeset
3044 if ( GetOffHandItem() != nullptr || mainHandItem->GetPlayerSkillType() != 4 )
Ritor1
parents:
diff changeset
3045 {
Ritor1
parents:
diff changeset
3046 v25 = mainHandItem->GetDamageDice();
Ritor1
parents:
diff changeset
3047 }
Ritor1
parents:
diff changeset
3048 else
Ritor1
parents:
diff changeset
3049 {
Ritor1
parents:
diff changeset
3050 v25 = mainHandItem->GetDamageDice() + 1;
Ritor1
parents:
diff changeset
3051 }
Ritor1
parents:
diff changeset
3052 v5 = mainHandItem->GetDamageMod() + v25 * v26;
Ritor1
parents:
diff changeset
3053 }
Ritor1
parents:
diff changeset
3054 }
Ritor1
parents:
diff changeset
3055 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0 || GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2))
Ritor1
parents:
diff changeset
3056 {
Ritor1
parents:
diff changeset
3057 return v5;
Ritor1
parents:
diff changeset
3058 }
Ritor1
parents:
diff changeset
3059 else
Ritor1
parents:
diff changeset
3060 {
Ritor1
parents:
diff changeset
3061 ItemGen* offHandItem = GetOffHandItem();
Ritor1
parents:
diff changeset
3062 v15 = offHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3063 v14 = offHandItem->GetDamageDice() * offHandItem->GetDamageRoll();
Ritor1
parents:
diff changeset
3064 return v5 + v15 + v14;
Ritor1
parents:
diff changeset
3065 }
Ritor1
parents:
diff changeset
3066 }
Ritor1
parents:
diff changeset
3067 break;
Ritor1
parents:
diff changeset
3068
Ritor1
parents:
diff changeset
3069 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3070 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3071 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3072 {
Ritor1
parents:
diff changeset
3073 return 0;
Ritor1
parents:
diff changeset
3074 }
Ritor1
parents:
diff changeset
3075 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3076 {
Ritor1
parents:
diff changeset
3077 v17 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3078 if ( v17 >= 0 && v17 <= 2)
Ritor1
parents:
diff changeset
3079 {
Ritor1
parents:
diff changeset
3080 v5 = GetMainHandItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3081 }
Ritor1
parents:
diff changeset
3082 }
Ritor1
parents:
diff changeset
3083 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
Ritor1
parents:
diff changeset
3084 return v5;
Ritor1
parents:
diff changeset
3085 else
Ritor1
parents:
diff changeset
3086 {
Ritor1
parents:
diff changeset
3087 v56 = GetOffHandItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3088 return v5 + v56;
Ritor1
parents:
diff changeset
3089 }
Ritor1
parents:
diff changeset
3090 break;
Ritor1
parents:
diff changeset
3091
Ritor1
parents:
diff changeset
3092 case CHARACTER_ATTRIBUTE_MELEE_DMG_MIN:
Ritor1
parents:
diff changeset
3093 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3094 {
Ritor1
parents:
diff changeset
3095 return 1;
Ritor1
parents:
diff changeset
3096 }
Ritor1
parents:
diff changeset
3097 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3098 {
Ritor1
parents:
diff changeset
3099 v9 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3100 if ( v9 >= 0 && v9 <= 2)
Ritor1
parents:
diff changeset
3101 {
Ritor1
parents:
diff changeset
3102 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
3103 v5 = mainHandItem->GetDamageDice() +
Ritor1
parents:
diff changeset
3104 mainHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3105 if ( GetOffHandItem() == nullptr && mainHandItem->GetPlayerSkillType() == 4)
Ritor1
parents:
diff changeset
3106 {
Ritor1
parents:
diff changeset
3107 ++v5;
Ritor1
parents:
diff changeset
3108 }
Ritor1
parents:
diff changeset
3109 }
Ritor1
parents:
diff changeset
3110 }
Ritor1
parents:
diff changeset
3111
Ritor1
parents:
diff changeset
3112 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
Ritor1
parents:
diff changeset
3113 {
Ritor1
parents:
diff changeset
3114 return v5;
Ritor1
parents:
diff changeset
3115 }
Ritor1
parents:
diff changeset
3116 else
Ritor1
parents:
diff changeset
3117 {
Ritor1
parents:
diff changeset
3118 ItemGen* offHandItem = GetOffHandItem();
Ritor1
parents:
diff changeset
3119 v14 = offHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3120 v15 = offHandItem->GetDamageDice();
Ritor1
parents:
diff changeset
3121 return v5 + v15 + v14;
Ritor1
parents:
diff changeset
3122 }
Ritor1
parents:
diff changeset
3123 break;
Ritor1
parents:
diff changeset
3124
Ritor1
parents:
diff changeset
3125 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
3126 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
3127 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
3128 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
3129 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
3130 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
3131 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
3132 case CHARACTER_ATTRIBUTE_HEALTH:
Ritor1
parents:
diff changeset
3133 case CHARACTER_ATTRIBUTE_MANA:
Ritor1
parents:
diff changeset
3134 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3135
Ritor1
parents:
diff changeset
3136 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
3137 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
3138 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
3139 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
3140 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
3141 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
3142 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
3143
Ritor1
parents:
diff changeset
3144 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY:
Ritor1
parents:
diff changeset
3145 case CHARACTER_ATTRIBUTE_SKILL_STEALING:
Ritor1
parents:
diff changeset
3146 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM:
Ritor1
parents:
diff changeset
3147 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID:
Ritor1
parents:
diff changeset
3148 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID:
Ritor1
parents:
diff changeset
3149 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER:
Ritor1
parents:
diff changeset
3150 case CHARACTER_ATTRIBUTE_SKILL_DODGE:
Ritor1
parents:
diff changeset
3151 case CHARACTER_ATTRIBUTE_SKILL_UNARMED:
Ritor1
parents:
diff changeset
3152
Ritor1
parents:
diff changeset
3153 case CHARACTER_ATTRIBUTE_SKILL_FIRE:
Ritor1
parents:
diff changeset
3154 case CHARACTER_ATTRIBUTE_SKILL_AIR:
Ritor1
parents:
diff changeset
3155 case CHARACTER_ATTRIBUTE_SKILL_WATER:
Ritor1
parents:
diff changeset
3156 case CHARACTER_ATTRIBUTE_SKILL_EARTH:
Ritor1
parents:
diff changeset
3157 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
3158 case CHARACTER_ATTRIBUTE_SKILL_MIND:
Ritor1
parents:
diff changeset
3159 case CHARACTER_ATTRIBUTE_SKILL_BODY:
Ritor1
parents:
diff changeset
3160 case CHARACTER_ATTRIBUTE_SKILL_LIGHT:
Ritor1
parents:
diff changeset
3161 case CHARACTER_ATTRIBUTE_SKILL_DARK:
Ritor1
parents:
diff changeset
3162 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION:
Ritor1
parents:
diff changeset
3163 case CHARACTER_ATTRIBUTE_SKILL_BOW:
Ritor1
parents:
diff changeset
3164 case CHARACTER_ATTRIBUTE_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3165 case CHARACTER_ATTRIBUTE_SKILL_LEARNING:
Ritor1
parents:
diff changeset
3166 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3167 {
Ritor1
parents:
diff changeset
3168 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3169 {
Ritor1
parents:
diff changeset
3170 currEquippedItem = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3171 if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS )
Ritor1
parents:
diff changeset
3172 {
Ritor1
parents:
diff changeset
3173 v32 = currEquippedItem->GetItemEquipType();
Ritor1
parents:
diff changeset
3174 if ( v32 >= 3 && v32 <= 11 )
Ritor1
parents:
diff changeset
3175 {
Ritor1
parents:
diff changeset
3176 v5 += currEquippedItem->GetDamageDice() + currEquippedItem->GetDamageMod();
Ritor1
parents:
diff changeset
3177 }
Ritor1
parents:
diff changeset
3178 }
Ritor1
parents:
diff changeset
3179 if ( pItemsTable->IsMaterialNonCommon(currEquippedItem)
Ritor1
parents:
diff changeset
3180 && !pItemsTable->IsMaterialSpecial(currEquippedItem) )
Ritor1
parents:
diff changeset
3181 {
Ritor1
parents:
diff changeset
3182 currEquippedItem->GetItemBonusArtifact(this, attr, &v62);
Ritor1
parents:
diff changeset
3183 }
Ritor1
parents:
diff changeset
3184 else if ( currEquippedItem->uEnchantmentType != 0 )
Ritor1
parents:
diff changeset
3185 {
Ritor1
parents:
diff changeset
3186 if (this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uEnchantmentType - 1 == attr)//if (currEquippedItem->IsRegularEnchanmentForAttribute(attr))
Ritor1
parents:
diff changeset
3187 {
Ritor1
parents:
diff changeset
3188 if ( attr > CHARACTER_ATTRIBUTE_RESIST_BODY && v5 < currEquippedItem->m_enchantmentStrength )//for skills bonuses
Ritor1
parents:
diff changeset
3189 v5 = currEquippedItem->m_enchantmentStrength;
Ritor1
parents:
diff changeset
3190 else // for resists and attributes bonuses
Ritor1
parents:
diff changeset
3191 v5 += currEquippedItem->m_enchantmentStrength;
Ritor1
parents:
diff changeset
3192 }
Ritor1
parents:
diff changeset
3193 }
Ritor1
parents:
diff changeset
3194 else
Ritor1
parents:
diff changeset
3195 {
Ritor1
parents:
diff changeset
3196 currEquippedItem->GetItemBonusSpecialEnchantment(this, attr, &v5, &v61);
Ritor1
parents:
diff changeset
3197 }
Ritor1
parents:
diff changeset
3198 }
Ritor1
parents:
diff changeset
3199 }
Ritor1
parents:
diff changeset
3200 return v5 + v62 + v61;
Ritor1
parents:
diff changeset
3201 break;
Ritor1
parents:
diff changeset
3202 default:
Ritor1
parents:
diff changeset
3203 return 0;
Ritor1
parents:
diff changeset
3204 }
Ritor1
parents:
diff changeset
3205 }
Ritor1
parents:
diff changeset
3206
Ritor1
parents:
diff changeset
3207 //----- (0048F73C) --------------------------------------------------------
Ritor1
parents:
diff changeset
3208 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
3209 {
Ritor1
parents:
diff changeset
3210 int v3 = 0; // eax@4
Ritor1
parents:
diff changeset
3211 int v4 = 0; // ecx@5
Ritor1
parents:
diff changeset
3212
Ritor1
parents:
diff changeset
3213 switch ( a2 )
Ritor1
parents:
diff changeset
3214 {
Ritor1
parents:
diff changeset
3215 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
3216 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].uPower;
Ritor1
parents:
diff changeset
3217 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower;
Ritor1
parents:
diff changeset
3218 break;
Ritor1
parents:
diff changeset
3219 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
3220 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].uPower;
Ritor1
parents:
diff changeset
3221 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower;
Ritor1
parents:
diff changeset
3222 break;
Ritor1
parents:
diff changeset
3223 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
3224 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].uPower;
Ritor1
parents:
diff changeset
3225 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower;
Ritor1
parents:
diff changeset
3226 break;
Ritor1
parents:
diff changeset
3227 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
3228 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].uPower;
Ritor1
parents:
diff changeset
3229 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower;
Ritor1
parents:
diff changeset
3230 break;
Ritor1
parents:
diff changeset
3231 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
3232 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].uPower;
Ritor1
parents:
diff changeset
3233 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower;
Ritor1
parents:
diff changeset
3234 break;
Ritor1
parents:
diff changeset
3235 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
3236 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].uPower;
Ritor1
parents:
diff changeset
3237 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower;
Ritor1
parents:
diff changeset
3238 break;
Ritor1
parents:
diff changeset
3239 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3240 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3241 v3 = this->pPlayerBuffs[PLAYER_BUFF_BLESS].uPower; //only player effect spell in both VI and VII
Ritor1
parents:
diff changeset
3242 break;
Ritor1
parents:
diff changeset
3243 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3244 v3 = this->pPlayerBuffs[PLAYER_BUFF_HEROISM].uPower;
Ritor1
parents:
diff changeset
3245 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
Ritor1
parents:
diff changeset
3246 break;
Ritor1
parents:
diff changeset
3247 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
3248 v3 = pPlayerBuffs[PLAYER_BUFF_STRENGTH].uPower;
Ritor1
parents:
diff changeset
3249 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3250 break;
Ritor1
parents:
diff changeset
3251 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
3252 v3 = pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].uPower;
Ritor1
parents:
diff changeset
3253 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3254 break;
Ritor1
parents:
diff changeset
3255 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
3256 v3 = pPlayerBuffs[PLAYER_BUFF_WILLPOWER].uPower;
Ritor1
parents:
diff changeset
3257 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3258 break;
Ritor1
parents:
diff changeset
3259 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
3260 v3 = pPlayerBuffs[PLAYER_BUFF_ENDURANCE].uPower;
Ritor1
parents:
diff changeset
3261 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3262 break;
Ritor1
parents:
diff changeset
3263 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
3264 v3 = pPlayerBuffs[PLAYER_BUFF_ACCURACY].uPower;
Ritor1
parents:
diff changeset
3265 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3266 break;
Ritor1
parents:
diff changeset
3267 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
3268 v3 = pPlayerBuffs[PLAYER_BUFF_SPEED].uPower;
Ritor1
parents:
diff changeset
3269 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3270 break;
Ritor1
parents:
diff changeset
3271 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
3272 v3 = pPlayerBuffs[PLAYER_BUFF_LUCK].uPower;
Ritor1
parents:
diff changeset
3273 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3274 break;
Ritor1
parents:
diff changeset
3275 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3276 v3 = this->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uPower;
Ritor1
parents:
diff changeset
3277 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower;
Ritor1
parents:
diff changeset
3278 break;
Ritor1
parents:
diff changeset
3279 }
Ritor1
parents:
diff changeset
3280 return v3 + v4;
Ritor1
parents:
diff changeset
3281 }
Ritor1
parents:
diff changeset
3282
Ritor1
parents:
diff changeset
3283 //----- (0048F882) --------------------------------------------------------
Ritor1
parents:
diff changeset
3284 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType )
Ritor1
parents:
diff changeset
3285 {
Ritor1
parents:
diff changeset
3286 signed int bonus_value; // esi@1
Ritor1
parents:
diff changeset
3287 unsigned __int16 skill_value; // ax@126
Ritor1
parents:
diff changeset
3288 int result; // al@127
Ritor1
parents:
diff changeset
3289
Ritor1
parents:
diff changeset
3290 bonus_value = 0;
Ritor1
parents:
diff changeset
3291 switch (uSkillType)
Ritor1
parents:
diff changeset
3292 {
Ritor1
parents:
diff changeset
3293 case PLAYER_SKILL_MONSTER_ID:
Ritor1
parents:
diff changeset
3294 {
Ritor1
parents:
diff changeset
3295 if ( CheckHiredNPCSpeciality(Hunter) )
Ritor1
parents:
diff changeset
3296 bonus_value = 6;
Ritor1
parents:
diff changeset
3297 if ( CheckHiredNPCSpeciality(Sage) )
Ritor1
parents:
diff changeset
3298 bonus_value += 6;
Ritor1
parents:
diff changeset
3299 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID);
Ritor1
parents:
diff changeset
3300 }
Ritor1
parents:
diff changeset
3301 break;
Ritor1
parents:
diff changeset
3302
Ritor1
parents:
diff changeset
3303 case PLAYER_SKILL_ARMSMASTER:
Ritor1
parents:
diff changeset
3304 {
Ritor1
parents:
diff changeset
3305 if ( CheckHiredNPCSpeciality(Armsmaster) )
Ritor1
parents:
diff changeset
3306 bonus_value = 2;
Ritor1
parents:
diff changeset
3307 if ( CheckHiredNPCSpeciality(Weaponsmaster) )
Ritor1
parents:
diff changeset
3308 bonus_value += 3;
Ritor1
parents:
diff changeset
3309 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER);
Ritor1
parents:
diff changeset
3310 }
Ritor1
parents:
diff changeset
3311 break;
Ritor1
parents:
diff changeset
3312
Ritor1
parents:
diff changeset
3313 case PLAYER_SKILL_STEALING:
Ritor1
parents:
diff changeset
3314 {
Ritor1
parents:
diff changeset
3315 if (CheckHiredNPCSpeciality(Burglar))
Ritor1
parents:
diff changeset
3316 bonus_value = 8;
Ritor1
parents:
diff changeset
3317 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING);
Ritor1
parents:
diff changeset
3318 }
Ritor1
parents:
diff changeset
3319 break;
Ritor1
parents:
diff changeset
3320
Ritor1
parents:
diff changeset
3321
Ritor1
parents:
diff changeset
3322 case PLAYER_SKILL_ALCHEMY:
Ritor1
parents:
diff changeset
3323 {
Ritor1
parents:
diff changeset
3324 if ( CheckHiredNPCSpeciality(Herbalist) )
Ritor1
parents:
diff changeset
3325 bonus_value = 4;
Ritor1
parents:
diff changeset
3326 if ( CheckHiredNPCSpeciality(Apothecary) )
Ritor1
parents:
diff changeset
3327 bonus_value += 8;
Ritor1
parents:
diff changeset
3328 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY);
Ritor1
parents:
diff changeset
3329 }
Ritor1
parents:
diff changeset
3330 break;
Ritor1
parents:
diff changeset
3331
Ritor1
parents:
diff changeset
3332 case PLAYER_SKILL_LEARNING:
Ritor1
parents:
diff changeset
3333 {
Ritor1
parents:
diff changeset
3334 if ( CheckHiredNPCSpeciality(Teacher) )
Ritor1
parents:
diff changeset
3335 bonus_value = 10;
Ritor1
parents:
diff changeset
3336 if ( CheckHiredNPCSpeciality(Instructor) )
Ritor1
parents:
diff changeset
3337 bonus_value += 15;
Ritor1
parents:
diff changeset
3338 if ( CheckHiredNPCSpeciality(Scholar) )
Ritor1
parents:
diff changeset
3339 bonus_value += 5;
Ritor1
parents:
diff changeset
3340 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING);
Ritor1
parents:
diff changeset
3341 }
Ritor1
parents:
diff changeset
3342 break;
Ritor1
parents:
diff changeset
3343
Ritor1
parents:
diff changeset
3344 case PLAYER_SKILL_UNARMED:
Ritor1
parents:
diff changeset
3345 {
Ritor1
parents:
diff changeset
3346 if (CheckHiredNPCSpeciality(Monk) )
Ritor1
parents:
diff changeset
3347 bonus_value = 2;
Ritor1
parents:
diff changeset
3348 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3349 }
Ritor1
parents:
diff changeset
3350 break;
Ritor1
parents:
diff changeset
3351
Ritor1
parents:
diff changeset
3352 case PLAYER_SKILL_DODGE:
Ritor1
parents:
diff changeset
3353 {
Ritor1
parents:
diff changeset
3354 if ( CheckHiredNPCSpeciality(Monk) )
Ritor1
parents:
diff changeset
3355 bonus_value = 2;
Ritor1
parents:
diff changeset
3356 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE);
Ritor1
parents:
diff changeset
3357 }
Ritor1
parents:
diff changeset
3358 break;
Ritor1
parents:
diff changeset
3359
Ritor1
parents:
diff changeset
3360 case PLAYER_SKILL_BOW:
Ritor1
parents:
diff changeset
3361 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW);
Ritor1
parents:
diff changeset
3362 break;
Ritor1
parents:
diff changeset
3363 case PLAYER_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3364 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD);
Ritor1
parents:
diff changeset
3365 break;
Ritor1
parents:
diff changeset
3366
Ritor1
parents:
diff changeset
3367 case PLAYER_SKILL_EARTH:
Ritor1
parents:
diff changeset
3368 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3369 bonus_value = 2;
Ritor1
parents:
diff changeset
3370 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3371 bonus_value += 3;
Ritor1
parents:
diff changeset
3372 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3373 bonus_value += 4;
Ritor1
parents:
diff changeset
3374 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3375 bonus_value += 3;
Ritor1
parents:
diff changeset
3376 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH);
Ritor1
parents:
diff changeset
3377 break;
Ritor1
parents:
diff changeset
3378 case PLAYER_SKILL_FIRE:
Ritor1
parents:
diff changeset
3379 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3380 bonus_value = 2;
Ritor1
parents:
diff changeset
3381 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3382 bonus_value += 3;
Ritor1
parents:
diff changeset
3383 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3384 bonus_value += 4;
Ritor1
parents:
diff changeset
3385 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3386 bonus_value += 3;
Ritor1
parents:
diff changeset
3387 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE);
Ritor1
parents:
diff changeset
3388 break;
Ritor1
parents:
diff changeset
3389 case PLAYER_SKILL_AIR:
Ritor1
parents:
diff changeset
3390 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3391 bonus_value = 2;
Ritor1
parents:
diff changeset
3392 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3393 bonus_value += 3;
Ritor1
parents:
diff changeset
3394 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3395 bonus_value += 4;
Ritor1
parents:
diff changeset
3396 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3397 bonus_value += 3;
Ritor1
parents:
diff changeset
3398 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR);
Ritor1
parents:
diff changeset
3399 break;
Ritor1
parents:
diff changeset
3400 case PLAYER_SKILL_WATER:
Ritor1
parents:
diff changeset
3401 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3402 bonus_value = 2;
Ritor1
parents:
diff changeset
3403 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3404 bonus_value += 3;
Ritor1
parents:
diff changeset
3405 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3406 bonus_value += 4;
Ritor1
parents:
diff changeset
3407 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3408 bonus_value += 3;
Ritor1
parents:
diff changeset
3409 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER);
Ritor1
parents:
diff changeset
3410 break;
Ritor1
parents:
diff changeset
3411 case PLAYER_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
3412 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3413 bonus_value = 2;
Ritor1
parents:
diff changeset
3414 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3415 bonus_value += 3;
Ritor1
parents:
diff changeset
3416 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3417 bonus_value += 4;
Ritor1
parents:
diff changeset
3418 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT);
Ritor1
parents:
diff changeset
3419 break;
Ritor1
parents:
diff changeset
3420 case PLAYER_SKILL_MIND:
Ritor1
parents:
diff changeset
3421 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3422 bonus_value = 2;
Ritor1
parents:
diff changeset
3423 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3424 bonus_value += 3;
Ritor1
parents:
diff changeset
3425 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3426 bonus_value += 4;
Ritor1
parents:
diff changeset
3427 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND);
Ritor1
parents:
diff changeset
3428 break;
Ritor1
parents:
diff changeset
3429 case PLAYER_SKILL_BODY:
Ritor1
parents:
diff changeset
3430 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3431 bonus_value = 2;
Ritor1
parents:
diff changeset
3432 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3433 bonus_value += 3;
Ritor1
parents:
diff changeset
3434 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3435 bonus_value += 4;
Ritor1
parents:
diff changeset
3436 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY);
Ritor1
parents:
diff changeset
3437 break;
Ritor1
parents:
diff changeset
3438 case PLAYER_SKILL_LIGHT:
Ritor1
parents:
diff changeset
3439 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT);
Ritor1
parents:
diff changeset
3440 break;
Ritor1
parents:
diff changeset
3441 case PLAYER_SKILL_DARK:
Ritor1
parents:
diff changeset
3442 {
Ritor1
parents:
diff changeset
3443 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK);
Ritor1
parents:
diff changeset
3444 }
Ritor1
parents:
diff changeset
3445 break;
Ritor1
parents:
diff changeset
3446
Ritor1
parents:
diff changeset
3447 case PLAYER_SKILL_MERCHANT:
Ritor1
parents:
diff changeset
3448 {
Ritor1
parents:
diff changeset
3449 if ( CheckHiredNPCSpeciality(Trader) )
Ritor1
parents:
diff changeset
3450 bonus_value = 4;
Ritor1
parents:
diff changeset
3451 if ( CheckHiredNPCSpeciality(Merchant) )
Ritor1
parents:
diff changeset
3452 bonus_value += 6;
Ritor1
parents:
diff changeset
3453 if ( CheckHiredNPCSpeciality(Gypsy) )
Ritor1
parents:
diff changeset
3454 bonus_value += 3;
Ritor1
parents:
diff changeset
3455 if ( CheckHiredNPCSpeciality(Duper) )
Ritor1
parents:
diff changeset
3456 bonus_value += 8;
Ritor1
parents:
diff changeset
3457 }
Ritor1
parents:
diff changeset
3458 break;
Ritor1
parents:
diff changeset
3459
Ritor1
parents:
diff changeset
3460 case PLAYER_SKILL_PERCEPTION:
Ritor1
parents:
diff changeset
3461 {
Ritor1
parents:
diff changeset
3462 if ( CheckHiredNPCSpeciality(Scout) )
Ritor1
parents:
diff changeset
3463 bonus_value = 6;
Ritor1
parents:
diff changeset
3464 if ( CheckHiredNPCSpeciality(Psychic) )
Ritor1
parents:
diff changeset
3465 bonus_value += 5;
Ritor1
parents:
diff changeset
3466 }
Ritor1
parents:
diff changeset
3467 break;
Ritor1
parents:
diff changeset
3468
Ritor1
parents:
diff changeset
3469 case PLAYER_SKILL_ITEM_ID:
Ritor1
parents:
diff changeset
3470 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID);
Ritor1
parents:
diff changeset
3471 break;
Ritor1
parents:
diff changeset
3472 case PLAYER_SKILL_MEDITATION:
Ritor1
parents:
diff changeset
3473 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION);
Ritor1
parents:
diff changeset
3474 break;
Ritor1
parents:
diff changeset
3475 case PLAYER_SKILL_TRAP_DISARM:
Ritor1
parents:
diff changeset
3476 {
Ritor1
parents:
diff changeset
3477 if ( CheckHiredNPCSpeciality(Tinker) )
Ritor1
parents:
diff changeset
3478 bonus_value = 4;
Ritor1
parents:
diff changeset
3479 if ( CheckHiredNPCSpeciality(Locksmith) )
Ritor1
parents:
diff changeset
3480 bonus_value += 6;
Ritor1
parents:
diff changeset
3481 if ( CheckHiredNPCSpeciality(Burglar) )
Ritor1
parents:
diff changeset
3482 bonus_value += 8;
Ritor1
parents:
diff changeset
3483 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM);
Ritor1
parents:
diff changeset
3484 }
Ritor1
parents:
diff changeset
3485 break;
Ritor1
parents:
diff changeset
3486 }
Ritor1
parents:
diff changeset
3487
Ritor1
parents:
diff changeset
3488 skill_value = pActiveSkills[uSkillType];
Ritor1
parents:
diff changeset
3489 if ( bonus_value + (skill_value & 0x3F) < 60 )
Ritor1
parents:
diff changeset
3490 result = bonus_value + skill_value;
Ritor1
parents:
diff changeset
3491 else
Ritor1
parents:
diff changeset
3492 result = skill_value & 0xFFFC | 0x3C; //al
Ritor1
parents:
diff changeset
3493 return result;
Ritor1
parents:
diff changeset
3494 }
Ritor1
parents:
diff changeset
3495
Ritor1
parents:
diff changeset
3496
Ritor1
parents:
diff changeset
3497 //----- (0048FC00) --------------------------------------------------------
Ritor1
parents:
diff changeset
3498 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE inSkill) //TODO: move the individual implementations to attribute classes once possible
Ritor1
parents:
diff changeset
3499 {
Ritor1
parents:
diff changeset
3500 int armsMasterBonus;
Ritor1
parents:
diff changeset
3501
Ritor1
parents:
diff changeset
3502 armsMasterBonus = 0;
Ritor1
parents:
diff changeset
3503 int armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER);
Ritor1
parents:
diff changeset
3504 if ( armmaster_skill > 0 )
Ritor1
parents:
diff changeset
3505 {
Ritor1
parents:
diff changeset
3506 int multiplier = 0;
Ritor1
parents:
diff changeset
3507 if ( inSkill == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
Ritor1
parents:
diff changeset
3508 {
Ritor1
parents:
diff changeset
3509 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 0, 1, 2);
Ritor1
parents:
diff changeset
3510 }
Ritor1
parents:
diff changeset
3511 else if ( inSkill == CHARACTER_ATTRIBUTE_ATTACK )
Ritor1
parents:
diff changeset
3512 {
Ritor1
parents:
diff changeset
3513 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2);
Ritor1
parents:
diff changeset
3514 }
Ritor1
parents:
diff changeset
3515 armsMasterBonus = multiplier * (armmaster_skill & 0x3F);
Ritor1
parents:
diff changeset
3516 }
Ritor1
parents:
diff changeset
3517
Ritor1
parents:
diff changeset
3518 switch(inSkill)
Ritor1
parents:
diff changeset
3519 {
Ritor1
parents:
diff changeset
3520 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS:
Ritor1
parents:
diff changeset
3521 if (HasItemEquipped(EQUIP_BOW))
Ritor1
parents:
diff changeset
3522 {
Ritor1
parents:
diff changeset
3523 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE);
Ritor1
parents:
diff changeset
3524 int multiplier = GetMultiplierForSkillLevel(bowSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3525 return multiplier * (bowSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3526 }
Ritor1
parents:
diff changeset
3527 return 0;
Ritor1
parents:
diff changeset
3528 break;
Ritor1
parents:
diff changeset
3529 case CHARACTER_ATTRIBUTE_HEALTH:
Ritor1
parents:
diff changeset
3530 {
Ritor1
parents:
diff changeset
3531 int base_value = pBaseHealthPerLevelByClass[classType];
Ritor1
parents:
diff changeset
3532 int attrib_modif = GetBodybuilding();
Ritor1
parents:
diff changeset
3533 return base_value * attrib_modif;
Ritor1
parents:
diff changeset
3534 }
Ritor1
parents:
diff changeset
3535 break;
Ritor1
parents:
diff changeset
3536 case CHARACTER_ATTRIBUTE_MANA:
Ritor1
parents:
diff changeset
3537 {
Ritor1
parents:
diff changeset
3538 int base_value = pBaseManaPerLevelByClass[classType];
Ritor1
parents:
diff changeset
3539 int attrib_modif = GetMeditation();
Ritor1
parents:
diff changeset
3540 return base_value * attrib_modif;
Ritor1
parents:
diff changeset
3541 }
Ritor1
parents:
diff changeset
3542 break;
Ritor1
parents:
diff changeset
3543 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3544 {
Ritor1
parents:
diff changeset
3545 bool wearingArmor = false;
Ritor1
parents:
diff changeset
3546 bool wearingLeather = false;
Ritor1
parents:
diff changeset
3547 unsigned int ACSum = 0;
Ritor1
parents:
diff changeset
3548
Ritor1
parents:
diff changeset
3549 for (int j = 0; j < 16; ++j)
Ritor1
parents:
diff changeset
3550 {
Ritor1
parents:
diff changeset
3551 ItemGen* currItem = GetNthEquippedIndexItem(j);
Ritor1
parents:
diff changeset
3552 if (currItem != nullptr && (!currItem->IsBroken()))
Ritor1
parents:
diff changeset
3553 {
Ritor1
parents:
diff changeset
3554 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3555 int currArmorSkillLevel = 0;
Ritor1
parents:
diff changeset
3556 int multiplier = 0;
Ritor1
parents:
diff changeset
3557 switch (itemSkillType)
Ritor1
parents:
diff changeset
3558 {
Ritor1
parents:
diff changeset
3559 case PLAYER_SKILL_STAFF:
Ritor1
parents:
diff changeset
3560 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3561 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 1, 1, 1);
Ritor1
parents:
diff changeset
3562 break;
Ritor1
parents:
diff changeset
3563 case PLAYER_SKILL_SWORD:
Ritor1
parents:
diff changeset
3564 case PLAYER_SKILL_SPEAR:
Ritor1
parents:
diff changeset
3565 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3566 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3567 break;
Ritor1
parents:
diff changeset
3568 case PLAYER_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3569 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3570 wearingArmor = true;
Ritor1
parents:
diff changeset
3571 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3572 break;
Ritor1
parents:
diff changeset
3573 case PLAYER_SKILL_LEATHER:
Ritor1
parents:
diff changeset
3574 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3575 wearingLeather = true;
Ritor1
parents:
diff changeset
3576 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3577 break;
Ritor1
parents:
diff changeset
3578 case PLAYER_SKILL_CHAIN:
Ritor1
parents:
diff changeset
3579 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3580 wearingArmor = true;
Ritor1
parents:
diff changeset
3581 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3582 break;
Ritor1
parents:
diff changeset
3583 case PLAYER_SKILL_PLATE:
Ritor1
parents:
diff changeset
3584 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3585 wearingArmor = true;
Ritor1
parents:
diff changeset
3586 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3587 break;
Ritor1
parents:
diff changeset
3588 }
Ritor1
parents:
diff changeset
3589 ACSum += multiplier * (currArmorSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3590 }
Ritor1
parents:
diff changeset
3591 }
Ritor1
parents:
diff changeset
3592
Ritor1
parents:
diff changeset
3593 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE);
Ritor1
parents:
diff changeset
3594 int dodgeMastery = SkillToMastery(dodgeSkillLevel);
Ritor1
parents:
diff changeset
3595 int multiplier = GetMultiplierForSkillLevel(dodgeSkillLevel, 1, 2, 3, 3);
Ritor1
parents:
diff changeset
3596 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) )
Ritor1
parents:
diff changeset
3597 {
Ritor1
parents:
diff changeset
3598 ACSum += multiplier * (dodgeSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3599 }
Ritor1
parents:
diff changeset
3600 return ACSum;
Ritor1
parents:
diff changeset
3601 }
Ritor1
parents:
diff changeset
3602 break;
Ritor1
parents:
diff changeset
3603 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3604 if ( this->IsUnarmed() )
Ritor1
parents:
diff changeset
3605 {
Ritor1
parents:
diff changeset
3606 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3607 if (!unarmedSkill)
Ritor1
parents:
diff changeset
3608 {
Ritor1
parents:
diff changeset
3609 return 0;
Ritor1
parents:
diff changeset
3610 }
Ritor1
parents:
diff changeset
3611 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3612 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F);
Ritor1
parents:
diff changeset
3613 }
Ritor1
parents:
diff changeset
3614 for (int i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
3615 {
Ritor1
parents:
diff changeset
3616 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3617 {
Ritor1
parents:
diff changeset
3618 ItemGen* currItem = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3619 if ( currItem->GetItemEquipType() <= EQUIP_TWO_HANDED)
Ritor1
parents:
diff changeset
3620 {
Ritor1
parents:
diff changeset
3621 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3622 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
Ritor1
parents:
diff changeset
3623 if (currItemSkillType == PLAYER_SKILL_BLASTER)
Ritor1
parents:
diff changeset
3624 {
Ritor1
parents:
diff changeset
3625 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
3626 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3627 }
Ritor1
parents:
diff changeset
3628 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
3629 {
Ritor1
parents:
diff changeset
3630 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3631 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3632 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3633 }
Ritor1
parents:
diff changeset
3634 else
Ritor1
parents:
diff changeset
3635 {
Ritor1
parents:
diff changeset
3636 return armsMasterBonus + (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3637 }
Ritor1
parents:
diff changeset
3638 }
Ritor1
parents:
diff changeset
3639 }
Ritor1
parents:
diff changeset
3640 }
Ritor1
parents:
diff changeset
3641 return 0;
Ritor1
parents:
diff changeset
3642 break;
Ritor1
parents:
diff changeset
3643
Ritor1
parents:
diff changeset
3644 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3645 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3646 {
Ritor1
parents:
diff changeset
3647 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3648 {
Ritor1
parents:
diff changeset
3649 ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3650 if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
Ritor1
parents:
diff changeset
3651 {
Ritor1
parents:
diff changeset
3652 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(i)->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3653 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType);
Ritor1
parents:
diff changeset
3654 if ( currentItemSkillType == PLAYER_SKILL_BOW )
Ritor1
parents:
diff changeset
3655 {
Ritor1
parents:
diff changeset
3656 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3657 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3658 }
Ritor1
parents:
diff changeset
3659 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER )
Ritor1
parents:
diff changeset
3660 {
Ritor1
parents:
diff changeset
3661 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
3662 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3663 }
Ritor1
parents:
diff changeset
3664 }
Ritor1
parents:
diff changeset
3665 }
Ritor1
parents:
diff changeset
3666 }
Ritor1
parents:
diff changeset
3667 return 0;
Ritor1
parents:
diff changeset
3668 break;
Ritor1
parents:
diff changeset
3669
Ritor1
parents:
diff changeset
3670 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3671 if ( this->IsUnarmed() )
Ritor1
parents:
diff changeset
3672 {
Ritor1
parents:
diff changeset
3673 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3674 if ( !unarmedSkillLevel )
Ritor1
parents:
diff changeset
3675 {
Ritor1
parents:
diff changeset
3676 return 0;
Ritor1
parents:
diff changeset
3677 }
Ritor1
parents:
diff changeset
3678 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3679 return multiplier * (unarmedSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3680 }
Ritor1
parents:
diff changeset
3681 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3682 {
Ritor1
parents:
diff changeset
3683 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3684 {
Ritor1
parents:
diff changeset
3685 ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3686 if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
Ritor1
parents:
diff changeset
3687 {
Ritor1
parents:
diff changeset
3688 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3689 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
Ritor1
parents:
diff changeset
3690 int baseSkillBonus;
Ritor1
parents:
diff changeset
3691 int multiplier;
Ritor1
parents:
diff changeset
3692 switch (currItemSkillType)
Ritor1
parents:
diff changeset
3693 {
Ritor1
parents:
diff changeset
3694 case PLAYER_SKILL_STAFF:
Ritor1
parents:
diff changeset
3695 if ( SkillToMastery(currItemSkillLevel) >= 4 && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
3696 {
Ritor1
parents:
diff changeset
3697 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3698 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3699 return multiplier * (unarmedSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3700 }
Ritor1
parents:
diff changeset
3701 else
Ritor1
parents:
diff changeset
3702 {
Ritor1
parents:
diff changeset
3703 return armsMasterBonus;
Ritor1
parents:
diff changeset
3704 }
Ritor1
parents:
diff changeset
3705 break;
Ritor1
parents:
diff changeset
3706
Ritor1
parents:
diff changeset
3707 case PLAYER_SKILL_DAGGER:
Ritor1
parents:
diff changeset
3708 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3709 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3710 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3711 break;
Ritor1
parents:
diff changeset
3712 case PLAYER_SKILL_SWORD:
Ritor1
parents:
diff changeset
3713 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
3714 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3715 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3716 break;
Ritor1
parents:
diff changeset
3717 case PLAYER_SKILL_MACE:
Ritor1
parents:
diff changeset
3718 case PLAYER_SKILL_SPEAR:
Ritor1
parents:
diff changeset
3719 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1);
Ritor1
parents:
diff changeset
3720 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3721 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3722 break;
Ritor1
parents:
diff changeset
3723 case PLAYER_SKILL_AXE:
Ritor1
parents:
diff changeset
3724 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1);
Ritor1
parents:
diff changeset
3725 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3726 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3727 break;
Ritor1
parents:
diff changeset
3728 }
Ritor1
parents:
diff changeset
3729 }
Ritor1
parents:
diff changeset
3730 }
Ritor1
parents:
diff changeset
3731 }
Ritor1
parents:
diff changeset
3732 return 0;
Ritor1
parents:
diff changeset
3733 break;
Ritor1
parents:
diff changeset
3734 default:
Ritor1
parents:
diff changeset
3735 return 0;
Ritor1
parents:
diff changeset
3736 }
Ritor1
parents:
diff changeset
3737 }
Ritor1
parents:
diff changeset
3738
Ritor1
parents:
diff changeset
3739 unsigned int Player::GetMultiplierForSkillLevel(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4)
Ritor1
parents:
diff changeset
3740 {
Ritor1
parents:
diff changeset
3741 int masteryLvl = SkillToMastery(skillValue);
Ritor1
parents:
diff changeset
3742 switch (masteryLvl)
Ritor1
parents:
diff changeset
3743 {
Ritor1
parents:
diff changeset
3744 case 1: return mult1;
Ritor1
parents:
diff changeset
3745 case 2: return mult2;
Ritor1
parents:
diff changeset
3746 case 3: return mult3;
Ritor1
parents:
diff changeset
3747 case 4: return mult4;
Ritor1
parents:
diff changeset
3748 }
Ritor1
parents:
diff changeset
3749 Error("(%u)", masteryLvl);
Ritor1
parents:
diff changeset
3750 return 0;
Ritor1
parents:
diff changeset
3751 }
Ritor1
parents:
diff changeset
3752 //----- (00490109) --------------------------------------------------------
Ritor1
parents:
diff changeset
3753 // faces are: 0 1 2 3 human males
Ritor1
parents:
diff changeset
3754 // 4 5 6 7 human females
Ritor1
parents:
diff changeset
3755 // 8 9 elf males
Ritor1
parents:
diff changeset
3756 // 10 11 elf females
Ritor1
parents:
diff changeset
3757 // 12 13 dwarf males
Ritor1
parents:
diff changeset
3758 // 14 15 dwarf females
Ritor1
parents:
diff changeset
3759 // 16 17 goblin males
Ritor1
parents:
diff changeset
3760 // 18 19 goblin females
Ritor1
parents:
diff changeset
3761 // 20 lich male
Ritor1
parents:
diff changeset
3762 // 21 lich female
Ritor1
parents:
diff changeset
3763 // 22 underwater suits (unused)
Ritor1
parents:
diff changeset
3764 // 23 zombie male
Ritor1
parents:
diff changeset
3765 // 24 zombie female
Ritor1
parents:
diff changeset
3766 enum CHARACTER_RACE Player::GetRace()
Ritor1
parents:
diff changeset
3767 {
Ritor1
parents:
diff changeset
3768 if ( uCurrentFace <= 7 )
Ritor1
parents:
diff changeset
3769 {
Ritor1
parents:
diff changeset
3770 return CHARACTER_RACE_HUMAN;
Ritor1
parents:
diff changeset
3771 }
Ritor1
parents:
diff changeset
3772 else if ( uCurrentFace <= 11 )
Ritor1
parents:
diff changeset
3773 {
Ritor1
parents:
diff changeset
3774 return CHARACTER_RACE_ELF;
Ritor1
parents:
diff changeset
3775 }
Ritor1
parents:
diff changeset
3776 else if ( uCurrentFace <= 15 )
Ritor1
parents:
diff changeset
3777 {
Ritor1
parents:
diff changeset
3778 return CHARACTER_RACE_DWARF;
Ritor1
parents:
diff changeset
3779 }
Ritor1
parents:
diff changeset
3780 else if ( uCurrentFace <= 19 )
Ritor1
parents:
diff changeset
3781 {
Ritor1
parents:
diff changeset
3782 return CHARACTER_RACE_GOBLIN;
Ritor1
parents:
diff changeset
3783 }
Ritor1
parents:
diff changeset
3784 else
Ritor1
parents:
diff changeset
3785 {
Ritor1
parents:
diff changeset
3786 return CHARACTER_RACE_HUMAN;
Ritor1
parents:
diff changeset
3787 }
Ritor1
parents:
diff changeset
3788 }
Ritor1
parents:
diff changeset
3789
Ritor1
parents:
diff changeset
3790 //----- (00490141) --------------------------------------------------------
Ritor1
parents:
diff changeset
3791 PLAYER_SEX Player::GetSexByVoice()
Ritor1
parents:
diff changeset
3792 {
Ritor1
parents:
diff changeset
3793 switch ( this->uVoiceID )
Ritor1
parents:
diff changeset
3794 {
Ritor1
parents:
diff changeset
3795 case 0u:
Ritor1
parents:
diff changeset
3796 case 1u:
Ritor1
parents:
diff changeset
3797 case 2u:
Ritor1
parents:
diff changeset
3798 case 3u:
Ritor1
parents:
diff changeset
3799 case 8u:
Ritor1
parents:
diff changeset
3800 case 9u:
Ritor1
parents:
diff changeset
3801 case 0xCu:
Ritor1
parents:
diff changeset
3802 case 0xDu:
Ritor1
parents:
diff changeset
3803 case 0x10u:
Ritor1
parents:
diff changeset
3804 case 0x11u:
Ritor1
parents:
diff changeset
3805 case 0x14u:
Ritor1
parents:
diff changeset
3806 case 0x17u:
Ritor1
parents:
diff changeset
3807 return SEX_MALE;
Ritor1
parents:
diff changeset
3808
Ritor1
parents:
diff changeset
3809 case 4u:
Ritor1
parents:
diff changeset
3810 case 5u:
Ritor1
parents:
diff changeset
3811 case 6u:
Ritor1
parents:
diff changeset
3812 case 7u:
Ritor1
parents:
diff changeset
3813 case 0xAu:
Ritor1
parents:
diff changeset
3814 case 0xBu:
Ritor1
parents:
diff changeset
3815 case 0xEu:
Ritor1
parents:
diff changeset
3816 case 0xFu:
Ritor1
parents:
diff changeset
3817 case 0x12u:
Ritor1
parents:
diff changeset
3818 case 0x13u:
Ritor1
parents:
diff changeset
3819 case 0x15u:
Ritor1
parents:
diff changeset
3820 case 0x18u:
Ritor1
parents:
diff changeset
3821 return SEX_FEMALE;
Ritor1
parents:
diff changeset
3822 }
Ritor1
parents:
diff changeset
3823 Error("(%u)", this->uVoiceID);
Ritor1
parents:
diff changeset
3824 return SEX_MALE;
Ritor1
parents:
diff changeset
3825 }
Ritor1
parents:
diff changeset
3826
Ritor1
parents:
diff changeset
3827 //----- (00490188) --------------------------------------------------------
Ritor1
parents:
diff changeset
3828 void Player::SetInitialStats()
Ritor1
parents:
diff changeset
3829 {
Ritor1
parents:
diff changeset
3830 CHARACTER_RACE v1 = GetRace();
Ritor1
parents:
diff changeset
3831 uMight = StatTable[v1][0].uBaseValue;
Ritor1
parents:
diff changeset
3832 uIntelligence = StatTable[v1][1].uBaseValue;
Ritor1
parents:
diff changeset
3833 uWillpower = StatTable[v1][2].uBaseValue;
Ritor1
parents:
diff changeset
3834 uEndurance = StatTable[v1][3].uBaseValue;
Ritor1
parents:
diff changeset
3835 uAccuracy = StatTable[v1][4].uBaseValue;
Ritor1
parents:
diff changeset
3836 uSpeed = StatTable[v1][5].uBaseValue;
Ritor1
parents:
diff changeset
3837 uLuck = StatTable[v1][6].uBaseValue;
Ritor1
parents:
diff changeset
3838 }
Ritor1
parents:
diff changeset
3839
Ritor1
parents:
diff changeset
3840 //----- (004901FC) --------------------------------------------------------
Ritor1
parents:
diff changeset
3841 void Player::SetSexByVoice()
Ritor1
parents:
diff changeset
3842 {
Ritor1
parents:
diff changeset
3843 switch ( this->uVoiceID)
Ritor1
parents:
diff changeset
3844 {
Ritor1
parents:
diff changeset
3845 case 0:
Ritor1
parents:
diff changeset
3846 case 1:
Ritor1
parents:
diff changeset
3847 case 2:
Ritor1
parents:
diff changeset
3848 case 3:
Ritor1
parents:
diff changeset
3849 case 8:
Ritor1
parents:
diff changeset
3850 case 9:
Ritor1
parents:
diff changeset
3851 case 0xC:
Ritor1
parents:
diff changeset
3852 case 0xD:
Ritor1
parents:
diff changeset
3853 case 0x10:
Ritor1
parents:
diff changeset
3854 case 0x11:
Ritor1
parents:
diff changeset
3855 case 0x14:
Ritor1
parents:
diff changeset
3856 case 0x17:
Ritor1
parents:
diff changeset
3857 this->uSex = SEX_MALE;
Ritor1
parents:
diff changeset
3858 break;
Ritor1
parents:
diff changeset
3859 case 4:
Ritor1
parents:
diff changeset
3860 case 5:
Ritor1
parents:
diff changeset
3861 case 6:
Ritor1
parents:
diff changeset
3862 case 7:
Ritor1
parents:
diff changeset
3863 case 0xA:
Ritor1
parents:
diff changeset
3864 case 0xB:
Ritor1
parents:
diff changeset
3865 case 0xE:
Ritor1
parents:
diff changeset
3866 case 0xF:
Ritor1
parents:
diff changeset
3867 case 0x12:
Ritor1
parents:
diff changeset
3868 case 0x13:
Ritor1
parents:
diff changeset
3869 case 0x15:
Ritor1
parents:
diff changeset
3870 case 0x18:
Ritor1
parents:
diff changeset
3871 this->uSex = SEX_FEMALE;
Ritor1
parents:
diff changeset
3872 break;
Ritor1
parents:
diff changeset
3873 default:
Ritor1
parents:
diff changeset
3874 Error("(%u)", this->uVoiceID);
Ritor1
parents:
diff changeset
3875 break;
Ritor1
parents:
diff changeset
3876 }
Ritor1
parents:
diff changeset
3877
Ritor1
parents:
diff changeset
3878 }
Ritor1
parents:
diff changeset
3879
Ritor1
parents:
diff changeset
3880 //----- (0049024A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3881 void Player::Reset(PLAYER_CLASS_TYPE cls)
Ritor1
parents:
diff changeset
3882 {
Ritor1
parents:
diff changeset
3883 sLevelModifier = 0;
Ritor1
parents:
diff changeset
3884 sAgeModifier = 0;
Ritor1
parents:
diff changeset
3885
Ritor1
parents:
diff changeset
3886 classType = cls;
Ritor1
parents:
diff changeset
3887 uLuckBonus = 0;
Ritor1
parents:
diff changeset
3888 uSpeedBonus = 0;
Ritor1
parents:
diff changeset
3889 uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
3890 uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
3891 uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
3892 uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
3893 uMightBonus = 0;
Ritor1
parents:
diff changeset
3894 uLevel = 1;
Ritor1
parents:
diff changeset
3895 uExperience = 251 + rand() % 100;
Ritor1
parents:
diff changeset
3896 uBirthYear = 1147 - rand() % 6;
Ritor1
parents:
diff changeset
3897 pActiveSkills.fill(0);
Ritor1
parents:
diff changeset
3898 memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits));
Ritor1
parents:
diff changeset
3899 memset(&spellbook, 0, sizeof(spellbook));
Ritor1
parents:
diff changeset
3900
Ritor1
parents:
diff changeset
3901 for (uint i = 0; i < 37; ++i)
Ritor1
parents:
diff changeset
3902 {
Ritor1
parents:
diff changeset
3903 if (pSkillAvailabilityPerClass[classType / 4][i] != 2)
Ritor1
parents:
diff changeset
3904 continue;
Ritor1
parents:
diff changeset
3905
Ritor1
parents:
diff changeset
3906 pActiveSkills[i] = 1;
Ritor1
parents:
diff changeset
3907
Ritor1
parents:
diff changeset
3908 switch (i)
Ritor1
parents:
diff changeset
3909 {
Ritor1
parents:
diff changeset
3910 case PLAYER_SKILL_FIRE:
Ritor1
parents:
diff changeset
3911 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells
Ritor1
parents:
diff changeset
3912
Ritor1
parents:
diff changeset
3913 extern bool all_magic;
Ritor1
parents:
diff changeset
3914 if ( all_magic == true )
Ritor1
parents:
diff changeset
3915 {
Ritor1
parents:
diff changeset
3916 pActiveSkills[PLAYER_SKILL_AIR] = 1;
Ritor1
parents:
diff changeset
3917 pActiveSkills[PLAYER_SKILL_WATER] = 1;
Ritor1
parents:
diff changeset
3918 pActiveSkills[PLAYER_SKILL_EARTH] = 1;
Ritor1
parents:
diff changeset
3919 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3920 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3921 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3922 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3923 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3924 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3925 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3926 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3927 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3928 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3929 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3930 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3931 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3932 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3933 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3934 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3935 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3936 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3937 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3938 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3939 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3940 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3941 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3942 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3943 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3944 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3945 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3946 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3947 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3948 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3949 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3950 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3951 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3952 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3953 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3954 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3955 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3956 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3957 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3958 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3959 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3960 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3961 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3962 }
Ritor1
parents:
diff changeset
3963 break;
Ritor1
parents:
diff changeset
3964 case PLAYER_SKILL_AIR:
Ritor1
parents:
diff changeset
3965 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3966 break;
Ritor1
parents:
diff changeset
3967 case PLAYER_SKILL_WATER:
Ritor1
parents:
diff changeset
3968 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3969 break;
Ritor1
parents:
diff changeset
3970 case PLAYER_SKILL_EARTH:
Ritor1
parents:
diff changeset
3971 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3972 break;
Ritor1
parents:
diff changeset
3973 case PLAYER_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
3974 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3975 break;
Ritor1
parents:
diff changeset
3976 case PLAYER_SKILL_MIND:
Ritor1
parents:
diff changeset
3977 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3978 break;
Ritor1
parents:
diff changeset
3979 case PLAYER_SKILL_BODY:
Ritor1
parents:
diff changeset
3980 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3981
Ritor1
parents:
diff changeset
3982 if ( all_magic == true )
Ritor1
parents:
diff changeset
3983 {
Ritor1
parents:
diff changeset
3984 pActiveSkills[PLAYER_SKILL_MIND] = 1;
Ritor1
parents:
diff changeset
3985 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1;
Ritor1
parents:
diff changeset
3986 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3987 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3988 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3989 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3990 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3991 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3992 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3993 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3994 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3995 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3996 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3997 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3998 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3999 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
4000 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
4001 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
4002 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
4003 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
4004 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
4005 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
4006 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
4007 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4008 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
4009 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
4010 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
4011 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
4012 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
4013 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
4014 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
4015 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
4016 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
4017 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
4018 }
Ritor1
parents:
diff changeset
4019 break;
Ritor1
parents:
diff changeset
4020 case PLAYER_SKILL_LIGHT:
Ritor1
parents:
diff changeset
4021 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4022 break;
Ritor1
parents:
diff changeset
4023 case PLAYER_SKILL_DARK:
Ritor1
parents:
diff changeset
4024 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4025 break;
Ritor1
parents:
diff changeset
4026 }
Ritor1
parents:
diff changeset
4027 }
Ritor1
parents:
diff changeset
4028
Ritor1
parents:
diff changeset
4029 memset(&pEquipment, 0, sizeof(PlayerEquipment));
Ritor1
parents:
diff changeset
4030 pInventoryMatrix.fill(0);
Ritor1
parents:
diff changeset
4031 for (uint i = 0; i < 126; ++i)
Ritor1
parents:
diff changeset
4032 pInventoryItemList[i].Reset();
Ritor1
parents:
diff changeset
4033 for (uint i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
4034 pEquippedItems[i].Reset();
Ritor1
parents:
diff changeset
4035
Ritor1
parents:
diff changeset
4036 sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
4037 sMana = GetMaxMana();
Ritor1
parents:
diff changeset
4038 }
Ritor1
parents:
diff changeset
4039
Ritor1
parents:
diff changeset
4040 //----- (004903C9) --------------------------------------------------------
Ritor1
parents:
diff changeset
4041 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order)
Ritor1
parents:
diff changeset
4042 {
Ritor1
parents:
diff changeset
4043 int counter; // edx@5
Ritor1
parents:
diff changeset
4044 bool canBeInactive;
Ritor1
parents:
diff changeset
4045 unsigned char requiredValue;
Ritor1
parents:
diff changeset
4046 signed int offset;
Ritor1
parents:
diff changeset
4047
Ritor1
parents:
diff changeset
4048 if ( order <= 1 )
Ritor1
parents:
diff changeset
4049 {
Ritor1
parents:
diff changeset
4050 canBeInactive = false;
Ritor1
parents:
diff changeset
4051 requiredValue = 2; // 2 - primary skill
Ritor1
parents:
diff changeset
4052 offset = 0;
Ritor1
parents:
diff changeset
4053 }
Ritor1
parents:
diff changeset
4054 else if ( order <= 3 )
Ritor1
parents:
diff changeset
4055 {
Ritor1
parents:
diff changeset
4056 canBeInactive = false;
Ritor1
parents:
diff changeset
4057 requiredValue = 1; // 1 - available
Ritor1
parents:
diff changeset
4058 offset = 2;
Ritor1
parents:
diff changeset
4059 }
Ritor1
parents:
diff changeset
4060 else if ( order <= 12 )
Ritor1
parents:
diff changeset
4061 {
Ritor1
parents:
diff changeset
4062 canBeInactive = true;
Ritor1
parents:
diff changeset
4063 requiredValue = 1; // 1 - available
Ritor1
parents:
diff changeset
4064 offset = 4;
Ritor1
parents:
diff changeset
4065 }
Ritor1
parents:
diff changeset
4066 else
Ritor1
parents:
diff changeset
4067 {
Ritor1
parents:
diff changeset
4068 return (PLAYER_SKILL_TYPE)37;
Ritor1
parents:
diff changeset
4069 }
Ritor1
parents:
diff changeset
4070 counter = 0;
Ritor1
parents:
diff changeset
4071 for (int i = 0; i < 37; i++)
Ritor1
parents:
diff changeset
4072 {
Ritor1
parents:
diff changeset
4073 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue )
Ritor1
parents:
diff changeset
4074 {
Ritor1
parents:
diff changeset
4075 if ( counter == order - offset )
Ritor1
parents:
diff changeset
4076 return (PLAYER_SKILL_TYPE)i;
Ritor1
parents:
diff changeset
4077 ++counter;
Ritor1
parents:
diff changeset
4078 }
Ritor1
parents:
diff changeset
4079 }
Ritor1
parents:
diff changeset
4080
Ritor1
parents:
diff changeset
4081 return (PLAYER_SKILL_TYPE)37;
Ritor1
parents:
diff changeset
4082 }
Ritor1
parents:
diff changeset
4083
Ritor1
parents:
diff changeset
4084
Ritor1
parents:
diff changeset
4085
Ritor1
parents:
diff changeset
4086 //----- (0049048D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4087 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute)
Ritor1
parents:
diff changeset
4088 void Player::DecreaseAttribute(int eAttribute)
Ritor1
parents:
diff changeset
4089 {
Ritor1
parents:
diff changeset
4090 int pBaseValue; // ecx@1
Ritor1
parents:
diff changeset
4091 int pDroppedStep; // ebx@1
Ritor1
parents:
diff changeset
4092 int pStep; // esi@1
Ritor1
parents:
diff changeset
4093 int uMinValue; // [sp+Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
4094
Ritor1
parents:
diff changeset
4095 int raceId = GetRace();
Ritor1
parents:
diff changeset
4096 pBaseValue = StatTable[raceId][eAttribute].uBaseValue;
Ritor1
parents:
diff changeset
4097 pDroppedStep = StatTable[raceId][eAttribute].uDroppedStep;
Ritor1
parents:
diff changeset
4098 uMinValue = pBaseValue - 2;
Ritor1
parents:
diff changeset
4099 pStep = StatTable[raceId][eAttribute].uBaseStep;
Ritor1
parents:
diff changeset
4100 unsigned short* AttrToChange = nullptr;
Ritor1
parents:
diff changeset
4101 switch ( eAttribute )
Ritor1
parents:
diff changeset
4102 {
Ritor1
parents:
diff changeset
4103 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
4104 AttrToChange = &this->uMight;
Ritor1
parents:
diff changeset
4105 break;
Ritor1
parents:
diff changeset
4106 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
4107 AttrToChange = &this->uIntelligence;
Ritor1
parents:
diff changeset
4108 break;
Ritor1
parents:
diff changeset
4109 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
4110 AttrToChange = &this->uWillpower;
Ritor1
parents:
diff changeset
4111 break;
Ritor1
parents:
diff changeset
4112 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
4113 AttrToChange = &this->uEndurance;
Ritor1
parents:
diff changeset
4114 break;
Ritor1
parents:
diff changeset
4115 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
4116 AttrToChange = &this->uAccuracy;
Ritor1
parents:
diff changeset
4117 break;
Ritor1
parents:
diff changeset
4118 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
4119 AttrToChange = &this->uSpeed;
Ritor1
parents:
diff changeset
4120 break;
Ritor1
parents:
diff changeset
4121 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
4122 AttrToChange = &this->uLuck;
Ritor1
parents:
diff changeset
4123 break;
Ritor1
parents:
diff changeset
4124 }
Ritor1
parents:
diff changeset
4125 if ( *AttrToChange <= pBaseValue )
Ritor1
parents:
diff changeset
4126 pStep = pDroppedStep;
Ritor1
parents:
diff changeset
4127 if ( *AttrToChange - pStep >= uMinValue )
Ritor1
parents:
diff changeset
4128 *AttrToChange -= pStep;
Ritor1
parents:
diff changeset
4129 }
Ritor1
parents:
diff changeset
4130
Ritor1
parents:
diff changeset
4131 //----- (004905F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
4132 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute)
Ritor1
parents:
diff changeset
4133 void Player::IncreaseAttribute( int eAttribute )
Ritor1
parents:
diff changeset
4134 {
Ritor1
parents:
diff changeset
4135 int raceId; // eax@1
Ritor1
parents:
diff changeset
4136 int maxValue; // ebx@1
Ritor1
parents:
diff changeset
4137 signed int baseStep; // edi@1
Ritor1
parents:
diff changeset
4138 signed int tmp; // eax@17
Ritor1
parents:
diff changeset
4139 signed int result; // eax@18
Ritor1
parents:
diff changeset
4140 int baseValue; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4141 signed int droppedStep; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
4142 unsigned short* statToChange;
Ritor1
parents:
diff changeset
4143
Ritor1
parents:
diff changeset
4144 raceId = GetRace();
Ritor1
parents:
diff changeset
4145 maxValue = StatTable[raceId][eAttribute].uMaxValue;
Ritor1
parents:
diff changeset
4146 baseStep = StatTable[raceId][eAttribute].uBaseStep;
Ritor1
parents:
diff changeset
4147 baseValue = StatTable[raceId][eAttribute].uBaseValue;
Ritor1
parents:
diff changeset
4148 droppedStep = StatTable[raceId][eAttribute].uDroppedStep;
Ritor1
parents:
diff changeset
4149 PlayerCreation_GetUnspentAttributePointCount();
Ritor1
parents:
diff changeset
4150 switch ( eAttribute )
Ritor1
parents:
diff changeset
4151 {
Ritor1
parents:
diff changeset
4152 case 0:
Ritor1
parents:
diff changeset
4153 statToChange = &this->uMight;
Ritor1
parents:
diff changeset
4154 break;
Ritor1
parents:
diff changeset
4155 case 1:
Ritor1
parents:
diff changeset
4156 statToChange = &this->uIntelligence;
Ritor1
parents:
diff changeset
4157 break;
Ritor1
parents:
diff changeset
4158 case 2:
Ritor1
parents:
diff changeset
4159 statToChange = &this->uWillpower;
Ritor1
parents:
diff changeset
4160 break;
Ritor1
parents:
diff changeset
4161 case 3:
Ritor1
parents:
diff changeset
4162 statToChange = &this->uEndurance;
Ritor1
parents:
diff changeset
4163 break;
Ritor1
parents:
diff changeset
4164 case 4:
Ritor1
parents:
diff changeset
4165 statToChange = &this->uAccuracy;
Ritor1
parents:
diff changeset
4166 break;
Ritor1
parents:
diff changeset
4167 case 5:
Ritor1
parents:
diff changeset
4168 statToChange = &this->uSpeed;
Ritor1
parents:
diff changeset
4169 break;
Ritor1
parents:
diff changeset
4170 case 6:
Ritor1
parents:
diff changeset
4171 statToChange = &this->uLuck;
Ritor1
parents:
diff changeset
4172 break;
Ritor1
parents:
diff changeset
4173 default:
Ritor1
parents:
diff changeset
4174 Error("(%u)", eAttribute);
Ritor1
parents:
diff changeset
4175 break;
Ritor1
parents:
diff changeset
4176 }
Ritor1
parents:
diff changeset
4177 if ( *statToChange < baseValue )
Ritor1
parents:
diff changeset
4178 {
Ritor1
parents:
diff changeset
4179 tmp = baseStep;
Ritor1
parents:
diff changeset
4180 baseStep = droppedStep;
Ritor1
parents:
diff changeset
4181 droppedStep = tmp;
Ritor1
parents:
diff changeset
4182 }
Ritor1
parents:
diff changeset
4183 result = PlayerCreation_GetUnspentAttributePointCount();
Ritor1
parents:
diff changeset
4184 if ( result >= droppedStep )
Ritor1
parents:
diff changeset
4185 {
Ritor1
parents:
diff changeset
4186 if ( baseStep + *statToChange <= maxValue )
Ritor1
parents:
diff changeset
4187 *statToChange += baseStep;
Ritor1
parents:
diff changeset
4188 }
Ritor1
parents:
diff changeset
4189 }
Ritor1
parents:
diff changeset
4190
Ritor1
parents:
diff changeset
4191 //----- (0049070F) --------------------------------------------------------
Ritor1
parents:
diff changeset
4192 void Player::Zero()
Ritor1
parents:
diff changeset
4193 {
Ritor1
parents:
diff changeset
4194 this->sLevelModifier = 0;
Ritor1
parents:
diff changeset
4195 this->sACModifier = 0;
Ritor1
parents:
diff changeset
4196 this->uLuckBonus = 0;
Ritor1
parents:
diff changeset
4197 this->uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
4198 this->uSpeedBonus = 0;
Ritor1
parents:
diff changeset
4199 this->uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
4200 this->uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
4201 this->uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
4202 this->uMightBonus = 0;
Ritor1
parents:
diff changeset
4203 this->field_100 = 0;
Ritor1
parents:
diff changeset
4204 this->field_FC = 0;
Ritor1
parents:
diff changeset
4205 this->field_F8 = 0;
Ritor1
parents:
diff changeset
4206 this->field_F4 = 0;
Ritor1
parents:
diff changeset
4207 this->field_F0 = 0;
Ritor1
parents:
diff changeset
4208 this->field_EC = 0;
Ritor1
parents:
diff changeset
4209 this->field_E8 = 0;
Ritor1
parents:
diff changeset
4210 this->field_E4 = 0;
Ritor1
parents:
diff changeset
4211 this->field_E0 = 0;
Ritor1
parents:
diff changeset
4212 memset(&this->sResFireBonus, 0, 0x16u);
Ritor1
parents:
diff changeset
4213 this->field_1A97 = 0;
Ritor1
parents:
diff changeset
4214 this->_ranged_dmg_bonus = 0;
Ritor1
parents:
diff changeset
4215 this->field_1A95 = 0;
Ritor1
parents:
diff changeset
4216 this->_ranged_atk_bonus = 0;
Ritor1
parents:
diff changeset
4217 this->field_1A93 = 0;
Ritor1
parents:
diff changeset
4218 this->_melee_dmg_bonus = 0;
Ritor1
parents:
diff changeset
4219 this->field_1A91 = 0;
Ritor1
parents:
diff changeset
4220 this->_some_attack_bonus = 0;
Ritor1
parents:
diff changeset
4221 this->_mana_related = 0;
Ritor1
parents:
diff changeset
4222 this->uFullManaBonus = 0;
Ritor1
parents:
diff changeset
4223 this->_health_related = 0;
Ritor1
parents:
diff changeset
4224 this->uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
4225 }
Ritor1
parents:
diff changeset
4226
Ritor1
parents:
diff changeset
4227 //----- (004907E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
4228 unsigned int Player::GetStatColor(int uStat)
Ritor1
parents:
diff changeset
4229 {
Ritor1
parents:
diff changeset
4230 int attribute_value; // edx@1
Ritor1
parents:
diff changeset
4231
Ritor1
parents:
diff changeset
4232 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue;
Ritor1
parents:
diff changeset
4233 switch (uStat)
Ritor1
parents:
diff changeset
4234 {
Ritor1
parents:
diff changeset
4235 case 0: attribute_value = uMight; break;
Ritor1
parents:
diff changeset
4236 case 1: attribute_value = uIntelligence; break;
Ritor1
parents:
diff changeset
4237 case 2: attribute_value = uWillpower; break;
Ritor1
parents:
diff changeset
4238 case 3: attribute_value = uEndurance; break;
Ritor1
parents:
diff changeset
4239 case 4: attribute_value = uAccuracy; break;
Ritor1
parents:
diff changeset
4240 case 5: attribute_value = uSpeed; break;
Ritor1
parents:
diff changeset
4241 case 6: attribute_value = uLuck; break;
Ritor1
parents:
diff changeset
4242 default: Error("Unexpected attribute");
Ritor1
parents:
diff changeset
4243 };
Ritor1
parents:
diff changeset
4244
Ritor1
parents:
diff changeset
4245 if (attribute_value == base_attribute_value)
Ritor1
parents:
diff changeset
4246 return ui_character_stat_default_color;
Ritor1
parents:
diff changeset
4247 else if (attribute_value > base_attribute_value)
Ritor1
parents:
diff changeset
4248 return ui_character_stat_buffed_color;
Ritor1
parents:
diff changeset
4249 else
Ritor1
parents:
diff changeset
4250 return ui_character_stat_debuffed_color;
Ritor1
parents:
diff changeset
4251 }
Ritor1
parents:
diff changeset
4252
Ritor1
parents:
diff changeset
4253 //----- (004908A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
4254 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, signed __int64 uTime)
Ritor1
parents:
diff changeset
4255 {
Ritor1
parents:
diff changeset
4256 if ( pConditions[uCondition] && (uTime < (signed long long)pConditions[uCondition]) )
Ritor1
parents:
diff changeset
4257 {
Ritor1
parents:
diff changeset
4258 pConditions[uCondition] = 0i64;
Ritor1
parents:
diff changeset
4259 return true;
Ritor1
parents:
diff changeset
4260 }
Ritor1
parents:
diff changeset
4261 else
Ritor1
parents:
diff changeset
4262 return false;
Ritor1
parents:
diff changeset
4263 }
Ritor1
parents:
diff changeset
4264
Ritor1
parents:
diff changeset
4265 //----- (004680ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
4266 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
Ritor1
parents:
diff changeset
4267 {
Ritor1
parents:
diff changeset
4268 Player *playerAffected; // esi@1
Ritor1
parents:
diff changeset
4269 signed int v5; // eax@17
Ritor1
parents:
diff changeset
4270 int v8; // edx@39
Ritor1
parents:
diff changeset
4271 const char *v13; // eax@45
Ritor1
parents:
diff changeset
4272 signed int v15; // edi@68
Ritor1
parents:
diff changeset
4273 int v16; // edx@73
Ritor1
parents:
diff changeset
4274 unsigned __int16 v17; // edi@73
Ritor1
parents:
diff changeset
4275 unsigned int v18; // eax@73
Ritor1
parents:
diff changeset
4276 const char *v22; // eax@84
Ritor1
parents:
diff changeset
4277 int scroll_id; // esi@96
Ritor1
parents:
diff changeset
4278 int v25; // eax@109
Ritor1
parents:
diff changeset
4279 int v26; // eax@113
Ritor1
parents:
diff changeset
4280 int new_mana_val; // edi@114
Ritor1
parents:
diff changeset
4281 signed __int64 v28; // qax@120
Ritor1
parents:
diff changeset
4282 __int64 v30; // edi@137
Ritor1
parents:
diff changeset
4283 __int64 v32; // ST3C_4@137
Ritor1
parents:
diff changeset
4284 __int64 v34; // ST34_4@137
Ritor1
parents:
diff changeset
4285 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
Ritor1
parents:
diff changeset
4286 const char *v66; // [sp-4h] [bp-30h]@69
Ritor1
parents:
diff changeset
4287 signed int v67; // [sp-4h] [bp-30h]@77
Ritor1
parents:
diff changeset
4288 const char *v68; // [sp-4h] [bp-30h]@89
Ritor1
parents:
diff changeset
4289 char v72; // [sp+20h] [bp-Ch]@68
Ritor1
parents:
diff changeset
4290 signed int v73; // [sp+24h] [bp-8h]@1
Ritor1
parents:
diff changeset
4291 const char* v74; // [sp+24h] [bp-8h]@23
Ritor1
parents:
diff changeset
4292 //Player *thisb; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
4293 unsigned int thisa; // [sp+28h] [bp-4h]@22
Ritor1
parents:
diff changeset
4294
Ritor1
parents:
diff changeset
4295 //thisb = this;
Ritor1
parents:
diff changeset
4296 playerAffected = &pParty->pPlayers[player_num-1];
Ritor1
parents:
diff changeset
4297 v73 = 1;
Ritor1
parents:
diff changeset
4298 if ( pParty->bTurnBasedModeOn == true && (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) )
Ritor1
parents:
diff changeset
4299 return;
Ritor1
parents:
diff changeset
4300 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_REAGENT )
Ritor1
parents:
diff changeset
4301 {
Ritor1
parents:
diff changeset
4302 if ( pParty->pPickedItem.uItemID == 160 )
Ritor1
parents:
diff changeset
4303 {
Ritor1
parents:
diff changeset
4304 playerAffected->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
4305 }
Ritor1
parents:
diff changeset
4306 else if ( pParty->pPickedItem.uItemID == 161 )
Ritor1
parents:
diff changeset
4307 {
Ritor1
parents:
diff changeset
4308 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4309 new_mana_val += 2;
Ritor1
parents:
diff changeset
4310 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4311 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4312 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4313 }
Ritor1
parents:
diff changeset
4314 else if ( pParty->pPickedItem.uItemID == 162 )
Ritor1
parents:
diff changeset
4315 {
Ritor1
parents:
diff changeset
4316 playerAffected->Heal(2);
Ritor1
parents:
diff changeset
4317 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4318 }
Ritor1
parents:
diff changeset
4319 else
Ritor1
parents:
diff changeset
4320 {
Ritor1
parents:
diff changeset
4321 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4322 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
Ritor1
parents:
diff changeset
4323 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4324 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4325 return;
Ritor1
parents:
diff changeset
4326 }
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4327 pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4328
Ritor1
parents:
diff changeset
4329 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4330 {
Ritor1
parents:
diff changeset
4331 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4332 }
Ritor1
parents:
diff changeset
4333 if ( v73 )
Ritor1
parents:
diff changeset
4334 {
Ritor1
parents:
diff changeset
4335 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4336 {
Ritor1
parents:
diff changeset
4337 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4338 this->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4339 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4340 }
Ritor1
parents:
diff changeset
4341 else
Ritor1
parents:
diff changeset
4342 {
Ritor1
parents:
diff changeset
4343 this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
Ritor1
parents:
diff changeset
4344 }
Ritor1
parents:
diff changeset
4345 }
Ritor1
parents:
diff changeset
4346 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4347 return;
Ritor1
parents:
diff changeset
4348 }
Ritor1
parents:
diff changeset
4349
Ritor1
parents:
diff changeset
4350 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_POTION )
Ritor1
parents:
diff changeset
4351 {
Ritor1
parents:
diff changeset
4352 switch ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
4353 {
Ritor1
parents:
diff changeset
4354 case 221: //Catalyst
Ritor1
parents:
diff changeset
4355 playerAffected->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
4356 break;
Ritor1
parents:
diff changeset
4357 case 222: //Cure Wounds
Ritor1
parents:
diff changeset
4358 v25 = pParty->pPickedItem.uEnchantmentType + 10;
Ritor1
parents:
diff changeset
4359 playerAffected->Heal(v25);
Ritor1
parents:
diff changeset
4360 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4361 break;
Ritor1
parents:
diff changeset
4362 case 223: //Magic Potion
Ritor1
parents:
diff changeset
4363 v26 = pParty->pPickedItem.uEnchantmentType + 10;
Ritor1
parents:
diff changeset
4364 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4365 new_mana_val += v26;
Ritor1
parents:
diff changeset
4366 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4367 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4368 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4369 playerAffected->sMana = new_mana_val;
Ritor1
parents:
diff changeset
4370 break;
Ritor1
parents:
diff changeset
4371 case 224: //Cure Weakness
Ritor1
parents:
diff changeset
4372 playerAffected->pConditions[Condition_Weak] = 0i64;
Ritor1
parents:
diff changeset
4373 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4374 break;
Ritor1
parents:
diff changeset
4375 case 225: //Cure Disease
Ritor1
parents:
diff changeset
4376 playerAffected->pConditions[Condition_Disease_Severe] = 0i64;
Ritor1
parents:
diff changeset
4377 playerAffected->pConditions[Condition_Disease_Medium] = 0i64;
Ritor1
parents:
diff changeset
4378 playerAffected->pConditions[Condition_Disease_Weak] = 0i64;
Ritor1
parents:
diff changeset
4379 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4380 break;
Ritor1
parents:
diff changeset
4381 case 226: //Cure Poison
Ritor1
parents:
diff changeset
4382 playerAffected->pConditions[Condition_Poison_Severe] = 0i64;
Ritor1
parents:
diff changeset
4383 playerAffected->pConditions[Condition_Poison_Medium] = 0i64;
Ritor1
parents:
diff changeset
4384 playerAffected->pConditions[Condition_Poison_Weak] = 0i64;
Ritor1
parents:
diff changeset
4385 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4386 break;
Ritor1
parents:
diff changeset
4387 case 227: //Awaken
Ritor1
parents:
diff changeset
4388 playerAffected->pConditions[Condition_Sleep] = 0i64;
Ritor1
parents:
diff changeset
4389 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4390 break;
Ritor1
parents:
diff changeset
4391 case 228: //Haste
Ritor1
parents:
diff changeset
4392 if ( !playerAffected->pConditions[Condition_Weak] )
Ritor1
parents:
diff changeset
4393 {
Ritor1
parents:
diff changeset
4394 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4395 playerAffected->pPlayerBuffs[PLAYER_BUFF_HASTE].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4396 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4397 }
Ritor1
parents:
diff changeset
4398 break;
Ritor1
parents:
diff changeset
4399 case 229: //Heroism
Ritor1
parents:
diff changeset
4400 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4401 playerAffected->pPlayerBuffs[PLAYER_BUFF_HEROISM].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4402 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4403 break;
Ritor1
parents:
diff changeset
4404 case 230: //Bless
Ritor1
parents:
diff changeset
4405 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4406 playerAffected->pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4407 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4408 break;
Ritor1
parents:
diff changeset
4409 case 231: //Preservation
Ritor1
parents:
diff changeset
4410 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4411 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4412 playerAffected->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4413 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4414 break;
Ritor1
parents:
diff changeset
4415 case 232: //Shield
Ritor1
parents:
diff changeset
4416 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4417 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4418 playerAffected->pPlayerBuffs[PLAYER_BUFF_SHIELD].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4419 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4420 break;
Ritor1
parents:
diff changeset
4421 case 234: //Stoneskin
Ritor1
parents:
diff changeset
4422 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4423 playerAffected->pPlayerBuffs[PLAYER_BUFF_STONESKIN].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4424 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4425 break;
Ritor1
parents:
diff changeset
4426 case 235: //Water Breathing
Ritor1
parents:
diff changeset
4427 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
Ritor1
parents:
diff changeset
4428 playerAffected->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4429 break;
Ritor1
parents:
diff changeset
4430 case 237: //Remove Fear
Ritor1
parents:
diff changeset
4431 playerAffected->pConditions[Condition_Fear] = 0i64;
Ritor1
parents:
diff changeset
4432 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4433 break;
Ritor1
parents:
diff changeset
4434 case 238: //Remove Curse
Ritor1
parents:
diff changeset
4435 playerAffected->pConditions[Condition_Cursed] = 0i64;
Ritor1
parents:
diff changeset
4436 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4437 break;
Ritor1
parents:
diff changeset
4438 case 239: //Cure Insanity
Ritor1
parents:
diff changeset
4439 playerAffected->pConditions[Condition_Insane] = 0i64;
Ritor1
parents:
diff changeset
4440 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4441 break;
Ritor1
parents:
diff changeset
4442 case 240: //Might Boost
Ritor1
parents:
diff changeset
4443 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4444 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4445 playerAffected->pPlayerBuffs[PLAYER_BUFF_STRENGTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4446 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4447 break;
Ritor1
parents:
diff changeset
4448 case 241: //Intellect Boost
Ritor1
parents:
diff changeset
4449 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4450 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4451 playerAffected->pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4452 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4453 break;
Ritor1
parents:
diff changeset
4454 case 242: //Personality Boost
Ritor1
parents:
diff changeset
4455 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4456 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4457 playerAffected->pPlayerBuffs[PLAYER_BUFF_WILLPOWER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4458 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4459 break;
Ritor1
parents:
diff changeset
4460 case 243://Endurance Boost
Ritor1
parents:
diff changeset
4461 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4462 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4463 playerAffected->pPlayerBuffs[PLAYER_BUFF_ENDURANCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4464 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4465 break;
Ritor1
parents:
diff changeset
4466 case 244: //Speed Boost
Ritor1
parents:
diff changeset
4467 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4468 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4469 playerAffected->pPlayerBuffs[PLAYER_BUFF_SPEED].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4470 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4471 break;
Ritor1
parents:
diff changeset
4472 case 245: //Accuracy Boost
Ritor1
parents:
diff changeset
4473 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4474 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4475 playerAffected->pPlayerBuffs[PLAYER_BUFF_ACCURACY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4476 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4477 break;
Ritor1
parents:
diff changeset
4478 case 251: //Cure Paralysis
Ritor1
parents:
diff changeset
4479 playerAffected->pConditions[Condition_Paralyzed] = 0i64;
Ritor1
parents:
diff changeset
4480 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4481 break;
Ritor1
parents:
diff changeset
4482 case 252://Divine Restoration
Ritor1
parents:
diff changeset
4483 v30 = playerAffected->pConditions[Condition_Dead];
Ritor1
parents:
diff changeset
4484 v32 = playerAffected->pConditions[Condition_Pertified];
Ritor1
parents:
diff changeset
4485 v34 = playerAffected->pConditions[Condition_Eradicated];
Ritor1
parents:
diff changeset
4486 pConditions.fill(0);
Ritor1
parents:
diff changeset
4487 playerAffected->pConditions[Condition_Dead] = v30;
Ritor1
parents:
diff changeset
4488 playerAffected->pConditions[Condition_Pertified] = v32;
Ritor1
parents:
diff changeset
4489 playerAffected->pConditions[Condition_Eradicated] = v34;
Ritor1
parents:
diff changeset
4490 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4491 break;
Ritor1
parents:
diff changeset
4492 case 253: //Divine Cure
Ritor1
parents:
diff changeset
4493 v25 = 5 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4494 playerAffected->Heal(v25);
Ritor1
parents:
diff changeset
4495 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4496 break;
Ritor1
parents:
diff changeset
4497 case 254: //Divine Power
Ritor1
parents:
diff changeset
4498 v26 = 5 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4499 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4500 new_mana_val += v26;
Ritor1
parents:
diff changeset
4501 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4502 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4503 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4504 break;
Ritor1
parents:
diff changeset
4505 case 255: //Luck Boost
Ritor1
parents:
diff changeset
4506 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4507 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4508 playerAffected->pPlayerBuffs[PLAYER_BUFF_LUCK].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4509 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4510 break;
Ritor1
parents:
diff changeset
4511 case 256: //Fire Resistance
Ritor1
parents:
diff changeset
4512 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4513 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4514 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4515 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4516 break;
Ritor1
parents:
diff changeset
4517 case 257: //Air Resistance
Ritor1
parents:
diff changeset
4518 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4519 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4520 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4521 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4522 break;
Ritor1
parents:
diff changeset
4523 case 258: //Water Resistance
Ritor1
parents:
diff changeset
4524 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4525 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4526 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4527 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4528 break;
Ritor1
parents:
diff changeset
4529 case 259: //Earth Resistance
Ritor1
parents:
diff changeset
4530 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4531 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4532 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4533 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4534 break;
Ritor1
parents:
diff changeset
4535 case 260: //Mind Resistance
Ritor1
parents:
diff changeset
4536 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4537 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4538 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4539 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4540 break;
Ritor1
parents:
diff changeset
4541 case 261: //Body Resistance
Ritor1
parents:
diff changeset
4542 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4543 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4544 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4545 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4546 break;
Ritor1
parents:
diff changeset
4547 case 262: //Stone to Flesh
Ritor1
parents:
diff changeset
4548 playerAffected->pConditions[Condition_Pertified] = 0i64;
Ritor1
parents:
diff changeset
4549 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4550 break;
Ritor1
parents:
diff changeset
4551 case 264: //Pure Luck
Ritor1
parents:
diff changeset
4552 if ( !playerAffected->pure_luck_used )
Ritor1
parents:
diff changeset
4553 {
Ritor1
parents:
diff changeset
4554 playerAffected->uLuck += 50;
Ritor1
parents:
diff changeset
4555 playerAffected->pure_luck_used = 1;
Ritor1
parents:
diff changeset
4556 }
Ritor1
parents:
diff changeset
4557 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4558 break;
Ritor1
parents:
diff changeset
4559 case 265: //Pure Speed
Ritor1
parents:
diff changeset
4560 if ( !playerAffected->pure_speed_used )
Ritor1
parents:
diff changeset
4561 {
Ritor1
parents:
diff changeset
4562 playerAffected->uSpeed += 50;
Ritor1
parents:
diff changeset
4563 playerAffected->pure_speed_used = 1;
Ritor1
parents:
diff changeset
4564 }
Ritor1
parents:
diff changeset
4565 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4566 break;
Ritor1
parents:
diff changeset
4567 case 266: //Pure Intellect
Ritor1
parents:
diff changeset
4568 if ( !playerAffected->pure_intellect_used )
Ritor1
parents:
diff changeset
4569 {
Ritor1
parents:
diff changeset
4570 playerAffected->uIntelligence += 50;
Ritor1
parents:
diff changeset
4571 playerAffected->pure_intellect_used = 1;
Ritor1
parents:
diff changeset
4572 }
Ritor1
parents:
diff changeset
4573 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4574 break;
Ritor1
parents:
diff changeset
4575 case 267: //Pure Endurance
Ritor1
parents:
diff changeset
4576 if ( !playerAffected->pure_endurance_used )
Ritor1
parents:
diff changeset
4577 {
Ritor1
parents:
diff changeset
4578 playerAffected->uEndurance += 50;
Ritor1
parents:
diff changeset
4579 playerAffected->pure_endurance_used = 1;
Ritor1
parents:
diff changeset
4580 }
Ritor1
parents:
diff changeset
4581 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4582 break;
Ritor1
parents:
diff changeset
4583 case 268: //Pure Personality
Ritor1
parents:
diff changeset
4584 if ( !playerAffected->pure_willpower_used )
Ritor1
parents:
diff changeset
4585 {
Ritor1
parents:
diff changeset
4586 playerAffected->uWillpower += 50;
Ritor1
parents:
diff changeset
4587 playerAffected->pure_willpower_used = 1;
Ritor1
parents:
diff changeset
4588 }
Ritor1
parents:
diff changeset
4589 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4590 break;
Ritor1
parents:
diff changeset
4591 case 269: //Pure Accuracy
Ritor1
parents:
diff changeset
4592 if ( !playerAffected->pure_accuracy_used )
Ritor1
parents:
diff changeset
4593 {
Ritor1
parents:
diff changeset
4594 playerAffected->uAccuracy += 50;
Ritor1
parents:
diff changeset
4595 playerAffected->pure_accuracy_used = 1;
Ritor1
parents:
diff changeset
4596 }
Ritor1
parents:
diff changeset
4597 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4598 break;
Ritor1
parents:
diff changeset
4599 case 270: //Pure Might
Ritor1
parents:
diff changeset
4600 if ( !playerAffected->pure_might_used )
Ritor1
parents:
diff changeset
4601 {
Ritor1
parents:
diff changeset
4602 playerAffected->uMight += 50;
Ritor1
parents:
diff changeset
4603 playerAffected->pure_might_used = 1;
Ritor1
parents:
diff changeset
4604 }
Ritor1
parents:
diff changeset
4605 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4606 break;
Ritor1
parents:
diff changeset
4607 case 271: //Rejuvenation
Ritor1
parents:
diff changeset
4608 playerAffected->sAgeModifier = 0;
Ritor1
parents:
diff changeset
4609 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4610 break;
Ritor1
parents:
diff changeset
4611
Ritor1
parents:
diff changeset
4612 default:
Ritor1
parents:
diff changeset
4613 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4614 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4615 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4616 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4617 return;
Ritor1
parents:
diff changeset
4618 }
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4619 pAudioPlayer->PlaySound(SOUND_drink, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4620 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4621 {
Ritor1
parents:
diff changeset
4622 // if ( !v73 ) v73 is always 1 at this point
Ritor1
parents:
diff changeset
4623 // {
Ritor1
parents:
diff changeset
4624 // pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4625 // return;
Ritor1
parents:
diff changeset
4626 // }
Ritor1
parents:
diff changeset
4627 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4628 }
Ritor1
parents:
diff changeset
4629 if ( v73 )
Ritor1
parents:
diff changeset
4630 {
Ritor1
parents:
diff changeset
4631 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4632 {
Ritor1
parents:
diff changeset
4633 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4634 this->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4635 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4636 }
Ritor1
parents:
diff changeset
4637 else
Ritor1
parents:
diff changeset
4638 {
Ritor1
parents:
diff changeset
4639 this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
Ritor1
parents:
diff changeset
4640 }
Ritor1
parents:
diff changeset
4641 }
Ritor1
parents:
diff changeset
4642 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4643 return;
Ritor1
parents:
diff changeset
4644 }
Ritor1
parents:
diff changeset
4645
Ritor1
parents:
diff changeset
4646
Ritor1
parents:
diff changeset
4647 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_SPELL_SCROLL )
Ritor1
parents:
diff changeset
4648 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4649 if ( current_screen_type == SCREEN_CASTING )
2498
Ritor1
parents:
diff changeset
4650 return;
Ritor1
parents:
diff changeset
4651 if ( !playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4652 {
Ritor1
parents:
diff changeset
4653
Ritor1
parents:
diff changeset
4654 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4655 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4656 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4657 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4658 return;
Ritor1
parents:
diff changeset
4659 }
Ritor1
parents:
diff changeset
4660 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
4661 {
Ritor1
parents:
diff changeset
4662 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4663 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4664 return;
Ritor1
parents:
diff changeset
4665 }
Ritor1
parents:
diff changeset
4666
Ritor1
parents:
diff changeset
4667 scroll_id = pParty->pPickedItem.uItemID - 299;
Ritor1
parents:
diff changeset
4668 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
Ritor1
parents:
diff changeset
4669 {
Ritor1
parents:
diff changeset
4670 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4671 pGUIWindow_CurrentMenu->Release();
Ritor1
parents:
diff changeset
4672 pIcons_LOD->RemoveTexturesPackFromTextureList();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4673 current_screen_type = SCREEN_GAME;
2498
Ritor1
parents:
diff changeset
4674 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
4675 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
Ritor1
parents:
diff changeset
4676 }
Ritor1
parents:
diff changeset
4677 else
Ritor1
parents:
diff changeset
4678 {
Ritor1
parents:
diff changeset
4679 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4680 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
2543
b6140dfeac27 GameOver h/cpp
a.parshin
parents: 2541
diff changeset
4681 if (current_screen_type != SCREEN_GAME && pGUIWindow_CurrentMenu
2498
Ritor1
parents:
diff changeset
4682 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
Ritor1
parents:
diff changeset
4683 {
Ritor1
parents:
diff changeset
4684 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4685 }
Ritor1
parents:
diff changeset
4686 }
Ritor1
parents:
diff changeset
4687 return;
Ritor1
parents:
diff changeset
4688 }
Ritor1
parents:
diff changeset
4689
Ritor1
parents:
diff changeset
4690 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_BOOK )
Ritor1
parents:
diff changeset
4691 {
Ritor1
parents:
diff changeset
4692 v15 = pParty->pPickedItem.uItemID - 400;
Ritor1
parents:
diff changeset
4693 v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
Ritor1
parents:
diff changeset
4694 if ( v72 )
Ritor1
parents:
diff changeset
4695 {
Ritor1
parents:
diff changeset
4696 v66 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4697 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4698 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4699 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4700 return;
Ritor1
parents:
diff changeset
4701 }
Ritor1
parents:
diff changeset
4702 if ( !playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4703 {
Ritor1
parents:
diff changeset
4704 v66 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4705 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
Ritor1
parents:
diff changeset
4706 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4707 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4708 return;
Ritor1
parents:
diff changeset
4709 }
Ritor1
parents:
diff changeset
4710 v16 = v15 % 11 + 1;
Ritor1
parents:
diff changeset
4711 v17 = playerAffected->pActiveSkills[v15 / 11 + 12];
Ritor1
parents:
diff changeset
4712 v18 = SkillToMastery(v17) - 1;
Ritor1
parents:
diff changeset
4713 switch (v18)
Ritor1
parents:
diff changeset
4714 {
Ritor1
parents:
diff changeset
4715 case 0: v67 = 4; break;
Ritor1
parents:
diff changeset
4716 case 1: v67 = 7; break;
Ritor1
parents:
diff changeset
4717 case 2: v67 = 10; break;
Ritor1
parents:
diff changeset
4718 case 3: v67 = 11; break;
Ritor1
parents:
diff changeset
4719 default:
Ritor1
parents:
diff changeset
4720 v67 = player_num;
Ritor1
parents:
diff changeset
4721 }
Ritor1
parents:
diff changeset
4722
Ritor1
parents:
diff changeset
4723 if ( v16 > v67 || !v17 )
Ritor1
parents:
diff changeset
4724 {
Ritor1
parents:
diff changeset
4725 v22 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4726 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
Ritor1
parents:
diff changeset
4727 ShowStatusBarString(pTmpBuf.data(), 2);
Ritor1
parents:
diff changeset
4728 playerAffected->PlaySound((PlayerSpeech)20, 0);
Ritor1
parents:
diff changeset
4729 return;
Ritor1
parents:
diff changeset
4730 }
Ritor1
parents:
diff changeset
4731 playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400] = 1;
Ritor1
parents:
diff changeset
4732 playerAffected->PlaySound(SPEECH_21, 0);
Ritor1
parents:
diff changeset
4733 v73 = 0;
Ritor1
parents:
diff changeset
4734
Ritor1
parents:
diff changeset
4735
Ritor1
parents:
diff changeset
4736 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4737 {
Ritor1
parents:
diff changeset
4738 if ( !v73 )
Ritor1
parents:
diff changeset
4739 {
Ritor1
parents:
diff changeset
4740 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4741 return;
Ritor1
parents:
diff changeset
4742 }
Ritor1
parents:
diff changeset
4743 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4744 }
Ritor1
parents:
diff changeset
4745 // if ( v73 ) v73 is always 0 at this point
Ritor1
parents:
diff changeset
4746 // {
Ritor1
parents:
diff changeset
4747 // if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4748 // {
Ritor1
parents:
diff changeset
4749 // pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4750 // thisb->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4751 // pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4752 // }
Ritor1
parents:
diff changeset
4753 // else
Ritor1
parents:
diff changeset
4754 // {
Ritor1
parents:
diff changeset
4755 // thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
Ritor1
parents:
diff changeset
4756 // }
Ritor1
parents:
diff changeset
4757 // }
Ritor1
parents:
diff changeset
4758 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4759 return;
Ritor1
parents:
diff changeset
4760 }
Ritor1
parents:
diff changeset
4761
Ritor1
parents:
diff changeset
4762 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_MESSAGE_SCROLL )
Ritor1
parents:
diff changeset
4763 {
Ritor1
parents:
diff changeset
4764 if ( playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4765 {
Ritor1
parents:
diff changeset
4766 CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
Ritor1
parents:
diff changeset
4767 playerAffected->PlaySound(SPEECH_37, 0);
Ritor1
parents:
diff changeset
4768 return;
Ritor1
parents:
diff changeset
4769 }
Ritor1
parents:
diff changeset
4770 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4771 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);//That player is %s
Ritor1
parents:
diff changeset
4772 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4773 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4774 return;
Ritor1
parents:
diff changeset
4775 }
Ritor1
parents:
diff changeset
4776 else
Ritor1
parents:
diff changeset
4777 {
Ritor1
parents:
diff changeset
4778 if (pParty->pPickedItem.uItemID == 616) //Genie Lamp
Ritor1
parents:
diff changeset
4779 {
Ritor1
parents:
diff changeset
4780 thisa = pParty->uCurrentMonthWeek + 1;
Ritor1
parents:
diff changeset
4781 if ( pParty->uCurrentMonth >= 7 )
Ritor1
parents:
diff changeset
4782 v74 = nullptr;
Ritor1
parents:
diff changeset
4783 else
Ritor1
parents:
diff changeset
4784 v74 = aAttributeNames[pParty->uCurrentMonth];
Ritor1
parents:
diff changeset
4785 switch ( pParty->uCurrentMonth )
Ritor1
parents:
diff changeset
4786 {
Ritor1
parents:
diff changeset
4787 case 0:
Ritor1
parents:
diff changeset
4788 playerAffected->uMight += thisa;
Ritor1
parents:
diff changeset
4789 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4790 break;
Ritor1
parents:
diff changeset
4791 case 1:
Ritor1
parents:
diff changeset
4792 playerAffected->uIntelligence += thisa;
Ritor1
parents:
diff changeset
4793 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4794 break;
Ritor1
parents:
diff changeset
4795 case 2:
Ritor1
parents:
diff changeset
4796 playerAffected->uWillpower += thisa;
Ritor1
parents:
diff changeset
4797 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4798 break;
Ritor1
parents:
diff changeset
4799 case 3:
Ritor1
parents:
diff changeset
4800 playerAffected->uEndurance += thisa;
Ritor1
parents:
diff changeset
4801 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4802 break;
Ritor1
parents:
diff changeset
4803 case 4:
Ritor1
parents:
diff changeset
4804 playerAffected->uAccuracy += thisa;
Ritor1
parents:
diff changeset
4805 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4806 break;
Ritor1
parents:
diff changeset
4807 case 5:
Ritor1
parents:
diff changeset
4808 playerAffected->uSpeed += thisa;
Ritor1
parents:
diff changeset
4809 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4810 break;
Ritor1
parents:
diff changeset
4811 case 6:
Ritor1
parents:
diff changeset
4812 playerAffected->uLuck += thisa;
Ritor1
parents:
diff changeset
4813 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4814 break;
Ritor1
parents:
diff changeset
4815 case 7:
Ritor1
parents:
diff changeset
4816 pParty->PartyFindsGold(1000 * thisa, 0);
Ritor1
parents:
diff changeset
4817 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
Ritor1
parents:
diff changeset
4818 break;
Ritor1
parents:
diff changeset
4819 case 8:
Ritor1
parents:
diff changeset
4820 Party::GiveFood(5 * thisa);
Ritor1
parents:
diff changeset
4821 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
Ritor1
parents:
diff changeset
4822 break;
Ritor1
parents:
diff changeset
4823 case 9u:
Ritor1
parents:
diff changeset
4824 playerAffected->uSkillPoints += 2 * thisa;
Ritor1
parents:
diff changeset
4825 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
Ritor1
parents:
diff changeset
4826 break;
Ritor1
parents:
diff changeset
4827 case 10:
Ritor1
parents:
diff changeset
4828 playerAffected->uExperience += 2500 * thisa;
Ritor1
parents:
diff changeset
4829 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
Ritor1
parents:
diff changeset
4830 break;
Ritor1
parents:
diff changeset
4831 case 11:
Ritor1
parents:
diff changeset
4832 v8 = rand() % 6;
Ritor1
parents:
diff changeset
4833 switch (v8)
Ritor1
parents:
diff changeset
4834 {
Ritor1
parents:
diff changeset
4835 case 0:
Ritor1
parents:
diff changeset
4836 playerAffected->sResFireBase += thisa;
Ritor1
parents:
diff changeset
4837 v13 = pGlobalTXT_LocalizationStrings[87];//Fire
Ritor1
parents:
diff changeset
4838 break;
Ritor1
parents:
diff changeset
4839 case 1:
Ritor1
parents:
diff changeset
4840 playerAffected->sResAirBase += thisa;
Ritor1
parents:
diff changeset
4841 v13 = pGlobalTXT_LocalizationStrings[6];//Air
Ritor1
parents:
diff changeset
4842 break;
Ritor1
parents:
diff changeset
4843 case 2:
Ritor1
parents:
diff changeset
4844 playerAffected->sResWaterBase += thisa;
Ritor1
parents:
diff changeset
4845 v13 = pGlobalTXT_LocalizationStrings[240];//Water
Ritor1
parents:
diff changeset
4846 break;
Ritor1
parents:
diff changeset
4847 case 3:
Ritor1
parents:
diff changeset
4848 playerAffected->sResEarthBase += thisa;
Ritor1
parents:
diff changeset
4849 v13 = pGlobalTXT_LocalizationStrings[70];//Earth
Ritor1
parents:
diff changeset
4850 break;
Ritor1
parents:
diff changeset
4851 case 4:
Ritor1
parents:
diff changeset
4852 playerAffected->sResMindBase += thisa;
Ritor1
parents:
diff changeset
4853 v13 = pGlobalTXT_LocalizationStrings[142];//Mind
Ritor1
parents:
diff changeset
4854 break;
Ritor1
parents:
diff changeset
4855 case 5:
Ritor1
parents:
diff changeset
4856 playerAffected->sResBodyBase += thisa;
Ritor1
parents:
diff changeset
4857 v13 = pGlobalTXT_LocalizationStrings[29];//Body
Ritor1
parents:
diff changeset
4858 break;
Ritor1
parents:
diff changeset
4859 default: ("Unexpected attribute");
Ritor1
parents:
diff changeset
4860 return;
Ritor1
parents:
diff changeset
4861 }
Ritor1
parents:
diff changeset
4862 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);//Permanent
Ritor1
parents:
diff changeset
4863 break;
Ritor1
parents:
diff changeset
4864
Ritor1
parents:
diff changeset
4865 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4866 ShowStatusBarString(pTmpBuf.data(), 2);
2498
Ritor1
parents:
diff changeset
4867 pMouse->RemoveHoldingItem();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4868 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
2498
Ritor1
parents:
diff changeset
4869 playerAffected->PlaySound(SPEECH_93, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4870 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4871 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4872 {
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4873 playerAffected->SetCondition(Condition_Eradicated, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4874 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4875 }
2498
Ritor1
parents:
diff changeset
4876 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4877 {
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4878 playerAffected->SetCondition(Condition_Dead, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4879 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4880 }
2498
Ritor1
parents:
diff changeset
4881 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
Ritor1
parents:
diff changeset
4882 {
Ritor1
parents:
diff changeset
4883 playerAffected->SetCondition(Condition_Pertified, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4884 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4885 }
Ritor1
parents:
diff changeset
4886 return;
Ritor1
parents:
diff changeset
4887 }
Ritor1
parents:
diff changeset
4888 else if ( pParty->pPickedItem.uItemID == 630 ) //Red Apple
Ritor1
parents:
diff changeset
4889 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4890 Party::GiveFood(1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4891 pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4892 }
Ritor1
parents:
diff changeset
4893 else if ( pParty->pPickedItem.uItemID == 632 ) //Lute
Ritor1
parents:
diff changeset
4894 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4895 pAudioPlayer->PlaySound(SOUND_luteguitar, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4896 return;
Ritor1
parents:
diff changeset
4897 }
Ritor1
parents:
diff changeset
4898 else if ( pParty->pPickedItem.uItemID == 633 ) //Faerie Pipes
Ritor1
parents:
diff changeset
4899 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4900 pAudioPlayer->PlaySound(SOUND_panflute, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4901 return;
Ritor1
parents:
diff changeset
4902 }
Ritor1
parents:
diff changeset
4903 else if ( pParty->pPickedItem.uItemID == 634 ) //Gryphonheart's Trumpet
Ritor1
parents:
diff changeset
4904 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4905 pAudioPlayer->PlaySound(SOUND_trumpet, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4906 return;
Ritor1
parents:
diff changeset
4907 }
Ritor1
parents:
diff changeset
4908 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
Ritor1
parents:
diff changeset
4909 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4910 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
2498
Ritor1
parents:
diff changeset
4911 v5 = PID(OBJECT_Player, player_num + 49);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4912 pAudioPlayer->PlaySound(SOUND_quest, v5, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4913 playerAffected->AddVariable(VAR_NumSkillPoints, 2);
Ritor1
parents:
diff changeset
4914 }
Ritor1
parents:
diff changeset
4915 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
Ritor1
parents:
diff changeset
4916 {
Ritor1
parents:
diff changeset
4917 TeleportToNWCDungeon();
Ritor1
parents:
diff changeset
4918 return;
Ritor1
parents:
diff changeset
4919 }
Ritor1
parents:
diff changeset
4920 else
Ritor1
parents:
diff changeset
4921 {
Ritor1
parents:
diff changeset
4922 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4923 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4924 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4925 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4926 return;
Ritor1
parents:
diff changeset
4927 }
Ritor1
parents:
diff changeset
4928
Ritor1
parents:
diff changeset
4929 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4930 return;
Ritor1
parents:
diff changeset
4931 }
Ritor1
parents:
diff changeset
4932 }
Ritor1
parents:
diff changeset
4933
Ritor1
parents:
diff changeset
4934 bool CmpSkillValue(int valToCompare, int skillValue)
Ritor1
parents:
diff changeset
4935 {
Ritor1
parents:
diff changeset
4936 int v4;
Ritor1
parents:
diff changeset
4937 if ( valToCompare <= 63 )
Ritor1
parents:
diff changeset
4938 v4 = skillValue & 0x3F;
Ritor1
parents:
diff changeset
4939 else
Ritor1
parents:
diff changeset
4940 v4 = skillValue & skillValue;
Ritor1
parents:
diff changeset
4941 return v4 >= valToCompare;
Ritor1
parents:
diff changeset
4942 }
Ritor1
parents:
diff changeset
4943
Ritor1
parents:
diff changeset
4944 //----- (00449BB4) --------------------------------------------------------
Ritor1
parents:
diff changeset
4945 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default
Ritor1
parents:
diff changeset
4946 {
Ritor1
parents:
diff changeset
4947 Assert(pValue >= 0, "Compare variable shouldn't have negative arguments");
Ritor1
parents:
diff changeset
4948
Ritor1
parents:
diff changeset
4949 signed int v4; // edi@1
Ritor1
parents:
diff changeset
4950 unsigned __int8 test_bit_value; // eax@25
Ritor1
parents:
diff changeset
4951 unsigned __int8 byteWithRequestedBit; // cl@25
Ritor1
parents:
diff changeset
4952 DDM_DLV_Header *v19; // eax@122
Ritor1
parents:
diff changeset
4953 DDM_DLV_Header *v21; // eax@126
Ritor1
parents:
diff changeset
4954 int actStat; // ebx@161
Ritor1
parents:
diff changeset
4955 int baseStat; // eax@161
Ritor1
parents:
diff changeset
4956
Ritor1
parents:
diff changeset
4957
Ritor1
parents:
diff changeset
4958 if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
4959 return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum];
Ritor1
parents:
diff changeset
4960 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
4961 return (unsigned __int8)stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] > 0; //not really sure whether the number gets up to 99, but can't ignore the possibility
Ritor1
parents:
diff changeset
4962
Ritor1
parents:
diff changeset
4963 switch ( VarNum )
Ritor1
parents:
diff changeset
4964 {
Ritor1
parents:
diff changeset
4965 case VAR_Sex:
Ritor1
parents:
diff changeset
4966 return ( pValue == this->uSex );
Ritor1
parents:
diff changeset
4967 case VAR_Class:
Ritor1
parents:
diff changeset
4968 return ( pValue == this->classType );
Ritor1
parents:
diff changeset
4969 case VAR_Race:
Ritor1
parents:
diff changeset
4970 return pValue == GetRace();
Ritor1
parents:
diff changeset
4971 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
4972 return this->sHealth >= pValue;
Ritor1
parents:
diff changeset
4973 case VAR_MaxHP:
Ritor1
parents:
diff changeset
4974 return (this->sHealth >= GetMaxHealth());
Ritor1
parents:
diff changeset
4975 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
4976 return this->sMana >= pValue;
Ritor1
parents:
diff changeset
4977 case VAR_MaxSP:
Ritor1
parents:
diff changeset
4978 return (this->sMana >= GetMaxMana());
Ritor1
parents:
diff changeset
4979 case VAR_ActualAC:
Ritor1
parents:
diff changeset
4980 return GetActualAC() >= pValue;
Ritor1
parents:
diff changeset
4981 case VAR_ACModifier:
Ritor1
parents:
diff changeset
4982 return this->sACModifier >= pValue;
Ritor1
parents:
diff changeset
4983 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
4984 return this->uLevel >= pValue;
Ritor1
parents:
diff changeset
4985 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
4986 return this->sLevelModifier >= pValue;
Ritor1
parents:
diff changeset
4987 case VAR_Age:
Ritor1
parents:
diff changeset
4988 return GetActualAge() >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
4989 case VAR_Award:
Ritor1
parents:
diff changeset
4990 return _449B57_test_bit(this->_achieved_awards_bits, pValue);
Ritor1
parents:
diff changeset
4991 case VAR_Experience:
Ritor1
parents:
diff changeset
4992 return this->uExperience >= pValue; //TODO change pValue to long long
Ritor1
parents:
diff changeset
4993 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
4994 return _449B57_test_bit(pParty->_quest_bits, pValue);
Ritor1
parents:
diff changeset
4995 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
4996 //for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
4997 for (int i = 0; i < 126; i++)
Ritor1
parents:
diff changeset
4998 {
Ritor1
parents:
diff changeset
4999 if (pInventoryItemList[i].uItemID == pValue)
Ritor1
parents:
diff changeset
5000 {
Ritor1
parents:
diff changeset
5001 return true;
Ritor1
parents:
diff changeset
5002 }
Ritor1
parents:
diff changeset
5003 }
Ritor1
parents:
diff changeset
5004 return pParty->pPickedItem.uItemID == pValue;
Ritor1
parents:
diff changeset
5005 case VAR_Hour:
Ritor1
parents:
diff changeset
5006 if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue )
Ritor1
parents:
diff changeset
5007 return true;
Ritor1
parents:
diff changeset
5008 return false;
Ritor1
parents:
diff changeset
5009 case VAR_DayOfYear:
Ritor1
parents:
diff changeset
5010 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue)
Ritor1
parents:
diff changeset
5011 return true;
Ritor1
parents:
diff changeset
5012 return false;
Ritor1
parents:
diff changeset
5013 case VAR_DayOfWeek:
Ritor1
parents:
diff changeset
5014 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7)
Ritor1
parents:
diff changeset
5015 return true;
Ritor1
parents:
diff changeset
5016 return false;
Ritor1
parents:
diff changeset
5017 case VAR_FixedGold:
Ritor1
parents:
diff changeset
5018 return pParty->uNumGold >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5019 case VAR_FixedFood:
Ritor1
parents:
diff changeset
5020 return pParty->uNumFoodRations >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5021 case VAR_MightBonus:
Ritor1
parents:
diff changeset
5022 return this->uMightBonus >= pValue;
Ritor1
parents:
diff changeset
5023 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
5024 return this->uIntelligenceBonus >= pValue;
Ritor1
parents:
diff changeset
5025 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
5026 return this->uWillpowerBonus >= pValue;
Ritor1
parents:
diff changeset
5027 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
5028 return this->uEnduranceBonus >= pValue;
Ritor1
parents:
diff changeset
5029 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
5030 return this->uSpeedBonus >= pValue;
Ritor1
parents:
diff changeset
5031 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
5032 return this->uAccuracyBonus >= pValue;
Ritor1
parents:
diff changeset
5033 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
5034 return this->uLuckBonus >= pValue;
Ritor1
parents:
diff changeset
5035 case VAR_BaseMight:
Ritor1
parents:
diff changeset
5036 return this->uMight >= pValue;
Ritor1
parents:
diff changeset
5037 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
5038 return this->uIntelligence >= pValue;
Ritor1
parents:
diff changeset
5039 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
5040 return this->uWillpower >= pValue;
Ritor1
parents:
diff changeset
5041 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
5042 return this->uEndurance >= pValue;
Ritor1
parents:
diff changeset
5043 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
5044 return this->uSpeed >= pValue;
Ritor1
parents:
diff changeset
5045 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
5046 return this->uAccuracy >= pValue;
Ritor1
parents:
diff changeset
5047 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
5048 return this->uLuck >= pValue;
Ritor1
parents:
diff changeset
5049 case VAR_ActualMight:
Ritor1
parents:
diff changeset
5050 return GetActualMight() >= pValue;
Ritor1
parents:
diff changeset
5051 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
5052 return GetActualIntelligence() >= pValue;
Ritor1
parents:
diff changeset
5053 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
5054 return GetActualWillpower() >= pValue;
Ritor1
parents:
diff changeset
5055 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
5056 return GetActualEndurance() >= pValue;
Ritor1
parents:
diff changeset
5057 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
5058 return GetActualSpeed() >= pValue;
Ritor1
parents:
diff changeset
5059 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
5060 return GetActualAccuracy() >= pValue;
Ritor1
parents:
diff changeset
5061 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
5062 return GetActualLuck() >= pValue;
Ritor1
parents:
diff changeset
5063 case VAR_FireResistance:
Ritor1
parents:
diff changeset
5064 return this->sResFireBase >= pValue;
Ritor1
parents:
diff changeset
5065 case VAR_AirResistance:
Ritor1
parents:
diff changeset
5066 return this->sResAirBase >= pValue;
Ritor1
parents:
diff changeset
5067 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
5068 return this->sResWaterBase >= pValue;
Ritor1
parents:
diff changeset
5069 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
5070 return this->sResEarthBase >= pValue;
Ritor1
parents:
diff changeset
5071 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
5072 return this->sResSpiritBase >= pValue;
Ritor1
parents:
diff changeset
5073 case VAR_MindResistance:
Ritor1
parents:
diff changeset
5074 return this->sResMindBase >= pValue;
Ritor1
parents:
diff changeset
5075 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
5076 return this->sResBodyBase >= pValue;
Ritor1
parents:
diff changeset
5077 case VAR_LightResistance:
Ritor1
parents:
diff changeset
5078 return this->sResLightBase >= pValue;
Ritor1
parents:
diff changeset
5079 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
5080 return this->sResDarkBase >= pValue;
Ritor1
parents:
diff changeset
5081 case VAR_PhysicalResistance:
Ritor1
parents:
diff changeset
5082 Error("Physical resistance isn't used in events");
Ritor1
parents:
diff changeset
5083 return false;
Ritor1
parents:
diff changeset
5084 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
5085 return this->sResMagicBase >= pValue;
Ritor1
parents:
diff changeset
5086 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
5087 return this->sResFireBonus >= pValue;
Ritor1
parents:
diff changeset
5088 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
5089 return this->sResAirBonus >= pValue;
Ritor1
parents:
diff changeset
5090 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
5091 return this->sResWaterBonus >= pValue;
Ritor1
parents:
diff changeset
5092 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
5093 return this->sResEarthBonus >= pValue;
Ritor1
parents:
diff changeset
5094 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
5095 return this->sResSpiritBonus >= pValue;
Ritor1
parents:
diff changeset
5096 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
5097 return this->sResMindBonus >= pValue;
Ritor1
parents:
diff changeset
5098 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
5099 return this->sResBodyBonus >= pValue;
Ritor1
parents:
diff changeset
5100 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
5101 return this->sResLightBonus >= pValue;
Ritor1
parents:
diff changeset
5102 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
5103 return this->sResDarkBonus >= pValue;
Ritor1
parents:
diff changeset
5104 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
5105 return this->sResMagicBonus >= pValue;
Ritor1
parents:
diff changeset
5106 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
5107 return CmpSkillValue(pValue, this->skillStaff);
Ritor1
parents:
diff changeset
5108 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
5109 return CmpSkillValue(pValue, this->skillSword);
Ritor1
parents:
diff changeset
5110 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
5111 return CmpSkillValue(pValue, this->skillDagger);
Ritor1
parents:
diff changeset
5112 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
5113 return CmpSkillValue(pValue, this->skillAxe);
Ritor1
parents:
diff changeset
5114 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
5115 return CmpSkillValue(pValue, this->skillSpear);
Ritor1
parents:
diff changeset
5116 case VAR_BowSkill:
Ritor1
parents:
diff changeset
5117 return CmpSkillValue(pValue, this->skillBow);
Ritor1
parents:
diff changeset
5118 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
5119 return CmpSkillValue(pValue, this->skillMace);
Ritor1
parents:
diff changeset
5120 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
5121 return CmpSkillValue(pValue, this->skillBlaster);
Ritor1
parents:
diff changeset
5122 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
5123 return CmpSkillValue(pValue, this->skillShield);
Ritor1
parents:
diff changeset
5124 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
5125 return CmpSkillValue(pValue, this->skillLeather);
Ritor1
parents:
diff changeset
5126 case VAR_SkillChain:
Ritor1
parents:
diff changeset
5127 return CmpSkillValue(pValue, this->skillChain);
Ritor1
parents:
diff changeset
5128 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
5129 return CmpSkillValue(pValue, this->skillPlate);
Ritor1
parents:
diff changeset
5130 case VAR_FireSkill:
Ritor1
parents:
diff changeset
5131 return CmpSkillValue(pValue, this->skillFire);
Ritor1
parents:
diff changeset
5132 case VAR_AirSkill:
Ritor1
parents:
diff changeset
5133 return CmpSkillValue(pValue, this->skillAir);
Ritor1
parents:
diff changeset
5134 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
5135 return CmpSkillValue(pValue, this->skillWater);
Ritor1
parents:
diff changeset
5136 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
5137 return CmpSkillValue(pValue, this->skillEarth);
Ritor1
parents:
diff changeset
5138 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
5139 return CmpSkillValue(pValue, this->skillSpirit);
Ritor1
parents:
diff changeset
5140 case VAR_MindSkill:
Ritor1
parents:
diff changeset
5141 return CmpSkillValue(pValue, this->skillMind);
Ritor1
parents:
diff changeset
5142 case VAR_BodySkill:
Ritor1
parents:
diff changeset
5143 return CmpSkillValue(pValue, this->skillBody);
Ritor1
parents:
diff changeset
5144 case VAR_LightSkill:
Ritor1
parents:
diff changeset
5145 return CmpSkillValue(pValue, this->skillLight);
Ritor1
parents:
diff changeset
5146 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
5147 return CmpSkillValue(pValue, this->skillDark);
Ritor1
parents:
diff changeset
5148 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
5149 return CmpSkillValue(pValue, this->skillItemId);
Ritor1
parents:
diff changeset
5150 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
5151 return CmpSkillValue(pValue, this->skillMerchant);
Ritor1
parents:
diff changeset
5152 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
5153 return CmpSkillValue(pValue, this->skillRepair);
Ritor1
parents:
diff changeset
5154 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
5155 return CmpSkillValue(pValue, this->skillBodybuilding);
Ritor1
parents:
diff changeset
5156 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
5157 return CmpSkillValue(pValue, this->skillMeditation);
Ritor1
parents:
diff changeset
5158 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
5159 return CmpSkillValue(pValue, this->skillPerception);
Ritor1
parents:
diff changeset
5160 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
5161 return CmpSkillValue(pValue, this->skillDiplomacy);
Ritor1
parents:
diff changeset
5162 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
5163 Error("Thievery isn't used in events");
Ritor1
parents:
diff changeset
5164 return false;
Ritor1
parents:
diff changeset
5165 case VAR_DisarmTrapSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5166 return CmpSkillValue(pValue, this->skillDisarmTrap);
Ritor1
parents:
diff changeset
5167 case VAR_DodgeSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5168 return CmpSkillValue(pValue, this->skillDodge);
Ritor1
parents:
diff changeset
5169 case VAR_UnarmedSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5170 return CmpSkillValue(pValue, this->skillUnarmed);
Ritor1
parents:
diff changeset
5171 case VAR_IdentifyMonsterSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5172 return CmpSkillValue(pValue, this->skillMonsterId);
Ritor1
parents:
diff changeset
5173 case VAR_ArmsmasterSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5174 return CmpSkillValue(pValue, this->skillArmsmaster);
Ritor1
parents:
diff changeset
5175 case VAR_StealingSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5176 return CmpSkillValue(pValue, this->skillStealing);
Ritor1
parents:
diff changeset
5177 case VAR_AlchemySkill: //wasn't in the original
Ritor1
parents:
diff changeset
5178 return CmpSkillValue(pValue, this->skillAlchemy);
Ritor1
parents:
diff changeset
5179 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
5180 return CmpSkillValue(pValue, this->skillLearning);
Ritor1
parents:
diff changeset
5181 case VAR_Cursed:
Ritor1
parents:
diff changeset
5182 return pConditions[Condition_Cursed] > 0;
Ritor1
parents:
diff changeset
5183 case VAR_Weak:
Ritor1
parents:
diff changeset
5184 return pConditions[Condition_Weak] > 0;
Ritor1
parents:
diff changeset
5185 case VAR_Asleep:
Ritor1
parents:
diff changeset
5186 return pConditions[Condition_Sleep] > 0;
Ritor1
parents:
diff changeset
5187 case VAR_Afraid:
Ritor1
parents:
diff changeset
5188 return pConditions[Condition_Fear] > 0;
Ritor1
parents:
diff changeset
5189 case VAR_Drunk:
Ritor1
parents:
diff changeset
5190 return pConditions[Condition_Drunk] > 0;
Ritor1
parents:
diff changeset
5191 case VAR_Insane:
Ritor1
parents:
diff changeset
5192 return pConditions[Condition_Insane] > 0;
Ritor1
parents:
diff changeset
5193 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
5194 return pConditions[Condition_Poison_Weak] > 0;
Ritor1
parents:
diff changeset
5195 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
5196 return pConditions[Condition_Disease_Weak] > 0;
Ritor1
parents:
diff changeset
5197 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
5198 return pConditions[Condition_Poison_Medium] > 0;
Ritor1
parents:
diff changeset
5199 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
5200 return pConditions[Condition_Disease_Medium] > 0;
Ritor1
parents:
diff changeset
5201 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
5202 return pConditions[Condition_Poison_Severe] > 0;
Ritor1
parents:
diff changeset
5203 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
5204 return pConditions[Condition_Disease_Severe] > 0;
Ritor1
parents:
diff changeset
5205 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
5206 return pConditions[Condition_Paralyzed] > 0;
Ritor1
parents:
diff changeset
5207 case VAR_Unconsious:
Ritor1
parents:
diff changeset
5208 return pConditions[Condition_Unconcious] > 0;
Ritor1
parents:
diff changeset
5209 case VAR_Dead:
Ritor1
parents:
diff changeset
5210 return pConditions[Condition_Dead] > 0;
Ritor1
parents:
diff changeset
5211 case VAR_Stoned:
Ritor1
parents:
diff changeset
5212 return pConditions[Condition_Pertified] > 0;
Ritor1
parents:
diff changeset
5213 case VAR_Eradicated:
Ritor1
parents:
diff changeset
5214 return pConditions[Condition_Eradicated] > 0;
Ritor1
parents:
diff changeset
5215 case VAR_MajorCondition:
Ritor1
parents:
diff changeset
5216 v4 = GetMajorConditionIdx();
Ritor1
parents:
diff changeset
5217 if ( v4 != 18 )
Ritor1
parents:
diff changeset
5218 {
Ritor1
parents:
diff changeset
5219 return v4 >= pValue;
Ritor1
parents:
diff changeset
5220 }
Ritor1
parents:
diff changeset
5221 return true;
Ritor1
parents:
diff changeset
5222 case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used
Ritor1
parents:
diff changeset
5223 test_bit_value = 0x80u >> (pValue - 2) % 8;
Ritor1
parents:
diff changeset
5224 byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8];
Ritor1
parents:
diff changeset
5225 return (test_bit_value & byteWithRequestedBit) != 0;
Ritor1
parents:
diff changeset
5226 case VAR_IsMightMoreThanBase:
Ritor1
parents:
diff changeset
5227 actStat = GetActualMight();
Ritor1
parents:
diff changeset
5228 baseStat = GetBaseStrength();
Ritor1
parents:
diff changeset
5229 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5230 case VAR_IsIntellectMoreThanBase:
Ritor1
parents:
diff changeset
5231 actStat = GetActualIntelligence();
Ritor1
parents:
diff changeset
5232 baseStat = GetBaseIntelligence();
Ritor1
parents:
diff changeset
5233 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5234 case VAR_IsPersonalityMoreThanBase:
Ritor1
parents:
diff changeset
5235 actStat = GetActualWillpower();
Ritor1
parents:
diff changeset
5236 baseStat = GetBaseWillpower();
Ritor1
parents:
diff changeset
5237 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5238 case VAR_IsEnduranceMoreThanBase:
Ritor1
parents:
diff changeset
5239 actStat = GetActualEndurance();
Ritor1
parents:
diff changeset
5240 baseStat = GetBaseEndurance();
Ritor1
parents:
diff changeset
5241 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5242 case VAR_IsSpeedMoreThanBase:
Ritor1
parents:
diff changeset
5243 actStat = GetActualSpeed();
Ritor1
parents:
diff changeset
5244 baseStat = GetBaseSpeed();
Ritor1
parents:
diff changeset
5245 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5246 case VAR_IsAccuracyMoreThanBase:
Ritor1
parents:
diff changeset
5247 actStat = GetActualAccuracy();
Ritor1
parents:
diff changeset
5248 baseStat = GetBaseAccuracy();
Ritor1
parents:
diff changeset
5249 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5250 case VAR_IsLuckMoreThanBase:
Ritor1
parents:
diff changeset
5251 actStat = GetActualLuck();
Ritor1
parents:
diff changeset
5252 baseStat = GetBaseLuck();
Ritor1
parents:
diff changeset
5253 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5254 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
5255 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
Ritor1
parents:
diff changeset
5256 byteWithRequestedBit = this->playerEventBits[((signed __int16)pValue - 1)/8];
Ritor1
parents:
diff changeset
5257 return ( test_bit_value & byteWithRequestedBit ) != 0;
Ritor1
parents:
diff changeset
5258 case VAR_NPCs2:
Ritor1
parents:
diff changeset
5259 return pNPCStats->pNewNPCData[pValue].Hired();
Ritor1
parents:
diff changeset
5260 case VAR_IsFlying:
Ritor1
parents:
diff changeset
5261 if ( pParty->bFlying
Ritor1
parents:
diff changeset
5262 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) )
Ritor1
parents:
diff changeset
5263 return true;
Ritor1
parents:
diff changeset
5264 return false;
Ritor1
parents:
diff changeset
5265 case VAR_HiredNPCHasSpeciality:
Ritor1
parents:
diff changeset
5266 return CheckHiredNPCSpeciality(pValue);
Ritor1
parents:
diff changeset
5267 case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration
Ritor1
parents:
diff changeset
5268 v4 = 0;
Ritor1
parents:
diff changeset
5269 for (int playerNum = 0; playerNum < 4; playerNum++)
Ritor1
parents:
diff changeset
5270 {
Ritor1
parents:
diff changeset
5271 for (int invPos = 0; invPos < 138; invPos++)
Ritor1
parents:
diff changeset
5272 {
Ritor1
parents:
diff changeset
5273 int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID;
Ritor1
parents:
diff changeset
5274 switch ( itemId )
Ritor1
parents:
diff changeset
5275 {
Ritor1
parents:
diff changeset
5276 case 0x1D6u:
Ritor1
parents:
diff changeset
5277 ++v4;
Ritor1
parents:
diff changeset
5278 break;
Ritor1
parents:
diff changeset
5279 case 0x1D7u:
Ritor1
parents:
diff changeset
5280 v4 += 3;
Ritor1
parents:
diff changeset
5281 break;
Ritor1
parents:
diff changeset
5282 case 0x1DDu:
Ritor1
parents:
diff changeset
5283 v4 += 5;
Ritor1
parents:
diff changeset
5284 break;
Ritor1
parents:
diff changeset
5285 }
Ritor1
parents:
diff changeset
5286 }
Ritor1
parents:
diff changeset
5287 }
Ritor1
parents:
diff changeset
5288 return v4 >= pValue;
Ritor1
parents:
diff changeset
5289 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
5290 return this->uSkillPoints >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5291 case VAR_MonthIs:
Ritor1
parents:
diff changeset
5292 return (pParty->uCurrentMonth == (unsigned int)pValue);
Ritor1
parents:
diff changeset
5293 case VAR_Counter1:
Ritor1
parents:
diff changeset
5294 case VAR_Counter2:
Ritor1
parents:
diff changeset
5295 case VAR_Counter3:
Ritor1
parents:
diff changeset
5296 case VAR_Counter4:
Ritor1
parents:
diff changeset
5297 case VAR_Counter5:
Ritor1
parents:
diff changeset
5298 case VAR_Counter6:
Ritor1
parents:
diff changeset
5299 case VAR_Counter7:
Ritor1
parents:
diff changeset
5300 case VAR_Counter8:
Ritor1
parents:
diff changeset
5301 case VAR_Counter9:
Ritor1
parents:
diff changeset
5302 case VAR_Counter10:
Ritor1
parents:
diff changeset
5303 if (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1]) //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300])
Ritor1
parents:
diff changeset
5304 {
Ritor1
parents:
diff changeset
5305 return (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ;
Ritor1
parents:
diff changeset
5306 }
Ritor1
parents:
diff changeset
5307 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
5308 v19 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5309 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5310 v19 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5311 return (v19->uReputation >= pValue);
Ritor1
parents:
diff changeset
5312 case VAR_Unknown1:
Ritor1
parents:
diff changeset
5313 v21 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5314 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5315 v21 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5316 return (v21->field_C_alert == pValue); //yes, equality, not >=
Ritor1
parents:
diff changeset
5317 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
5318 return pParty->uNumGoldInBank >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5319 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
5320 return pParty->uNumDeaths >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5321 case VAR_NumBounties:
Ritor1
parents:
diff changeset
5322 return pParty->uNumBountiesCollected >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5323 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
5324 return pParty->uNumPrisonTerms >= pValue;
Ritor1
parents:
diff changeset
5325 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
5326 return (unsigned __int8)pParty->uNumArenaPageWins >= pValue;
Ritor1
parents:
diff changeset
5327 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
5328 return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue;
Ritor1
parents:
diff changeset
5329 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
5330 return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue;
Ritor1
parents:
diff changeset
5331 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
5332 return pParty->uNumArenaLordWins >= pValue;
Ritor1
parents:
diff changeset
5333 case VAR_Invisible:
Ritor1
parents:
diff changeset
5334 return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 );
Ritor1
parents:
diff changeset
5335 case VAR_ItemEquipped:
Ritor1
parents:
diff changeset
5336 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
5337 {
Ritor1
parents:
diff changeset
5338 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue )
Ritor1
parents:
diff changeset
5339 {
Ritor1
parents:
diff changeset
5340 return true;
Ritor1
parents:
diff changeset
5341 }
Ritor1
parents:
diff changeset
5342 }
Ritor1
parents:
diff changeset
5343 return false;
Ritor1
parents:
diff changeset
5344 }
Ritor1
parents:
diff changeset
5345
Ritor1
parents:
diff changeset
5346 return false;
Ritor1
parents:
diff changeset
5347 }
Ritor1
parents:
diff changeset
5348
Ritor1
parents:
diff changeset
5349
Ritor1
parents:
diff changeset
5350 //----- (0044A5CB) --------------------------------------------------------
Ritor1
parents:
diff changeset
5351 void Player::SetVariable(enum VariableType var_type, signed int var_value)
Ritor1
parents:
diff changeset
5352 {
Ritor1
parents:
diff changeset
5353 unsigned int v6; // esi@13
Ritor1
parents:
diff changeset
5354 unsigned int v7; // esi@14
Ritor1
parents:
diff changeset
5355 signed int v11; // eax@30
Ritor1
parents:
diff changeset
5356 DDM_DLV_Header *v24; // ecx@148
Ritor1
parents:
diff changeset
5357 ItemGen item; // [sp+Ch] [bp-28h]@52
Ritor1
parents:
diff changeset
5358
Ritor1
parents:
diff changeset
5359
Ritor1
parents:
diff changeset
5360 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
Ritor1
parents:
diff changeset
5361 {
Ritor1
parents:
diff changeset
5362 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
Ritor1
parents:
diff changeset
5363 {
Ritor1
parents:
diff changeset
5364 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
5365 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText)
Ritor1
parents:
diff changeset
5366 {
Ritor1
parents:
diff changeset
5367 bFlashHistoryBook = 1;
Ritor1
parents:
diff changeset
5368 PlayAwardSound();
Ritor1
parents:
diff changeset
5369 }
Ritor1
parents:
diff changeset
5370 }
Ritor1
parents:
diff changeset
5371 return;
Ritor1
parents:
diff changeset
5372 }
Ritor1
parents:
diff changeset
5373
Ritor1
parents:
diff changeset
5374 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5375 {
Ritor1
parents:
diff changeset
5376 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
5377 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = (char)var_value; // originally (unsigned __int8)byte_5E4C15[VarNum];
Ritor1
parents:
diff changeset
5378 if ( var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5379 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = (unsigned char)var_value; //not really sure whether the number gets up to 99, but can't ignore the possibility
Ritor1
parents:
diff changeset
5380 return;
Ritor1
parents:
diff changeset
5381 }
Ritor1
parents:
diff changeset
5382
Ritor1
parents:
diff changeset
5383 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
Ritor1
parents:
diff changeset
5384 {
Ritor1
parents:
diff changeset
5385 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed
Ritor1
parents:
diff changeset
5386 PlayAwardSound();
Ritor1
parents:
diff changeset
5387 return;
Ritor1
parents:
diff changeset
5388 }
Ritor1
parents:
diff changeset
5389
Ritor1
parents:
diff changeset
5390 switch ( var_type )
Ritor1
parents:
diff changeset
5391 {
Ritor1
parents:
diff changeset
5392 case VAR_Sex:
Ritor1
parents:
diff changeset
5393 this->uSex = (PLAYER_SEX)var_value;
Ritor1
parents:
diff changeset
5394 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5395 return;
Ritor1
parents:
diff changeset
5396 case VAR_Class:
Ritor1
parents:
diff changeset
5397 this->classType = (PLAYER_CLASS_TYPE)var_value;
Ritor1
parents:
diff changeset
5398 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
5399 {
Ritor1
parents:
diff changeset
5400 for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
5401 {
Ritor1
parents:
diff changeset
5402 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY)
Ritor1
parents:
diff changeset
5403 {
Ritor1
parents:
diff changeset
5404 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL;
Ritor1
parents:
diff changeset
5405 this->pOwnItems[i].uHolderPlayer = GetPlayerIndex() + 1;
Ritor1
parents:
diff changeset
5406 }
Ritor1
parents:
diff changeset
5407 }
Ritor1
parents:
diff changeset
5408 if ( this->sResFireBase < 20 )
Ritor1
parents:
diff changeset
5409 this->sResFireBase = 20;
Ritor1
parents:
diff changeset
5410 if ( this->sResAirBase < 20 )
Ritor1
parents:
diff changeset
5411 this->sResAirBase = 20;
Ritor1
parents:
diff changeset
5412 if ( this->sResWaterBase < 20 )
Ritor1
parents:
diff changeset
5413 this->sResWaterBase = 20;
Ritor1
parents:
diff changeset
5414 if ( this->sResEarthBase < 20 )
Ritor1
parents:
diff changeset
5415 this->sResEarthBase = 20;
Ritor1
parents:
diff changeset
5416 this->sResMindBase = 200;
Ritor1
parents:
diff changeset
5417 this->sResBodyBase = 200;
Ritor1
parents:
diff changeset
5418 v11 = this->GetSexByVoice();
Ritor1
parents:
diff changeset
5419 this->uPrevVoiceID = this->uVoiceID;
Ritor1
parents:
diff changeset
5420 this->uPrevFace = this->uCurrentFace;
Ritor1
parents:
diff changeset
5421 if ( v11 )
Ritor1
parents:
diff changeset
5422 {
Ritor1
parents:
diff changeset
5423 this->uCurrentFace = 21;
Ritor1
parents:
diff changeset
5424 this->uVoiceID = 21;
Ritor1
parents:
diff changeset
5425 }
Ritor1
parents:
diff changeset
5426 else
Ritor1
parents:
diff changeset
5427 {
Ritor1
parents:
diff changeset
5428 this->uCurrentFace = 20;
Ritor1
parents:
diff changeset
5429 this->uVoiceID = 20;
Ritor1
parents:
diff changeset
5430 }
Ritor1
parents:
diff changeset
5431 ReloadPlayerPortraits(GetPlayerIndex(), this->uCurrentFace);
Ritor1
parents:
diff changeset
5432 }
Ritor1
parents:
diff changeset
5433 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5434 return;
Ritor1
parents:
diff changeset
5435 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
5436 this->sHealth = var_value;
Ritor1
parents:
diff changeset
5437 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5438 return;
Ritor1
parents:
diff changeset
5439 case VAR_MaxHP:
Ritor1
parents:
diff changeset
5440 this->sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
5441 return;
Ritor1
parents:
diff changeset
5442 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
5443 this->sMana = var_value;
Ritor1
parents:
diff changeset
5444 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5445 return;
Ritor1
parents:
diff changeset
5446 case VAR_MaxSP:
Ritor1
parents:
diff changeset
5447 this->sMana = GetMaxMana();
Ritor1
parents:
diff changeset
5448 return;
Ritor1
parents:
diff changeset
5449 case VAR_ACModifier:
Ritor1
parents:
diff changeset
5450 this->sACModifier = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5451 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5452 return;
Ritor1
parents:
diff changeset
5453 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
5454 this->uLevel = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5455 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5456 return;
Ritor1
parents:
diff changeset
5457 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
5458 this->sLevelModifier = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5459 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5460 return;
Ritor1
parents:
diff changeset
5461 case VAR_Age:
Ritor1
parents:
diff changeset
5462 this->sAgeModifier = var_value;
Ritor1
parents:
diff changeset
5463 return;
Ritor1
parents:
diff changeset
5464 case VAR_Award:
Ritor1
parents:
diff changeset
5465 if ( !_449B57_test_bit(this->_achieved_awards_bits, var_value) && pAwards[var_value].pText )
Ritor1
parents:
diff changeset
5466 {
Ritor1
parents:
diff changeset
5467 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5468 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
5469 }
Ritor1
parents:
diff changeset
5470 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5471 return;
Ritor1
parents:
diff changeset
5472 case VAR_Experience:
Ritor1
parents:
diff changeset
5473 this->uExperience = var_value;
Ritor1
parents:
diff changeset
5474 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5475 return;
Ritor1
parents:
diff changeset
5476 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
5477 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] )
Ritor1
parents:
diff changeset
5478 {
Ritor1
parents:
diff changeset
5479 bFlashQuestBook = 1;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5480 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
5481 PlayAwardSound();
Ritor1
parents:
diff changeset
5482 this->PlaySound(SPEECH_93, 0);
Ritor1
parents:
diff changeset
5483 }
Ritor1
parents:
diff changeset
5484 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5485 return;
Ritor1
parents:
diff changeset
5486 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
5487 item.Reset();
Ritor1
parents:
diff changeset
5488 item.uItemID = var_value;
Ritor1
parents:
diff changeset
5489 item.uAttributes = 1;
Ritor1
parents:
diff changeset
5490 pParty->SetHoldingItem(&item);
Ritor1
parents:
diff changeset
5491 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER )
Ritor1
parents:
diff changeset
5492 pParty->pIsArtifactFound[var_value-500] = 1;
Ritor1
parents:
diff changeset
5493 return;
Ritor1
parents:
diff changeset
5494 case VAR_FixedGold:
Ritor1
parents:
diff changeset
5495 Party::SetGold(var_value);
Ritor1
parents:
diff changeset
5496 return;
Ritor1
parents:
diff changeset
5497 case VAR_RandomGold:
Ritor1
parents:
diff changeset
5498 v6 = rand() % var_value + 1;
Ritor1
parents:
diff changeset
5499 Party::SetGold(v6);
Ritor1
parents:
diff changeset
5500 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
Ritor1
parents:
diff changeset
5501 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
5502 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
5503 return;
Ritor1
parents:
diff changeset
5504 case VAR_FixedFood:
Ritor1
parents:
diff changeset
5505 Party::SetFood(var_value);
Ritor1
parents:
diff changeset
5506 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5507 return;
Ritor1
parents:
diff changeset
5508 case VAR_RandomFood:
Ritor1
parents:
diff changeset
5509 v7 = rand() % var_value + 1;
Ritor1
parents:
diff changeset
5510 Party::SetFood(v7);
Ritor1
parents:
diff changeset
5511 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
Ritor1
parents:
diff changeset
5512 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
5513 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
5514 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5515 return;
Ritor1
parents:
diff changeset
5516 case VAR_BaseMight:
Ritor1
parents:
diff changeset
5517 this->uMight = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5518 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5519 return;
Ritor1
parents:
diff changeset
5520 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
5521 this->uIntelligence = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5522 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5523 return;
Ritor1
parents:
diff changeset
5524 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
5525 this->uWillpower = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5526 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5527 return;
Ritor1
parents:
diff changeset
5528 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
5529 this->uEndurance = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5530 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5531 return;
Ritor1
parents:
diff changeset
5532 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
5533 this->uSpeed = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5534 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5535 return;
Ritor1
parents:
diff changeset
5536 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
5537 this->uAccuracy = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5538 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5539 return;
Ritor1
parents:
diff changeset
5540 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
5541 this->uLuck = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5542 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5543 return;
Ritor1
parents:
diff changeset
5544 case VAR_MightBonus:
Ritor1
parents:
diff changeset
5545 case VAR_ActualMight:
Ritor1
parents:
diff changeset
5546 this->uMightBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5547 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5548 return;
Ritor1
parents:
diff changeset
5549 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
5550 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
5551 this->uIntelligenceBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5552 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5553 return;
Ritor1
parents:
diff changeset
5554 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
5555 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
5556 this->uWillpowerBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5557 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5558 return;
Ritor1
parents:
diff changeset
5559 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
5560 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
5561 this->uEnduranceBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5562 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5563 return;
Ritor1
parents:
diff changeset
5564 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
5565 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
5566 this->uSpeedBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5567 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5568 return;
Ritor1
parents:
diff changeset
5569 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
5570 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
5571 this->uAccuracyBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5572 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5573 return;
Ritor1
parents:
diff changeset
5574 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
5575 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
5576 this->uLuckBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5577 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5578 return;
Ritor1
parents:
diff changeset
5579 case VAR_FireResistance:
Ritor1
parents:
diff changeset
5580 this->sResFireBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5581 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5582 return;
Ritor1
parents:
diff changeset
5583 case VAR_AirResistance:
Ritor1
parents:
diff changeset
5584 this->sResAirBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5585 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5586 return;
Ritor1
parents:
diff changeset
5587 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
5588 this->sResWaterBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5589 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5590 return;
Ritor1
parents:
diff changeset
5591 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
5592 this->sResEarthBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5593 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5594 return;
Ritor1
parents:
diff changeset
5595 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
5596 this->sResSpiritBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5597 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5598 return;
Ritor1
parents:
diff changeset
5599 case VAR_MindResistance:
Ritor1
parents:
diff changeset
5600 this->sResMindBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5601 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5602 return;
Ritor1
parents:
diff changeset
5603 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
5604 this->sResBodyBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5605 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5606 return;
Ritor1
parents:
diff changeset
5607 case VAR_LightResistance:
Ritor1
parents:
diff changeset
5608 this->sResLightBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5609 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5610 return;
Ritor1
parents:
diff changeset
5611 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
5612 this->sResDarkBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5613 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5614 return;
Ritor1
parents:
diff changeset
5615 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
5616 this->sResMagicBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5617 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5618 return;
Ritor1
parents:
diff changeset
5619 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
5620 this->sResFireBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5621 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5622 return;
Ritor1
parents:
diff changeset
5623 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
5624 this->sResAirBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5625 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5626 return;
Ritor1
parents:
diff changeset
5627 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
5628 this->sResWaterBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5629 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5630 return;
Ritor1
parents:
diff changeset
5631 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
5632 this->sResEarthBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5633 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5634 return;
Ritor1
parents:
diff changeset
5635 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
5636 this->sResSpiritBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5637 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5638 return;
Ritor1
parents:
diff changeset
5639 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
5640 this->sResMindBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5641 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5642 return;
Ritor1
parents:
diff changeset
5643 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
5644 this->sResBodyBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5645 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5646 return;
Ritor1
parents:
diff changeset
5647 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
5648 this->sResLightBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5649 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5650 return;
Ritor1
parents:
diff changeset
5651 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
5652 this->sResDarkBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5653 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5654 return;
Ritor1
parents:
diff changeset
5655 case VAR_PhysicalResistanceBonus:
Ritor1
parents:
diff changeset
5656 Error("Physical res. bonus not used");
Ritor1
parents:
diff changeset
5657 return;
Ritor1
parents:
diff changeset
5658 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
5659 this->sResMagicBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5660 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5661 return;
Ritor1
parents:
diff changeset
5662 case VAR_Cursed:
Ritor1
parents:
diff changeset
5663 this->SetCondition(Condition_Cursed, 1);
Ritor1
parents:
diff changeset
5664 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5665 return;
Ritor1
parents:
diff changeset
5666 case VAR_Weak:
Ritor1
parents:
diff changeset
5667 this->SetCondition(Condition_Weak, 1);
Ritor1
parents:
diff changeset
5668 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5669 return;
Ritor1
parents:
diff changeset
5670 case VAR_Asleep:
Ritor1
parents:
diff changeset
5671 this->SetCondition(Condition_Sleep, 1);
Ritor1
parents:
diff changeset
5672 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5673 return;
Ritor1
parents:
diff changeset
5674 case VAR_Afraid:
Ritor1
parents:
diff changeset
5675 this->SetCondition(Condition_Fear, 1);
Ritor1
parents:
diff changeset
5676 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5677 return;
Ritor1
parents:
diff changeset
5678 case VAR_Drunk:
Ritor1
parents:
diff changeset
5679 this->SetCondition(Condition_Drunk, 1);
Ritor1
parents:
diff changeset
5680 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5681 return;
Ritor1
parents:
diff changeset
5682 case VAR_Insane:
Ritor1
parents:
diff changeset
5683 this->SetCondition(Condition_Insane, 1);
Ritor1
parents:
diff changeset
5684 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5685 return;
Ritor1
parents:
diff changeset
5686 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
5687 this->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
5688 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5689 return;
Ritor1
parents:
diff changeset
5690 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
5691 this->SetCondition(Condition_Disease_Weak, 1);
Ritor1
parents:
diff changeset
5692 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5693 return;
Ritor1
parents:
diff changeset
5694 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
5695 this->SetCondition(Condition_Poison_Medium, 1);
Ritor1
parents:
diff changeset
5696 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5697 return;
Ritor1
parents:
diff changeset
5698 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
5699 this->SetCondition(Condition_Disease_Medium, 1);
Ritor1
parents:
diff changeset
5700 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5701 return;
Ritor1
parents:
diff changeset
5702 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
5703 this->SetCondition(Condition_Poison_Severe, 1);
Ritor1
parents:
diff changeset
5704 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5705 return;
Ritor1
parents:
diff changeset
5706 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
5707 this->SetCondition(Condition_Disease_Severe, 1);
Ritor1
parents:
diff changeset
5708 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5709 return;
Ritor1
parents:
diff changeset
5710 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
5711 this->SetCondition(Condition_Paralyzed, 1);
Ritor1
parents:
diff changeset
5712 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5713 return;
Ritor1
parents:
diff changeset
5714 case VAR_Unconsious:
Ritor1
parents:
diff changeset
5715 this->SetCondition(Condition_Unconcious, 1);
Ritor1
parents:
diff changeset
5716 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5717 return;
Ritor1
parents:
diff changeset
5718 case VAR_Dead:
Ritor1
parents:
diff changeset
5719 this->SetCondition(Condition_Dead, 1);
Ritor1
parents:
diff changeset
5720 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5721 return;
Ritor1
parents:
diff changeset
5722 case VAR_Stoned:
Ritor1
parents:
diff changeset
5723 this->SetCondition(Condition_Pertified, 1);
Ritor1
parents:
diff changeset
5724 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5725 return;
Ritor1
parents:
diff changeset
5726 case VAR_Eradicated:
Ritor1
parents:
diff changeset
5727 this->SetCondition(Condition_Eradicated, 1);
Ritor1
parents:
diff changeset
5728 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5729 return;
Ritor1
parents:
diff changeset
5730 case VAR_MajorCondition:
Ritor1
parents:
diff changeset
5731 pConditions.fill(0);
Ritor1
parents:
diff changeset
5732 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5733 return;
Ritor1
parents:
diff changeset
5734 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
5735 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText )
Ritor1
parents:
diff changeset
5736 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5737 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
5738 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
5739 bFlashAutonotesBook = 1;
Ritor1
parents:
diff changeset
5740 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
Ritor1
parents:
diff changeset
5741 }
Ritor1
parents:
diff changeset
5742 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5743 PlayAwardSound();
Ritor1
parents:
diff changeset
5744 return;
Ritor1
parents:
diff changeset
5745 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
5746 _449B7E_toggle_bit((unsigned char *)playerEventBits, var_value, 1u);
Ritor1
parents:
diff changeset
5747 return;
Ritor1
parents:
diff changeset
5748 case VAR_NPCs2:
Ritor1
parents:
diff changeset
5749 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
5750 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
Ritor1
parents:
diff changeset
5751 pParty->CountHirelings();
Ritor1
parents:
diff changeset
5752 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
5753 return;
Ritor1
parents:
diff changeset
5754 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
5755 this->uSkillPoints = var_value;
Ritor1
parents:
diff changeset
5756 return;
Ritor1
parents:
diff changeset
5757 case VAR_Counter1:
Ritor1
parents:
diff changeset
5758 case VAR_Counter2:
Ritor1
parents:
diff changeset
5759 case VAR_Counter3:
Ritor1
parents:
diff changeset
5760 case VAR_Counter4:
Ritor1
parents:
diff changeset
5761 case VAR_Counter5:
Ritor1
parents:
diff changeset
5762 case VAR_Counter6:
Ritor1
parents:
diff changeset
5763 case VAR_Counter7:
Ritor1
parents:
diff changeset
5764 case VAR_Counter8:
Ritor1
parents:
diff changeset
5765 case VAR_Counter9:
Ritor1
parents:
diff changeset
5766 case VAR_Counter10:
Ritor1
parents:
diff changeset
5767 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; // *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
5768 return;
Ritor1
parents:
diff changeset
5769 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
5770 v24 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5771 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5772 v24 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5773 v24->uReputation = var_value;
Ritor1
parents:
diff changeset
5774 if ( var_value > 10000 )
Ritor1
parents:
diff changeset
5775 v24->uReputation = 10000;
Ritor1
parents:
diff changeset
5776 return;
Ritor1
parents:
diff changeset
5777 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
5778 pParty->uNumGoldInBank = var_value;
Ritor1
parents:
diff changeset
5779 return;
Ritor1
parents:
diff changeset
5780 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
5781 pParty->uNumDeaths = var_value;
Ritor1
parents:
diff changeset
5782 return;
Ritor1
parents:
diff changeset
5783 case VAR_NumBounties:
Ritor1
parents:
diff changeset
5784 pParty->uNumBountiesCollected = var_value;
Ritor1
parents:
diff changeset
5785 return;
Ritor1
parents:
diff changeset
5786 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
5787 pParty->uNumPrisonTerms = var_value;
Ritor1
parents:
diff changeset
5788 return;
Ritor1
parents:
diff changeset
5789 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
5790 pParty->uNumArenaPageWins = var_value;
Ritor1
parents:
diff changeset
5791 return;
Ritor1
parents:
diff changeset
5792 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
5793 pParty->uNumArenaSquireWins = var_value;
Ritor1
parents:
diff changeset
5794 return;
Ritor1
parents:
diff changeset
5795 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
5796 pParty->uNumArenaKnightWins = var_value;
Ritor1
parents:
diff changeset
5797 return;
Ritor1
parents:
diff changeset
5798 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
5799 pParty->uNumArenaLordWins = var_value;
Ritor1
parents:
diff changeset
5800 return;
Ritor1
parents:
diff changeset
5801 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
5802 SetSkillByEvent(&Player::skillStaff, var_value);
Ritor1
parents:
diff changeset
5803 return;
Ritor1
parents:
diff changeset
5804 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
5805 SetSkillByEvent(&Player::skillSword, var_value);
Ritor1
parents:
diff changeset
5806 return;
Ritor1
parents:
diff changeset
5807 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
5808 SetSkillByEvent(&Player::skillDagger, var_value);
Ritor1
parents:
diff changeset
5809 return;
Ritor1
parents:
diff changeset
5810 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
5811 SetSkillByEvent(&Player::skillAxe, var_value);
Ritor1
parents:
diff changeset
5812 return;
Ritor1
parents:
diff changeset
5813 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
5814 SetSkillByEvent(&Player::skillSpear, var_value);
Ritor1
parents:
diff changeset
5815 return;
Ritor1
parents:
diff changeset
5816 case VAR_BowSkill:
Ritor1
parents:
diff changeset
5817 SetSkillByEvent(&Player::skillBow, var_value);
Ritor1
parents:
diff changeset
5818 return;
Ritor1
parents:
diff changeset
5819 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
5820 SetSkillByEvent(&Player::skillMace, var_value);
Ritor1
parents:
diff changeset
5821 return;
Ritor1
parents:
diff changeset
5822 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
5823 SetSkillByEvent(&Player::skillBlaster, var_value);
Ritor1
parents:
diff changeset
5824 return;
Ritor1
parents:
diff changeset
5825 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
5826 SetSkillByEvent(&Player::skillShield, var_value);
Ritor1
parents:
diff changeset
5827 return;
Ritor1
parents:
diff changeset
5828 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
5829 SetSkillByEvent(&Player::skillLeather, var_value);
Ritor1
parents:
diff changeset
5830 return;
Ritor1
parents:
diff changeset
5831 case VAR_SkillChain:
Ritor1
parents:
diff changeset
5832 SetSkillByEvent(&Player::skillChain, var_value);
Ritor1
parents:
diff changeset
5833 return;
Ritor1
parents:
diff changeset
5834 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
5835 SetSkillByEvent(&Player::skillPlate, var_value);
Ritor1
parents:
diff changeset
5836 return;
Ritor1
parents:
diff changeset
5837 case VAR_FireSkill:
Ritor1
parents:
diff changeset
5838 SetSkillByEvent(&Player::skillFire, var_value);
Ritor1
parents:
diff changeset
5839 return;
Ritor1
parents:
diff changeset
5840 case VAR_AirSkill:
Ritor1
parents:
diff changeset
5841 SetSkillByEvent(&Player::skillAir, var_value);
Ritor1
parents:
diff changeset
5842 return;
Ritor1
parents:
diff changeset
5843 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
5844 SetSkillByEvent(&Player::skillWater, var_value);
Ritor1
parents:
diff changeset
5845 return;
Ritor1
parents:
diff changeset
5846 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
5847 SetSkillByEvent(&Player::skillEarth, var_value);
Ritor1
parents:
diff changeset
5848 return;
Ritor1
parents:
diff changeset
5849 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
5850 SetSkillByEvent(&Player::skillSpirit, var_value);
Ritor1
parents:
diff changeset
5851 return;
Ritor1
parents:
diff changeset
5852 case VAR_MindSkill:
Ritor1
parents:
diff changeset
5853 SetSkillByEvent(&Player::skillMind, var_value);
Ritor1
parents:
diff changeset
5854 return;
Ritor1
parents:
diff changeset
5855 case VAR_BodySkill:
Ritor1
parents:
diff changeset
5856 SetSkillByEvent(&Player::skillBody, var_value);
Ritor1
parents:
diff changeset
5857 return;
Ritor1
parents:
diff changeset
5858 case VAR_LightSkill:
Ritor1
parents:
diff changeset
5859 SetSkillByEvent(&Player::skillLight, var_value);
Ritor1
parents:
diff changeset
5860 return;
Ritor1
parents:
diff changeset
5861 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
5862 SetSkillByEvent(&Player::skillDark, var_value);
Ritor1
parents:
diff changeset
5863 return;
Ritor1
parents:
diff changeset
5864 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
5865 SetSkillByEvent(&Player::skillItemId, var_value);
Ritor1
parents:
diff changeset
5866 return;
Ritor1
parents:
diff changeset
5867 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
5868 SetSkillByEvent(&Player::skillMerchant, var_value);
Ritor1
parents:
diff changeset
5869 return;
Ritor1
parents:
diff changeset
5870 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
5871 SetSkillByEvent(&Player::skillRepair, var_value);
Ritor1
parents:
diff changeset
5872 return;
Ritor1
parents:
diff changeset
5873 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
5874 SetSkillByEvent(&Player::skillBodybuilding, var_value);
Ritor1
parents:
diff changeset
5875 return;
Ritor1
parents:
diff changeset
5876 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
5877 SetSkillByEvent(&Player::skillMeditation, var_value);
Ritor1
parents:
diff changeset
5878 return;
Ritor1
parents:
diff changeset
5879 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
5880 SetSkillByEvent(&Player::skillPerception, var_value);
Ritor1
parents:
diff changeset
5881 return;
Ritor1
parents:
diff changeset
5882 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
5883 SetSkillByEvent(&Player::skillDiplomacy, var_value);
Ritor1
parents:
diff changeset
5884 return;
Ritor1
parents:
diff changeset
5885 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
5886 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
5887 return;
Ritor1
parents:
diff changeset
5888 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
5889 SetSkillByEvent(&Player::skillDisarmTrap, var_value);
Ritor1
parents:
diff changeset
5890 return;
Ritor1
parents:
diff changeset
5891 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
5892 SetSkillByEvent(&Player::skillDodge, var_value);
Ritor1
parents:
diff changeset
5893 return;
Ritor1
parents:
diff changeset
5894 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
5895 SetSkillByEvent(&Player::skillUnarmed, var_value);
Ritor1
parents:
diff changeset
5896 return;
Ritor1
parents:
diff changeset
5897 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
5898 SetSkillByEvent(&Player::skillMonsterId, var_value);
Ritor1
parents:
diff changeset
5899 return;
Ritor1
parents:
diff changeset
5900 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
5901 SetSkillByEvent(&Player::skillArmsmaster, var_value);
Ritor1
parents:
diff changeset
5902 return;
Ritor1
parents:
diff changeset
5903 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
5904 SetSkillByEvent(&Player::skillStealing, var_value);
Ritor1
parents:
diff changeset
5905 return;
Ritor1
parents:
diff changeset
5906 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
5907 SetSkillByEvent(&Player::skillAlchemy, var_value);
Ritor1
parents:
diff changeset
5908 return;
Ritor1
parents:
diff changeset
5909 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
5910 SetSkillByEvent(&Player::skillLearning, var_value);
Ritor1
parents:
diff changeset
5911 return;
Ritor1
parents:
diff changeset
5912 }
Ritor1
parents:
diff changeset
5913 }
Ritor1
parents:
diff changeset
5914
Ritor1
parents:
diff changeset
5915
Ritor1
parents:
diff changeset
5916 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5917 void Player::PlayAwardSound()
Ritor1
parents:
diff changeset
5918 {
Ritor1
parents:
diff changeset
5919 int playerIndex = GetPlayerIndex();
Ritor1
parents:
diff changeset
5920 signed int v25 = 8 * playerIndex + 400;
Ritor1
parents:
diff changeset
5921 LOBYTE(v25) = PID(OBJECT_Player,playerIndex - 112);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
5922 pAudioPlayer->PlaySound(SOUND_quest, v25, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
5923 }
Ritor1
parents:
diff changeset
5924
Ritor1
parents:
diff changeset
5925 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5926 void Player::PlayAwardSound_Anim()
Ritor1
parents:
diff changeset
5927 {
Ritor1
parents:
diff changeset
5928 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5929 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
2498
Ritor1
parents:
diff changeset
5930 PlayAwardSound();
Ritor1
parents:
diff changeset
5931 }
Ritor1
parents:
diff changeset
5932
Ritor1
parents:
diff changeset
5933 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5934 void Player::PlayAwardSound_Anim_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
5935 {
Ritor1
parents:
diff changeset
5936 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
5937 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5938 }
Ritor1
parents:
diff changeset
5939
Ritor1
parents:
diff changeset
5940 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5941 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 skillValue )
Ritor1
parents:
diff changeset
5942 {
Ritor1
parents:
diff changeset
5943 unsigned __int16 currSkillValue = this->*skillToSet;
Ritor1
parents:
diff changeset
5944 if ( skillValue > 63 ) //the original had the condition reversed which was probably wrong
Ritor1
parents:
diff changeset
5945 {
Ritor1
parents:
diff changeset
5946 this->*skillToSet = skillValue | currSkillValue & 63;
Ritor1
parents:
diff changeset
5947 }
Ritor1
parents:
diff changeset
5948 else
Ritor1
parents:
diff changeset
5949 {
Ritor1
parents:
diff changeset
5950 this->*skillToSet = skillValue | currSkillValue & 0xC0;
Ritor1
parents:
diff changeset
5951 }
Ritor1
parents:
diff changeset
5952 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5953 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
2498
Ritor1
parents:
diff changeset
5954 PlayAwardSound();
Ritor1
parents:
diff changeset
5955 }
Ritor1
parents:
diff changeset
5956
Ritor1
parents:
diff changeset
5957 //----- (0044AFFB) --------------------------------------------------------
Ritor1
parents:
diff changeset
5958 void Player::AddVariable(enum VariableType var_type, signed int val)
Ritor1
parents:
diff changeset
5959 {
Ritor1
parents:
diff changeset
5960 int v6; // eax@15
Ritor1
parents:
diff changeset
5961 unsigned int v7; // esi@18
Ritor1
parents:
diff changeset
5962 DDM_DLV_Header *v27; // eax@153
Ritor1
parents:
diff changeset
5963 ItemGen item; // [sp+Ch] [bp-2Ch]@45
Ritor1
parents:
diff changeset
5964
Ritor1
parents:
diff changeset
5965 if ( var_type >= VAR_Counter1 && var_type <= VAR_Counter10)
Ritor1
parents:
diff changeset
5966 {
Ritor1
parents:
diff changeset
5967 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
5968 return;
Ritor1
parents:
diff changeset
5969 }
Ritor1
parents:
diff changeset
5970
Ritor1
parents:
diff changeset
5971 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
Ritor1
parents:
diff changeset
5972 {
Ritor1
parents:
diff changeset
5973 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
5974 PlayAwardSound();
Ritor1
parents:
diff changeset
5975 return;
Ritor1
parents:
diff changeset
5976 }
Ritor1
parents:
diff changeset
5977
Ritor1
parents:
diff changeset
5978 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5979 {
Ritor1
parents:
diff changeset
5980
Ritor1
parents:
diff changeset
5981 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
5982 {
Ritor1
parents:
diff changeset
5983 if (255 - val > stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0])
Ritor1
parents:
diff changeset
5984 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] += val;
Ritor1
parents:
diff changeset
5985 else
Ritor1
parents:
diff changeset
5986 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = 255;
Ritor1
parents:
diff changeset
5987 }
Ritor1
parents:
diff changeset
5988 if ( (signed int)var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5989 {
Ritor1
parents:
diff changeset
5990 if (255 - val > stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75])
Ritor1
parents:
diff changeset
5991 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] += val;
Ritor1
parents:
diff changeset
5992 else
Ritor1
parents:
diff changeset
5993 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = 255;
Ritor1
parents:
diff changeset
5994 }
Ritor1
parents:
diff changeset
5995 return;
Ritor1
parents:
diff changeset
5996 }
Ritor1
parents:
diff changeset
5997
Ritor1
parents:
diff changeset
5998 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
Ritor1
parents:
diff changeset
5999 {
Ritor1
parents:
diff changeset
6000 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
Ritor1
parents:
diff changeset
6001 {
Ritor1
parents:
diff changeset
6002 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
6003 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0)
Ritor1
parents:
diff changeset
6004 {
Ritor1
parents:
diff changeset
6005 bFlashHistoryBook = 1;
Ritor1
parents:
diff changeset
6006 PlayAwardSound();
Ritor1
parents:
diff changeset
6007 }
Ritor1
parents:
diff changeset
6008 }
Ritor1
parents:
diff changeset
6009 return;
Ritor1
parents:
diff changeset
6010 }
Ritor1
parents:
diff changeset
6011
Ritor1
parents:
diff changeset
6012 switch ( var_type )
Ritor1
parents:
diff changeset
6013 {
Ritor1
parents:
diff changeset
6014 case VAR_RandomGold:
Ritor1
parents:
diff changeset
6015 if ( val == 0 )
Ritor1
parents:
diff changeset
6016 val = 1;
Ritor1
parents:
diff changeset
6017 v6 = rand();
Ritor1
parents:
diff changeset
6018 pParty->PartyFindsGold(v6 % val + 1, 1);
Ritor1
parents:
diff changeset
6019 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6020 return;
Ritor1
parents:
diff changeset
6021 case VAR_RandomFood:
Ritor1
parents:
diff changeset
6022 if ( val == 0 )
Ritor1
parents:
diff changeset
6023 val = 1;
Ritor1
parents:
diff changeset
6024 v7 = rand() % val + 1;
Ritor1
parents:
diff changeset
6025 Party::GiveFood(v7);
Ritor1
parents:
diff changeset
6026 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
Ritor1
parents:
diff changeset
6027 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6028 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6029 PlayAwardSound();
Ritor1
parents:
diff changeset
6030 return;
Ritor1
parents:
diff changeset
6031 case VAR_Sex:
Ritor1
parents:
diff changeset
6032 this->uSex = (PLAYER_SEX)val;
Ritor1
parents:
diff changeset
6033 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6034 return;
Ritor1
parents:
diff changeset
6035 case VAR_Class:
Ritor1
parents:
diff changeset
6036 this->classType = (PLAYER_CLASS_TYPE)val;
Ritor1
parents:
diff changeset
6037 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6038 return;
Ritor1
parents:
diff changeset
6039 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
6040 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() );
Ritor1
parents:
diff changeset
6041 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6042 return;
Ritor1
parents:
diff changeset
6043 case VAR_MaxHP:
Ritor1
parents:
diff changeset
6044 this->_health_related = 0;
Ritor1
parents:
diff changeset
6045 this->uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
6046 this->sHealth = this->GetMaxHealth();
Ritor1
parents:
diff changeset
6047 return;
Ritor1
parents:
diff changeset
6048 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
6049 this->sMana = min(this->sMana + val, this->GetMaxMana() );
Ritor1
parents:
diff changeset
6050 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6051 return;
Ritor1
parents:
diff changeset
6052 case VAR_MaxSP:
Ritor1
parents:
diff changeset
6053 this->_mana_related = 0;
Ritor1
parents:
diff changeset
6054 this->uFullManaBonus = 0;
Ritor1
parents:
diff changeset
6055 this->sMana = GetMaxMana();
Ritor1
parents:
diff changeset
6056 return;
Ritor1
parents:
diff changeset
6057 case VAR_ACModifier:
Ritor1
parents:
diff changeset
6058 this->sACModifier = min(this->sACModifier + val, 255);
Ritor1
parents:
diff changeset
6059 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6060 return;
Ritor1
parents:
diff changeset
6061 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
6062 this->uLevel = min(this->uLevel + val, 255);
Ritor1
parents:
diff changeset
6063 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6064 return;
Ritor1
parents:
diff changeset
6065 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
6066 this->sLevelModifier = min(this->sLevelModifier + val, 255);
Ritor1
parents:
diff changeset
6067 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6068 return;
Ritor1
parents:
diff changeset
6069 case VAR_Age:
Ritor1
parents:
diff changeset
6070 this->sAgeModifier += val;
Ritor1
parents:
diff changeset
6071 return;
Ritor1
parents:
diff changeset
6072 case VAR_Award:
Ritor1
parents:
diff changeset
6073 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText )
Ritor1
parents:
diff changeset
6074 {
Ritor1
parents:
diff changeset
6075 PlayAwardSound_Anim97_Face(SPEECH_96);
Ritor1
parents:
diff changeset
6076 }
Ritor1
parents:
diff changeset
6077 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1);
Ritor1
parents:
diff changeset
6078 return;
Ritor1
parents:
diff changeset
6079 case VAR_Experience:
Ritor1
parents:
diff changeset
6080 this->uExperience = min(this->uExperience + val, 4000000000i64);
Ritor1
parents:
diff changeset
6081 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6082 return;
Ritor1
parents:
diff changeset
6083 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
6084 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] )
Ritor1
parents:
diff changeset
6085 {
Ritor1
parents:
diff changeset
6086 bFlashQuestBook = 1;
Ritor1
parents:
diff changeset
6087 PlayAwardSound_Anim97_Face(SPEECH_93);
Ritor1
parents:
diff changeset
6088 }
Ritor1
parents:
diff changeset
6089 _449B7E_toggle_bit(pParty->_quest_bits, val, 1);
Ritor1
parents:
diff changeset
6090 return;
Ritor1
parents:
diff changeset
6091 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
6092 item.Reset();
Ritor1
parents:
diff changeset
6093 item.uAttributes = 1;
Ritor1
parents:
diff changeset
6094 item.uItemID = val;
Ritor1
parents:
diff changeset
6095 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
Ritor1
parents:
diff changeset
6096 pParty->pIsArtifactFound[val-500] = 1;
Ritor1
parents:
diff changeset
6097 else if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
Ritor1
parents:
diff changeset
6098 {
Ritor1
parents:
diff changeset
6099 item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
Ritor1
parents:
diff changeset
6100 item.uMaxCharges = LOBYTE(item.uNumCharges);
Ritor1
parents:
diff changeset
6101 }
Ritor1
parents:
diff changeset
6102 pParty->SetHoldingItem(&item);
Ritor1
parents:
diff changeset
6103 return;
Ritor1
parents:
diff changeset
6104 case VAR_FixedGold:
Ritor1
parents:
diff changeset
6105 pParty->PartyFindsGold(val, 1);
Ritor1
parents:
diff changeset
6106 return;
Ritor1
parents:
diff changeset
6107 case VAR_BaseMight:
Ritor1
parents:
diff changeset
6108 this->uMight = min(this->uMight + val, 255);
Ritor1
parents:
diff changeset
6109 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6110 return;
Ritor1
parents:
diff changeset
6111 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
6112 this->uIntelligence = min(this->uIntelligence + val, 255);
Ritor1
parents:
diff changeset
6113 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6114 return;
Ritor1
parents:
diff changeset
6115 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
6116 this->uWillpower = min(this->uWillpower + val, 255);
Ritor1
parents:
diff changeset
6117 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6118 return;
Ritor1
parents:
diff changeset
6119 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
6120 this->uEndurance = min(this->uEndurance + val, 255);
Ritor1
parents:
diff changeset
6121 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6122 return;
Ritor1
parents:
diff changeset
6123 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
6124 this->uSpeed = min(this->uSpeed + val, 255);
Ritor1
parents:
diff changeset
6125 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6126 return;
Ritor1
parents:
diff changeset
6127 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
6128 this->uAccuracy = min(this->uAccuracy + val, 255);
Ritor1
parents:
diff changeset
6129 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6130 return;
Ritor1
parents:
diff changeset
6131 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
6132 this->uLuck = min(this->uLuck + val, 255);
Ritor1
parents:
diff changeset
6133 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6134 return;
Ritor1
parents:
diff changeset
6135 case VAR_FixedFood:
Ritor1
parents:
diff changeset
6136 Party::GiveFood(val);
Ritor1
parents:
diff changeset
6137 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
Ritor1
parents:
diff changeset
6138 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6139 if ( pParty->uNumFoodRations > 0xFFFF )
Ritor1
parents:
diff changeset
6140 Party::SetFood(0xFFFFu);
Ritor1
parents:
diff changeset
6141 PlayAwardSound();
Ritor1
parents:
diff changeset
6142 return;
Ritor1
parents:
diff changeset
6143 case VAR_MightBonus:
Ritor1
parents:
diff changeset
6144 case VAR_ActualMight:
Ritor1
parents:
diff changeset
6145 this->uMightBonus = min(this->uMightBonus + val, 255);
Ritor1
parents:
diff changeset
6146 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6147 return;
Ritor1
parents:
diff changeset
6148 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
6149 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
6150 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255);
Ritor1
parents:
diff changeset
6151 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6152 return;
Ritor1
parents:
diff changeset
6153 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
6154 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
6155 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255);
Ritor1
parents:
diff changeset
6156 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6157 return;
Ritor1
parents:
diff changeset
6158 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
6159 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
6160 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255);
Ritor1
parents:
diff changeset
6161 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6162 return;
Ritor1
parents:
diff changeset
6163 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
6164 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
6165 this->uSpeedBonus = min(this->uSpeedBonus + val, 255);
Ritor1
parents:
diff changeset
6166 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6167 return;
Ritor1
parents:
diff changeset
6168 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
6169 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
6170 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255);
Ritor1
parents:
diff changeset
6171 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6172 return;
Ritor1
parents:
diff changeset
6173 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
6174 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
6175 this->uLuckBonus = min(this->uLuckBonus + val, 255);
Ritor1
parents:
diff changeset
6176 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6177 return;
Ritor1
parents:
diff changeset
6178 case VAR_FireResistance:
Ritor1
parents:
diff changeset
6179 this->sResFireBase = min(this->sResFireBase + val, 255);
Ritor1
parents:
diff changeset
6180 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6181 return;
Ritor1
parents:
diff changeset
6182 case VAR_AirResistance:
Ritor1
parents:
diff changeset
6183 this->sResAirBase = min(this->sResAirBase + val, 255);
Ritor1
parents:
diff changeset
6184 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6185 return;
Ritor1
parents:
diff changeset
6186 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
6187 this->sResWaterBase = min(this->sResWaterBase + val, 255);
Ritor1
parents:
diff changeset
6188 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6189 return;
Ritor1
parents:
diff changeset
6190 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
6191 this->sResEarthBase = min(this->sResEarthBase + val, 255);
Ritor1
parents:
diff changeset
6192 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6193 return;
Ritor1
parents:
diff changeset
6194 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
6195 this->sResSpiritBase = min(this->sResSpiritBase + val, 255);
Ritor1
parents:
diff changeset
6196 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6197 return;
Ritor1
parents:
diff changeset
6198 case VAR_MindResistance:
Ritor1
parents:
diff changeset
6199 this->sResMindBase = min(this->sResMindBase + val, 255);
Ritor1
parents:
diff changeset
6200 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6201 return;
Ritor1
parents:
diff changeset
6202 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
6203 this->sResBodyBase = min(this->sResBodyBase + val, 255);
Ritor1
parents:
diff changeset
6204 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6205 return;
Ritor1
parents:
diff changeset
6206 case VAR_LightResistance:
Ritor1
parents:
diff changeset
6207 this->sResLightBase = min(this->sResLightBase + val, 255);
Ritor1
parents:
diff changeset
6208 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6209 return;
Ritor1
parents:
diff changeset
6210 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
6211 this->sResDarkBase = min(this->sResDarkBase + val, 255);
Ritor1
parents:
diff changeset
6212 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6213 return;
Ritor1
parents:
diff changeset
6214 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
6215 this->sResMagicBase = min(this->sResMagicBase + val, 255);
Ritor1
parents:
diff changeset
6216 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6217 return;
Ritor1
parents:
diff changeset
6218 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
6219 this->sResFireBonus = min(this->sResFireBonus + val, 255);
Ritor1
parents:
diff changeset
6220 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6221 return;
Ritor1
parents:
diff changeset
6222 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
6223 this->sResAirBonus = min(this->sResAirBonus + val, 255);
Ritor1
parents:
diff changeset
6224 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6225 return;
Ritor1
parents:
diff changeset
6226 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
6227 this->sResWaterBonus = min(this->sResWaterBonus + val, 255);
Ritor1
parents:
diff changeset
6228 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6229 return;
Ritor1
parents:
diff changeset
6230 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
6231 this->sResEarthBonus = min(this->sResEarthBonus + val, 255);
Ritor1
parents:
diff changeset
6232 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6233 return;
Ritor1
parents:
diff changeset
6234 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
6235 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255);
Ritor1
parents:
diff changeset
6236 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6237 return;
Ritor1
parents:
diff changeset
6238 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
6239 this->sResMindBonus = min(this->sResMindBonus + val, 255);
Ritor1
parents:
diff changeset
6240 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6241 return;
Ritor1
parents:
diff changeset
6242 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
6243 this->sResBodyBonus = min(this->sResBodyBonus + val, 255);
Ritor1
parents:
diff changeset
6244 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6245 return;
Ritor1
parents:
diff changeset
6246 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
6247 this->sResLightBonus = min(this->sResLightBonus + val, 255);
Ritor1
parents:
diff changeset
6248 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6249 return;
Ritor1
parents:
diff changeset
6250 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
6251 this->sResDarkBonus = min(this->sResDarkBonus + val, 255);
Ritor1
parents:
diff changeset
6252 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6253 return;
Ritor1
parents:
diff changeset
6254 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
6255 this->sResMagicBonus = min(this->sResMagicBonus + val, 255);
Ritor1
parents:
diff changeset
6256 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6257 return;
Ritor1
parents:
diff changeset
6258 case VAR_Cursed:
Ritor1
parents:
diff changeset
6259 this->SetCondition(Condition_Cursed, 1);
Ritor1
parents:
diff changeset
6260 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6261 return;
Ritor1
parents:
diff changeset
6262 case VAR_Weak:
Ritor1
parents:
diff changeset
6263 this->SetCondition(Condition_Weak, 1);
Ritor1
parents:
diff changeset
6264 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6265 return;
Ritor1
parents:
diff changeset
6266 case VAR_Asleep:
Ritor1
parents:
diff changeset
6267 this->SetCondition(Condition_Sleep, 1);
Ritor1
parents:
diff changeset
6268 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6269 return;
Ritor1
parents:
diff changeset
6270 case VAR_Afraid:
Ritor1
parents:
diff changeset
6271 this->SetCondition(Condition_Fear, 1);
Ritor1
parents:
diff changeset
6272 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6273 return;
Ritor1
parents:
diff changeset
6274 case VAR_Drunk:
Ritor1
parents:
diff changeset
6275 this->SetCondition(Condition_Drunk, 1);
Ritor1
parents:
diff changeset
6276 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6277 return;
Ritor1
parents:
diff changeset
6278 case VAR_Insane:
Ritor1
parents:
diff changeset
6279 this->SetCondition(Condition_Insane, 1);
Ritor1
parents:
diff changeset
6280 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6281 return;
Ritor1
parents:
diff changeset
6282 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
6283 this->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
6284 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6285 return;
Ritor1
parents:
diff changeset
6286 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
6287 this->SetCondition(Condition_Disease_Weak, 1);
Ritor1
parents:
diff changeset
6288 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6289 return;
Ritor1
parents:
diff changeset
6290 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
6291 this->SetCondition(Condition_Poison_Medium, 1);
Ritor1
parents:
diff changeset
6292 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6293 return;
Ritor1
parents:
diff changeset
6294 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
6295 this->SetCondition(Condition_Disease_Medium, 1);
Ritor1
parents:
diff changeset
6296 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6297 return;
Ritor1
parents:
diff changeset
6298 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
6299 this->SetCondition(Condition_Poison_Severe, 1);
Ritor1
parents:
diff changeset
6300 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6301 return;
Ritor1
parents:
diff changeset
6302 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
6303 this->SetCondition(Condition_Disease_Severe, 1);
Ritor1
parents:
diff changeset
6304 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6305 return;
Ritor1
parents:
diff changeset
6306 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
6307 this->SetCondition(Condition_Paralyzed, 1);
Ritor1
parents:
diff changeset
6308 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6309 return;
Ritor1
parents:
diff changeset
6310 case VAR_Unconsious:
Ritor1
parents:
diff changeset
6311 this->SetCondition(Condition_Unconcious, 1);
Ritor1
parents:
diff changeset
6312 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6313 return;
Ritor1
parents:
diff changeset
6314 case VAR_Dead:
Ritor1
parents:
diff changeset
6315 this->SetCondition(Condition_Dead, 1);
Ritor1
parents:
diff changeset
6316 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6317 return;
Ritor1
parents:
diff changeset
6318 case VAR_Stoned:
Ritor1
parents:
diff changeset
6319 this->SetCondition(Condition_Pertified, 1);
Ritor1
parents:
diff changeset
6320 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6321 return;
Ritor1
parents:
diff changeset
6322 case VAR_Eradicated:
Ritor1
parents:
diff changeset
6323 this->SetCondition(Condition_Eradicated, 1);
Ritor1
parents:
diff changeset
6324 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6325 return;
Ritor1
parents:
diff changeset
6326 case VAR_MajorCondition :
Ritor1
parents:
diff changeset
6327 pConditions.fill(0);
Ritor1
parents:
diff changeset
6328 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6329 return;
Ritor1
parents:
diff changeset
6330 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
6331 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
Ritor1
parents:
diff changeset
6332 {
Ritor1
parents:
diff changeset
6333 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
6334 bFlashAutonotesBook = 1;
Ritor1
parents:
diff changeset
6335 _506568_autonote_type = pAutonoteTxt[val].eType;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6336 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
6337 }
Ritor1
parents:
diff changeset
6338 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
Ritor1
parents:
diff changeset
6339 PlayAwardSound();
Ritor1
parents:
diff changeset
6340 return;
Ritor1
parents:
diff changeset
6341 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
6342 _449B7E_toggle_bit((unsigned char *)this->playerEventBits, val, 1u);
Ritor1
parents:
diff changeset
6343 return;
Ritor1
parents:
diff changeset
6344 case VAR_NPCs2:
Ritor1
parents:
diff changeset
6345 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
6346 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u;
Ritor1
parents:
diff changeset
6347 pParty->CountHirelings();
Ritor1
parents:
diff changeset
6348 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
6349 return;
Ritor1
parents:
diff changeset
6350 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
6351 this->uSkillPoints += val;
Ritor1
parents:
diff changeset
6352 return;
Ritor1
parents:
diff changeset
6353 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
6354 v27 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
6355 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
6356 v27 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
6357 v27->uReputation += val;
Ritor1
parents:
diff changeset
6358 if ( v27->uReputation > 10000 )
Ritor1
parents:
diff changeset
6359 v27->uReputation = 10000;
Ritor1
parents:
diff changeset
6360 return;
Ritor1
parents:
diff changeset
6361 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
6362 pParty->uNumGoldInBank += val;
Ritor1
parents:
diff changeset
6363 return;
Ritor1
parents:
diff changeset
6364 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
6365 pParty->uNumDeaths += val;
Ritor1
parents:
diff changeset
6366 return;
Ritor1
parents:
diff changeset
6367 case VAR_NumBounties:
Ritor1
parents:
diff changeset
6368 pParty->uNumBountiesCollected += val;
Ritor1
parents:
diff changeset
6369 return;
Ritor1
parents:
diff changeset
6370 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
6371 pParty->uNumPrisonTerms += val;
Ritor1
parents:
diff changeset
6372 return;
Ritor1
parents:
diff changeset
6373 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
6374 pParty->uNumArenaPageWins += val;
Ritor1
parents:
diff changeset
6375 return;
Ritor1
parents:
diff changeset
6376 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
6377 pParty->uNumArenaSquireWins += val;
Ritor1
parents:
diff changeset
6378 return;
Ritor1
parents:
diff changeset
6379 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
6380 pParty->uNumArenaKnightWins += val;
Ritor1
parents:
diff changeset
6381 return;
Ritor1
parents:
diff changeset
6382 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
6383 pParty->uNumArenaLordWins += val;
Ritor1
parents:
diff changeset
6384 return;
Ritor1
parents:
diff changeset
6385 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
6386 AddSkillByEvent(&Player::skillStaff, val);
Ritor1
parents:
diff changeset
6387 return;
Ritor1
parents:
diff changeset
6388 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
6389 AddSkillByEvent(&Player::skillSword, val);
Ritor1
parents:
diff changeset
6390 return;
Ritor1
parents:
diff changeset
6391 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
6392 AddSkillByEvent(&Player::skillDagger, val);
Ritor1
parents:
diff changeset
6393 return;
Ritor1
parents:
diff changeset
6394 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
6395 AddSkillByEvent(&Player::skillAxe, val);
Ritor1
parents:
diff changeset
6396 return;
Ritor1
parents:
diff changeset
6397 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
6398 AddSkillByEvent(&Player::skillSpear, val);
Ritor1
parents:
diff changeset
6399 return;
Ritor1
parents:
diff changeset
6400 case VAR_BowSkill:
Ritor1
parents:
diff changeset
6401 AddSkillByEvent(&Player::skillBow, val);
Ritor1
parents:
diff changeset
6402 return;
Ritor1
parents:
diff changeset
6403 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
6404 AddSkillByEvent(&Player::skillMace, val);
Ritor1
parents:
diff changeset
6405 return;
Ritor1
parents:
diff changeset
6406 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
6407 AddSkillByEvent(&Player::skillBlaster, val);
Ritor1
parents:
diff changeset
6408 return;
Ritor1
parents:
diff changeset
6409 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
6410 AddSkillByEvent(&Player::skillShield, val);
Ritor1
parents:
diff changeset
6411 return;
Ritor1
parents:
diff changeset
6412 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
6413 AddSkillByEvent(&Player::skillLeather, val);
Ritor1
parents:
diff changeset
6414 return;
Ritor1
parents:
diff changeset
6415 case VAR_SkillChain:
Ritor1
parents:
diff changeset
6416 AddSkillByEvent(&Player::skillChain, val);
Ritor1
parents:
diff changeset
6417 return;
Ritor1
parents:
diff changeset
6418 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
6419 AddSkillByEvent(&Player::skillPlate, val);
Ritor1
parents:
diff changeset
6420 return;
Ritor1
parents:
diff changeset
6421 case VAR_FireSkill:
Ritor1
parents:
diff changeset
6422 AddSkillByEvent(&Player::skillFire, val);
Ritor1
parents:
diff changeset
6423 return;
Ritor1
parents:
diff changeset
6424 case VAR_AirSkill:
Ritor1
parents:
diff changeset
6425 AddSkillByEvent(&Player::skillAir, val);
Ritor1
parents:
diff changeset
6426 return;
Ritor1
parents:
diff changeset
6427 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
6428 AddSkillByEvent(&Player::skillWater, val);
Ritor1
parents:
diff changeset
6429 return;
Ritor1
parents:
diff changeset
6430 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
6431 AddSkillByEvent(&Player::skillEarth, val);
Ritor1
parents:
diff changeset
6432 return;
Ritor1
parents:
diff changeset
6433 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
6434 AddSkillByEvent(&Player::skillSpirit, val);
Ritor1
parents:
diff changeset
6435 return;
Ritor1
parents:
diff changeset
6436 case VAR_MindSkill:
Ritor1
parents:
diff changeset
6437 AddSkillByEvent(&Player::skillMind, val);
Ritor1
parents:
diff changeset
6438 return;
Ritor1
parents:
diff changeset
6439 case VAR_BodySkill:
Ritor1
parents:
diff changeset
6440 AddSkillByEvent(&Player::skillBody, val);
Ritor1
parents:
diff changeset
6441 return;
Ritor1
parents:
diff changeset
6442 case VAR_LightSkill:
Ritor1
parents:
diff changeset
6443 AddSkillByEvent(&Player::skillLight, val);
Ritor1
parents:
diff changeset
6444 return;
Ritor1
parents:
diff changeset
6445 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
6446 AddSkillByEvent(&Player::skillDark, val);
Ritor1
parents:
diff changeset
6447 return;
Ritor1
parents:
diff changeset
6448 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
6449 AddSkillByEvent(&Player::skillItemId, val);
Ritor1
parents:
diff changeset
6450 return;
Ritor1
parents:
diff changeset
6451 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
6452 AddSkillByEvent(&Player::skillMerchant, val);
Ritor1
parents:
diff changeset
6453 return;
Ritor1
parents:
diff changeset
6454 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
6455 AddSkillByEvent(&Player::skillRepair, val);
Ritor1
parents:
diff changeset
6456 return;
Ritor1
parents:
diff changeset
6457 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
6458 AddSkillByEvent(&Player::skillBodybuilding, val);
Ritor1
parents:
diff changeset
6459 return;
Ritor1
parents:
diff changeset
6460 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
6461 AddSkillByEvent(&Player::skillMeditation, val);
Ritor1
parents:
diff changeset
6462 return;
Ritor1
parents:
diff changeset
6463 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
6464 AddSkillByEvent(&Player::skillPerception, val);
Ritor1
parents:
diff changeset
6465 return;
Ritor1
parents:
diff changeset
6466 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
6467 AddSkillByEvent(&Player::skillDiplomacy, val);
Ritor1
parents:
diff changeset
6468 return;
Ritor1
parents:
diff changeset
6469 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
6470 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
6471 return;
Ritor1
parents:
diff changeset
6472 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
6473 AddSkillByEvent(&Player::skillDisarmTrap, val);
Ritor1
parents:
diff changeset
6474 return;
Ritor1
parents:
diff changeset
6475 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
6476 AddSkillByEvent(&Player::skillDodge, val);
Ritor1
parents:
diff changeset
6477 return;
Ritor1
parents:
diff changeset
6478 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
6479 AddSkillByEvent(&Player::skillUnarmed, val);
Ritor1
parents:
diff changeset
6480 return;
Ritor1
parents:
diff changeset
6481 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
6482 AddSkillByEvent(&Player::skillMonsterId, val);
Ritor1
parents:
diff changeset
6483 return;
Ritor1
parents:
diff changeset
6484 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
6485 AddSkillByEvent(&Player::skillArmsmaster, val);
Ritor1
parents:
diff changeset
6486 return;
Ritor1
parents:
diff changeset
6487 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
6488 AddSkillByEvent(&Player::skillStealing, val);
Ritor1
parents:
diff changeset
6489 return;
Ritor1
parents:
diff changeset
6490 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
6491 AddSkillByEvent(&Player::skillAlchemy, val);
Ritor1
parents:
diff changeset
6492 return;
Ritor1
parents:
diff changeset
6493 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
6494 AddSkillByEvent(&Player::skillLearning, val);
Ritor1
parents:
diff changeset
6495 return;
Ritor1
parents:
diff changeset
6496 default:
Ritor1
parents:
diff changeset
6497 return;
Ritor1
parents:
diff changeset
6498 }
Ritor1
parents:
diff changeset
6499 }
Ritor1
parents:
diff changeset
6500
Ritor1
parents:
diff changeset
6501 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6502 void Player::PlayAwardSound_Anim97()
Ritor1
parents:
diff changeset
6503 {
Ritor1
parents:
diff changeset
6504 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6505 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, playerIndex);
2498
Ritor1
parents:
diff changeset
6506 PlayAwardSound();
Ritor1
parents:
diff changeset
6507 }
Ritor1
parents:
diff changeset
6508
Ritor1
parents:
diff changeset
6509 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6510 void Player::PlayAwardSound_Anim97_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
6511 {
Ritor1
parents:
diff changeset
6512 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
6513 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6514 }
Ritor1
parents:
diff changeset
6515
Ritor1
parents:
diff changeset
6516 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6517 void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue )
Ritor1
parents:
diff changeset
6518 {
Ritor1
parents:
diff changeset
6519 if ( addSkillValue > 63 )
Ritor1
parents:
diff changeset
6520 {
Ritor1
parents:
diff changeset
6521 this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63;
Ritor1
parents:
diff changeset
6522 }
Ritor1
parents:
diff changeset
6523 else
Ritor1
parents:
diff changeset
6524 {
Ritor1
parents:
diff changeset
6525 this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0;
Ritor1
parents:
diff changeset
6526 }
Ritor1
parents:
diff changeset
6527 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6528 return;
Ritor1
parents:
diff changeset
6529 }
Ritor1
parents:
diff changeset
6530
Ritor1
parents:
diff changeset
6531 //----- (0044B9C4) --------------------------------------------------------
Ritor1
parents:
diff changeset
6532 void Player::SubtractVariable( enum VariableType VarNum, signed int pValue )
Ritor1
parents:
diff changeset
6533 {
Ritor1
parents:
diff changeset
6534 DDM_DLV_Header *locationHeader; // eax@90
Ritor1
parents:
diff changeset
6535 int randGold;
Ritor1
parents:
diff changeset
6536 int randFood;
Ritor1
parents:
diff changeset
6537 int npcIndex;
Ritor1
parents:
diff changeset
6538
Ritor1
parents:
diff changeset
6539 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6540 {
Ritor1
parents:
diff changeset
6541 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
6542 {
Ritor1
parents:
diff changeset
6543 stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] -= pValue;
Ritor1
parents:
diff changeset
6544 }
Ritor1
parents:
diff changeset
6545 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6546 {
Ritor1
parents:
diff changeset
6547 stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] -= pValue;
Ritor1
parents:
diff changeset
6548 }
Ritor1
parents:
diff changeset
6549 return;
Ritor1
parents:
diff changeset
6550 }
Ritor1
parents:
diff changeset
6551
Ritor1
parents:
diff changeset
6552 switch (VarNum)
Ritor1
parents:
diff changeset
6553 {
Ritor1
parents:
diff changeset
6554 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
6555 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
Ritor1
parents:
diff changeset
6556 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6557 return;
Ritor1
parents:
diff changeset
6558 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
6559 this->sMana = max(this->sMana - pValue, 0);
Ritor1
parents:
diff changeset
6560 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6561 return;
Ritor1
parents:
diff changeset
6562 case VAR_ACModifier:
Ritor1
parents:
diff changeset
6563 this->sACModifier -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6564 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6565 return;
Ritor1
parents:
diff changeset
6566 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
6567 this->uLevel -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6568 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6569 return;
Ritor1
parents:
diff changeset
6570 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
6571 this->sLevelModifier -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6572 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6573 return;
Ritor1
parents:
diff changeset
6574 case VAR_Age:
Ritor1
parents:
diff changeset
6575 this->sAgeModifier -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6576 return;
Ritor1
parents:
diff changeset
6577 case VAR_Award:
Ritor1
parents:
diff changeset
6578 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0);
Ritor1
parents:
diff changeset
6579 return;
Ritor1
parents:
diff changeset
6580 case VAR_Experience:
Ritor1
parents:
diff changeset
6581 this->uExperience -= pValue;
Ritor1
parents:
diff changeset
6582 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6583 return;
Ritor1
parents:
diff changeset
6584 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
6585 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0);
Ritor1
parents:
diff changeset
6586 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
6587 return;
Ritor1
parents:
diff changeset
6588 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
6589 for ( uint i = 0; i < 16; ++i )
Ritor1
parents:
diff changeset
6590 {
Ritor1
parents:
diff changeset
6591 int id_ = this->pEquipment.pIndices[i];
Ritor1
parents:
diff changeset
6592 if ( id_ > 0 )
Ritor1
parents:
diff changeset
6593 {
Ritor1
parents:
diff changeset
6594 if ( this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == pValue )
Ritor1
parents:
diff changeset
6595 {
Ritor1
parents:
diff changeset
6596 this->pEquipment.pIndices[i] = 0;
Ritor1
parents:
diff changeset
6597 }
Ritor1
parents:
diff changeset
6598 }
Ritor1
parents:
diff changeset
6599 }
Ritor1
parents:
diff changeset
6600 for (int i = 0; i < 126; i++)
Ritor1
parents:
diff changeset
6601 {
Ritor1
parents:
diff changeset
6602 int id_ = this->pInventoryMatrix[i];
Ritor1
parents:
diff changeset
6603 if ( id_ > 0 )
Ritor1
parents:
diff changeset
6604 {
Ritor1
parents:
diff changeset
6605 if ( this->pInventoryItemList[id_ - 1].uItemID == pValue )
Ritor1
parents:
diff changeset
6606 {
Ritor1
parents:
diff changeset
6607 RemoveItemAtInventoryIndex(i);
Ritor1
parents:
diff changeset
6608 return;
Ritor1
parents:
diff changeset
6609 }
Ritor1
parents:
diff changeset
6610 }
Ritor1
parents:
diff changeset
6611 }
Ritor1
parents:
diff changeset
6612 if ( pParty->pPickedItem.uItemID == pValue )
Ritor1
parents:
diff changeset
6613 {
Ritor1
parents:
diff changeset
6614 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
6615 return;
Ritor1
parents:
diff changeset
6616 }
Ritor1
parents:
diff changeset
6617 return;
Ritor1
parents:
diff changeset
6618 case VAR_FixedGold:
Ritor1
parents:
diff changeset
6619 if ( (unsigned int)pValue > pParty->uNumGold )
Ritor1
parents:
diff changeset
6620 {
Ritor1
parents:
diff changeset
6621 dword_5B65C4_cancelEventProcessing = 1;
Ritor1
parents:
diff changeset
6622 return;
Ritor1
parents:
diff changeset
6623 }
Ritor1
parents:
diff changeset
6624 Party::TakeGold((unsigned int)pValue);
Ritor1
parents:
diff changeset
6625 return;
Ritor1
parents:
diff changeset
6626 case VAR_RandomGold:
Ritor1
parents:
diff changeset
6627 randGold = rand() % (signed int)pValue + 1;
Ritor1
parents:
diff changeset
6628 if ( (unsigned int)randGold > pParty->uNumGold )
Ritor1
parents:
diff changeset
6629 randGold = pParty->uNumGold;
Ritor1
parents:
diff changeset
6630 Party::TakeGold(randGold);
Ritor1
parents:
diff changeset
6631 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], randGold);
Ritor1
parents:
diff changeset
6632 ShowStatusBarString(pTmpBuf.data(), 2);
Ritor1
parents:
diff changeset
6633 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6634 return;
Ritor1
parents:
diff changeset
6635 case VAR_FixedFood:
Ritor1
parents:
diff changeset
6636 Party::TakeFood((unsigned int)pValue);
Ritor1
parents:
diff changeset
6637 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6638 return;
Ritor1
parents:
diff changeset
6639 case VAR_RandomFood:
Ritor1
parents:
diff changeset
6640 randFood = rand() % (signed int)pValue + 1;
Ritor1
parents:
diff changeset
6641 if ( (unsigned int)randFood > pParty->uNumFoodRations )
Ritor1
parents:
diff changeset
6642 randFood = pParty->uNumFoodRations;
Ritor1
parents:
diff changeset
6643 Party::TakeFood(randFood);
Ritor1
parents:
diff changeset
6644 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood);
Ritor1
parents:
diff changeset
6645 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6646 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6647 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6648 return;
Ritor1
parents:
diff changeset
6649 case VAR_MightBonus:
Ritor1
parents:
diff changeset
6650 case VAR_ActualMight:
Ritor1
parents:
diff changeset
6651 this->uMightBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6652 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6653 return;
Ritor1
parents:
diff changeset
6654 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
6655 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
6656 this->uIntelligenceBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6657 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6658 return;
Ritor1
parents:
diff changeset
6659 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
6660 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
6661 this->uWillpowerBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6662 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6663 return;
Ritor1
parents:
diff changeset
6664 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
6665 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
6666 this->uEnduranceBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6667 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6668 return;
Ritor1
parents:
diff changeset
6669 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
6670 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
6671 this->uSpeedBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6672 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6673 return;
Ritor1
parents:
diff changeset
6674 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
6675 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
6676 this->uAccuracyBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6677 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6678 return;
Ritor1
parents:
diff changeset
6679 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
6680 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
6681 this->uLuckBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6682 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6683 return;
Ritor1
parents:
diff changeset
6684 case VAR_BaseMight:
Ritor1
parents:
diff changeset
6685 this->uMight -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6686 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6687 return;
Ritor1
parents:
diff changeset
6688 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
6689 this->uIntelligence -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6690 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6691 return;
Ritor1
parents:
diff changeset
6692 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
6693 this->uWillpower -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6694 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6695 return;
Ritor1
parents:
diff changeset
6696 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
6697 this->uEndurance -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6698 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6699 return;
Ritor1
parents:
diff changeset
6700 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
6701 this->uSpeed -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6702 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6703 return;
Ritor1
parents:
diff changeset
6704 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
6705 this->uAccuracy -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6706 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6707 return;
Ritor1
parents:
diff changeset
6708 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
6709 this->uLuck -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6710 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6711 return;
Ritor1
parents:
diff changeset
6712 case VAR_FireResistance:
Ritor1
parents:
diff changeset
6713 this->sResFireBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6714 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6715 return;
Ritor1
parents:
diff changeset
6716 case VAR_AirResistance:
Ritor1
parents:
diff changeset
6717 this->sResAirBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6718 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6719 return;
Ritor1
parents:
diff changeset
6720 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
6721 this->sResWaterBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6722 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6723 return;
Ritor1
parents:
diff changeset
6724 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
6725 this->sResEarthBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6726 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6727 return;
Ritor1
parents:
diff changeset
6728 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
6729 this->sResSpiritBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6730 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6731 return;
Ritor1
parents:
diff changeset
6732 case VAR_MindResistance:
Ritor1
parents:
diff changeset
6733 this->sResMindBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6734 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6735 return;
Ritor1
parents:
diff changeset
6736 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
6737 this->sResBodyBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6738 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6739 return;
Ritor1
parents:
diff changeset
6740 case VAR_LightResistance:
Ritor1
parents:
diff changeset
6741 this->sResLightBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6742 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6743 return;
Ritor1
parents:
diff changeset
6744 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
6745 this->sResDarkBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6746 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6747 return;
Ritor1
parents:
diff changeset
6748 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
6749 this->sResMagicBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6750 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6751 return;
Ritor1
parents:
diff changeset
6752 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
6753 this->sResFireBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6754 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6755 return;
Ritor1
parents:
diff changeset
6756 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
6757 this->sResAirBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6758 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6759 return;
Ritor1
parents:
diff changeset
6760 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
6761 this->sResWaterBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6762 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6763 return;
Ritor1
parents:
diff changeset
6764 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
6765 this->sResEarthBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6766 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6767 return;
Ritor1
parents:
diff changeset
6768 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
6769 this->sResSpiritBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6770 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6771 return;
Ritor1
parents:
diff changeset
6772 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
6773 this->sResMindBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6774 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6775 return;
Ritor1
parents:
diff changeset
6776 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
6777 this->sResBodyBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6778 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6779 return;
Ritor1
parents:
diff changeset
6780 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
6781 this->sResLightBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6782 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6783 return;
Ritor1
parents:
diff changeset
6784 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
6785 this->sResDarkBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6786 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6787 return;
Ritor1
parents:
diff changeset
6788 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
6789 this->sResMagicBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6790 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6791 return;
Ritor1
parents:
diff changeset
6792 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
6793 this->skillStaff -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6794 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6795 return;
Ritor1
parents:
diff changeset
6796 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
6797 this->skillSword -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6798 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6799 return;
Ritor1
parents:
diff changeset
6800 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
6801 this->skillDagger -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6802 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6803 return;
Ritor1
parents:
diff changeset
6804 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
6805 this->skillAxe -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6806 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6807 return;
Ritor1
parents:
diff changeset
6808 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
6809 this->skillSpear -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6810 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6811 return;
Ritor1
parents:
diff changeset
6812 case VAR_BowSkill:
Ritor1
parents:
diff changeset
6813 this->skillBow -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6814 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6815 return;
Ritor1
parents:
diff changeset
6816 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
6817 this->skillMace -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6818 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6819 return;
Ritor1
parents:
diff changeset
6820 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
6821 this->skillBlaster -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6822 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6823 return;
Ritor1
parents:
diff changeset
6824 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
6825 this->skillShield -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6826 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6827 return;
Ritor1
parents:
diff changeset
6828 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
6829 this->skillLearning -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6830 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6831 return;
Ritor1
parents:
diff changeset
6832 case VAR_SkillChain:
Ritor1
parents:
diff changeset
6833 this->skillChain -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6834 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6835 return;
Ritor1
parents:
diff changeset
6836 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
6837 this->skillPlate -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6838 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6839 return;
Ritor1
parents:
diff changeset
6840 case VAR_FireSkill:
Ritor1
parents:
diff changeset
6841 this->skillFire -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6842 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6843 return;
Ritor1
parents:
diff changeset
6844 case VAR_AirSkill:
Ritor1
parents:
diff changeset
6845 this->skillAir -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6846 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6847 return;
Ritor1
parents:
diff changeset
6848 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
6849 this->skillWater -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6850 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6851 return;
Ritor1
parents:
diff changeset
6852 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
6853 this->skillEarth -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6854 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6855 return;
Ritor1
parents:
diff changeset
6856 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
6857 this->skillSpirit -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6858 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6859 return;
Ritor1
parents:
diff changeset
6860 case VAR_MindSkill:
Ritor1
parents:
diff changeset
6861 this->skillMind -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6862 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6863 return;
Ritor1
parents:
diff changeset
6864 case VAR_BodySkill:
Ritor1
parents:
diff changeset
6865 this->skillBody -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6866 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6867 return;
Ritor1
parents:
diff changeset
6868 case VAR_LightSkill:
Ritor1
parents:
diff changeset
6869 this->skillLight -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6870 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6871 return;
Ritor1
parents:
diff changeset
6872 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
6873 this->skillDark -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6874 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6875 return;
Ritor1
parents:
diff changeset
6876 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
6877 this->skillItemId -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6878 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6879 return;
Ritor1
parents:
diff changeset
6880 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
6881 this->skillMerchant -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6882 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6883 return;
Ritor1
parents:
diff changeset
6884 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
6885 this->skillRepair -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6886 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6887 return;
Ritor1
parents:
diff changeset
6888 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
6889 this->skillBodybuilding -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6890 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6891 return;
Ritor1
parents:
diff changeset
6892 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
6893 this->skillMeditation -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6894 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6895 return;
Ritor1
parents:
diff changeset
6896 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
6897 this->skillPerception -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6898 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6899 return;
Ritor1
parents:
diff changeset
6900 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
6901 this->skillDiplomacy -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6902 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6903 return;
Ritor1
parents:
diff changeset
6904 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
6905 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
6906 return;
Ritor1
parents:
diff changeset
6907 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
6908 this->skillDisarmTrap -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6909 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6910 return;
Ritor1
parents:
diff changeset
6911 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
6912 this->skillDodge -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6913 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6914 return;
Ritor1
parents:
diff changeset
6915 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
6916 this->skillUnarmed -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6917 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6918 return;
Ritor1
parents:
diff changeset
6919 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
6920 this->skillMonsterId -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6921 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6922 return;
Ritor1
parents:
diff changeset
6923 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
6924 this->skillArmsmaster -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6925 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6926 return;
Ritor1
parents:
diff changeset
6927 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
6928 this->skillStealing -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6929 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6930 return;
Ritor1
parents:
diff changeset
6931 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
6932 this->skillAlchemy -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6933 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6934 return;
Ritor1
parents:
diff changeset
6935 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
6936 this->skillLearning -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6937 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6938 return;
Ritor1
parents:
diff changeset
6939 case VAR_Cursed:
Ritor1
parents:
diff changeset
6940 this->pConditions[Condition_Cursed] = 0;
Ritor1
parents:
diff changeset
6941 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6942 return;
Ritor1
parents:
diff changeset
6943 case VAR_Weak:
Ritor1
parents:
diff changeset
6944 this->pConditions[Condition_Weak] = 0;
Ritor1
parents:
diff changeset
6945 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6946 return;
Ritor1
parents:
diff changeset
6947 case VAR_Asleep:
Ritor1
parents:
diff changeset
6948 this->pConditions[Condition_Sleep] = 0;
Ritor1
parents:
diff changeset
6949 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6950 return;
Ritor1
parents:
diff changeset
6951 case VAR_Afraid:
Ritor1
parents:
diff changeset
6952 this->pConditions[Condition_Fear] = 0;
Ritor1
parents:
diff changeset
6953 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6954 return;
Ritor1
parents:
diff changeset
6955 case VAR_Drunk:
Ritor1
parents:
diff changeset
6956 this->pConditions[Condition_Drunk] = 0;
Ritor1
parents:
diff changeset
6957 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6958 return;
Ritor1
parents:
diff changeset
6959 case VAR_Insane:
Ritor1
parents:
diff changeset
6960 this->pConditions[Condition_Insane] = 0;
Ritor1
parents:
diff changeset
6961 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6962 return;
Ritor1
parents:
diff changeset
6963 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
6964 this->pConditions[Condition_Poison_Weak] = 0;
Ritor1
parents:
diff changeset
6965 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6966 return;
Ritor1
parents:
diff changeset
6967 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
6968 this->pConditions[Condition_Disease_Weak] = 0;
Ritor1
parents:
diff changeset
6969 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6970 return;
Ritor1
parents:
diff changeset
6971 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
6972 this->pConditions[Condition_Poison_Medium] = 0;
Ritor1
parents:
diff changeset
6973 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6974 return;
Ritor1
parents:
diff changeset
6975 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
6976 this->pConditions[Condition_Disease_Medium] = 0;
Ritor1
parents:
diff changeset
6977 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6978 return;
Ritor1
parents:
diff changeset
6979 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
6980 this->pConditions[Condition_Poison_Severe] = 0;
Ritor1
parents:
diff changeset
6981 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6982 return;
Ritor1
parents:
diff changeset
6983 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
6984 this->pConditions[Condition_Disease_Severe] = 0;
Ritor1
parents:
diff changeset
6985 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6986 return;
Ritor1
parents:
diff changeset
6987 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
6988 this->pConditions[Condition_Paralyzed] = 0;
Ritor1
parents:
diff changeset
6989 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6990 return;
Ritor1
parents:
diff changeset
6991 case VAR_Unconsious:
Ritor1
parents:
diff changeset
6992 this->pConditions[Condition_Unconcious] = 0;
Ritor1
parents:
diff changeset
6993 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6994 return;
Ritor1
parents:
diff changeset
6995 case VAR_Dead:
Ritor1
parents:
diff changeset
6996 this->pConditions[Condition_Dead] = 0;
Ritor1
parents:
diff changeset
6997 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6998 return;
Ritor1
parents:
diff changeset
6999 case VAR_Stoned:
Ritor1
parents:
diff changeset
7000 this->pConditions[Condition_Pertified] = 0;
Ritor1
parents:
diff changeset
7001 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7002 return;
Ritor1
parents:
diff changeset
7003 case VAR_Eradicated:
Ritor1
parents:
diff changeset
7004 this->pConditions[Condition_Eradicated] = 0;
Ritor1
parents:
diff changeset
7005 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7006 return;
Ritor1
parents:
diff changeset
7007 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
7008 _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0);
Ritor1
parents:
diff changeset
7009 return;
Ritor1
parents:
diff changeset
7010 case VAR_NPCs2:
Ritor1
parents:
diff changeset
7011 npcIndex = 0;
Ritor1
parents:
diff changeset
7012 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &npcIndex);
Ritor1
parents:
diff changeset
7013 if ( npcIndex == pValue )
Ritor1
parents:
diff changeset
7014 {
Ritor1
parents:
diff changeset
7015 npcIdToDismissAfterDialogue = pValue;
Ritor1
parents:
diff changeset
7016 }
Ritor1
parents:
diff changeset
7017 else
Ritor1
parents:
diff changeset
7018 {
Ritor1
parents:
diff changeset
7019 npcIdToDismissAfterDialogue = 0;
Ritor1
parents:
diff changeset
7020 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
7021 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
Ritor1
parents:
diff changeset
7022 pParty->CountHirelings();
Ritor1
parents:
diff changeset
7023 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
7024 }
Ritor1
parents:
diff changeset
7025 return;
Ritor1
parents:
diff changeset
7026 case VAR_HiredNPCHasSpeciality:
Ritor1
parents:
diff changeset
7027 for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; i++)
Ritor1
parents:
diff changeset
7028 {
Ritor1
parents:
diff changeset
7029 if (pNPCStats->pNewNPCData[i].uProfession == pValue)
Ritor1
parents:
diff changeset
7030 {
Ritor1
parents:
diff changeset
7031 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
Ritor1
parents:
diff changeset
7032 }
Ritor1
parents:
diff changeset
7033 }
Ritor1
parents:
diff changeset
7034 if ( pParty->pHirelings[0].uProfession == pValue )
Ritor1
parents:
diff changeset
7035 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
Ritor1
parents:
diff changeset
7036 if ( pParty->pHirelings[1].uProfession == pValue )
Ritor1
parents:
diff changeset
7037 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
Ritor1
parents:
diff changeset
7038 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
7039 pParty->CountHirelings();
Ritor1
parents:
diff changeset
7040 return;
Ritor1
parents:
diff changeset
7041 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
7042 if ((unsigned int)pValue <= this->uSkillPoints)
Ritor1
parents:
diff changeset
7043 {
Ritor1
parents:
diff changeset
7044 this->uSkillPoints -= pValue;
Ritor1
parents:
diff changeset
7045 }
Ritor1
parents:
diff changeset
7046 else
Ritor1
parents:
diff changeset
7047 {
Ritor1
parents:
diff changeset
7048 this->uSkillPoints = 0;
Ritor1
parents:
diff changeset
7049 }
Ritor1
parents:
diff changeset
7050 return;
Ritor1
parents:
diff changeset
7051 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
7052 locationHeader = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
7053 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
7054 locationHeader = &pIndoor->dlv;
Ritor1
parents:
diff changeset
7055 locationHeader->uReputation -= pValue;
Ritor1
parents:
diff changeset
7056 if (locationHeader->uReputation < -10000)
Ritor1
parents:
diff changeset
7057 locationHeader->uReputation = -10000;
Ritor1
parents:
diff changeset
7058 return;
Ritor1
parents:
diff changeset
7059 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
7060 if ( (unsigned int)pValue <= pParty->uNumGoldInBank )
Ritor1
parents:
diff changeset
7061 {
Ritor1
parents:
diff changeset
7062 pParty->uNumGoldInBank -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7063 }
Ritor1
parents:
diff changeset
7064 else
Ritor1
parents:
diff changeset
7065 {
Ritor1
parents:
diff changeset
7066 dword_5B65C4_cancelEventProcessing = 1;
Ritor1
parents:
diff changeset
7067 }
Ritor1
parents:
diff changeset
7068 return;
Ritor1
parents:
diff changeset
7069 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
7070 pParty->uNumDeaths -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7071 return;
Ritor1
parents:
diff changeset
7072 case VAR_NumBounties:
Ritor1
parents:
diff changeset
7073 pParty->uNumBountiesCollected -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7074 return;
Ritor1
parents:
diff changeset
7075 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
7076 pParty->uNumPrisonTerms -= (int)pValue;
Ritor1
parents:
diff changeset
7077 return;
Ritor1
parents:
diff changeset
7078 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
7079 pParty->uNumArenaPageWins -= (char)pValue;
Ritor1
parents:
diff changeset
7080 return;
Ritor1
parents:
diff changeset
7081 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
7082 pParty->uNumArenaSquireWins -= (char)pValue;
Ritor1
parents:
diff changeset
7083 return;
Ritor1
parents:
diff changeset
7084 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
7085 pParty->uNumArenaKnightWins -= (char)pValue;
Ritor1
parents:
diff changeset
7086 return;
Ritor1
parents:
diff changeset
7087 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
7088 pParty->uNumArenaLordWins -= (char)pValue;
Ritor1
parents:
diff changeset
7089 return;
Ritor1
parents:
diff changeset
7090 }
Ritor1
parents:
diff changeset
7091 }
Ritor1
parents:
diff changeset
7092 // 5B65C4: using guessed type int dword_5B65C4;
Ritor1
parents:
diff changeset
7093 // 5B65CC: using guessed type int dword_5B65CC;
Ritor1
parents:
diff changeset
7094
Ritor1
parents:
diff changeset
7095 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
7096 void Player::PlayAwardSound_Anim98()
Ritor1
parents:
diff changeset
7097 {
Ritor1
parents:
diff changeset
7098 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7099 pEngine->pStru6Instance->SetPlayerBuffAnim(0x98u, playerIndex);
2498
Ritor1
parents:
diff changeset
7100 PlayAwardSound();
Ritor1
parents:
diff changeset
7101 }
Ritor1
parents:
diff changeset
7102
Ritor1
parents:
diff changeset
7103 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
7104 void Player::PlayAwardSound_Anim98_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
7105 {
Ritor1
parents:
diff changeset
7106 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
7107 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7108 }
Ritor1
parents:
diff changeset
7109
Ritor1
parents:
diff changeset
7110 //----- (00467E7F) --------------------------------------------------------
Ritor1
parents:
diff changeset
7111 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType)
Ritor1
parents:
diff changeset
7112 {
Ritor1
parents:
diff changeset
7113 int itemAnchor; // ebx@1
Ritor1
parents:
diff changeset
7114 int itemInvLocation; // edx@1
Ritor1
parents:
diff changeset
7115 int freeSlot; // eax@3
Ritor1
parents:
diff changeset
7116 ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1
Ritor1
parents:
diff changeset
7117
Ritor1
parents:
diff changeset
7118 tempPickedItem.Reset();
Ritor1
parents:
diff changeset
7119 itemAnchor = pEquipTypeToBodyAnchor[uEquipType];
Ritor1
parents:
diff changeset
7120 itemInvLocation = pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor];
Ritor1
parents:
diff changeset
7121 if ( itemInvLocation )//ïåðåîäåòüñÿ â äðóãóþ âåùü
Ritor1
parents:
diff changeset
7122 {
Ritor1
parents:
diff changeset
7123 memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem));
Ritor1
parents:
diff changeset
7124 pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1].uBodyAnchor = 0;
Ritor1
parents:
diff changeset
7125 pParty->pPickedItem.Reset();
Ritor1
parents:
diff changeset
7126 pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1]);
Ritor1
parents:
diff changeset
7127 tempPickedItem.uBodyAnchor = itemAnchor + 1;
Ritor1
parents:
diff changeset
7128 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1], &tempPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7129 pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] = itemInvLocation;
Ritor1
parents:
diff changeset
7130 }
Ritor1
parents:
diff changeset
7131 else//îäåòü âåùü
Ritor1
parents:
diff changeset
7132 {
Ritor1
parents:
diff changeset
7133 freeSlot = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
7134 if (freeSlot >= 0)
Ritor1
parents:
diff changeset
7135 {
Ritor1
parents:
diff changeset
7136 pParty->pPickedItem.uBodyAnchor = itemAnchor + 1;
Ritor1
parents:
diff changeset
7137 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[freeSlot], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7138 pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] = freeSlot + 1;
Ritor1
parents:
diff changeset
7139 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7140 }
Ritor1
parents:
diff changeset
7141 }
Ritor1
parents:
diff changeset
7142 }
Ritor1
parents:
diff changeset
7143
Ritor1
parents:
diff changeset
7144 //----- (0049387A) --------------------------------------------------------
Ritor1
parents:
diff changeset
7145 int CycleCharacter(bool backwards)
Ritor1
parents:
diff changeset
7146 {
Ritor1
parents:
diff changeset
7147 const int PARTYSIZE = 4;
Ritor1
parents:
diff changeset
7148 int valToAdd = backwards ? (PARTYSIZE - 2) : 0;
Ritor1
parents:
diff changeset
7149 int mult = backwards ? -1 : 1;
Ritor1
parents:
diff changeset
7150
Ritor1
parents:
diff changeset
7151 for (int i = 0; i < (PARTYSIZE - 1); i++)
Ritor1
parents:
diff changeset
7152 {
Ritor1
parents:
diff changeset
7153 int currCharId = ((uActiveCharacter + mult * i + valToAdd) % PARTYSIZE) + 1;
Ritor1
parents:
diff changeset
7154 if ( pPlayers[currCharId]->uTimeToRecovery == 0 )
Ritor1
parents:
diff changeset
7155 {
Ritor1
parents:
diff changeset
7156 return currCharId;
Ritor1
parents:
diff changeset
7157 }
Ritor1
parents:
diff changeset
7158 }
Ritor1
parents:
diff changeset
7159 return uActiveCharacter;
Ritor1
parents:
diff changeset
7160 }
Ritor1
parents:
diff changeset
7161
Ritor1
parents:
diff changeset
7162 //----- (0043EE77) --------------------------------------------------------
Ritor1
parents:
diff changeset
7163 bool Player::HasUnderwaterSuitEquipped() //the original function took the player number as a parameter. if it was 0, the whole party was checked. calls with the parameter 0 have been changed to calls to this for every player
Ritor1
parents:
diff changeset
7164 {
Ritor1
parents:
diff changeset
7165 if (GetArmorItem() == nullptr || GetArmorItem()->uItemID != 604)
Ritor1
parents:
diff changeset
7166 {
Ritor1
parents:
diff changeset
7167 return false;
Ritor1
parents:
diff changeset
7168 }
Ritor1
parents:
diff changeset
7169 return true;
Ritor1
parents:
diff changeset
7170 }
Ritor1
parents:
diff changeset
7171
Ritor1
parents:
diff changeset
7172 //----- (0043EE15) --------------------------------------------------------
Ritor1
parents:
diff changeset
7173 bool Player::HasItem( unsigned int uItemID, bool checkHeldItem )
Ritor1
parents:
diff changeset
7174 {
Ritor1
parents:
diff changeset
7175 if ( !checkHeldItem || pParty->pPickedItem.uItemID != uItemID )
Ritor1
parents:
diff changeset
7176 {
Ritor1
parents:
diff changeset
7177 for ( uint i = 0; i < 126; ++i )
Ritor1
parents:
diff changeset
7178 {
Ritor1
parents:
diff changeset
7179 if ( this->pInventoryMatrix[i] > 0 )
Ritor1
parents:
diff changeset
7180 {
Ritor1
parents:
diff changeset
7181 if ( (unsigned int)this->pInventoryItemList[this->pInventoryMatrix[i] - 1].uItemID == uItemID )
Ritor1
parents:
diff changeset
7182 return true;
Ritor1
parents:
diff changeset
7183 }
Ritor1
parents:
diff changeset
7184 }
Ritor1
parents:
diff changeset
7185 for ( uint i = 0; i < 16; ++i )
Ritor1
parents:
diff changeset
7186 {
Ritor1
parents:
diff changeset
7187 if ( this->pEquipment.pIndices[i] )
Ritor1
parents:
diff changeset
7188 {
Ritor1
parents:
diff changeset
7189 if ( (unsigned int)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == uItemID )
Ritor1
parents:
diff changeset
7190 return true;
Ritor1
parents:
diff changeset
7191 }
Ritor1
parents:
diff changeset
7192 }
Ritor1
parents:
diff changeset
7193 return false;
Ritor1
parents:
diff changeset
7194 }
Ritor1
parents:
diff changeset
7195 else
Ritor1
parents:
diff changeset
7196 {
Ritor1
parents:
diff changeset
7197 return true;
Ritor1
parents:
diff changeset
7198 }
Ritor1
parents:
diff changeset
7199 }
Ritor1
parents:
diff changeset
7200 //----- (0043EDB9) --------------------------------------------------------
Ritor1
parents:
diff changeset
7201 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this)
Ritor1
parents:
diff changeset
7202 {
Ritor1
parents:
diff changeset
7203 CHARACTER_RACE race; // edi@2
Ritor1
parents:
diff changeset
7204 PLAYER_SEX sex; // eax@2
Ritor1
parents:
diff changeset
7205
Ritor1
parents:
diff changeset
7206 for (int i = 1; i <= 4; i++)
Ritor1
parents:
diff changeset
7207 {
Ritor1
parents:
diff changeset
7208 race = pPlayers[i]->GetRace();
Ritor1
parents:
diff changeset
7209 sex = pPlayers[i]->GetSexByVoice();
Ritor1
parents:
diff changeset
7210 switch(_this)
Ritor1
parents:
diff changeset
7211 {
Ritor1
parents:
diff changeset
7212 case 0:
Ritor1
parents:
diff changeset
7213 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_MALE )
Ritor1
parents:
diff changeset
7214 return true;
Ritor1
parents:
diff changeset
7215 break;
Ritor1
parents:
diff changeset
7216 case 1:
Ritor1
parents:
diff changeset
7217 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_FEMALE )
Ritor1
parents:
diff changeset
7218 return true;
Ritor1
parents:
diff changeset
7219 break;
Ritor1
parents:
diff changeset
7220 case 2:
Ritor1
parents:
diff changeset
7221 if ( race == CHARACTER_RACE_DWARF && sex == SEX_MALE )
Ritor1
parents:
diff changeset
7222 return true;
Ritor1
parents:
diff changeset
7223 break;
Ritor1
parents:
diff changeset
7224 case 3:
Ritor1
parents:
diff changeset
7225 if ( race == CHARACTER_RACE_DWARF && sex == SEX_FEMALE )
Ritor1
parents:
diff changeset
7226 return true;
Ritor1
parents:
diff changeset
7227 break;
Ritor1
parents:
diff changeset
7228 }
Ritor1
parents:
diff changeset
7229 }
Ritor1
parents:
diff changeset
7230 return false;
Ritor1
parents:
diff changeset
7231 }
Ritor1
parents:
diff changeset
7232
Ritor1
parents:
diff changeset
7233 //----- (0043ED6F) --------------------------------------------------------
Ritor1
parents:
diff changeset
7234 bool IsDwarfPresentInParty(bool a1)
Ritor1
parents:
diff changeset
7235 {
Ritor1
parents:
diff changeset
7236 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
7237 {
Ritor1
parents:
diff changeset
7238 CHARACTER_RACE race = pParty->pPlayers[i].GetRace();
Ritor1
parents:
diff changeset
7239
Ritor1
parents:
diff changeset
7240 if (race == CHARACTER_RACE_DWARF && a1)
Ritor1
parents:
diff changeset
7241 return true;
Ritor1
parents:
diff changeset
7242 else if (race != CHARACTER_RACE_DWARF && !a1)
Ritor1
parents:
diff changeset
7243 return true;
Ritor1
parents:
diff changeset
7244 }
Ritor1
parents:
diff changeset
7245 return false;
Ritor1
parents:
diff changeset
7246 }
Ritor1
parents:
diff changeset
7247
Ritor1
parents:
diff changeset
7248 //----- (00439FCB) --------------------------------------------------------
Ritor1
parents:
diff changeset
7249 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, signed int a4)
Ritor1
parents:
diff changeset
7250 {
Ritor1
parents:
diff changeset
7251 Player *playerPtr; // ebx@3
Ritor1
parents:
diff changeset
7252 Actor *actorPtr; // esi@3
Ritor1
parents:
diff changeset
7253 int spellId; // eax@38
Ritor1
parents:
diff changeset
7254 signed int recvdMagicDmg; // eax@139
Ritor1
parents:
diff changeset
7255 int v72[4]; // [sp+30h] [bp-24h]@164
Ritor1
parents:
diff changeset
7256 int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3
Ritor1
parents:
diff changeset
7257 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
7258
Ritor1
parents:
diff changeset
7259 uActorID = PID_ID(uObjID);
Ritor1
parents:
diff changeset
7260 if ( PID_TYPE(uObjID) != 2)
Ritor1
parents:
diff changeset
7261 {
Ritor1
parents:
diff changeset
7262 playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7263 actorPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
7264 healthBeforeRecvdDamage = playerPtr->sHealth;
Ritor1
parents:
diff changeset
7265 if ( PID_TYPE(uObjID) != 3 || !actorPtr->ActorHitOrMiss(playerPtr) )
Ritor1
parents:
diff changeset
7266 return;
Ritor1
parents:
diff changeset
7267 ItemGen* equippedArmor = playerPtr->GetArmorItem();
Ritor1
parents:
diff changeset
7268 SoundID soundToPlay;
Ritor1
parents:
diff changeset
7269 if ( !equippedArmor
Ritor1
parents:
diff changeset
7270 || equippedArmor->IsBroken()
Ritor1
parents:
diff changeset
7271 ||
Ritor1
parents:
diff changeset
7272 (equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_CHAIN
Ritor1
parents:
diff changeset
7273 && equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_PLATE
Ritor1
parents:
diff changeset
7274 )
Ritor1
parents:
diff changeset
7275 )
Ritor1
parents:
diff changeset
7276 {
Ritor1
parents:
diff changeset
7277 int randVal = rand() % 4;
Ritor1
parents:
diff changeset
7278 switch (randVal)
Ritor1
parents:
diff changeset
7279 {
Ritor1
parents:
diff changeset
7280 case 0 : soundToPlay = (SoundID)108; break;
Ritor1
parents:
diff changeset
7281 case 1 : soundToPlay = (SoundID)109; break;
Ritor1
parents:
diff changeset
7282 case 2 : soundToPlay = (SoundID)110; break;
Ritor1
parents:
diff changeset
7283 case 3 : soundToPlay = (SoundID)44; break;
Ritor1
parents:
diff changeset
7284 default: Error("Unexpected sound value");
Ritor1
parents:
diff changeset
7285 }
Ritor1
parents:
diff changeset
7286 }
Ritor1
parents:
diff changeset
7287 else
Ritor1
parents:
diff changeset
7288 {
Ritor1
parents:
diff changeset
7289 int randVal = rand() % 4;
Ritor1
parents:
diff changeset
7290 switch (randVal)
Ritor1
parents:
diff changeset
7291 {
Ritor1
parents:
diff changeset
7292 case 0 : soundToPlay = (SoundID)105; break;
Ritor1
parents:
diff changeset
7293 case 1 : soundToPlay = (SoundID)106; break;
Ritor1
parents:
diff changeset
7294 case 2 : soundToPlay = (SoundID)107; break;
Ritor1
parents:
diff changeset
7295 case 3 : soundToPlay = (SoundID)45; break;
Ritor1
parents:
diff changeset
7296 default: Error("Unexpected sound value");
Ritor1
parents:
diff changeset
7297 }
Ritor1
parents:
diff changeset
7298 }
Ritor1
parents:
diff changeset
7299 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
7300 int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
Ritor1
parents:
diff changeset
7301 if ( actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7302 {
Ritor1
parents:
diff changeset
7303 __int16 spellPower = actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
Ritor1
parents:
diff changeset
7304 if ( spellPower )
Ritor1
parents:
diff changeset
7305 dmgToReceive /= (signed int)spellPower;
Ritor1
parents:
diff changeset
7306 }
Ritor1
parents:
diff changeset
7307 int damageType;
Ritor1
parents:
diff changeset
7308 switch (dmgSource)
Ritor1
parents:
diff changeset
7309 {
Ritor1
parents:
diff changeset
7310 case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type;
Ritor1
parents:
diff changeset
7311 break;
Ritor1
parents:
diff changeset
7312 case 1: damageType = actorPtr->pMonsterInfo.uAttack2Type;
Ritor1
parents:
diff changeset
7313 break;
Ritor1
parents:
diff changeset
7314 case 2: spellId = actorPtr->pMonsterInfo.uSpell1ID;
Ritor1
parents:
diff changeset
7315 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7316 break;
Ritor1
parents:
diff changeset
7317 case 3: spellId = actorPtr->pMonsterInfo.uSpell2ID;
Ritor1
parents:
diff changeset
7318 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7319 break;
Ritor1
parents:
diff changeset
7320 case 4: damageType = actorPtr->pMonsterInfo.field_3C_some_special_attack;
Ritor1
parents:
diff changeset
7321 break;
Ritor1
parents:
diff changeset
7322 default:
Ritor1
parents:
diff changeset
7323 case 5: damageType = 4; //yes, the original just assigned the value 4
Ritor1
parents:
diff changeset
7324 break;
Ritor1
parents:
diff changeset
7325 }
Ritor1
parents:
diff changeset
7326 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
Ritor1
parents:
diff changeset
7327 {
Ritor1
parents:
diff changeset
7328 dmgToReceive = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
Ritor1
parents:
diff changeset
7329 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7330 {
Ritor1
parents:
diff changeset
7331 int actorState = actorPtr->uAIState;
Ritor1
parents:
diff changeset
7332 if ( actorState != Dying && actorState != Dead)
Ritor1
parents:
diff changeset
7333 {
Ritor1
parents:
diff changeset
7334 int reflectedDamage = actorPtr->CalcMagicalDamageToActor((DAMAGE_TYPE)damageType, dmgToReceive);
Ritor1
parents:
diff changeset
7335 actorPtr->sCurrentHP -= reflectedDamage;
Ritor1
parents:
diff changeset
7336 if ( reflectedDamage >= 0 )
Ritor1
parents:
diff changeset
7337 {
Ritor1
parents:
diff changeset
7338 if ( actorPtr->sCurrentHP >= 1 )
Ritor1
parents:
diff changeset
7339 {
Ritor1
parents:
diff changeset
7340 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); //todo extract this branch to a function once Actor::functions are changed to nonstatic actor functions
Ritor1
parents:
diff changeset
7341 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7342 }
Ritor1
parents:
diff changeset
7343 else
Ritor1
parents:
diff changeset
7344 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7345 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
2498
Ritor1
parents:
diff changeset
7346 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7347 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
2498
Ritor1
parents:
diff changeset
7348 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
Ritor1
parents:
diff changeset
7349 }
Ritor1
parents:
diff changeset
7350 Actor::Die(uActorID);
Ritor1
parents:
diff changeset
7351 Actor::ApplyFineForKillingPeasant(uActorID);
Ritor1
parents:
diff changeset
7352 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7353 if ( actorPtr->pMonsterInfo.uExp )
Ritor1
parents:
diff changeset
7354 pParty->GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp);
Ritor1
parents:
diff changeset
7355 int speechToPlay = SPEECH_51;
Ritor1
parents:
diff changeset
7356 if ( rand() % 100 < 20 )
Ritor1
parents:
diff changeset
7357 speechToPlay = actorPtr->pMonsterInfo.uHP >= 100 ? 2 : 1;
Ritor1
parents:
diff changeset
7358 playerPtr->PlaySound((PlayerSpeech)speechToPlay, 0);
Ritor1
parents:
diff changeset
7359 }
Ritor1
parents:
diff changeset
7360 }
Ritor1
parents:
diff changeset
7361 }
Ritor1
parents:
diff changeset
7362 }
Ritor1
parents:
diff changeset
7363 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
Ritor1
parents:
diff changeset
7364 && actorPtr->pMonsterInfo.uSpecialAttackType
Ritor1
parents:
diff changeset
7365 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
Ritor1
parents:
diff changeset
7366 {
Ritor1
parents:
diff changeset
7367 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
Ritor1
parents:
diff changeset
7368 }
Ritor1
parents:
diff changeset
7369 }
Ritor1
parents:
diff changeset
7370 if ( !pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
7371 {
Ritor1
parents:
diff changeset
7372 int actEndurance = playerPtr->GetActualEndurance();
Ritor1
parents:
diff changeset
7373 int recoveryTime = (int)((20 - playerPtr->GetParameterBonus(actEndurance)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333);
Ritor1
parents:
diff changeset
7374 playerPtr->SetRecoveryTime(recoveryTime);
Ritor1
parents:
diff changeset
7375 }
Ritor1
parents:
diff changeset
7376 int yellThreshold = playerPtr->GetMaxHealth() / 4;
Ritor1
parents:
diff changeset
7377 if ( yellThreshold < playerPtr->sHealth && yellThreshold >= healthBeforeRecvdDamage && playerPtr->sHealth > 0 )
Ritor1
parents:
diff changeset
7378 {
Ritor1
parents:
diff changeset
7379 playerPtr->PlaySound(SPEECH_48, 0);
Ritor1
parents:
diff changeset
7380 }
Ritor1
parents:
diff changeset
7381 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
7382 return;
Ritor1
parents:
diff changeset
7383 }
Ritor1
parents:
diff changeset
7384 else
Ritor1
parents:
diff changeset
7385 {
Ritor1
parents:
diff changeset
7386 SpriteObject* v37 = &pSpriteObjects[uActorID];
Ritor1
parents:
diff changeset
7387 int uActorType = PID_TYPE(v37->spell_caster_pid);
Ritor1
parents:
diff changeset
7388 int uActorID = PID_ID(v37->spell_caster_pid);
Ritor1
parents:
diff changeset
7389 if ( uActorType == 2 )
Ritor1
parents:
diff changeset
7390 {
Ritor1
parents:
diff changeset
7391 Player *playerPtr; // eax@81
Ritor1
parents:
diff changeset
7392 if ( a4 != -1 )
Ritor1
parents:
diff changeset
7393 {
Ritor1
parents:
diff changeset
7394 playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7395 }
Ritor1
parents:
diff changeset
7396 else
Ritor1
parents:
diff changeset
7397 {
Ritor1
parents:
diff changeset
7398 int activePlayerCounter = 0;
Ritor1
parents:
diff changeset
7399 for (int i = 1; i <= 4; i++)
Ritor1
parents:
diff changeset
7400 {
Ritor1
parents:
diff changeset
7401 if (pPlayers[i]->CanAct())
Ritor1
parents:
diff changeset
7402 {
Ritor1
parents:
diff changeset
7403 v72[activePlayerCounter] = i;
Ritor1
parents:
diff changeset
7404 activePlayerCounter++;
Ritor1
parents:
diff changeset
7405 }
Ritor1
parents:
diff changeset
7406 }
Ritor1
parents:
diff changeset
7407 if ( activePlayerCounter )
Ritor1
parents:
diff changeset
7408 {
Ritor1
parents:
diff changeset
7409 playerPtr = &pParty->pPlayers[v72[rand() % activePlayerCounter] - 1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552];
Ritor1
parents:
diff changeset
7410 }
Ritor1
parents:
diff changeset
7411 }
Ritor1
parents:
diff changeset
7412 int v68;
Ritor1
parents:
diff changeset
7413 int v69;
Ritor1
parents:
diff changeset
7414 if ( uActorType != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW)
Ritor1
parents:
diff changeset
7415 {
Ritor1
parents:
diff changeset
7416 int playerMaxHp = playerPtr->GetMaxHealth();
Ritor1
parents:
diff changeset
7417 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, playerMaxHp);
Ritor1
parents:
diff changeset
7418 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool);
Ritor1
parents:
diff changeset
7419 }
Ritor1
parents:
diff changeset
7420 else
Ritor1
parents:
diff changeset
7421 {
Ritor1
parents:
diff changeset
7422 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
Ritor1
parents:
diff changeset
7423 v69 = 0;
Ritor1
parents:
diff changeset
7424 }
Ritor1
parents:
diff changeset
7425 playerPtr->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
Ritor1
parents:
diff changeset
7426 if ( uActorType == OBJECT_Player && !_A750D8_player_speech_timer )
Ritor1
parents:
diff changeset
7427 {
Ritor1
parents:
diff changeset
7428 _A750D8_player_speech_timer = 256i64;
Ritor1
parents:
diff changeset
7429 PlayerSpeechID = SPEECH_44;
Ritor1
parents:
diff changeset
7430 uSpeakingCharacter = uActorID + 1;
Ritor1
parents:
diff changeset
7431 }
Ritor1
parents:
diff changeset
7432 return;
Ritor1
parents:
diff changeset
7433 }
Ritor1
parents:
diff changeset
7434 else if ( uActorType == 3 )
Ritor1
parents:
diff changeset
7435 {
Ritor1
parents:
diff changeset
7436 Actor *actorPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
7437 if ( a4 == -1 )
Ritor1
parents:
diff changeset
7438 a4 = stru_50C198.which_player_to_attack(actorPtr);
Ritor1
parents:
diff changeset
7439 Player *playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7440 int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
Ritor1
parents:
diff changeset
7441 unsigned __int16 spriteType = v37->uType;
Ritor1
parents:
diff changeset
7442 if ( v37->uType == 545 )
Ritor1
parents:
diff changeset
7443 {
Ritor1
parents:
diff changeset
7444 __int16 skillLevel = playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
7445 if ( SkillToMastery(skillLevel) >= 4 && rand() % 100 < (skillLevel & 0x3F) )
Ritor1
parents:
diff changeset
7446 {
Ritor1
parents:
diff changeset
7447 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], playerPtr->pName);
Ritor1
parents:
diff changeset
7448 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
7449 playerPtr->PlaySound(SPEECH_6, 0);
Ritor1
parents:
diff changeset
7450 return;
Ritor1
parents:
diff changeset
7451 }
Ritor1
parents:
diff changeset
7452 }
Ritor1
parents:
diff changeset
7453 else if ( spriteType == 555
Ritor1
parents:
diff changeset
7454 || spriteType == 510
Ritor1
parents:
diff changeset
7455 || spriteType == 500
Ritor1
parents:
diff changeset
7456 || spriteType == 515
Ritor1
parents:
diff changeset
7457 || spriteType == 505
Ritor1
parents:
diff changeset
7458 || spriteType == 530
Ritor1
parents:
diff changeset
7459 || spriteType == 525
Ritor1
parents:
diff changeset
7460 || spriteType == 520
Ritor1
parents:
diff changeset
7461 || spriteType == 535
Ritor1
parents:
diff changeset
7462 || spriteType == 540 )
Ritor1
parents:
diff changeset
7463 {
Ritor1
parents:
diff changeset
7464 if ( !actorPtr->ActorHitOrMiss(playerPtr) )
Ritor1
parents:
diff changeset
7465 return;
Ritor1
parents:
diff changeset
7466 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7467 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7468 if ( playerPtr->HasEnchantedItemEquipped(36) )
Ritor1
parents:
diff changeset
7469 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7470 if ( playerPtr->HasEnchantedItemEquipped(69) )
Ritor1
parents:
diff changeset
7471 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7472 if ( playerPtr->HasItemEquipped(EQUIP_ARMOUR)
Ritor1
parents:
diff changeset
7473 && playerPtr->GetArmorItem()->uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR )
Ritor1
parents:
diff changeset
7474 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7475 if ( playerPtr->HasItemEquipped(EQUIP_TWO_HANDED))
Ritor1
parents:
diff changeset
7476 {
Ritor1
parents:
diff changeset
7477 ItemGen* mainHandItem = playerPtr->GetMainHandItem();
Ritor1
parents:
diff changeset
7478 if ( mainHandItem->uItemID == ITEM_RELIC_KELEBRIM || mainHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (mainHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
Ritor1
parents:
diff changeset
7479 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7480 }
Ritor1
parents:
diff changeset
7481 if ( playerPtr->HasItemEquipped(EQUIP_SINGLE_HANDED))
Ritor1
parents:
diff changeset
7482 {
Ritor1
parents:
diff changeset
7483 ItemGen* offHandItem = playerPtr->GetOffHandItem();
Ritor1
parents:
diff changeset
7484 if ( offHandItem->uItemID == ITEM_RELIC_KELEBRIM || offHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (offHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
Ritor1
parents:
diff changeset
7485 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7486 }
Ritor1
parents:
diff changeset
7487 }
Ritor1
parents:
diff changeset
7488 if ( actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7489 {
Ritor1
parents:
diff changeset
7490 int spellPower = actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
Ritor1
parents:
diff changeset
7491 if ( spellPower )
Ritor1
parents:
diff changeset
7492 dmgToReceive /= (signed int)spellPower;
Ritor1
parents:
diff changeset
7493 }
Ritor1
parents:
diff changeset
7494 int damageType;
Ritor1
parents:
diff changeset
7495 switch(dmgSource)
Ritor1
parents:
diff changeset
7496 {
Ritor1
parents:
diff changeset
7497 case 0:
Ritor1
parents:
diff changeset
7498 damageType = actorPtr->pMonsterInfo.uAttack1Type;
Ritor1
parents:
diff changeset
7499 break;
Ritor1
parents:
diff changeset
7500 case 1:
Ritor1
parents:
diff changeset
7501 damageType = actorPtr->pMonsterInfo.uAttack2Type;
Ritor1
parents:
diff changeset
7502 break;
Ritor1
parents:
diff changeset
7503 case 2:
Ritor1
parents:
diff changeset
7504 spellId = actorPtr->pMonsterInfo.uSpell1ID;
Ritor1
parents:
diff changeset
7505 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7506 break;
Ritor1
parents:
diff changeset
7507 case 3:
Ritor1
parents:
diff changeset
7508 spellId = actorPtr->pMonsterInfo.uSpell2ID;
Ritor1
parents:
diff changeset
7509 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7510 break;
Ritor1
parents:
diff changeset
7511 case 4:
Ritor1
parents:
diff changeset
7512 damageType = actorPtr->pMonsterInfo.field_3C_some_special_attack;
Ritor1
parents:
diff changeset
7513 break;
Ritor1
parents:
diff changeset
7514 case 5:
Ritor1
parents:
diff changeset
7515 damageType = 4;
Ritor1
parents:
diff changeset
7516 break;
Ritor1
parents:
diff changeset
7517 }
Ritor1
parents:
diff changeset
7518 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
Ritor1
parents:
diff changeset
7519 {
Ritor1
parents:
diff changeset
7520 int reflectedDmg = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
Ritor1
parents:
diff changeset
7521 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7522 {
Ritor1
parents:
diff changeset
7523 unsigned __int16 actorState = actorPtr->uAIState;
Ritor1
parents:
diff changeset
7524 if ( actorState != Dying && actorState != Dead)
Ritor1
parents:
diff changeset
7525 {
Ritor1
parents:
diff changeset
7526 recvdMagicDmg = actorPtr->CalcMagicalDamageToActor((DAMAGE_TYPE)damageType, reflectedDmg);
Ritor1
parents:
diff changeset
7527 actorPtr->sCurrentHP -= recvdMagicDmg;
Ritor1
parents:
diff changeset
7528 if ( recvdMagicDmg >= 0 )
Ritor1
parents:
diff changeset
7529 {
Ritor1
parents:
diff changeset
7530 if ( actorPtr->sCurrentHP >= 1 )
Ritor1
parents:
diff changeset
7531 {
Ritor1
parents:
diff changeset
7532 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
Ritor1
parents:
diff changeset
7533 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7534 }
Ritor1
parents:
diff changeset
7535 else
Ritor1
parents:
diff changeset
7536 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7537 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
2498
Ritor1
parents:
diff changeset
7538 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7539 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
2498
Ritor1
parents:
diff changeset
7540 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
Ritor1
parents:
diff changeset
7541 }
Ritor1
parents:
diff changeset
7542 Actor::Die(uActorID);
Ritor1
parents:
diff changeset
7543 Actor::ApplyFineForKillingPeasant(uActorID);
Ritor1
parents:
diff changeset
7544 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7545 if ( actorPtr->pMonsterInfo.uExp )
Ritor1
parents:
diff changeset
7546 pParty->GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp);
Ritor1
parents:
diff changeset
7547 int speechToPlay = SPEECH_51;
Ritor1
parents:
diff changeset
7548 if ( rand() % 100 < 20 )
Ritor1
parents:
diff changeset
7549 speechToPlay = actorPtr->pMonsterInfo.uHP >= 100 ? 2 : 1;
Ritor1
parents:
diff changeset
7550 playerPtr->PlaySound((PlayerSpeech)speechToPlay, 0);
Ritor1
parents:
diff changeset
7551 }
Ritor1
parents:
diff changeset
7552 }
Ritor1
parents:
diff changeset
7553 }
Ritor1
parents:
diff changeset
7554 }
Ritor1
parents:
diff changeset
7555 }
Ritor1
parents:
diff changeset
7556 if ( !dmgSource
Ritor1
parents:
diff changeset
7557 && !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
Ritor1
parents:
diff changeset
7558 && actorPtr->pMonsterInfo.uSpecialAttackType
Ritor1
parents:
diff changeset
7559 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
Ritor1
parents:
diff changeset
7560 {
Ritor1
parents:
diff changeset
7561 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
Ritor1
parents:
diff changeset
7562 }
Ritor1
parents:
diff changeset
7563 if ( !pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
7564 {
Ritor1
parents:
diff changeset
7565 int actEnd = playerPtr->GetActualEndurance();
Ritor1
parents:
diff changeset
7566 int recTime = (int)((20 - playerPtr->GetParameterBonus(actEnd))
Ritor1
parents:
diff changeset
7567 * flt_6BE3A4_debug_recmod1
Ritor1
parents:
diff changeset
7568 * 2.133333333333333);
Ritor1
parents:
diff changeset
7569 playerPtr->SetRecoveryTime(recTime);
Ritor1
parents:
diff changeset
7570 }
Ritor1
parents:
diff changeset
7571 return;
Ritor1
parents:
diff changeset
7572 }
Ritor1
parents:
diff changeset
7573 else
Ritor1
parents:
diff changeset
7574 {
Ritor1
parents:
diff changeset
7575 return;
Ritor1
parents:
diff changeset
7576 }
Ritor1
parents:
diff changeset
7577 }
Ritor1
parents:
diff changeset
7578 }
Ritor1
parents:
diff changeset
7579 //----- (00421EA6) --------------------------------------------------------
Ritor1
parents:
diff changeset
7580 void Player::OnInventoryLeftClick()
Ritor1
parents:
diff changeset
7581 {
Ritor1
parents:
diff changeset
7582 signed int inventoryXCoord; // ecx@2
Ritor1
parents:
diff changeset
7583 int inventoryYCoord; // eax@2
Ritor1
parents:
diff changeset
7584 int invMatrixIndex; // eax@2
Ritor1
parents:
diff changeset
7585 unsigned int enchantedItemPos; // eax@7
Ritor1
parents:
diff changeset
7586 unsigned int pickedItemId; // esi@12
Ritor1
parents:
diff changeset
7587 unsigned int invItemIndex; // eax@12
Ritor1
parents:
diff changeset
7588 unsigned int itemPos; // eax@18
Ritor1
parents:
diff changeset
7589 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1
Ritor1
parents:
diff changeset
7590 unsigned int pY; // [sp+3Ch] [bp-Ch]@2
Ritor1
parents:
diff changeset
7591 unsigned int pX; // [sp+40h] [bp-8h]@2
Ritor1
parents:
diff changeset
7592 CastSpellInfo *pSpellInfo;
Ritor1
parents:
diff changeset
7593
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2543
diff changeset
7594 if (current_character_screen_window == WINDOW_CharacterWindow_Inventory)
2498
Ritor1
parents:
diff changeset
7595 {
Ritor1
parents:
diff changeset
7596 pMouse->GetClickPos(&pX, &pY);
Ritor1
parents:
diff changeset
7597 inventoryYCoord = (pY - 17) / 32;
Ritor1
parents:
diff changeset
7598 inventoryXCoord = (pX - 14) / 32;
Ritor1
parents:
diff changeset
7599 invMatrixIndex = inventoryXCoord + (INVETORYSLOTSWIDTH * inventoryYCoord);
Ritor1
parents:
diff changeset
7600 if ( inventoryYCoord >= 0 && inventoryYCoord < INVETORYSLOTSHEIGHT && inventoryXCoord >= 0 && inventoryXCoord < INVETORYSLOTSWIDTH)
Ritor1
parents:
diff changeset
7601 {
Ritor1
parents:
diff changeset
7602 if ( _50C9A0_IsEnchantingInProgress )
Ritor1
parents:
diff changeset
7603 {
Ritor1
parents:
diff changeset
7604 enchantedItemPos = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
Ritor1
parents:
diff changeset
7605 if ( enchantedItemPos )
Ritor1
parents:
diff changeset
7606 {
2554
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7607 /* *((char *)pGUIWindow_CastTargetedSpell->ptr_1C + 8) &= 0x7Fu;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7608 *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 2) = uActiveCharacter - 1;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7609 *((int *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = enchantedItemPos - 1;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7610 *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = invMatrixIndex;*/
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7611 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
2498
Ritor1
parents:
diff changeset
7612 pSpellInfo->uFlags &= 0x7F;
Ritor1
parents:
diff changeset
7613 pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
Ritor1
parents:
diff changeset
7614 pSpellInfo->spell_target_pid = enchantedItemPos - 1;
Ritor1
parents:
diff changeset
7615 pSpellInfo->field_6 = invMatrixIndex;
Ritor1
parents:
diff changeset
7616 ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[enchantedItemPos-1];
Ritor1
parents:
diff changeset
7617 _50C9A0_IsEnchantingInProgress = 0;
Ritor1
parents:
diff changeset
7618 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
7619 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
Ritor1
parents:
diff changeset
7620 pMouse->SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
7621 _50C9D0_AfterEnchClickEventId = 113;
Ritor1
parents:
diff changeset
7622 _50C9D4_AfterEnchClickEventSecondParam = 0;
Ritor1
parents:
diff changeset
7623 _50C9D8_AfterEnchClickEventTimeout = 256;
Ritor1
parents:
diff changeset
7624 }
Ritor1
parents:
diff changeset
7625 return;
Ritor1
parents:
diff changeset
7626 }
Ritor1
parents:
diff changeset
7627 if ( ptr_50C9A4_ItemToEnchant )
Ritor1
parents:
diff changeset
7628 return;
Ritor1
parents:
diff changeset
7629 pickedItemId = pParty->pPickedItem.uItemID;
Ritor1
parents:
diff changeset
7630 invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
Ritor1
parents:
diff changeset
7631 if (!pickedItemId)
Ritor1
parents:
diff changeset
7632 {
Ritor1
parents:
diff changeset
7633 if ( !invItemIndex )
Ritor1
parents:
diff changeset
7634 return;
Ritor1
parents:
diff changeset
7635 else
Ritor1
parents:
diff changeset
7636 {
Ritor1
parents:
diff changeset
7637 memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem));
Ritor1
parents:
diff changeset
7638 this->RemoveItemAtInventoryIndex(invMatrixIndex);
Ritor1
parents:
diff changeset
7639 pickedItemId = pParty->pPickedItem.uItemID;
Ritor1
parents:
diff changeset
7640 pMouse->SetCursorBitmap(pItemsTable->pItems[pickedItemId].pIconName);
Ritor1
parents:
diff changeset
7641 return;
Ritor1
parents:
diff changeset
7642 }
Ritor1
parents:
diff changeset
7643 }
Ritor1
parents:
diff changeset
7644 else
Ritor1
parents:
diff changeset
7645 {
Ritor1
parents:
diff changeset
7646 if ( invItemIndex )
Ritor1
parents:
diff changeset
7647 {
Ritor1
parents:
diff changeset
7648 ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1];
Ritor1
parents:
diff changeset
7649 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem));
Ritor1
parents:
diff changeset
7650 this->RemoveItemAtInventoryIndex(invMatrixIndex);
Ritor1
parents:
diff changeset
7651 int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem);
Ritor1
parents:
diff changeset
7652 if ( !emptyIndex )
Ritor1
parents:
diff changeset
7653 {
Ritor1
parents:
diff changeset
7654 emptyIndex = this->AddItem2(-1, &pParty->pPickedItem);
Ritor1
parents:
diff changeset
7655 if ( !emptyIndex )
Ritor1
parents:
diff changeset
7656 {
Ritor1
parents:
diff changeset
7657 this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex);
Ritor1
parents:
diff changeset
7658 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7659 return;
Ritor1
parents:
diff changeset
7660 }
Ritor1
parents:
diff changeset
7661 }
Ritor1
parents:
diff changeset
7662 memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7663 pMouse->SetCursorBitmap(pParty->pPickedItem.GetIconName());
Ritor1
parents:
diff changeset
7664 return;
Ritor1
parents:
diff changeset
7665 }
Ritor1
parents:
diff changeset
7666 else
Ritor1
parents:
diff changeset
7667 {
Ritor1
parents:
diff changeset
7668 itemPos = this->AddItem(invMatrixIndex, pickedItemId);
Ritor1
parents:
diff changeset
7669 if ( itemPos )
Ritor1
parents:
diff changeset
7670 {
Ritor1
parents:
diff changeset
7671 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7672 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7673 return;
Ritor1
parents:
diff changeset
7674 }
Ritor1
parents:
diff changeset
7675 itemPos = this->AddItem(-1, pickedItemId);
Ritor1
parents:
diff changeset
7676 if ( itemPos )
Ritor1
parents:
diff changeset
7677 {
Ritor1
parents:
diff changeset
7678 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7679 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7680 return;
Ritor1
parents:
diff changeset
7681 }
Ritor1
parents:
diff changeset
7682 }
Ritor1
parents:
diff changeset
7683 }
Ritor1
parents:
diff changeset
7684 }
Ritor1
parents:
diff changeset
7685 }
Ritor1
parents:
diff changeset
7686 }
Ritor1
parents:
diff changeset
7687
Ritor1
parents:
diff changeset
7688
Ritor1
parents:
diff changeset
7689 bool Player::IsWeak()
Ritor1
parents:
diff changeset
7690 {
Ritor1
parents:
diff changeset
7691 return pConditions[Condition_Weak] != 0;
Ritor1
parents:
diff changeset
7692 }
Ritor1
parents:
diff changeset
7693
Ritor1
parents:
diff changeset
7694 bool Player::IsDead()
Ritor1
parents:
diff changeset
7695 {
Ritor1
parents:
diff changeset
7696 return pConditions[Condition_Dead] != 0;
Ritor1
parents:
diff changeset
7697 }
Ritor1
parents:
diff changeset
7698
Ritor1
parents:
diff changeset
7699 bool Player::IsEradicated()
Ritor1
parents:
diff changeset
7700 {
Ritor1
parents:
diff changeset
7701 return pConditions[Condition_Eradicated] != 0;
Ritor1
parents:
diff changeset
7702 }
Ritor1
parents:
diff changeset
7703
Ritor1
parents:
diff changeset
7704 bool Player::IsZombie()
Ritor1
parents:
diff changeset
7705 {
Ritor1
parents:
diff changeset
7706 return pConditions[Condition_Zombie] != 0;
Ritor1
parents:
diff changeset
7707 }
Ritor1
parents:
diff changeset
7708
Ritor1
parents:
diff changeset
7709 bool Player::IsCursed()
Ritor1
parents:
diff changeset
7710 {
Ritor1
parents:
diff changeset
7711 return pConditions[Condition_Cursed] != 0;
Ritor1
parents:
diff changeset
7712 }
Ritor1
parents:
diff changeset
7713
Ritor1
parents:
diff changeset
7714 bool Player::IsPertified()
Ritor1
parents:
diff changeset
7715 {
Ritor1
parents:
diff changeset
7716 return pConditions[Condition_Pertified] != 0;
Ritor1
parents:
diff changeset
7717 }
Ritor1
parents:
diff changeset
7718
Ritor1
parents:
diff changeset
7719 bool Player::IsUnconcious()
Ritor1
parents:
diff changeset
7720 {
Ritor1
parents:
diff changeset
7721 return pConditions[Condition_Unconcious] != 0;
Ritor1
parents:
diff changeset
7722 }
Ritor1
parents:
diff changeset
7723
Ritor1
parents:
diff changeset
7724 bool Player::IsAsleep()
Ritor1
parents:
diff changeset
7725 {
Ritor1
parents:
diff changeset
7726 return pConditions[Condition_Sleep] != 0;
Ritor1
parents:
diff changeset
7727 }
Ritor1
parents:
diff changeset
7728
Ritor1
parents:
diff changeset
7729 bool Player::IsParalyzed()
Ritor1
parents:
diff changeset
7730 {
Ritor1
parents:
diff changeset
7731 return pConditions[Condition_Paralyzed] != 0;
Ritor1
parents:
diff changeset
7732 }
Ritor1
parents:
diff changeset
7733
Ritor1
parents:
diff changeset
7734 bool Player::IsDrunk()
Ritor1
parents:
diff changeset
7735 {
Ritor1
parents:
diff changeset
7736 return pConditions[Condition_Drunk] != 0;
Ritor1
parents:
diff changeset
7737 }
Ritor1
parents:
diff changeset
7738
Ritor1
parents:
diff changeset
7739 void Player::SetCursed( unsigned long long state )
Ritor1
parents:
diff changeset
7740 {
Ritor1
parents:
diff changeset
7741 pConditions[Condition_Cursed] = state;
Ritor1
parents:
diff changeset
7742 }
Ritor1
parents:
diff changeset
7743
Ritor1
parents:
diff changeset
7744 void Player::SetWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7745 {
Ritor1
parents:
diff changeset
7746 pConditions[Condition_Weak] = state;
Ritor1
parents:
diff changeset
7747 }
Ritor1
parents:
diff changeset
7748
Ritor1
parents:
diff changeset
7749 void Player::SetAsleep( unsigned long long state )
Ritor1
parents:
diff changeset
7750 {
Ritor1
parents:
diff changeset
7751 pConditions[Condition_Sleep] = state;
Ritor1
parents:
diff changeset
7752 }
Ritor1
parents:
diff changeset
7753
Ritor1
parents:
diff changeset
7754 void Player::SetAfraid( unsigned long long state )
Ritor1
parents:
diff changeset
7755 {
Ritor1
parents:
diff changeset
7756 pConditions[Condition_Fear] = state;
Ritor1
parents:
diff changeset
7757 }
Ritor1
parents:
diff changeset
7758
Ritor1
parents:
diff changeset
7759 void Player::SetDrunk( unsigned long long state )
Ritor1
parents:
diff changeset
7760 {
Ritor1
parents:
diff changeset
7761 pConditions[Condition_Drunk] = state;
Ritor1
parents:
diff changeset
7762 }
Ritor1
parents:
diff changeset
7763
Ritor1
parents:
diff changeset
7764 void Player::SetInsane( unsigned long long state )
Ritor1
parents:
diff changeset
7765 {
Ritor1
parents:
diff changeset
7766 pConditions[Condition_Insane] = state;
Ritor1
parents:
diff changeset
7767 }
Ritor1
parents:
diff changeset
7768
Ritor1
parents:
diff changeset
7769 void Player::SetPoisonWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7770 {
Ritor1
parents:
diff changeset
7771 pConditions[Condition_Poison_Weak] = state;
Ritor1
parents:
diff changeset
7772 }
Ritor1
parents:
diff changeset
7773
Ritor1
parents:
diff changeset
7774 void Player::SetDiseaseWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7775 {
Ritor1
parents:
diff changeset
7776 pConditions[Condition_Disease_Weak] = state;
Ritor1
parents:
diff changeset
7777 }
Ritor1
parents:
diff changeset
7778
Ritor1
parents:
diff changeset
7779 void Player::SetPoisonMedium( unsigned long long state )
Ritor1
parents:
diff changeset
7780 {
Ritor1
parents:
diff changeset
7781 pConditions[Condition_Poison_Medium] = state;
Ritor1
parents:
diff changeset
7782 }
Ritor1
parents:
diff changeset
7783
Ritor1
parents:
diff changeset
7784 void Player::SetDiseaseMedium( unsigned long long state )
Ritor1
parents:
diff changeset
7785 {
Ritor1
parents:
diff changeset
7786 pConditions[Condition_Disease_Medium] = state;
Ritor1
parents:
diff changeset
7787 }
Ritor1
parents:
diff changeset
7788
Ritor1
parents:
diff changeset
7789 void Player::SetPoisonSevere( unsigned long long state )
Ritor1
parents:
diff changeset
7790 {
Ritor1
parents:
diff changeset
7791 pConditions[Condition_Poison_Severe] = state;
Ritor1
parents:
diff changeset
7792 }
Ritor1
parents:
diff changeset
7793
Ritor1
parents:
diff changeset
7794 void Player::SetDiseaseSevere( unsigned long long state )
Ritor1
parents:
diff changeset
7795 {
Ritor1
parents:
diff changeset
7796 pConditions[Condition_Disease_Severe] = state;
Ritor1
parents:
diff changeset
7797 }
Ritor1
parents:
diff changeset
7798
Ritor1
parents:
diff changeset
7799 void Player::SetParalyzed( unsigned long long state )
Ritor1
parents:
diff changeset
7800 {
Ritor1
parents:
diff changeset
7801 pConditions[Condition_Paralyzed] = state;
Ritor1
parents:
diff changeset
7802 }
Ritor1
parents:
diff changeset
7803
Ritor1
parents:
diff changeset
7804 void Player::SetUnconcious( unsigned long long state )
Ritor1
parents:
diff changeset
7805 {
Ritor1
parents:
diff changeset
7806 pConditions[Condition_Unconcious] = state;
Ritor1
parents:
diff changeset
7807 }
Ritor1
parents:
diff changeset
7808
Ritor1
parents:
diff changeset
7809 void Player::SetDead( unsigned long long state )
Ritor1
parents:
diff changeset
7810 {
Ritor1
parents:
diff changeset
7811 pConditions[Condition_Dead] = state;
Ritor1
parents:
diff changeset
7812 }
Ritor1
parents:
diff changeset
7813
Ritor1
parents:
diff changeset
7814 void Player::SetPertified( unsigned long long state )
Ritor1
parents:
diff changeset
7815 {
Ritor1
parents:
diff changeset
7816 pConditions[Condition_Pertified] = state;
Ritor1
parents:
diff changeset
7817 }
Ritor1
parents:
diff changeset
7818
Ritor1
parents:
diff changeset
7819 void Player::SetEradicated( unsigned long long state )
Ritor1
parents:
diff changeset
7820 {
Ritor1
parents:
diff changeset
7821 pConditions[Condition_Eradicated] = state;
Ritor1
parents:
diff changeset
7822 }
Ritor1
parents:
diff changeset
7823
Ritor1
parents:
diff changeset
7824 void Player::SetZombie( unsigned long long state )
Ritor1
parents:
diff changeset
7825 {
Ritor1
parents:
diff changeset
7826 pConditions[Condition_Zombie] = state;
Ritor1
parents:
diff changeset
7827 }
Ritor1
parents:
diff changeset
7828
Ritor1
parents:
diff changeset
7829 void Player::SetCondWeakWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7830 {
Ritor1
parents:
diff changeset
7831 SetCondition(Condition_Weak, blockable);
Ritor1
parents:
diff changeset
7832 }
Ritor1
parents:
diff changeset
7833
Ritor1
parents:
diff changeset
7834 void Player::SetCondInsaneWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7835 {
Ritor1
parents:
diff changeset
7836 SetCondition(Condition_Insane, blockable);
Ritor1
parents:
diff changeset
7837 }
Ritor1
parents:
diff changeset
7838
Ritor1
parents:
diff changeset
7839 void Player::SetCondDeadWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7840 {
Ritor1
parents:
diff changeset
7841 SetCondition(Condition_Dead, blockable);
Ritor1
parents:
diff changeset
7842 }
Ritor1
parents:
diff changeset
7843
Ritor1
parents:
diff changeset
7844 void Player::SetCondUnconsciousWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7845 {
Ritor1
parents:
diff changeset
7846 SetCondition(Condition_Dead, blockable);
Ritor1
parents:
diff changeset
7847 }
Ritor1
parents:
diff changeset
7848
Ritor1
parents:
diff changeset
7849 ItemGen* Player::GetOffHandItem()
Ritor1
parents:
diff changeset
7850 {
Ritor1
parents:
diff changeset
7851 return GetItem(&PlayerEquipment::uShield);
Ritor1
parents:
diff changeset
7852 }
Ritor1
parents:
diff changeset
7853
Ritor1
parents:
diff changeset
7854 ItemGen* Player::GetMainHandItem()
Ritor1
parents:
diff changeset
7855 {
Ritor1
parents:
diff changeset
7856 return GetItem(&PlayerEquipment::uMainHand);
Ritor1
parents:
diff changeset
7857 }
Ritor1
parents:
diff changeset
7858
Ritor1
parents:
diff changeset
7859 ItemGen* Player::GetBowItem()
Ritor1
parents:
diff changeset
7860 {
Ritor1
parents:
diff changeset
7861 return GetItem(&PlayerEquipment::uBow);
Ritor1
parents:
diff changeset
7862 }
Ritor1
parents:
diff changeset
7863
Ritor1
parents:
diff changeset
7864 ItemGen* Player::GetArmorItem()
Ritor1
parents:
diff changeset
7865 {
Ritor1
parents:
diff changeset
7866 return GetItem(&PlayerEquipment::uArmor);
Ritor1
parents:
diff changeset
7867 }
Ritor1
parents:
diff changeset
7868
Ritor1
parents:
diff changeset
7869 ItemGen* Player::GetHelmItem()
Ritor1
parents:
diff changeset
7870 {
Ritor1
parents:
diff changeset
7871 return GetItem(&PlayerEquipment::uHelm);
Ritor1
parents:
diff changeset
7872 }
Ritor1
parents:
diff changeset
7873
Ritor1
parents:
diff changeset
7874 ItemGen* Player::GetBeltItem()
Ritor1
parents:
diff changeset
7875 {
Ritor1
parents:
diff changeset
7876 return GetItem(&PlayerEquipment::uBelt);
Ritor1
parents:
diff changeset
7877 }
Ritor1
parents:
diff changeset
7878
Ritor1
parents:
diff changeset
7879 ItemGen* Player::GetCloakItem()
Ritor1
parents:
diff changeset
7880 {
Ritor1
parents:
diff changeset
7881 return GetItem(&PlayerEquipment::uCloak);
Ritor1
parents:
diff changeset
7882 }
Ritor1
parents:
diff changeset
7883
Ritor1
parents:
diff changeset
7884 ItemGen* Player::GetGloveItem()
Ritor1
parents:
diff changeset
7885 {
Ritor1
parents:
diff changeset
7886 return GetItem(&PlayerEquipment::uGlove);
Ritor1
parents:
diff changeset
7887 }
Ritor1
parents:
diff changeset
7888
Ritor1
parents:
diff changeset
7889 ItemGen* Player::GetBootItem()
Ritor1
parents:
diff changeset
7890 {
Ritor1
parents:
diff changeset
7891 return GetItem(&PlayerEquipment::uBoot);
Ritor1
parents:
diff changeset
7892 }
Ritor1
parents:
diff changeset
7893
Ritor1
parents:
diff changeset
7894 ItemGen* Player::GetAmuletItem()
Ritor1
parents:
diff changeset
7895 {
Ritor1
parents:
diff changeset
7896 return GetItem(&PlayerEquipment::uAmulet);
Ritor1
parents:
diff changeset
7897 }
Ritor1
parents:
diff changeset
7898
Ritor1
parents:
diff changeset
7899 ItemGen* Player::GetNthRingItem(int ringNum)
Ritor1
parents:
diff changeset
7900 {
Ritor1
parents:
diff changeset
7901 return GetNthEquippedIndexItem(ringNum + 10);
Ritor1
parents:
diff changeset
7902 }
Ritor1
parents:
diff changeset
7903
Ritor1
parents:
diff changeset
7904 ItemGen* Player::GetNthEquippedIndexItem(int index)
Ritor1
parents:
diff changeset
7905 {
Ritor1
parents:
diff changeset
7906 if (this->pEquipment.pIndices[index] == 0)
Ritor1
parents:
diff changeset
7907 {
Ritor1
parents:
diff changeset
7908 return nullptr;
Ritor1
parents:
diff changeset
7909 }
Ritor1
parents:
diff changeset
7910 return &this->pInventoryItemList[this->pEquipment.pIndices[index] - 1];
Ritor1
parents:
diff changeset
7911 }
Ritor1
parents:
diff changeset
7912
Ritor1
parents:
diff changeset
7913 ItemGen* Player::GetItem(unsigned int PlayerEquipment::* itemPos)
Ritor1
parents:
diff changeset
7914 {
Ritor1
parents:
diff changeset
7915 if (this->pEquipment.*itemPos == 0)
Ritor1
parents:
diff changeset
7916 {
Ritor1
parents:
diff changeset
7917 return nullptr;
Ritor1
parents:
diff changeset
7918 }
Ritor1
parents:
diff changeset
7919 return &this->pInventoryItemList[this->pEquipment.*itemPos - 1];
Ritor1
parents:
diff changeset
7920 }
Ritor1
parents:
diff changeset
7921
Ritor1
parents:
diff changeset
7922 int Player::GetPlayerIndex()
Ritor1
parents:
diff changeset
7923 {
Ritor1
parents:
diff changeset
7924 int uPlayerIdx = 0;
Ritor1
parents:
diff changeset
7925 if ( this == pPlayers[1] )
Ritor1
parents:
diff changeset
7926 uPlayerIdx = 0;
Ritor1
parents:
diff changeset
7927 else if( this == pPlayers[2] )
Ritor1
parents:
diff changeset
7928 uPlayerIdx = 1;
Ritor1
parents:
diff changeset
7929 else if ( this == pPlayers[3] )
Ritor1
parents:
diff changeset
7930 uPlayerIdx = 2;
Ritor1
parents:
diff changeset
7931 else if ( this == pPlayers[4] )
Ritor1
parents:
diff changeset
7932 uPlayerIdx = 3;
Ritor1
parents:
diff changeset
7933 else
Ritor1
parents:
diff changeset
7934 Error("Unexpected player pointer");
Ritor1
parents:
diff changeset
7935 return uPlayerIdx;
Ritor1
parents:
diff changeset
7936 }
Ritor1
parents:
diff changeset
7937
Ritor1
parents:
diff changeset
7938 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
7939 bool Player::PlayerHitOrMiss(Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
7940 {
Ritor1
parents:
diff changeset
7941 signed int naturalArmor; // esi@1
Ritor1
parents:
diff changeset
7942 signed int armorBuff; // edi@1
Ritor1
parents:
diff changeset
7943 int effectiveActorArmor; // esi@8
Ritor1
parents:
diff changeset
7944 int attBonus; // eax@9
Ritor1
parents:
diff changeset
7945 int v9; // edx@11
Ritor1
parents:
diff changeset
7946 // unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
7947 // unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
7948 int attPositiveMod; // edx@14
Ritor1
parents:
diff changeset
7949 int attNegativeMod; // eax@14
Ritor1
parents:
diff changeset
7950 // signed int result; // eax@17
Ritor1
parents:
diff changeset
7951
Ritor1
parents:
diff changeset
7952 naturalArmor = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
7953 armorBuff = 0;
Ritor1
parents:
diff changeset
7954 if ( pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7955 naturalArmor /= 2;
Ritor1
parents:
diff changeset
7956 if ( pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7957 armorBuff = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower;
Ritor1
parents:
diff changeset
7958 if ( pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > armorBuff )
Ritor1
parents:
diff changeset
7959 armorBuff = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
Ritor1
parents:
diff changeset
7960 effectiveActorArmor = armorBuff + naturalArmor;
Ritor1
parents:
diff changeset
7961 if ( a3 )
Ritor1
parents:
diff changeset
7962 attBonus = this->GetRangedAttack();
Ritor1
parents:
diff changeset
7963 else
Ritor1
parents:
diff changeset
7964 attBonus = this->GetActualAttack(false);
Ritor1
parents:
diff changeset
7965 v9 = rand() % (effectiveActorArmor + 2 * attBonus + 30);
Ritor1
parents:
diff changeset
7966 attPositiveMod = a4 + v9;
Ritor1
parents:
diff changeset
7967 if ( a3 == 2 )
Ritor1
parents:
diff changeset
7968 {
Ritor1
parents:
diff changeset
7969 attNegativeMod = ((effectiveActorArmor + 15) / 2) + effectiveActorArmor + 15;
Ritor1
parents:
diff changeset
7970 }
Ritor1
parents:
diff changeset
7971 else if ( a3 == 3 )
Ritor1
parents:
diff changeset
7972 {
Ritor1
parents:
diff changeset
7973 attNegativeMod = 2 * effectiveActorArmor + 30;
Ritor1
parents:
diff changeset
7974 }
Ritor1
parents:
diff changeset
7975 else
Ritor1
parents:
diff changeset
7976 {
Ritor1
parents:
diff changeset
7977 attNegativeMod = effectiveActorArmor + 15;
Ritor1
parents:
diff changeset
7978 }
Ritor1
parents:
diff changeset
7979 return (attPositiveMod > attNegativeMod);
Ritor1
parents:
diff changeset
7980 }
Ritor1
parents:
diff changeset
7981
Ritor1
parents:
diff changeset
7982
Ritor1
parents:
diff changeset
7983 //----- (0042ECB5) --------------------------------------------------------
Ritor1
parents:
diff changeset
7984 void Player::_42ECB5_PlayerAttacksActor()
Ritor1
parents:
diff changeset
7985 {
Ritor1
parents:
diff changeset
7986 // char *v5; // eax@8
Ritor1
parents:
diff changeset
7987 // unsigned int v9; // ecx@21
Ritor1
parents:
diff changeset
7988 // char *v11; // eax@26
Ritor1
parents:
diff changeset
7989 // unsigned int v12; // eax@47
Ritor1
parents:
diff changeset
7990 // SoundID v24; // [sp-4h] [bp-40h]@58
Ritor1
parents:
diff changeset
7991
Ritor1
parents:
diff changeset
7992 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
Ritor1
parents:
diff changeset
7993 Player* player = &pParty->pPlayers[uActiveCharacter - 1];
Ritor1
parents:
diff changeset
7994 if (!player->CanAct())
Ritor1
parents:
diff changeset
7995 return;
Ritor1
parents:
diff changeset
7996
Ritor1
parents:
diff changeset
7997 CastSpellInfoHelpers::_427D48();
Ritor1
parents:
diff changeset
7998 //v3 = 0;
Ritor1
parents:
diff changeset
7999 if (pParty->Invisible())
Ritor1
parents:
diff changeset
8000 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
Ritor1
parents:
diff changeset
8001
Ritor1
parents:
diff changeset
8002 //v31 = player->pEquipment.uBow;
Ritor1
parents:
diff changeset
8003 int bow_idx = player->pEquipment.uBow;
Ritor1
parents:
diff changeset
8004 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken())
Ritor1
parents:
diff changeset
8005 bow_idx = 0;
Ritor1
parents:
diff changeset
8006
Ritor1
parents:
diff changeset
8007 //v32 = 0;
Ritor1
parents:
diff changeset
8008 int wand_item_id = 0;
Ritor1
parents:
diff changeset
8009 //v33 = 0;
Ritor1
parents:
diff changeset
8010 //v4 = v1->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8011 int laser_weapon_item_id = 0;
Ritor1
parents:
diff changeset
8012
Ritor1
parents:
diff changeset
8013 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8014 if (main_hand_idx)
Ritor1
parents:
diff changeset
8015 {
Ritor1
parents:
diff changeset
8016 ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1];
Ritor1
parents:
diff changeset
8017 //v5 = (char *)v1 + 36 * v4;
Ritor1
parents:
diff changeset
8018 if (!item->IsBroken())
Ritor1
parents:
diff changeset
8019 {
Ritor1
parents:
diff changeset
8020 //v28b = &v1->pInventoryItems[v4].uItemID;
Ritor1
parents:
diff changeset
8021 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8022 if (item->GetItemEquipType() == EQUIP_WAND)
Ritor1
parents:
diff changeset
8023 {
Ritor1
parents:
diff changeset
8024 if (item->uNumCharges <= 0)
Ritor1
parents:
diff changeset
8025 player->pEquipment.uMainHand = 0; // wand discharged - unequip
Ritor1
parents:
diff changeset
8026 else
Ritor1
parents:
diff changeset
8027 wand_item_id = item->uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8028 }
Ritor1
parents:
diff changeset
8029 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
Ritor1
parents:
diff changeset
8030 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8031 }
Ritor1
parents:
diff changeset
8032 }
Ritor1
parents:
diff changeset
8033
Ritor1
parents:
diff changeset
8034 //v30 = 0;
Ritor1
parents:
diff changeset
8035 //v29 = 0;
Ritor1
parents:
diff changeset
8036 //v28 = 0;
Ritor1
parents:
diff changeset
8037 //v7 = pMouse->uPointingObjectID;
Ritor1
parents:
diff changeset
8038
Ritor1
parents:
diff changeset
8039 int target_pid = pMouse->uPointingObjectID;
Ritor1
parents:
diff changeset
8040 int target_type = PID_TYPE(target_pid),
Ritor1
parents:
diff changeset
8041 target_id = PID_ID(target_pid);
Ritor1
parents:
diff changeset
8042 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
Ritor1
parents:
diff changeset
8043 {
Ritor1
parents:
diff changeset
8044 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
Ritor1
parents:
diff changeset
8045 target_type = PID_TYPE(target_pid);
Ritor1
parents:
diff changeset
8046 target_id = PID_ID(target_pid);
Ritor1
parents:
diff changeset
8047 }
Ritor1
parents:
diff changeset
8048
Ritor1
parents:
diff changeset
8049 Actor* actor = &pActors[target_id];
Ritor1
parents:
diff changeset
8050 int actor_distance = 0;
Ritor1
parents:
diff changeset
8051 if (target_type == OBJECT_Actor)
Ritor1
parents:
diff changeset
8052 {
Ritor1
parents:
diff changeset
8053 int distance_x = actor->vPosition.x - pParty->vPosition.x,
Ritor1
parents:
diff changeset
8054 distance_y = actor->vPosition.y - pParty->vPosition.y,
Ritor1
parents:
diff changeset
8055 distance_z = actor->vPosition.z - pParty->vPosition.z;
Ritor1
parents:
diff changeset
8056 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius;
Ritor1
parents:
diff changeset
8057 if (actor_distance < 0)
Ritor1
parents:
diff changeset
8058 actor_distance = 0;
Ritor1
parents:
diff changeset
8059 }
Ritor1
parents:
diff changeset
8060
Ritor1
parents:
diff changeset
8061 bool shooting_bow = false,
Ritor1
parents:
diff changeset
8062 shotting_laser = false,
Ritor1
parents:
diff changeset
8063 shooting_wand = false,
Ritor1
parents:
diff changeset
8064 melee_attack = false;
Ritor1
parents:
diff changeset
8065 if (laser_weapon_item_id)
Ritor1
parents:
diff changeset
8066 {
Ritor1
parents:
diff changeset
8067 shotting_laser = true;
Ritor1
parents:
diff changeset
8068 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
Ritor1
parents:
diff changeset
8069 }
Ritor1
parents:
diff changeset
8070 else if (wand_item_id)
Ritor1
parents:
diff changeset
8071 {
Ritor1
parents:
diff changeset
8072 shooting_wand = true;
Ritor1
parents:
diff changeset
8073
Ritor1
parents:
diff changeset
8074 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8075 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
Ritor1
parents:
diff changeset
8076
Ritor1
parents:
diff changeset
8077 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
Ritor1
parents:
diff changeset
8078 player->pEquipment.uMainHand = 0;
Ritor1
parents:
diff changeset
8079 }
Ritor1
parents:
diff changeset
8080 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
Ritor1
parents:
diff changeset
8081 {
Ritor1
parents:
diff changeset
8082 melee_attack = true;
Ritor1
parents:
diff changeset
8083
Ritor1
parents:
diff changeset
8084 Vec3_int_ a3;
Ritor1
parents:
diff changeset
8085 a3.x = actor->vPosition.x - pParty->vPosition.x;
Ritor1
parents:
diff changeset
8086 a3.y = actor->vPosition.y - pParty->vPosition.y;
Ritor1
parents:
diff changeset
8087 a3.z = actor->vPosition.z - pParty->vPosition.z;
Ritor1
parents:
diff changeset
8088 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
Ritor1
parents:
diff changeset
8089
Ritor1
parents:
diff changeset
8090 Actor::DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
Ritor1
parents:
diff changeset
8091 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED))
Ritor1
parents:
diff changeset
8092 _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter);
Ritor1
parents:
diff changeset
8093 }
Ritor1
parents:
diff changeset
8094 else if (bow_idx)
Ritor1
parents:
diff changeset
8095 {
Ritor1
parents:
diff changeset
8096 shooting_bow = true;
Ritor1
parents:
diff changeset
8097 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
Ritor1
parents:
diff changeset
8098 }
Ritor1
parents:
diff changeset
8099 else
Ritor1
parents:
diff changeset
8100 {
Ritor1
parents:
diff changeset
8101 melee_attack = true;
Ritor1
parents:
diff changeset
8102 ; // actor out of range or no actor; no ranged weapon so melee attacking air
Ritor1
parents:
diff changeset
8103 }
Ritor1
parents:
diff changeset
8104
Ritor1
parents:
diff changeset
8105 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
Ritor1
parents:
diff changeset
8106 {
Ritor1
parents:
diff changeset
8107 int recovery = player->GetAttackRecoveryTime(false);
Ritor1
parents:
diff changeset
8108 if (recovery < 30 )
Ritor1
parents:
diff changeset
8109 recovery = 30;
Ritor1
parents:
diff changeset
8110 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
Ritor1
parents:
diff changeset
8111 }
Ritor1
parents:
diff changeset
8112
Ritor1
parents:
diff changeset
8113 int v34 = 0;
Ritor1
parents:
diff changeset
8114 if (shooting_wand)
Ritor1
parents:
diff changeset
8115 return;
Ritor1
parents:
diff changeset
8116 else if (shooting_bow)
Ritor1
parents:
diff changeset
8117 {
Ritor1
parents:
diff changeset
8118 v34 = 5;
Ritor1
parents:
diff changeset
8119 player->PlaySound(SPEECH_50, 0);
Ritor1
parents:
diff changeset
8120 }
2556
91c75d202d30 Shooting bow sound & stats word wrap
a.parshin
parents: 2554
diff changeset
8121 else if (shotting_laser)
2498
Ritor1
parents:
diff changeset
8122 v34 = 7;
Ritor1
parents:
diff changeset
8123 else
Ritor1
parents:
diff changeset
8124 {
Ritor1
parents:
diff changeset
8125 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8126 if (player->HasItemEquipped(EQUIP_TWO_HANDED))
Ritor1
parents:
diff changeset
8127 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType();
Ritor1
parents:
diff changeset
8128 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
8129 }
Ritor1
parents:
diff changeset
8130
Ritor1
parents:
diff changeset
8131 switch (v34)
Ritor1
parents:
diff changeset
8132 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8133 case 0: pAudioPlayer->PlaySound(SOUND_swing_with_blunt_weapon01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8134 case 1: pAudioPlayer->PlaySound(SOUND_swing_with_sword01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8135 case 2: pAudioPlayer->PlaySound(SOUND_swing_with_sword02, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8136 case 3: pAudioPlayer->PlaySound(SOUND_swing_with_axe01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8137 case 4: pAudioPlayer->PlaySound(SOUND_swing_with_axe03, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8138 case 5: pAudioPlayer->PlaySound(SOUND_shoot_bow01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8139 case 6: pAudioPlayer->PlaySound(SOUND_swing_with_blunt_weapon03, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8140 case 7: pAudioPlayer->PlaySound(SOUND_shoot_blaster01, 0, 0, -1, 0, 0, 0, 0); break;
2498
Ritor1
parents:
diff changeset
8141 }
Ritor1
parents:
diff changeset
8142 }
Ritor1
parents:
diff changeset
8143
Ritor1
parents:
diff changeset
8144
Ritor1
parents:
diff changeset
8145 //----- (0042FA66) --------------------------------------------------------
Ritor1
parents:
diff changeset
8146 void Player::_42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
Ritor1
parents:
diff changeset
8147 {
Ritor1
parents:
diff changeset
8148 unsigned __int16 v9; // ax@5
Ritor1
parents:
diff changeset
8149
Ritor1
parents:
diff changeset
8150 SpriteObject a1a; // [sp+Ch] [bp-74h]@1
Ritor1
parents:
diff changeset
8151 //SpriteObject::SpriteObject(&a1a);
Ritor1
parents:
diff changeset
8152 a1a.uType = 600;
Ritor1
parents:
diff changeset
8153 a1a.stru_24.Reset();
Ritor1
parents:
diff changeset
8154
Ritor1
parents:
diff changeset
8155 a1a.spell_id = SPELL_FIRE_FIREBALL;
Ritor1
parents:
diff changeset
8156 a1a.spell_level = 8;
Ritor1
parents:
diff changeset
8157 a1a.spell_skill = 3;
Ritor1
parents:
diff changeset
8158 v9 = 0;
Ritor1
parents:
diff changeset
8159 for ( uint i = 0; i < pObjectList->uNumObjects; ++i )
Ritor1
parents:
diff changeset
8160 {
Ritor1
parents:
diff changeset
8161 if ( a1a.uType == pObjectList->pObjects[i].uObjectID )
Ritor1
parents:
diff changeset
8162 v9 = i;
Ritor1
parents:
diff changeset
8163 }
Ritor1
parents:
diff changeset
8164 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
8165 a1a.vPosition.x = a1;
Ritor1
parents:
diff changeset
8166 a1a.vPosition.y = a2;
Ritor1
parents:
diff changeset
8167 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
8168 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
8169 a1a.uSectorID = pIndoor->GetSector(a1, a2, a3);
Ritor1
parents:
diff changeset
8170 a1a.uSpriteFrameID = 0;
Ritor1
parents:
diff changeset
8171 a1a.spell_target_pid = 0;
Ritor1
parents:
diff changeset
8172 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
8173 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
8174 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
8175 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
8176 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
Ritor1
parents:
diff changeset
8177 else
Ritor1
parents:
diff changeset
8178 a1a.spell_caster_pid = 0;
Ritor1
parents:
diff changeset
8179
Ritor1
parents:
diff changeset
8180 int id = a1a.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
8181 if (id != -1)
Ritor1
parents:
diff changeset
8182 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
8183 SLOWORD(a1a.vPosition.z), 0, 0);
Ritor1
parents:
diff changeset
8184 }
Ritor1
parents:
diff changeset
8185
Ritor1
parents:
diff changeset
8186 //----- (00458244) --------------------------------------------------------
Ritor1
parents:
diff changeset
8187 unsigned int SkillToMastery( unsigned int skill_value )
Ritor1
parents:
diff changeset
8188 {
Ritor1
parents:
diff changeset
8189 switch (skill_value & 0x1C0)
Ritor1
parents:
diff changeset
8190 {
Ritor1
parents:
diff changeset
8191 case 0x100: return 4; // Grandmaster
Ritor1
parents:
diff changeset
8192 case 0x80: return 3; // Master
Ritor1
parents:
diff changeset
8193 case 0x40: return 2; // Expert
Ritor1
parents:
diff changeset
8194 case 0x00: return 1; // Normal
Ritor1
parents:
diff changeset
8195 }
Ritor1
parents:
diff changeset
8196 assert(false);
Ritor1
parents:
diff changeset
8197 return 0;
Ritor1
parents:
diff changeset
8198 }