2497
|
1 #pragma once
|
|
2 #include "Monsters.h"
|
2499
|
3 #include "../Spells/Spells.h"
|
2497
|
4 #include "Items.h"
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11 /* 357 */
|
|
12 #pragma pack(push, 1)
|
|
13 struct stru319
|
|
14 {
|
|
15 int which_player_to_attack(struct Actor *pActor);
|
|
16 int _427546(int a2);
|
|
17 int FindClosestActor(int a2, int a3, int a4);
|
|
18
|
|
19 char field_0;
|
|
20 };
|
|
21 #pragma pack(pop)
|
|
22
|
|
23
|
|
24 extern stru319 stru_50C198; // idb
|
|
25
|
|
26
|
|
27 enum ABILITY_INDEX
|
|
28 {
|
|
29 ABILITY_ATTACK1 = 0,
|
|
30 ABILITY_ATTACK2 = 1,
|
|
31 ABILITY_SPELL1 = 2,
|
|
32 ABILITY_SPELL2 = 3,
|
|
33 };
|
|
34
|
|
35
|
|
36
|
|
37 /* 361 */
|
|
38 enum ACTOR_BUFF_INDEX
|
|
39 {
|
|
40 ACTOR_BUFF_CHARM = 1,
|
|
41 ACTOR_BUFF_SUMMONED = 2,
|
|
42 ACTOR_BUFF_SHRINK = 3,
|
|
43 ACTOR_BUFF_AFRAID = 4,
|
|
44 ACTOR_BUFF_STONED = 5,
|
|
45 ACTOR_BUFF_PARALYZED = 6,
|
|
46 ACTOR_BUFF_SLOWED = 7,
|
|
47 ACTOR_BUFF_SOMETHING_THAT_HALVES_AC = 8,
|
|
48 ACTOR_BUFF_BERSERK = 9,
|
|
49 ACTOR_BUFF_MASS_DISTORTION = 10,
|
|
50 ACTOR_BUFF_FATE = 11,
|
|
51 ACTOR_BUFF_ENSLAVED = 12,
|
|
52 ACTOR_BUFF_DAY_OF_PROTECTION = 13,
|
|
53 ACTOR_BUFF_HOUR_OF_POWER = 14,
|
|
54 ACTOR_BUFF_SHIELD = 15,
|
|
55 ACTOR_BUFF_STONESKIN = 16,
|
|
56 ACTOR_BUFF_BLESS = 17,
|
|
57 ACTOR_BUFF_HEROISM = 18,
|
|
58 ACTOR_BUFF_HASTE = 19,
|
|
59 ACTOR_BUFF_PAIN_REFLECTION = 20,
|
|
60 ACTOR_BUFF_PAIN_HAMMERHANDS = 21,
|
|
61 };
|
|
62
|
|
63
|
|
64
|
|
65
|
|
66
|
|
67 /* 295 */
|
|
68 enum ObjectType
|
|
69 {
|
|
70 OBJECT_Any = 0x0,
|
|
71 OBJECT_BLVDoor = 0x1,
|
|
72 OBJECT_Item = 0x2,
|
|
73 OBJECT_Actor = 0x3,
|
|
74 OBJECT_Player = 0x4,
|
|
75 OBJECT_Decoration = 0x5,
|
|
76 OBJECT_BModel = 0x6,
|
|
77 };
|
|
78
|
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
|
84
|
|
85 /* 264 */
|
|
86 enum AIState : unsigned __int16
|
|
87 {
|
|
88 Standing = 0x0,
|
|
89 Tethered = 0x1,
|
|
90 AttackingMelee = 0x2,
|
|
91 AttackingRanged1 = 0x3,
|
|
92 Dying = 0x4,
|
|
93 Dead = 0x5,
|
|
94 Pursuing = 0x6,
|
|
95 Fleeing = 0x7,
|
|
96 Stunned = 0x8,
|
|
97 Fidgeting = 0x9,
|
|
98 Interacting = 10,
|
|
99 Removed = 11,
|
|
100 AttackingRanged2 = 0xC,
|
|
101 AttackingRanged3 = 0xD,
|
|
102 Stoned = 0xE,
|
|
103 Paralyzed = 0xF,
|
|
104 Resurrected = 16,
|
|
105 Summoned = 17,
|
|
106 AttackingRanged4 = 18,
|
|
107 Disabled = 19,
|
|
108 };
|
|
109
|
|
110 /* 265 */
|
|
111 enum ActorAnimation : __int32
|
|
112 {
|
|
113 ANIM_Standing = 0x0,
|
|
114 ANIM_Walking = 0x1,
|
|
115 ANIM_AtkMelee = 0x2,
|
|
116 ANIM_AtkRanged = 0x3,
|
|
117 ANIM_GotHit = 0x4,
|
|
118 ANIM_Dying = 0x5,
|
|
119 ANIM_Dead = 0x6,
|
|
120 ANIM_Bored = 0x7,
|
|
121 };
|
|
122
|
|
123 #define ACTOR_UNKNOW2 0x00000008
|
|
124 #define ACTOR_STAND_IN_QUEUE 0x00000080
|
|
125 #define ACTOR_ALIVE 0x00000400
|
|
126 #define ACTOR_ACTIVE 0x00004000
|
|
127 #define ACTOR_NEARBY 0x00008000
|
|
128 #define ACTOR_UNKNOW11 0x00010000
|
|
129 #define ACTOR_FLEEING 0x00020000
|
|
130 #define ACTOR_UNKNOW5 0x00040000
|
|
131 #define ACTOR_AGGRESSOR 0x00080000
|
|
132 #define ACTOR_UNKNOW7 0x00100000
|
|
133 #define ACTOR_ANIMATION 0x00200000
|
|
134 #define ACTOR_UNKNOW9 0x00400000
|
|
135 #define ACTOR_HAS_ITEM 0x00800000
|
|
136 #define ACTOR_HOSTILE 0x01000000
|
|
137
|
|
138 #pragma pack(push, 1)
|
|
139
|
|
140
|
|
141
|
|
142
|
|
143 /* 247 */
|
|
144 #pragma pack(push, 1)
|
|
145 struct AIDirection
|
|
146 {
|
|
147 Vec3_int_ vDirection;
|
|
148 unsigned int uDistance;
|
|
149 unsigned int uDistanceXZ;
|
|
150 unsigned int uYawAngle;
|
|
151 unsigned int uPitchAngle;
|
|
152 };
|
|
153 #pragma pack(pop)
|
|
154
|
|
155
|
|
156
|
|
157
|
|
158
|
|
159 /* 71 */
|
|
160 #pragma pack(push, 1)
|
|
161 struct ActorJob
|
|
162 {
|
|
163 struct Vec3_short_ vPos;
|
|
164 unsigned __int16 uAttributes;
|
|
165 unsigned __int8 uAction;
|
|
166 unsigned __int8 uHour;
|
|
167 unsigned __int8 uDay;
|
|
168 unsigned __int8 uMonth;
|
|
169 };
|
|
170 #pragma pack(pop)
|
|
171
|
|
172
|
|
173 /* 66 */
|
|
174 #pragma pack(push, 1)
|
|
175 struct Actor
|
|
176 {
|
|
177 //----- (0041F4C1) --------------------------------------------------------
|
|
178 inline Actor()
|
|
179 {
|
|
180 signed int i; // edx@1
|
|
181
|
|
182 for ( i = 0; i < 22; i++ )
|
|
183 {
|
|
184 this->pActorBuffs[i].uSkill = 0;
|
|
185 this->pActorBuffs[i].uPower = 0;
|
|
186 this->pActorBuffs[i].uExpireTime = 0;
|
|
187 this->pActorBuffs[i].uCaster = 0;
|
|
188 this->pActorBuffs[i].uFlags = 0;
|
|
189 }
|
|
190 for ( i = 0; i < 4; i++ )
|
|
191 this->ActorHasItems[i].Reset();
|
|
192 Reset();
|
|
193 }
|
|
194
|
|
195 void SummonMinion(int summonerId);
|
|
196 void Reset();
|
|
197 void Remove();
|
|
198 void PrepareSprites(char load_sounds_if_bit1_set);
|
|
199 void UpdateAnimation();
|
|
200 signed int GetActorsRelation(Actor *a2);
|
|
201 void SetRandomGoldIfTheresNoItem();
|
|
202 bool CanAct();
|
|
203 bool IsNotAlive();
|
|
204 bool IsPeasant();
|
|
205
|
|
206 inline void ResetAnimation(){uAttributes &= 0xFFDFFFFF;}
|
|
207 inline void ResetQueue(){uAttributes &= ~ACTOR_STAND_IN_QUEUE;}
|
|
208 inline void ResetActive(){uAttributes &= 0xFFFFBFFF;}
|
|
209 inline void ResetAlive(){uAttributes &= 0xFFFFFBFF;}
|
|
210 inline void ResetHasItem(){uAttributes &= 0xFF7FFFFF;}
|
|
211 inline void ResetHostile(){uAttributes &= 0xFEFFFFFF;}
|
|
212 inline void ResetAggressor(){uAttributes &= 0xFFF7FFFF;}
|
|
213 inline bool ActorEnemy()const {return(uAttributes & ACTOR_AGGRESSOR) != 0;}
|
|
214 inline bool ActorFriend()const {return(uAttributes & ACTOR_AGGRESSOR) == 0;}
|
|
215 inline bool ActorHasItem()const {return(uAttributes & ACTOR_HAS_ITEM) != 0;}
|
|
216 inline bool ActorNearby()const {return(uAttributes & ACTOR_NEARBY) != 0;}
|
|
217
|
|
218 static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party);
|
|
219 static void AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4);
|
|
220 static void AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5);
|
|
221 static void AI_Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4);
|
|
222 static void AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir);
|
|
223 static void PlaySound(unsigned int uActorID, unsigned int uSoundID);
|
|
224 static void Die(unsigned int uActorID);
|
|
225 static void Resurrect(unsigned int uActorID);
|
|
226 static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4);
|
|
227 static void AI_Stun(unsigned int uActorID, signed int edx0, int arg0);
|
|
228 static char __fastcall _4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3);
|
|
229 static void AI_RandomMove(unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength);
|
|
230 static void AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
|
|
231 static void AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
|
|
232 static void AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
|
|
233 static void AI_SpellAttack2(unsigned int uActorID, signed int sTargetPid, struct AIDirection *pDir);
|
|
234 static void AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0);
|
|
235 static void __fastcall StandAwhile(unsigned int uActorID);
|
|
236 static void AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, struct AIDirection *a4);
|
|
237 static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4);
|
|
238 static void AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4);
|
|
239 static void GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4);
|
|
240 static void Explode(unsigned int uActorID);
|
|
241 static void AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4);
|
|
242 static void AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel);
|
|
243 static void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4);
|
|
244
|
|
245 static unsigned short GetObjDescId( int spellId );
|
|
246
|
|
247 static void AggroSurroundingPeasants(unsigned int uActorID, int a2);
|
|
248 static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2);
|
|
249 static void StealFrom(unsigned int uActorID);
|
|
250 static void GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive);
|
|
251 static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle);
|
|
252 static void ApplyFineForKillingPeasant(unsigned int uActorID);
|
|
253 static void DrawHealthBar(Actor *actor, struct GUIWindow *window);
|
|
254 int _43B3E0_CalcDamage(signed int dmgSource);
|
|
255 static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3);
|
|
256
|
|
257 static bool _46DF1A_collide_against_actor(int a1, int a2);
|
|
258 static void Arena_summon_actor(int monster_id, __int16 x, int y, int z);
|
|
259 static void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity);
|
|
260 static void MakeActorAIList_ODM();
|
|
261 static int MakeActorAIList_BLV();
|
|
262 static void UpdateActorAI();
|
|
263 static void InitializeActors();
|
|
264 static unsigned int SearchAliveActors(unsigned int *pTotalActors);
|
|
265 static unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID);
|
|
266 static unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup);
|
|
267 static unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2);
|
|
268
|
|
269
|
|
270 void LootActor();
|
|
271 bool _427102_IsOkToCastSpell(signed int a2);
|
|
272 ABILITY_INDEX special_ability_use_check(int a2);
|
|
273 bool _4273BB_DoesHitOtherActor(Actor *defender, int a3, int a4);
|
|
274 bool ActorHitOrMiss(Player *pPlayer);
|
|
275 int CalcMagicalDamageToActor(DAMAGE_TYPE dmgType, signed int incomingDmg);
|
|
276 bool DoesDmgTypeDoDamage(DAMAGE_TYPE uType);
|
|
277
|
|
278 char pActorName[32];
|
|
279 signed __int16 sNPC_ID;
|
|
280 __int16 field_22;
|
|
281 unsigned int uAttributes;
|
|
282 __int16 sCurrentHP;
|
|
283 char field_2A[2];
|
|
284 struct MonsterInfo pMonsterInfo;
|
|
285 __int16 word_000084_range_attack;
|
|
286 __int16 word_000086_some_monster_id;
|
|
287 unsigned __int16 uActorRadius;
|
|
288 unsigned __int16 uActorHeight;
|
|
289 unsigned __int16 uMovementSpeed;
|
|
290 struct Vec3_short_ vPosition;
|
|
291 struct Vec3_short_ vVelocity;
|
|
292 unsigned __int16 uYawAngle;
|
|
293 unsigned __int16 uPitchAngle;
|
|
294 __int16 uSectorID;
|
|
295 unsigned __int16 uCurrentActionLength;
|
|
296 struct Vec3_short_ vInitialPosition;
|
|
297 struct Vec3_short_ vGuardingPosition;
|
|
298 unsigned __int16 uTetherDistance;
|
|
299 AIState uAIState;
|
|
300 unsigned __int16 uCurrentActionAnimation;
|
|
301 unsigned __int16 uCarriedItemID;
|
|
302 char field_B6;
|
|
303 char field_B7;
|
|
304 unsigned int uCurrentActionTime;
|
|
305 unsigned __int16 pSpriteIDs[8];
|
|
306 unsigned __int16 pSoundSampleIDs[4]; // 1 die 3 bored
|
|
307 struct SpellBuff pActorBuffs[22];
|
|
308 struct ItemGen ActorHasItems[4];
|
|
309 unsigned int uGroup;
|
|
310 unsigned int uAlly;
|
|
311 struct ActorJob pScheduledJobs[8];
|
|
312 unsigned int uSummonerID;
|
|
313 unsigned int uLastCharacterIDToHit;
|
|
314 int dword_000334_unique_name;
|
|
315 char field_338[12];
|
|
316 };
|
|
317 #pragma pack(pop)
|
|
318
|
|
319
|
|
320
|
|
321
|
|
322
|
|
323
|
|
324 //extern Actor pMonsterInfoUI_Doll;
|
|
325
|
|
326 extern std::array<Actor, 500> pActors;
|
|
327 extern size_t uNumActors;
|
|
328
|
|
329 bool CheckActors_proximity();
|
|
330 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
|
|
331 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
|
|
332 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
|
|
333 bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID);
|
|
334 bool __fastcall SpawnActor(unsigned int uMonsterID);
|
|
335 int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3);
|
|
336 void SpawnEncounter(struct MapInfo *pMapInfo, struct SpawnPointMM7 *spawn, int a3, int a4, int a5);
|
|
337 void area_of_effect__damage_evaluate();
|
|
338 double __fastcall sub_43AE12(signed int a1);
|
|
339 void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity);
|