annotate Actor.h @ 512:968f4053da7f

little fix
author Ritor1
date Fri, 01 Mar 2013 20:38:43 +0600
parents 55684f4eda73
children 214d9d47cf1f
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2 #include "VectorTypes.h"
Ritor1
parents:
diff changeset
3 #include "Items.h"
Ritor1
parents:
diff changeset
4 #include "Monsters.h"
Ritor1
parents:
diff changeset
5 #include "Spells.h"
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12 /* 357 */
Ritor1
parents:
diff changeset
13 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
14 struct stru319
Ritor1
parents:
diff changeset
15 {
Ritor1
parents:
diff changeset
16 void LootActor(struct Actor *pActor);
Ritor1
parents:
diff changeset
17 int which_player_would_attack(struct Actor *pActor);
Ritor1
parents:
diff changeset
18 bool special_ability_use_check(struct Actor *pActor, int a2);
Ritor1
parents:
diff changeset
19 int _427102(struct Actor *pActor, signed int a2);
Ritor1
parents:
diff changeset
20 int PlayerHitOrMiss(struct Player *pPlayer, struct Actor *pActor, int a3, int a4);
Ritor1
parents:
diff changeset
21 bool _4273BB(struct Actor *pActor, struct Actor *a2, int a3, int a4);
Ritor1
parents:
diff changeset
22 bool ActorHitOrMiss(struct Actor *pActor, struct Player *pPlayer);
Ritor1
parents:
diff changeset
23 int _427546(int a2);
Ritor1
parents:
diff changeset
24 int CalcMagicalDamageToActor(struct Actor *pActor, int a2, signed int a3);
Ritor1
parents:
diff changeset
25 bool GetMagicalResistance(struct Actor *pActor, unsigned int uType);
271
1f0af5cac2dd _42ECB5_PlayerAttacksActor
Nomad
parents: 194
diff changeset
26 int FindClosestActor(int a2, int a3, int a4);
0
Ritor1
parents:
diff changeset
27
Ritor1
parents:
diff changeset
28 char field_0;
Ritor1
parents:
diff changeset
29 };
Ritor1
parents:
diff changeset
30 #pragma pack(pop)
Ritor1
parents:
diff changeset
31
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 extern stru319 stru_50C198; // idb
Ritor1
parents:
diff changeset
34
Ritor1
parents:
diff changeset
35
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40 /* 361 */
Ritor1
parents:
diff changeset
41 enum ACTOR_BUFF_INDEX
Ritor1
parents:
diff changeset
42 {
411
747933903b1c 00401A91 sub_401A91_AI(): actors drop when dead
Nomad
parents: 322
diff changeset
43 ACTOR_BUFF_CHARM = 1, // an assumption
747933903b1c 00401A91 sub_401A91_AI(): actors drop when dead
Nomad
parents: 322
diff changeset
44 ACTOR_BUFF_SHRINK = 3, // an assumption
142
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
45 ACTOR_BUFF_STONED = 5,
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
46 ACTOR_BUFF_PARALYZED = 6,
0
Ritor1
parents:
diff changeset
47 };
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49
Ritor1
parents:
diff changeset
50
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52
Ritor1
parents:
diff changeset
53 /* 295 */
Ritor1
parents:
diff changeset
54 enum ObjectType
Ritor1
parents:
diff changeset
55 {
194
650d96af8855 Vis overhaul; sprites can be picked by mouse
Nomad
parents: 142
diff changeset
56 OBJECT_Any = 0x0,
141
cca78efb377e Constants -> enums
Nomad
parents: 0
diff changeset
57 OBJECT_BLVDoor = 0x1,
0
Ritor1
parents:
diff changeset
58 OBJECT_Item = 0x2,
Ritor1
parents:
diff changeset
59 OBJECT_Actor = 0x3,
Ritor1
parents:
diff changeset
60 OBJECT_Player = 0x4,
Ritor1
parents:
diff changeset
61 OBJECT_Decoration = 0x5,
Ritor1
parents:
diff changeset
62 OBJECT_BModel = 0x6,
Ritor1
parents:
diff changeset
63 };
Ritor1
parents:
diff changeset
64
Ritor1
parents:
diff changeset
65
Ritor1
parents:
diff changeset
66
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 /* 337 */
Ritor1
parents:
diff changeset
72 enum AI_OBJECT_TYPE
Ritor1
parents:
diff changeset
73 {
Ritor1
parents:
diff changeset
74 AI_OBJECT_LAYING_ITEM = 0x2,
Ritor1
parents:
diff changeset
75 AI_OBJECT_ACTOR = 0x3,
Ritor1
parents:
diff changeset
76 AI_OBJECT_PARTY = 0x4,
Ritor1
parents:
diff changeset
77 AI_OBJECT_DECORATION = 0x5,
Ritor1
parents:
diff changeset
78 };
Ritor1
parents:
diff changeset
79
Ritor1
parents:
diff changeset
80 /* 264 */
Ritor1
parents:
diff changeset
81 enum AIState : unsigned __int16
Ritor1
parents:
diff changeset
82 {
Ritor1
parents:
diff changeset
83 Standing = 0x0,
Ritor1
parents:
diff changeset
84 Tethered = 0x1,
Ritor1
parents:
diff changeset
85 AttackingMelee = 0x2,
Ritor1
parents:
diff changeset
86 AttackingRanged1 = 0x3,
Ritor1
parents:
diff changeset
87 Dying = 0x4,
Ritor1
parents:
diff changeset
88 Dead = 0x5,
Ritor1
parents:
diff changeset
89 Pursuing = 0x6,
Ritor1
parents:
diff changeset
90 Fleeing = 0x7,
Ritor1
parents:
diff changeset
91 Stunned = 0x8,
Ritor1
parents:
diff changeset
92 Fidgeting = 0x9,
142
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
93 Interacting = 10,
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
94 Removed = 11,
0
Ritor1
parents:
diff changeset
95 AttackingRanged2 = 0xC,
Ritor1
parents:
diff changeset
96 AttackingRanged3 = 0xD,
Ritor1
parents:
diff changeset
97 Stoned = 0xE,
Ritor1
parents:
diff changeset
98 Paralyzed = 0xF,
142
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
99 Resurrected = 16,
141
cca78efb377e Constants -> enums
Nomad
parents: 0
diff changeset
100 Summoned = 17,
142
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
101 AttackingRanged4 = 18,
8b8fd4d83fdc Various things here and there
Nomad
parents: 141
diff changeset
102 Disabled = 19,
0
Ritor1
parents:
diff changeset
103 };
Ritor1
parents:
diff changeset
104
Ritor1
parents:
diff changeset
105 /* 265 */
Ritor1
parents:
diff changeset
106 enum ActorAnimation : __int32
Ritor1
parents:
diff changeset
107 {
Ritor1
parents:
diff changeset
108 ANIM_Standing = 0x0,
Ritor1
parents:
diff changeset
109 ANIM_Walking = 0x1,
Ritor1
parents:
diff changeset
110 ANIM_AtkMelee = 0x2,
Ritor1
parents:
diff changeset
111 ANIM_AtkRanged = 0x3,
Ritor1
parents:
diff changeset
112 ANIM_GotHit = 0x4,
Ritor1
parents:
diff changeset
113 ANIM_Dying = 0x5,
Ritor1
parents:
diff changeset
114 ANIM_Dead = 0x6,
Ritor1
parents:
diff changeset
115 ANIM_Bored = 0x7,
Ritor1
parents:
diff changeset
116 };
Ritor1
parents:
diff changeset
117
Ritor1
parents:
diff changeset
118
Ritor1
parents:
diff changeset
119
Ritor1
parents:
diff changeset
120
Ritor1
parents:
diff changeset
121
Ritor1
parents:
diff changeset
122 /* 247 */
Ritor1
parents:
diff changeset
123 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
124 struct AIDirection
Ritor1
parents:
diff changeset
125 {
Ritor1
parents:
diff changeset
126 Vec3_int_ vDirection;
Ritor1
parents:
diff changeset
127 unsigned int uDistance;
Ritor1
parents:
diff changeset
128 unsigned int uDistanceXZ;
Ritor1
parents:
diff changeset
129 unsigned int uYawAngle;
Ritor1
parents:
diff changeset
130 unsigned int uPitchAngle;
Ritor1
parents:
diff changeset
131 };
Ritor1
parents:
diff changeset
132 #pragma pack(pop)
Ritor1
parents:
diff changeset
133
Ritor1
parents:
diff changeset
134
Ritor1
parents:
diff changeset
135
Ritor1
parents:
diff changeset
136
Ritor1
parents:
diff changeset
137
Ritor1
parents:
diff changeset
138 /* 71 */
Ritor1
parents:
diff changeset
139 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
140 struct ActorJob
Ritor1
parents:
diff changeset
141 {
Ritor1
parents:
diff changeset
142 struct Vec3_short_ vPos;
Ritor1
parents:
diff changeset
143 unsigned __int16 uAttributes;
Ritor1
parents:
diff changeset
144 unsigned __int8 uAction;
Ritor1
parents:
diff changeset
145 unsigned __int8 uHour;
Ritor1
parents:
diff changeset
146 unsigned __int8 uDay;
Ritor1
parents:
diff changeset
147 unsigned __int8 uMonth;
Ritor1
parents:
diff changeset
148 };
Ritor1
parents:
diff changeset
149 #pragma pack(pop)
Ritor1
parents:
diff changeset
150
Ritor1
parents:
diff changeset
151
Ritor1
parents:
diff changeset
152 /* 66 */
Ritor1
parents:
diff changeset
153 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
154 struct Actor
Ritor1
parents:
diff changeset
155 {
Ritor1
parents:
diff changeset
156 //----- (0041F4C1) --------------------------------------------------------
Ritor1
parents:
diff changeset
157 inline Actor()
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 Actor *v1; // esi@1
Ritor1
parents:
diff changeset
160 SpellBuff *v2; // eax@1
Ritor1
parents:
diff changeset
161 signed int v3; // edx@1
Ritor1
parents:
diff changeset
162 ItemGen *v4; // edi@3
Ritor1
parents:
diff changeset
163 signed int v5; // ebx@3
Ritor1
parents:
diff changeset
164
Ritor1
parents:
diff changeset
165 v1 = this;
Ritor1
parents:
diff changeset
166 v2 = this->pActorBuffs;
Ritor1
parents:
diff changeset
167 v3 = 22;
Ritor1
parents:
diff changeset
168 do
Ritor1
parents:
diff changeset
169 {
Ritor1
parents:
diff changeset
170 v2->uSkill = 0;
Ritor1
parents:
diff changeset
171 v2->uPower = 0;
Ritor1
parents:
diff changeset
172 v2->uExpireTime = 0;
Ritor1
parents:
diff changeset
173 v2->uCaster = 0;
Ritor1
parents:
diff changeset
174 v2->uFlags = 0;
Ritor1
parents:
diff changeset
175 ++v2;
Ritor1
parents:
diff changeset
176 --v3;
Ritor1
parents:
diff changeset
177 }
Ritor1
parents:
diff changeset
178 while ( v3 );
Ritor1
parents:
diff changeset
179 v4 = this->array_000234;
Ritor1
parents:
diff changeset
180 v5 = 4;
Ritor1
parents:
diff changeset
181 do
Ritor1
parents:
diff changeset
182 {
Ritor1
parents:
diff changeset
183 v4->Reset();
Ritor1
parents:
diff changeset
184 ++v4;
Ritor1
parents:
diff changeset
185 --v5;
Ritor1
parents:
diff changeset
186 }
Ritor1
parents:
diff changeset
187 while ( v5 );
Ritor1
parents:
diff changeset
188 Reset();
Ritor1
parents:
diff changeset
189 }
Ritor1
parents:
diff changeset
190
Ritor1
parents:
diff changeset
191 int _44FD29(int a2);
Ritor1
parents:
diff changeset
192 void Reset();
Ritor1
parents:
diff changeset
193 void Remove();
Ritor1
parents:
diff changeset
194 void PrepareSprites(char load_sounds_if_bit1_set);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
195 void UpdateAnimation();
0
Ritor1
parents:
diff changeset
196 signed int GetActorsRelation(Actor *a2);
Ritor1
parents:
diff changeset
197 void SetRandomGoldIfTheresNoItem();
Ritor1
parents:
diff changeset
198 bool CanAct();
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 271
diff changeset
199 bool IsNotAlive();
0
Ritor1
parents:
diff changeset
200 void InitializeDialogue(int bPlayerSaysHello);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
201 bool IsPeasant();
0
Ritor1
parents:
diff changeset
202
Ritor1
parents:
diff changeset
203
417
55684f4eda73 Actor::SelectTarget & ai_near_actors_targets_pid
Nomad
parents: 414
diff changeset
204 static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
205 static void _402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
206 static void _40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
207 static void _402968(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
208 static void _402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
209 static void PlaySound(unsigned int uActorID, unsigned int uSoundID);
319
5a66be213cff Actor::Die
Nomad
parents: 303
diff changeset
210 static void Die(unsigned int uActorID);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
211 static void Resurrect(unsigned int uActorID);
414
d8b3056df4e2 AI_Bored
Nomad
parents: 413
diff changeset
212 static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
213 static void _4030AD(unsigned int uActorID, signed int edx0, int arg0);
0
Ritor1
parents:
diff changeset
214 static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
215 static void _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
216 static void _403476(unsigned int uActorID, signed int edx0, struct AIDirection *pDir);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
217 static void _40368B(unsigned int uActorID, signed int edx0, struct AIDirection *pDir);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
218 static void _403854(unsigned int uActorID, signed int edx0, struct AIDirection *pDir);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
219 static void _403A60(unsigned int uActorID, signed int edx0, struct AIDirection *pDir);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
220 static void _403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0);
0
Ritor1
parents:
diff changeset
221 static void __fastcall StandAwhile(unsigned int uActorID);
413
111f25d1cc04 AI_Stand
Nomad
parents: 411
diff changeset
222 static void AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, struct AIDirection *a4);
414
d8b3056df4e2 AI_Bored
Nomad
parents: 413
diff changeset
223 static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
224 static void FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4);
0
Ritor1
parents:
diff changeset
225 static struct AIDirection *__fastcall GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4);
Ritor1
parents:
diff changeset
226 static signed int __fastcall Explode(unsigned int uActorID);
Ritor1
parents:
diff changeset
227 static char __fastcall _404874(unsigned int uActorID, struct AIDirection *a2, int a3, char a4);
Ritor1
parents:
diff changeset
228 static void __fastcall _404AC7(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
229 static void AggroSurroundingPeasants(unsigned int uActorID, int a2);
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
230 static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2);
0
Ritor1
parents:
diff changeset
231 static bool StealFrom(unsigned int uActorID);
Ritor1
parents:
diff changeset
232 static void GiveItem(unsigned int uActorID, unsigned int uItemID, unsigned int bGive);
Ritor1
parents:
diff changeset
233 static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
234 static void ApplyFineForKillingPeasant(unsigned int uActorID);
0
Ritor1
parents:
diff changeset
235 static void DrawHealthBar(Actor *a1, struct GUIWindow *a2);
Ritor1
parents:
diff changeset
236 static int _43B3E0_CalcDamage(Actor *a1, signed int a2);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 319
diff changeset
237 static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3);
0
Ritor1
parents:
diff changeset
238
Ritor1
parents:
diff changeset
239
Ritor1
parents:
diff changeset
240 char pActorName[32];
Ritor1
parents:
diff changeset
241 unsigned __int16 uNPC_ID;
Ritor1
parents:
diff changeset
242 __int16 field_22;
Ritor1
parents:
diff changeset
243 unsigned int uAttributes;
Ritor1
parents:
diff changeset
244 __int16 sCurrentHP;
Ritor1
parents:
diff changeset
245 char field_2A[2];
Ritor1
parents:
diff changeset
246 struct MonsterInfo pMonsterInfo;
Ritor1
parents:
diff changeset
247 __int16 word_000084_range_attack;
Ritor1
parents:
diff changeset
248 __int16 word_000086_some_monster_id;
Ritor1
parents:
diff changeset
249 unsigned __int16 uActorRadius;
Ritor1
parents:
diff changeset
250 unsigned __int16 uActorHeight;
Ritor1
parents:
diff changeset
251 unsigned __int16 uMovementSpeed;
Ritor1
parents:
diff changeset
252 struct Vec3_short_ vPosition;
Ritor1
parents:
diff changeset
253 struct Vec3_short_ vVelocity;
Ritor1
parents:
diff changeset
254 unsigned __int16 uYawAngle;
Ritor1
parents:
diff changeset
255 unsigned __int16 uPitchAngle;
Ritor1
parents:
diff changeset
256 __int16 uSectorID;
Ritor1
parents:
diff changeset
257 unsigned __int16 uCurrentActionLength;
Ritor1
parents:
diff changeset
258 struct Vec3_short_ vInitialPosition;
Ritor1
parents:
diff changeset
259 struct Vec3_short_ vGuardingPosition;
Ritor1
parents:
diff changeset
260 unsigned __int16 uTetherDistance;
Ritor1
parents:
diff changeset
261 AIState uAIState;
Ritor1
parents:
diff changeset
262 unsigned __int16 uCurrentActionAnimation;
Ritor1
parents:
diff changeset
263 unsigned __int16 uCarriedItemID;
Ritor1
parents:
diff changeset
264 char field_B6;
Ritor1
parents:
diff changeset
265 char field_B7;
Ritor1
parents:
diff changeset
266 unsigned int uCurrentActionTime;
Ritor1
parents:
diff changeset
267 unsigned __int16 pSpriteIDs[8];
417
55684f4eda73 Actor::SelectTarget & ai_near_actors_targets_pid
Nomad
parents: 414
diff changeset
268 unsigned __int16 pSoundSampleIDs[4]; // 1 die 3 bored
0
Ritor1
parents:
diff changeset
269 struct SpellBuff pActorBuffs[22];
Ritor1
parents:
diff changeset
270 struct ItemGen array_000234[4];
Ritor1
parents:
diff changeset
271 unsigned int uGroup;
Ritor1
parents:
diff changeset
272 unsigned int uAlly;
Ritor1
parents:
diff changeset
273 struct ActorJob pScheduledJobs[8];
Ritor1
parents:
diff changeset
274 unsigned int uSummonerID;
Ritor1
parents:
diff changeset
275 unsigned int uLastCharacterIDToHit;
Ritor1
parents:
diff changeset
276 int dword_000334_unique_name;
Ritor1
parents:
diff changeset
277 char field_338[12];
Ritor1
parents:
diff changeset
278 };
Ritor1
parents:
diff changeset
279 #pragma pack(pop)
Ritor1
parents:
diff changeset
280
Ritor1
parents:
diff changeset
281
Ritor1
parents:
diff changeset
282
Ritor1
parents:
diff changeset
283
Ritor1
parents:
diff changeset
284
Ritor1
parents:
diff changeset
285
Ritor1
parents:
diff changeset
286 //extern Actor pMonsterInfoUI_Doll;
Ritor1
parents:
diff changeset
287
Ritor1
parents:
diff changeset
288
Ritor1
parents:
diff changeset
289 extern Actor pActors[500];
Ritor1
parents:
diff changeset
290 extern size_t uNumActors;