Mercurial > mm7
annotate Actor.cpp @ 1855:51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
author | Grumpy7 |
---|---|
date | Mon, 14 Oct 2013 00:40:25 +0200 |
parents | 4ae5b7e7a920 |
children | 656962b05d32 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1115
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1115
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1115
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1115
diff
changeset
|
4 |
1253 | 5 #include "mm7_data.h" |
1016 | 6 #include "DecalBuilder.h" |
7 | |
8 #include "Sprites.h" | |
9 #include "stru6.h" | |
10 | |
11 | |
0 | 12 #include "Actor.h" |
13 #include "Math.h" | |
14 #include "Outdoor.h" | |
15 #include "AudioPlayer.h" | |
16 #include "Game.h" | |
17 #include "ObjectList.h" | |
18 #include "Overlays.h" | |
19 #include "Events.h" | |
20 #include "FactionTable.h" | |
21 #include "TurnEngine.h" | |
22 #include "MapInfo.h" | |
924 | 23 #include "CastSpellInfo.h" |
0 | 24 #include "Time.h" |
25 #include "LOD.h" | |
26 #include "Party.h" | |
27 #include "GUIWindow.h" | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1603
diff
changeset
|
28 #include "Outdoor_stuff.h" |
0 | 29 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
30 #include "MM7.h" |
1016 | 31 #include "SpriteObject.h" |
1295 | 32 #include "stru298.h" |
1297 | 33 #include "Log.h" |
34 #include "Texts.h" | |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1827
diff
changeset
|
35 #include "Level/Decoration.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
36 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
37 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
38 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
39 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
40 |
1202 | 41 std::array<Actor, 500> pActors; |
1503 | 42 size_t uNumActors; |
0 | 43 |
44 stru319 stru_50C198; // idb | |
45 | |
994 | 46 |
47 | |
48 | |
49 //----- (0041AF52) -------------------------------------------------------- | |
1761 | 50 void Actor::DrawHealthBar(Actor *actor, GUIWindow *window) |
994 | 51 { |
1763 | 52 unsigned int bar_length; // esi@1 |
53 unsigned int uX; // ebx@10 | |
994 | 54 unsigned int v9; // [sp+14h] [bp-Ch]@4 |
55 unsigned int v10; // [sp+1Ch] [bp-4h]@4 | |
56 | |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
57 if (actor->pMonsterInfo.uHP <= 25) |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
58 bar_length = 25; |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
59 else if ( actor->pMonsterInfo.uHP < 200 ) |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
60 bar_length = actor->pMonsterInfo.uHP; |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
61 else |
1763 | 62 bar_length = 200; |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
63 |
1763 | 64 v10 = bar_length; |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
65 if ( actor->sCurrentHP <= (0.34 * actor->pMonsterInfo.uHP) ) |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
66 v9 = uTextureID_mhp_red; |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
67 else if ( actor->sCurrentHP <= ( 0.67 * actor->pMonsterInfo.uHP) ) |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
68 v9 = uTextureID_mhp_yel; |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
69 else |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
70 v9 = uTextureID_mhp_grn; |
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
71 |
1763 | 72 if ( actor->sCurrentHP < actor->pMonsterInfo.uHP ) |
994 | 73 { |
1763 | 74 v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP; |
994 | 75 } |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
76 |
1763 | 77 uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2; |
994 | 78 |
1763 | 79 pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52); |
80 pRenderer->DrawTextureIndexed(uX, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); | |
81 pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + v10, window->uFrameY + 52); | |
82 pRenderer->DrawTextureIndexed(uX, window->uFrameY + 34, pIcons_LOD->GetTexture(v9)); | |
994 | 83 |
84 pRenderer->ResetTextureClipRect(); | |
1763 | 85 pRenderer->DrawTextureIndexed(uX - 5, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl)); |
86 pRenderer->DrawTextureIndexed(uX + bar_length, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr)); | |
994 | 87 } |
88 | |
781 | 89 //----- (00448A40) -------------------------------------------------------- |
90 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle) | |
91 { | |
92 if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) ) | |
93 { | |
94 if ( bToggle ) | |
95 { | |
96 pActors[uActorID].uAttributes |= uFlag; | |
97 } | |
98 else | |
99 { | |
100 if ( uFlag == 0x10000 ) | |
101 { | |
102 if (pActors[uActorID].uAIState == Disabled ) | |
103 pActors[uActorID].uAIState = Standing; | |
104 } | |
105 pActors[uActorID].uAttributes &= ~uFlag; | |
106 } | |
107 } | |
108 } | |
0 | 109 |
110 //----- (00448518) -------------------------------------------------------- | |
111 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) | |
112 { | |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
113 for (int i = 0; i < uNumActors; i++) |
0 | 114 { |
1849
794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
Grumpy7
parents:
1828
diff
changeset
|
115 if (pActors[uNumActors].sNPC_ID == npc) |
0 | 116 { |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
117 Actor::GiveItem(i, item, a3); |
0 | 118 } |
119 } | |
120 } | |
121 | |
122 //----- (004485A7) -------------------------------------------------------- | |
526 | 123 void Actor::GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive) |
0 | 124 { |
526 | 125 if ( (uActorID >= 0) && (signed int)uActorID <= (signed int)(uNumActors - 1) ) |
0 | 126 { |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
127 Actor* currActor = &pActors[uActorID]; |
0 | 128 if ( bGive ) |
129 { | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
130 if ( currActor->uCarriedItemID == 0) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
131 currActor->uCarriedItemID = uItemID; |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
132 else if ( currActor->array_000234[0].uItemID == 0) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
133 currActor->array_000234[0].uItemID = uItemID; |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
134 else if ( currActor->array_000234[1].uItemID == 0) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
135 currActor->array_000234[1].uItemID = uItemID; |
0 | 136 } |
137 else | |
138 { | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
139 if ( currActor->uCarriedItemID == uItemID ) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
140 currActor->uCarriedItemID = 0; |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
141 else if ( currActor->array_000234[0].uItemID == uItemID ) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
142 currActor->array_000234[0].Reset(); |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
143 else if ( currActor->array_000234[1].uItemID == uItemID ) |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
144 currActor->array_000234[1].Reset(); |
0 | 145 } |
146 } | |
147 } | |
148 | |
149 //----- (0040894B) -------------------------------------------------------- | |
150 bool Actor::CanAct() | |
151 { | |
1114 | 152 bool isparalyzed; // esi@1 |
153 bool isstoned; // edi@2 | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
154 AIState v3; // ax@6 |
0 | 155 |
1114 | 156 isstoned = (signed __int64)this->pActorBuffs[5].uExpireTime > 0;// stoned |
157 isparalyzed = (signed __int64)this->pActorBuffs[6].uExpireTime > 0;// paralyzed | |
0 | 158 v3 = this->uAIState; |
1114 | 159 return !(isstoned || isparalyzed || v3 == Dying || v3 == Dead || v3 == Removed || v3 == Summoned || v3 == Disabled); |
0 | 160 } |
161 | |
162 //----- (004089C7) -------------------------------------------------------- | |
303 | 163 bool Actor::IsNotAlive() |
0 | 164 { |
1115 | 165 bool isstoned; // esi@1 |
0 | 166 |
1115 | 167 isstoned = (signed __int64)this->pActorBuffs[5].uExpireTime > 0;// stoned |
168 return (isstoned || (uAIState == Dying) || (uAIState == Dead) || (uAIState == Removed) || (uAIState == Summoned) || (uAIState == Disabled)); | |
0 | 169 } |
170 | |
171 //----- (004086E9) -------------------------------------------------------- | |
172 void Actor::SetRandomGoldIfTheresNoItem() | |
173 { | |
174 int v2; // edi@1 | |
175 unsigned __int8 v4; // al@7 | |
176 | |
177 v2 = 0; | |
178 if ( !this->array_000234[3].uItemID ) | |
179 { | |
180 if ( this->pMonsterInfo.uTreasureDiceRolls ) | |
181 { | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
182 for (int i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++) |
0 | 183 { |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
184 v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1; |
0 | 185 } |
186 if ( v2 ) | |
187 { | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
188 this->array_000234[3].uItemID = 197; |
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
189 this->array_000234[3].uSpecEnchantmentType = v2; //actual gold amount |
0 | 190 } |
191 } | |
192 } | |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
193 if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance ) |
0 | 194 { |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
195 v4 = this->pMonsterInfo.uTreasureLevel; |
0 | 196 if ( v4 ) |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
197 pItemsTable->GenerateItem(v4, this->pMonsterInfo.uTreasureType, &this->array_000234[2]); |
0 | 198 } |
1850
521ffedabe19
sub_448518_npc_set_item using body of cleaned up Actor::GiveItem
Grumpy7
parents:
1849
diff
changeset
|
199 this->uAttributes |= 0x800000; |
0 | 200 } |
201 | |
202 //----- (00404AC7) -------------------------------------------------------- | |
1519 | 203 void __fastcall Actor::AI_SpellAttack(unsigned int uActorID, AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel) |
0 | 204 { |
205 Actor *v5; // esi@1 | |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
206 unsigned int realPoints; // edi@1 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
207 unsigned int masteryLevel; // eax@1 |
0 | 208 int v8; // edi@16 |
209 int v9; // edi@17 | |
210 signed int v10; // ecx@22 | |
211 signed int v11; // eax@29 | |
212 __int16 *v12; // edi@30 | |
213 int v13; // ecx@34 | |
214 int v14; // edx@34 | |
215 int v15; // eax@34 | |
216 AIDirection *v16; // esi@34 | |
217 unsigned __int16 v17; // di@34 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
218 //int v18; // eax@34 |
0 | 219 int v19; // edi@34 |
220 int v20; // eax@35 | |
221 int v21; // eax@39 | |
222 SoundID v22; // eax@39 | |
223 signed int v23; // eax@41 | |
224 double v24; // st7@49 | |
225 float v25; // ST5C_4@50 | |
226 int v26; // eax@50 | |
227 double v27; // st7@50 | |
228 double v28; // st6@50 | |
229 float v29; // ST4C_4@51 | |
230 int v30; // esi@50 | |
231 int v31; // ST3C_4@51 | |
232 unsigned int v32; // edi@51 | |
233 char *v33; // eax@54 | |
234 unsigned __int16 v34; // ax@57 | |
235 signed int v35; // ecx@58 | |
236 signed int v36; // eax@67 | |
237 signed int v37; // eax@68 | |
238 signed __int64 v38; // qtt@69 | |
239 int v39; // ecx@75 | |
240 int v40; // eax@79 | |
241 int v41; // ecx@90 | |
242 int v42; // ecx@91 | |
243 int v43; // eax@95 | |
244 int v44; // ecx@100 | |
245 int v45; // ecx@101 | |
246 int v46; // eax@105 | |
247 int v48; // ecx@110 | |
248 char v49; // zf@123 | |
249 int v50; // eax@127 | |
250 int v51; // ecx@130 | |
251 int v52; // eax@132 | |
252 int v53; // ecx@137 | |
253 int v54; // ecx@138 | |
254 int v55; // eax@142 | |
255 SpellBuff *v56; // esi@143 | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
256 Player *v57; // esi@145 |
0 | 257 int v58; // eax@146 |
258 int v59; // edi@146 | |
259 int v60; // eax@146 | |
260 int v61; // edi@146 | |
261 int v62; // eax@146 | |
262 signed int v63; // edi@146 | |
263 signed int v64; // edi@147 | |
264 int v65; // eax@151 | |
265 char *v66; // eax@160 | |
266 int v67; // edi@167 | |
267 int v68; // edi@168 | |
268 int v69; // eax@171 | |
269 signed int v70; // ecx@172 | |
270 signed int v71; // eax@179 | |
271 __int16 *v72; // edi@180 | |
272 int v73; // ecx@184 | |
273 int v74; // edx@184 | |
274 int v75; // eax@184 | |
275 AIDirection *v76; // esi@184 | |
276 unsigned __int16 v77; // di@184 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
277 //int v78; // eax@184 |
0 | 278 int v79; // edx@185 |
279 int v80; // eax@185 | |
280 int v81; // eax@189 | |
281 unsigned __int16 v82; // ax@190 | |
282 int v83; // ecx@192 | |
283 int v84; // edx@192 | |
284 int v85; // eax@192 | |
285 AIDirection *v86; // esi@192 | |
286 unsigned __int16 v87; // di@192 | |
287 __int16 v88; // ax@192 | |
288 signed int v89; // ecx@192 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
289 //int v90; // eax@192 |
0 | 290 signed int v91; // eax@200 |
291 int v92; // eax@201 | |
292 int v93; // ecx@207 | |
293 int v94; // ecx@208 | |
294 int v95; // eax@212 | |
295 int v96; // ecx@217 | |
296 int v97; // eax@221 | |
297 SoundID v98; // [sp-18h] [bp-E8h]@79 | |
298 signed int v99; // [sp-14h] [bp-E4h]@39 | |
299 signed int v105; // [sp+4h] [bp-CCh]@23 | |
300 signed int v107; // [sp+4h] [bp-CCh]@42 | |
301 signed int v108; // [sp+4h] [bp-CCh]@173 | |
302 int pitch; // [sp+2Ch] [bp-A4h]@51 | |
303 float v110; // [sp+30h] [bp-A0h]@50 | |
304 int v111; // [sp+38h] [bp-98h]@41 | |
305 float v112; // [sp+3Ch] [bp-94h]@49 | |
306 int v113; // [sp+40h] [bp-90h]@41 | |
307 int v114; // [sp+48h] [bp-88h]@41 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
308 SpriteObject a1; // [sp+4Ch] [bp-84h]@1 |
0 | 309 int v116; // [sp+BCh] [bp-14h]@49 |
310 AIDirection *v117; // [sp+C0h] [bp-10h]@1 | |
311 int v118; // [sp+C4h] [bp-Ch]@29 | |
312 float v119; // [sp+C8h] [bp-8h]@48 | |
313 float v120; // [sp+CCh] [bp-4h]@1 | |
314 int spellnuma; // [sp+D8h] [bp+8h]@29 | |
315 int spellnumb; // [sp+D8h] [bp+8h]@48 | |
316 float spellnumc; // [sp+D8h] [bp+8h]@50 | |
317 signed int spellnumd; // [sp+D8h] [bp+8h]@53 | |
318 int spellnume; // [sp+D8h] [bp+8h]@179 | |
319 int a1a; // [sp+E0h] [bp+10h]@34 | |
320 signed int a1b; // [sp+E0h] [bp+10h]@145 | |
321 int a1c; // [sp+E0h] [bp+10h]@184 | |
322 | |
1855
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
323 |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
324 |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
325 if ( uSpellID == 6 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
326 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
327 if ( uSpellID == 11 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
328 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
329 if ( uSpellID == 18 || uSpellID == 2 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
330 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
331 if ( uSpellID == 26 || uSpellID == 29 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
332 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
333 if ( uSpellID == 39 || uSpellID == 41 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
334 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
335 if ( uSpellID == 57 || uSpellID == 65 || uSpellID == 70 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
336 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
337 if ( uSpellID == 78 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
338 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
339 if ( uSpellID == 90 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
340 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
341 if ( uSpellID == 97 ) |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
342 goto LABEL_159; |
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
343 |
0 | 344 LODWORD(v120) = uActorID; |
345 v5 = &pActors[uActorID]; | |
346 v117 = pDir; | |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
347 realPoints = uSkillLevel & 0x3F; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
348 masteryLevel = SkillToMastery(uSkillLevel); |
1519 | 349 if ( uSpellID <= 47 ) |
0 | 350 { |
1519 | 351 if ( uSpellID != 47 ) |
0 | 352 { |
1519 | 353 if ( uSpellID <= 18 ) |
0 | 354 { |
1519 | 355 if ( uSpellID != 5 ) |
0 | 356 { |
1519 | 357 if ( uSpellID != 9 ) |
0 | 358 { |
1519 | 359 if ( uSpellID != 11 ) |
0 | 360 { |
1519 | 361 if ( uSpellID != 15 ) |
0 | 362 { |
1519 | 363 if ( uSpellID != 17 ) |
0 | 364 return; |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
365 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
366 if (masteryLevel == 0) |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
367 { |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
368 v8 = 0; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
369 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
370 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 371 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
372 v9 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
373 v8 = v9 + 3840; |
0 | 374 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
375 else if (masteryLevel == 3 ) |
0 | 376 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
377 v9 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
378 v8 = v9 + 3840; |
0 | 379 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
380 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
381 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
382 v8 = 3600 * (realPoints + 64); |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
383 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
384 v5->pActorBuffs[15].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
385 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
386 masteryLevel, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
387 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
388 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
389 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
390 return; |
0 | 391 } |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
392 if (masteryLevel <= 1) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
393 v10 = 3; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
394 else if (masteryLevel == 2 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
395 v10 = 5; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
396 else if (masteryLevel == 3 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
397 v10 = 7; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
398 else if (masteryLevel == 4 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
399 v10 = 9; |
0 | 400 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
924 | 401 a1.uType = stru_4E3ACC[15].uType; |
0 | 402 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1); |
403 v11 = 0; | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
404 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 405 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
406 if (stru_4E3ACC[15].uType == pObjectList->pObjects[i].uObjectID) |
0 | 407 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
408 v11 = i; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
409 break; |
0 | 410 } |
411 } | |
412 a1.uObjectDescID = v11; | |
413 a1.stru_24.Reset(); | |
822 | 414 a1.spell_id = SPELL_AIR_SPARKS; |
0 | 415 v13 = v5->vPosition.x; |
416 v14 = v5->vPosition.y; | |
822 | 417 a1.spell_level = uSkillLevel; |
0 | 418 a1.vPosition.x = v13; |
419 v15 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); | |
420 v16 = v117; | |
421 v17 = LOWORD(v117->uYawAngle); | |
822 | 422 a1.spell_skill = 0; |
0 | 423 a1.vPosition.y = v14; |
424 a1.vPosition.z = v15; | |
425 a1.uFacing = v17; | |
426 a1.uSoundID = 0; | |
427 a1.uAttributes = 0; | |
428 a1.uSectorID = pIndoor->GetSector(v13, v14, v15); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
429 a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); |
0 | 430 a1.uSpriteFrameID = 0; |
823 | 431 a1.spell_target_pid = 0; |
0 | 432 a1.field_60_distance_related_prolly_lod = 3; |
433 v19 = spellnuma / -2; | |
434 a1a = spellnuma / 2; | |
435 if ( spellnuma / -2 > spellnuma / 2 ) | |
436 { | |
437 v20 = spellnuma / 2; | |
438 } | |
439 else | |
440 { | |
441 do | |
442 { | |
443 a1.uFacing = v19 + LOWORD(v16->uYawAngle); | |
444 v20 = a1.Create( | |
445 (signed __int16)a1.uFacing, | |
446 v16->uPitchAngle, | |
447 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
448 0); | |
449 v19 += v118; | |
450 } | |
451 while ( v19 <= a1a ); | |
452 } | |
453 if ( v20 != -1 ) | |
454 { | |
455 v21 = 8 * v20; | |
456 LOBYTE(v21) = v21 | 2; | |
457 v99 = v21; | |
458 v22 = (SoundID)word_4EE088_sound_ids[15]; | |
459 v98 = v22; | |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
460 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
461 return; |
0 | 462 } |
463 return; | |
464 } | |
465 LABEL_159: | |
1519 | 466 a1.uType = stru_4E3ACC[uSpellID].uType; |
0 | 467 v119 = 0.0; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
468 v82 = 0; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
469 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 470 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
471 if (a1.uType == pObjectList->pObjects[i].uObjectID) |
0 | 472 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
473 v82 = i; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
474 break; |
0 | 475 } |
476 } | |
477 a1.uObjectDescID = v82; | |
478 a1.stru_24.Reset(); | |
1519 | 479 a1.spell_id = uSpellID; |
0 | 480 v83 = v5->vPosition.x; |
481 v84 = v5->vPosition.y; | |
822 | 482 a1.spell_level = uSkillLevel; |
0 | 483 a1.vPosition.x = v83; |
484 v85 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); | |
485 v86 = v117; | |
486 v87 = LOWORD(v117->uYawAngle); | |
822 | 487 a1.spell_skill = 0; |
0 | 488 a1.vPosition.y = v84; |
489 a1.vPosition.z = v85; | |
490 a1.uFacing = v87; | |
491 a1.uSoundID = 0; | |
492 a1.uAttributes = 0; | |
493 v88 = pIndoor->GetSector(v83, v84, v85); | |
494 v89 = v86->uDistance; | |
495 a1.uSectorID = v88; | |
496 LODWORD(v119) = v89; | |
497 a1.uSpriteFrameID = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
498 a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); |
823 | 499 a1.spell_target_pid = 0; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
500 if ((double)v89 < 307.2 ) |
0 | 501 a1.field_60_distance_related_prolly_lod = 0; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
502 else if ( v89 < 1024 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
503 a1.field_60_distance_related_prolly_lod = 1; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
504 else if ( v89 < 2560 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
505 a1.field_60_distance_related_prolly_lod = 2; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
506 else |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
507 a1.field_60_distance_related_prolly_lod = 3; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
508 |
0 | 509 a1.field_61 = 2; |
510 v91 = a1.Create( | |
511 v86->uYawAngle, | |
512 v86->uPitchAngle, | |
513 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
514 0); | |
515 if ( v91 != -1 ) | |
516 { | |
517 v92 = 8 * v91; | |
518 LOBYTE(v92) = v92 | 2; | |
519 v99 = v92; | |
1519 | 520 v22 = (SoundID)word_4EE088_sound_ids[uSpellID]; |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
521 v98 = v22; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
522 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
523 return; |
0 | 524 } |
525 return; | |
526 } | |
527 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
528 return; | |
529 v118 = pParty->vPosition.z; | |
530 v111 = pParty->vPosition.x; | |
531 v114 = pParty->vPosition.z + 2500; | |
532 v113 = pParty->vPosition.y; | |
533 v23 = 8; | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
534 if (masteryLevel == 2) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
535 v23 = 10; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
536 else if (masteryLevel == 3) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
537 v23 = 12; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
538 else if (masteryLevel == 4) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
539 v23 = 14; |
0 | 540 v119 = 0.0; |
541 spellnumb = 0; | |
542 if ( v23 > 0 ) | |
543 { | |
544 v24 = (double)v118; | |
545 v118 = v23; | |
546 v112 = v24; | |
862 | 547 v116 = PID(OBJECT_Actor,LODWORD(v120)); |
0 | 548 do |
549 { | |
550 v26 = rand(); | |
551 v27 = (double)spellnumb; | |
552 v110 = v27; | |
553 v28 = (double)SLODWORD(v119); | |
554 v30 = v26 % 1000; | |
555 v25 = (double)v114; | |
556 spellnumc = (double)(v26 % 1000) + v112 - v25; | |
557 v120 = v28 * v28; | |
558 v119 = v27 * v27; | |
559 if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 ) | |
560 { | |
561 v32 = 0; | |
562 pitch = 0; | |
563 } | |
564 else | |
565 { | |
566 v31 = (signed __int64)sqrt(v119 + v120); | |
567 v29 = v28; | |
568 v32 = stru_5C6E00->Atan2((signed __int64)v110, (signed __int64)v29); | |
569 pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc); | |
570 } | |
571 a1.stru_24.Reset(); | |
924 | 572 a1.uType = stru_4E3ACC[9].uType; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
573 v34 = 0; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
574 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 575 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
576 if (pObjectList->pObjects[i].uObjectID == a1.uType) |
0 | 577 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
578 v34 = i; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
579 break; |
0 | 580 } |
581 } | |
582 a1.uObjectDescID = v34; | |
822 | 583 a1.spell_level = uSkillLevel; |
0 | 584 a1.vPosition.x = v111; |
585 a1.vPosition.y = v113; | |
586 a1.vPosition.z = v30 + v114; | |
822 | 587 a1.spell_id = SPELL_FIRE_METEOR_SHOWER; |
588 a1.spell_skill = 0; | |
0 | 589 a1.uAttributes = 0; |
590 a1.uSectorID = 0; | |
591 a1.uSpriteFrameID = 0; | |
822 | 592 a1.spell_caster_pid = v116; |
823 | 593 a1.spell_target_pid = 0; |
0 | 594 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(v30 + 2500); |
595 a1.uFacing = v32; | |
596 a1.uSoundID = 0; | |
597 v35 = v117->uDistance; | |
598 LODWORD(v119) = v117->uDistance; | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
599 if ((double)v119 < 307.2 ) |
0 | 600 a1.field_60_distance_related_prolly_lod = 0; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
601 else if ( v119 < 1024 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
602 a1.field_60_distance_related_prolly_lod = 1; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
603 else if ( v119 < 2560 ) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
604 a1.field_60_distance_related_prolly_lod = 2; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
605 else |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
606 a1.field_60_distance_related_prolly_lod = 3; |
0 | 607 a1.field_61 = 2; |
608 v36 = a1.Create( | |
609 v32, | |
610 pitch, | |
611 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
612 0); | |
613 if ( v36 != -1 ) | |
614 { | |
615 v37 = 8 * v36; | |
616 LOBYTE(v37) = v37 | 2; | |
617 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], v37, 0, -1, 0, 0, 0, 0); | |
618 } | |
619 spellnumb = rand() % 1024 - 512; | |
620 v38 = rand(); | |
621 v49 = v118-- == 1; | |
622 LODWORD(v119) = (unsigned __int64)(v38 % 1024) - 512; | |
623 } | |
624 while ( !v49 ); | |
625 } | |
626 return; | |
627 } | |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
628 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
629 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
630 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
631 v39 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
632 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
633 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 634 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
635 v39 = 60 * (realPoints + 60); |
0 | 636 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
637 else if (masteryLevel == 3 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
638 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
639 v39 = 180 * (realPoints + 20); |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
640 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
641 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
642 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
643 v39 = 240 * (realPoints + 15); |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
644 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
645 v5->pActorBuffs[19].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
646 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
647 masteryLevel, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
648 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
649 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
650 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
651 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
652 v40 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
653 LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
654 v99 = v40; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
655 v98 = (SoundID)10040; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
656 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
657 return; |
0 | 658 } |
1519 | 659 if ( uSpellID != 38 ) |
0 | 660 { |
1519 | 661 if ( uSpellID != 46 ) |
0 | 662 return; |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
663 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
664 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
665 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
666 v42 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
667 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
668 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 669 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
670 v41 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
671 v42 = v41 + 3840; |
0 | 672 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
673 else if (masteryLevel == 3 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
674 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
675 v41 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
676 v42 = v41 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
677 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
678 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
679 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
680 v41 = 1200 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
681 v42 = v41 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
682 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
683 v5->pActorBuffs[17].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
684 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
685 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
686 realPoints + 5, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
687 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
688 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
689 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
690 v43 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
691 LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
692 v99 = v43; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
693 v98 = (SoundID)14010; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
694 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
695 return; |
0 | 696 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
697 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
698 if (masteryLevel == 0) |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
699 { |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
700 v44 = 0; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
701 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
702 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 703 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
704 v45 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
705 v44 = v45 + 3840; |
0 | 706 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
707 else if (masteryLevel == 3 ) |
0 | 708 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
709 v45 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
710 v44 = v45 + 3840; |
0 | 711 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
712 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
713 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
714 v44 = 3600 * (realPoints + 64); |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
715 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
716 v5->pActorBuffs[16].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
717 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
718 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
719 realPoints + 5, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
720 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
721 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
722 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
723 v46 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
724 LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
725 v99 = v46; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
726 v98 = (SoundID)13040; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
727 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
728 return; |
0 | 729 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
730 |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
731 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
732 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
733 LOWORD(v48) = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
734 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
735 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 736 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
737 v48 = 2 * realPoints + 40; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
738 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
739 else if (masteryLevel == 3 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
740 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
741 v48 = 3 * realPoints + 60; |
0 | 742 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
743 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
744 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
745 LOWORD(v48) = 2 * (3 * realPoints + 60); |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
746 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
747 v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0); |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
748 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
749 v50 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
750 LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
751 v99 = v50; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
752 v98 = (SoundID)14020; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
753 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
754 return; |
0 | 755 } |
1519 | 756 if ( uSpellID <= 80 ) |
0 | 757 { |
1519 | 758 if ( uSpellID == 80 ) |
0 | 759 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
760 for (int i = 0; i < 20; i++ ) |
0 | 761 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
762 pParty->pPartyBuffs[i].Reset(); |
0 | 763 } |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
764 for (int i = 1; i <= 4; i++) |
0 | 765 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
766 v57 = pPlayers[i]; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
767 v58 = (v57)->GetActualWillpower(); |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
768 v59 = (v57)->GetParameterBonus(v58); |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
769 v60 = (v57)->GetActualIntelligence(); |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
770 v61 = ((v57)->GetParameterBonus(v60) + v59) >> 1; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
771 v62 = (v57)->GetActualLuck(); |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
772 v63 = v61 + (v57)->GetParameterBonus(v62) + 30; |
0 | 773 if ( rand() % v63 < 30 ) |
774 { | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
775 for (int k = 0; k < v57->pPlayerBuffs.size(); k++) |
0 | 776 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
777 v57->pPlayerBuffs[k].Reset(); |
0 | 778 } |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
779 pOtherOverlayList->_4418B1(11210, i + 99, 0, 65536); |
0 | 780 } |
781 } | |
782 v65 = 8 * LODWORD(v120); | |
862 | 783 LOBYTE(v65) = PID(OBJECT_Actor,LOBYTE(v120)); |
0 | 784 v99 = v65; |
785 v22 = (SoundID)word_4EE088_sound_ids[80]; | |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
786 v98 = v22; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
787 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
788 return; |
0 | 789 } |
1519 | 790 if ( uSpellID != 51 ) |
0 | 791 { |
1519 | 792 if ( uSpellID == 73 ) |
0 | 793 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
794 if ( (signed int)masteryLevel <= 0 || (signed int)masteryLevel > 4 ) |
0 | 795 v51 = 0; |
796 else | |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
797 v51 = 3600 * realPoints; |
0 | 798 v5->pActorBuffs[21].Apply( |
799 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335), | |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
800 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
801 realPoints, |
0 | 802 0, |
803 0); | |
804 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u); | |
805 v52 = 8 * LODWORD(v120); | |
862 | 806 LOBYTE(v52) = PID(OBJECT_Actor,LOBYTE(v120)); |
0 | 807 v99 = v52; |
808 v98 = (SoundID)16060; | |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
809 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
810 return; |
0 | 811 } |
1519 | 812 if ( uSpellID == 77 ) |
0 | 813 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
814 v5->sCurrentHP += 5 * realPoints + 10; |
0 | 815 if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP ) |
816 v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP); | |
817 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u); | |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
818 v50 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
819 LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
820 v99 = v50; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
821 v98 = (SoundID)14020; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
822 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
823 return; |
0 | 824 } |
1855
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
825 return; |
0 | 826 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
827 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
828 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
829 v54 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
830 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
831 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 832 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
833 v53 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
834 v54 = v53 + 3840; |
0 | 835 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
836 else if (masteryLevel == 3 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
837 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
838 v53 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
839 v54 = v53 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
840 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
841 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
842 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
843 v53 = 1200 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
844 v54 = v53 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
845 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
846 v5->pActorBuffs[18].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
847 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
848 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
849 realPoints + 5, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
850 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
851 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
852 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
853 v55 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
854 LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
855 v99 = v55; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
856 v98 = (SoundID)14060; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
857 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
858 return; |
0 | 859 } |
1519 | 860 if ( uSpellID == 85 ) |
0 | 861 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
862 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
863 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
864 LOWORD(realPoints) = uSkillLevel; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
865 v96 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
866 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
867 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 868 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
869 v96 = 300 * realPoints + 3840; |
0 | 870 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
871 else if (masteryLevel == 3 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
872 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
873 LOWORD(realPoints) = 3 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
874 v96 = 900 * (uSkillLevel & 0x3F) + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
875 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
876 else if (masteryLevel == 4 ) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
877 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
878 v96 = 1200 * realPoints + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
879 LOWORD(realPoints) = 4 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
880 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
881 v5->pActorBuffs[13].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
882 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
883 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
884 realPoints, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
885 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
886 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
887 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
888 v97 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
889 LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
890 v99 = v97; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
891 v98 = (SoundID)17070; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
892 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
893 return; |
0 | 894 } |
1519 | 895 if ( uSpellID == 86 ) |
0 | 896 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
897 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
898 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
899 v94 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
900 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
901 else if (masteryLevel == 1 || masteryLevel == 2) |
0 | 902 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
903 v93 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
904 v94 = v93 + 3840; |
0 | 905 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
906 else if (masteryLevel == 3) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
907 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
908 v93 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
909 v94 = v93 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
910 } |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
911 else // if (v7 == 4) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
912 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
913 v93 = 1200 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
914 v94 = v93 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
915 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
916 v5->pActorBuffs[14].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
917 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
918 masteryLevel, |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
919 realPoints + 5, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
920 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
921 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
922 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
923 v95 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
924 LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
925 v99 = v95; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
926 v98 = (SoundID)17080; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
927 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
928 return; |
0 | 929 } |
1519 | 930 if ( uSpellID != 93 ) |
0 | 931 { |
1519 | 932 if ( uSpellID != 95 ) |
0 | 933 { |
1855
51e9b4621d0a
Actor::AI_SpellAttack preparing to remove label 159
Grumpy7
parents:
1853
diff
changeset
|
934 return; |
0 | 935 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
936 if (masteryLevel == 0) |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
937 v68 = 0; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
938 else if (masteryLevel == 1 || (masteryLevel == 2) || (masteryLevel == 3)) |
0 | 939 { |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
940 v67 = 900 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
941 v68 = v67 + 3840; |
0 | 942 } |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
943 else |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
944 { |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
945 v67 = 300 * realPoints; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
946 v68 = v67 + 3840; |
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
947 } |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
948 v5->pActorBuffs[20].Apply( |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
949 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335), |
1852
979380004db2
Actor::AI_SpellAttack, extracting common code from different mastery levels
Grumpy7
parents:
1851
diff
changeset
|
950 masteryLevel, |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
951 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
952 0, |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
953 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
954 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
955 v69 = 8 * LODWORD(v120); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
956 LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120)); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
957 v99 = v69; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
958 v98 = (SoundID)18060; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
959 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
960 return; |
0 | 961 } |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
962 |
0 | 963 v70 = 3; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
964 if (masteryLevel == 2) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
965 v108 = 5; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
966 else if (masteryLevel == 3) |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
967 v108 = 7; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
968 else if (masteryLevel == 4) |
0 | 969 v108 = 9; |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
970 |
0 | 971 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
924 | 972 a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType; |
0 | 973 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1); |
974 v71 = 0; | |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
975 for (int i = 0; i < pObjectList->uNumObjects; i++) |
0 | 976 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
977 if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType) |
0 | 978 { |
1853
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
979 v71 = i; |
4ae5b7e7a920
Actor::AI_SpellAttack unnesting ifs, simplifying cycles
Grumpy7
parents:
1852
diff
changeset
|
980 break; |
0 | 981 } |
982 } | |
983 a1.uObjectDescID = v71; | |
984 a1.stru_24.Reset(); | |
822 | 985 a1.spell_id = SPELL_DARK_SHARPMETAL; |
0 | 986 v73 = v5->vPosition.x; |
987 v74 = v5->vPosition.y; | |
822 | 988 a1.spell_level = uSkillLevel; |
0 | 989 a1.vPosition.x = v73; |
990 v75 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); | |
991 v76 = v117; | |
992 v77 = LOWORD(v117->uYawAngle); | |
822 | 993 a1.spell_skill = 0; |
0 | 994 a1.vPosition.y = v74; |
995 a1.vPosition.z = v75; | |
996 a1.uFacing = v77; | |
997 a1.uSoundID = 0; | |
998 a1.uAttributes = 0; | |
999 a1.uSectorID = pIndoor->GetSector(v73, v74, v75); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1000 a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); |
0 | 1001 a1.uSpriteFrameID = 0; |
823 | 1002 a1.spell_target_pid = 0; |
0 | 1003 a1.field_60_distance_related_prolly_lod = 3; |
1004 a1c = spellnume / -2; | |
1005 if ( spellnume / -2 > spellnume / 2 ) | |
1006 { | |
1007 v80 = spellnume / -2; | |
1008 } | |
1009 else | |
1010 { | |
1011 do | |
1012 { | |
1013 v79 = v76->uYawAngle; | |
1014 a1.uFacing = a1c + LOWORD(v76->uYawAngle); | |
1015 v80 = a1.Create( | |
1016 v79, | |
1017 v76->uPitchAngle, | |
1018 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
1019 0); | |
1020 a1c += v116; | |
1021 } | |
1022 while ( a1c <= spellnume / 2 ); | |
1023 } | |
1024 if ( v80 != -1 ) | |
1025 { | |
1026 v81 = 8 * v80; | |
1027 LOBYTE(v81) = v81 | 2; | |
1028 v99 = v81; | |
1029 v22 = (SoundID)word_4EE088_sound_ids[93]; | |
1851
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
1030 v98 = v22; |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
1031 pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0); |
80e897fc2438
Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
Grumpy7
parents:
1850
diff
changeset
|
1032 return; |
0 | 1033 } |
1034 } | |
1035 | |
1036 //----- (0043ABB0) -------------------------------------------------------- | |
322 | 1037 bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2) |
0 | 1038 { |
1039 unsigned int v2; // esi@1 | |
1040 unsigned int v3; // edi@1 | |
1041 bool result; // eax@9 | |
1042 | |
1043 v2 = a1->uAlly; | |
1044 v3 = a2->uAlly; | |
1045 if ( !v2 ) | |
1046 v2 = (a1->pMonsterInfo.uID - 1) / 3 + 1; | |
1047 if ( !v3 ) | |
1048 v3 = (a2->pMonsterInfo.uID - 1) / 3 + 1; | |
1049 if ( (signed int)v2 >= 39 && (signed int)v2 <= 44 && (signed int)v3 >= 39 && (signed int)v3 <= 44 | |
1050 || (signed int)v2 >= 45 && (signed int)v2 <= 50 && (signed int)v3 >= 45 && (signed int)v3 <= 50 | |
1051 || (signed int)v2 >= 51 && (signed int)v2 <= 62 && (signed int)v3 >= 51 && (signed int)v3 <= 62 | |
1052 || (signed int)v2 >= 78 && (signed int)v2 <= 83 && (signed int)v3 >= 78 && (signed int)v3 <= 83 ) | |
1053 result = 1; | |
1054 else | |
1055 result = v2 == v3; | |
1056 return result; | |
1057 } | |
1058 | |
1059 //----- (0043AC45) -------------------------------------------------------- | |
322 | 1060 void Actor::AggroSurroundingPeasants(unsigned int uActorID, int a2) |
0 | 1061 { |
1062 int v4; // ebx@8 | |
1063 int v5; // ST1C_4@8 | |
1064 int v6; // eax@8 | |
1065 | |
1202 | 1066 auto victim = &pActors[uActorID]; |
0 | 1067 if ( a2 == 1 ) |
322 | 1068 BYTE2(victim->uAttributes) |= 8u; |
1069 | |
1070 for (uint i = 0; i < uNumActors; ++i) | |
0 | 1071 { |
1202 | 1072 auto actor = &pActors[i]; |
322 | 1073 if (!actor->CanAct() || i == uActorID) |
1074 continue; | |
1075 | |
1076 if (Actor::ArePeasantsOfSameFaction(victim, actor)) | |
0 | 1077 { |
322 | 1078 v4 = abs(actor->vPosition.x - victim->vPosition.x); |
1079 v5 = abs(actor->vPosition.y - victim->vPosition.y); | |
1080 v6 = abs(actor->vPosition.z - victim->vPosition.z); | |
1081 if (int_get_vector_length(v4, v5, v6) < 4096) | |
0 | 1082 { |
322 | 1083 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
1084 if ( a2 == 1 ) | |
1085 BYTE2(actor->uAttributes) |= 8u; | |
0 | 1086 } |
1087 } | |
1088 } | |
1089 } | |
1090 | |
1091 //----- (00404874) -------------------------------------------------------- | |
1060 | 1092 char __fastcall Actor::AI_RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4) |
0 | 1093 { |
1094 AIDirection *v4; // edi@1 | |
1095 Actor *v5; // esi@1 | |
1096 char result; // al@1 | |
1097 char *v7; // eax@15 | |
1098 unsigned __int16 v8; // ax@18 | |
1099 unsigned __int16 v9; // ax@19 | |
1100 __int16 v10; // ax@19 | |
1101 signed int v11; // ecx@19 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1102 //int v12; // eax@19 |
0 | 1103 int v13; // edx@28 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1104 //SpriteObject a1; // [sp+Ch] [bp-74h]@1 |
0 | 1105 unsigned int v15; // [sp+7Ch] [bp-4h]@1 |
1106 signed int v16; // [sp+88h] [bp+8h]@14 | |
1107 signed int v17; // [sp+88h] [bp+8h]@19 | |
1108 | |
1109 v15 = uActorID; | |
1110 v4 = a2; | |
1111 v5 = &pActors[uActorID]; | |
1112 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1113 SpriteObject a1; // [sp+Ch] [bp-74h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1114 //SpriteObject::SpriteObject(&a1); |
0 | 1115 |
1116 result = a3 - 1; | |
1117 switch ( a3 ) | |
1118 { | |
1119 case 1: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1120 a1.uType = 545; |
0 | 1121 goto LABEL_14; |
1122 case 2: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1123 a1.uType = 550; |
0 | 1124 goto LABEL_14; |
1125 case 3: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1126 a1.uType = 510; |
0 | 1127 goto LABEL_14; |
1128 case 4: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1129 a1.uType = 500; |
0 | 1130 goto LABEL_14; |
1131 case 5: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1132 a1.uType = 515; |
0 | 1133 goto LABEL_14; |
1134 case 6: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1135 a1.uType = 505; |
0 | 1136 goto LABEL_14; |
1137 case 7: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1138 a1.uType = 530; |
0 | 1139 goto LABEL_14; |
1140 case 8: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1141 a1.uType = 525; |
0 | 1142 goto LABEL_14; |
1143 case 9: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1144 a1.uType = 520; |
0 | 1145 goto LABEL_14; |
1146 case 10: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1147 a1.uType = 535; |
0 | 1148 goto LABEL_14; |
1149 case 11: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1150 a1.uType = 540; |
0 | 1151 goto LABEL_14; |
1152 case 13: | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1153 a1.uType = 555; |
0 | 1154 LABEL_14: |
1155 v16 = 0; | |
1156 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
1157 goto LABEL_18; | |
1158 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
1159 break; | |
1160 default: | |
1161 return result; | |
1162 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1163 while ( (short)a1.uType != *(short *)v7 ) |
0 | 1164 { |
1165 ++v16; | |
1166 v7 += 56; | |
1167 if ( v16 >= (signed int)pObjectList->uNumObjects ) | |
1168 { | |
1169 LABEL_18: | |
1170 v8 = 0; | |
1171 goto LABEL_19; | |
1172 } | |
1173 } | |
1174 v8 = v16; | |
1175 LABEL_19: | |
1176 a1.uObjectDescID = v8; | |
1177 a1.stru_24.Reset(); | |
1178 a1.vPosition.x = v5->vPosition.x; | |
822 | 1179 a1.spell_id = 0; |
0 | 1180 a1.vPosition.y = v5->vPosition.y; |
822 | 1181 a1.spell_level = 0; |
0 | 1182 v17 = v5->uActorHeight; |
822 | 1183 a1.spell_skill = 0; |
0 | 1184 v9 = LOWORD(v4->uYawAngle); |
1185 a1.vPosition.z = v5->vPosition.z - (unsigned int)(signed __int64)((double)v17 * -0.75); | |
1186 a1.uFacing = v9; | |
1187 a1.uSoundID = 0; | |
1188 a1.uAttributes = 0; | |
1189 v10 = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
1190 v11 = v4->uDistance; | |
1191 a1.uSectorID = v10; | |
1192 a1.uSpriteFrameID = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1193 a1.spell_caster_pid = PID(OBJECT_Actor, v15); |
823 | 1194 a1.spell_target_pid = 0; |
0 | 1195 if ( (double)v11 >= 307.2 ) |
1196 { | |
1197 if ( v11 >= 1024 ) | |
1198 { | |
1199 a1.field_60_distance_related_prolly_lod = 2; | |
1200 if ( v11 >= 2560 ) | |
1201 a1.field_60_distance_related_prolly_lod = 3; | |
1202 } | |
1203 else | |
1204 { | |
1205 a1.field_60_distance_related_prolly_lod = 1; | |
1206 } | |
1207 } | |
1208 else | |
1209 { | |
1210 a1.field_60_distance_related_prolly_lod = 0; | |
1211 } | |
1212 a1.field_61 = a4; | |
1213 result = a1.Create( | |
1214 v4->uYawAngle, | |
1215 v4->uPitchAngle, | |
1216 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
1217 0); | |
1218 if ( v5->pMonsterInfo.uSpecialAbilityType == 1 ) | |
1219 { | |
1220 result = v5->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | |
1221 if ( result == 2 ) | |
1222 { | |
1223 a1.vPosition.z += 40; | |
1224 v13 = v4->uYawAngle; | |
1225 } | |
1226 else | |
1227 { | |
1228 if ( result != 3 ) | |
1229 return result; | |
1230 a1.Create( | |
1231 v4->uYawAngle + 30, | |
1232 v4->uPitchAngle, | |
1233 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
1234 0); | |
1235 v13 = v4->uYawAngle - 30; | |
1236 } | |
1237 result = a1.Create( | |
1238 v13, | |
1239 v4->uPitchAngle, | |
1240 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
1241 0); | |
1242 } | |
1243 return result; | |
1244 } | |
1245 | |
1246 //----- (00404736) -------------------------------------------------------- | |
1247 signed int __fastcall Actor::Explode(unsigned int uActorID) | |
1248 { | |
1249 Actor *v1; // esi@1 | |
1250 signed int v2; // edx@1 | |
1251 char *v3; // ecx@2 | |
1252 unsigned __int16 v4; // ax@5 | |
1253 int v5; // ebx@6 | |
1254 int v6; // ecx@6 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1255 //int v7; // eax@6 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1256 SpriteObject a1; // [sp+Ch] [bp-78h]@1 |
0 | 1257 unsigned int v10; // [sp+7Ch] [bp-8h]@1 |
1258 int v11; // [sp+80h] [bp-4h]@6 | |
1259 | |
1260 v10 = uActorID; | |
1261 v1 = &pActors[uActorID]; | |
1262 v2 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1263 a1.uType = 600; |
0 | 1264 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1265 { | |
1266 LABEL_5: | |
1267 v4 = 0; | |
1268 } | |
1269 else | |
1270 { | |
1271 v3 = (char *)&pObjectList->pObjects->uObjectID; | |
1272 while ( *(short *)v3 != 600 ) | |
1273 { | |
1274 ++v2; | |
1275 v3 += 56; | |
1276 if ( v2 >= (signed int)pObjectList->uNumObjects ) | |
1277 goto LABEL_5; | |
1278 } | |
1279 v4 = v2; | |
1280 } | |
1281 a1.uObjectDescID = v4; | |
1282 a1.stru_24.Reset(); | |
1283 a1.vPosition.y = v1->vPosition.y; | |
822 | 1284 a1.spell_id = 0; |
0 | 1285 v5 = v1->vPosition.x; |
1286 v11 = v1->uActorHeight; | |
822 | 1287 a1.spell_level = 0; |
1288 a1.spell_skill = 0; | |
0 | 1289 a1.vPosition.x = v5; |
1290 v6 = v1->vPosition.z - (unsigned int)(signed __int64)((double)v11 * -0.75); | |
1291 a1.uFacing = 0; | |
1292 a1.vPosition.z = v6; | |
1293 a1.uSoundID = 0; | |
1294 a1.uAttributes = 0; | |
1295 a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6); | |
1296 a1.uSpriteFrameID = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1297 a1.spell_caster_pid = PID(OBJECT_Actor, v10); |
823 | 1298 a1.spell_target_pid = 0; |
0 | 1299 a1.field_60_distance_related_prolly_lod = 3; |
1300 a1.field_61 = 4; | |
1301 return a1.Create(0, 0, 0, 0); | |
1302 } | |
1303 | |
1304 //----- (004040E9) -------------------------------------------------------- | |
1305 // // Get direction vector from object1 to object2, | |
1306 // // distance from object1 to object2 and Euler angles of the direction vector | |
1307 // // | |
1308 // // | |
1309 // // object1 & object2 format : objectType | (objectID << 3) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
488
diff
changeset
|
1310 // // objectType == 2 - SpriteObject |
0 | 1311 // // objectType == 3 - Actor |
1312 // // objectType == 4 - Party | |
1313 // // objectType == 5 - Decoration | |
1314 // // | |
1315 // // originally this function had following prototype: | |
1316 // // struct DirectionInfo GetDirectionInfo(signed int object1, signed int object2, signed int a4) | |
1317 // // but compiler converts functions returning structures by value in the such way | |
1318 AIDirection *__fastcall Actor::GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, AIDirection *pOut, int a4) | |
1319 { | |
1320 signed int v4; // eax@1 | |
1336 | 1321 signed int v5; // ecx@1 |
1322 //unsigned int v6; // ebx@1 | |
0 | 1323 int v7; // ecx@2 |
1324 int v8; // ecx@3 | |
1325 int v9; // ecx@4 | |
1336 | 1326 //BLVFace *v10; // eax@8 |
1327 //unsigned int v11; // ecx@8 | |
1328 //signed int v12; // eax@9 | |
1329 //int v13; // ecx@9 | |
1330 //int v14; // eax@9 | |
0 | 1331 int v15; // eax@11 |
1332 int v16; // eax@12 | |
1333 int v17; // eax@13 | |
1334 int v18; // edx@15 | |
1336 | 1335 //signed int v19; // eax@25 |
1336 //signed int v20; // eax@28 | |
1337 //int v21; // ebx@28 | |
1338 //signed int v22; // eax@28 | |
1339 //BLVFace *v23; // eax@35 | |
1340 //int v24; // edx@35 | |
1341 //unsigned int v25; // ecx@35 | |
1342 //signed int v26; // eax@36 | |
1343 //int v27; // ecx@36 | |
1344 //int v28; // eax@36 | |
1345 //int v29; // eax@37 | |
1346 //signed int v30; // eax@42 | |
0 | 1347 double v31; // st7@45 |
1348 double v32; // st6@45 | |
1349 double v33; // st7@45 | |
1350 AIDirection *result; // eax@48 | |
1336 | 1351 //int v35; // [sp-18h] [bp-64h]@17 |
1352 //int v36; // [sp-14h] [bp-60h]@17 | |
0 | 1353 Vec3_int_ v37; // [sp-10h] [bp-5Ch]@15 |
1336 | 1354 //int *v38; // [sp-4h] [bp-50h]@15 |
1355 //int *v39; // [sp+0h] [bp-4Ch]@15 | |
1356 //int *v40; // [sp+4h] [bp-48h]@15 | |
0 | 1357 AIDirection v41; // [sp+14h] [bp-38h]@46 |
1358 float v42; // [sp+30h] [bp-1Ch]@23 | |
1359 float v43; // [sp+34h] [bp-18h]@45 | |
1336 | 1360 float outy2; // [sp+38h] [bp-14h]@33 |
1361 float outx2; // [sp+3Ch] [bp-10h]@33 | |
0 | 1362 int outz; // [sp+40h] [bp-Ch]@6 |
1363 int outy; // [sp+44h] [bp-8h]@6 | |
1364 int outx; // [sp+48h] [bp-4h]@6 | |
1365 float a4a; // [sp+58h] [bp+Ch]@45 | |
1366 | |
848 | 1367 v4 = PID_ID(uObj1ID); |
1336 | 1368 //v6 = uObj2ID; |
1369 v5 = PID_ID(uObj2ID); | |
1370 switch( PID_TYPE(uObj1ID) ) | |
0 | 1371 { |
1336 | 1372 case OBJECT_Item: |
1373 { | |
1374 outx = pSpriteObjects[v4].vPosition.x; | |
1375 outy = pSpriteObjects[v4].vPosition.y; | |
1376 outz = pSpriteObjects[v4].vPosition.z; | |
1377 break; | |
1378 } | |
1379 case OBJECT_Actor: | |
1380 { | |
1381 outx = pActors[v4].vPosition.x; | |
1382 outy = pActors[v4].vPosition.y; | |
1383 outz = pActors[v4].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v4].uActorHeight * -0.75); | |
1384 break; | |
1385 } | |
1386 case OBJECT_Player: | |
1387 { | |
1388 if ( !v4 ) | |
1389 { | |
1390 outx = pParty->vPosition.x; | |
1391 outy = pParty->vPosition.y; | |
1392 outz = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1393 break; | |
1394 } | |
1395 if ( v4 == 4 ) | |
1396 { | |
1397 v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; | |
1398 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1399 *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; | |
1400 Vec3_int_::Rotate(24, v18, 0, v37, &outx, &outy, &outz); | |
1401 break; | |
1402 } | |
1403 if ( v4 == 3 ) | |
1404 { | |
1405 v18 = pParty->sRotationY - stru_5C6E00->uIntegerHalfPi; | |
1406 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1407 *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; | |
1408 Vec3_int_::Rotate(8, v18, 0, v37, &outx, &outy, &outz); | |
1409 break; | |
1410 } | |
1411 if ( v4 == 2 ) | |
1412 { | |
1413 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1414 v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; | |
1415 *(_QWORD *)&v37.x = *(_QWORD *)&pParty->vPosition.x; | |
1416 Vec3_int_::Rotate(8, v18, 0, v37, &outx, &outy, &outz); | |
1417 break; | |
1418 } | |
1419 if ( v4 == 1 ) | |
1420 { | |
1421 v37.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
1422 v18 = stru_5C6E00->uIntegerHalfPi + pParty->sRotationY; | |
1423 *(_QWORD *)&v37 = *(_QWORD *)&pParty->vPosition.x; | |
1424 Vec3_int_::Rotate(24, v18, 0, v37, &outx, &outy, &outz); | |
1425 break; | |
1426 } | |
1427 } | |
1428 case OBJECT_Decoration: | |
1429 { | |
1430 outx = pLevelDecorations[v4].vPosition.x; | |
1431 outy = pLevelDecorations[v4].vPosition.y; | |
1432 outz = pLevelDecorations[v4].vPosition.z; | |
1433 break; | |
1434 } | |
1435 default: | |
1436 { | |
1437 outz = 0; | |
1438 outy = 0; | |
1439 outx = 0; | |
1440 break; | |
1441 } | |
1442 case OBJECT_BModel: | |
1443 { | |
1444 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1445 { | |
1446 outx = (pIndoor->pFaces[v4].pBounding.x1 + pIndoor->pFaces[v4].pBounding.x2) >> 1; | |
1447 outy = (pIndoor->pFaces[v4].pBounding.y1 + pIndoor->pFaces[v4].pBounding.y2) >> 1; | |
1448 outz = (pIndoor->pFaces[v4].pBounding.z1 + pIndoor->pFaces[v4].pBounding.z2) >> 1; | |
1449 } | |
1450 break; | |
1451 } | |
862 | 1452 } |
1336 | 1453 |
1454 switch( PID_TYPE(uObj2ID) ) | |
862 | 1455 { |
1336 | 1456 case OBJECT_Item: |
1457 { | |
1458 outx2 = pSpriteObjects[v5].vPosition.x; | |
1459 outy2 = pSpriteObjects[v5].vPosition.y; | |
1460 a4 = pSpriteObjects[v5].vPosition.z; | |
1461 break; | |
1462 } | |
1463 case OBJECT_Actor: | |
1464 { | |
1465 outx2 = pActors[v5].vPosition.x; | |
1466 outy2 = pActors[v5].vPosition.y; | |
1467 a4 = pActors[v5].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v5].uActorHeight * -0.75); | |
1468 break; | |
1469 } | |
1470 case OBJECT_Player: | |
1471 { | |
1472 outx2 = pParty->vPosition.x; | |
1473 outy2 = pParty->vPosition.y; | |
1474 if ( !a4 ) | |
1475 a4 = pParty->sEyelevel; | |
1476 a4 = pParty->vPosition.z + a4; | |
1477 break; | |
1478 } | |
1479 case OBJECT_Decoration: | |
1480 { | |
1481 outx2 = pLevelDecorations[v5].vPosition.x; | |
1482 outy2 = pLevelDecorations[v5].vPosition.y; | |
1483 a4 = pLevelDecorations[v5].vPosition.z; | |
1484 break; | |
1485 } | |
1486 default: | |
1487 { | |
1488 outx2 = 0.0; | |
1489 outy2 = 0.0; | |
1490 a4 = 0; | |
1491 break; | |
1492 } | |
1493 case OBJECT_BModel: | |
1494 { | |
1495 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1496 { | |
1497 outx2 = (pIndoor->pFaces[v5].pBounding.x1 + pIndoor->pFaces[v5].pBounding.x2) >> 1; | |
1498 outy2 = (pIndoor->pFaces[v5].pBounding.y1 + pIndoor->pFaces[v5].pBounding.y2) >> 1; | |
1499 a4 = (pIndoor->pFaces[v5].pBounding.z1 + pIndoor->pFaces[v5].pBounding.z2) >> 1; | |
1500 } | |
1501 break; | |
1502 } | |
0 | 1503 } |
862 | 1504 |
1336 | 1505 v31 = (double)outx2 - (double)outx; |
0 | 1506 v42 = v31; |
1336 | 1507 v32 = (double)outy2 - (double)outy; |
0 | 1508 v43 = v32; |
1509 a4a = (double)a4 - (double)outz; | |
1336 | 1510 outx2 = v32 * v32; |
1511 outy2 = v31 * v31; | |
1512 v33 = sqrt(a4a * a4a + outy2 + outx2); | |
0 | 1513 if ( v33 <= 1.0 ) |
1514 { | |
1515 v41.vDirection.x = 65536; | |
1516 v41.vDirection.y = 0; | |
1517 v41.vDirection.z = 0; | |
1518 v41.uDistance = 1; | |
1519 v41.uDistanceXZ = 1; | |
1520 v41.uYawAngle = 0; | |
1521 v41.uPitchAngle = 0; | |
1522 } | |
1523 else | |
1524 { | |
1525 v41.vDirection.x = (signed __int64)(1.0 / v33 * v42 * 65536.0); | |
1526 v41.vDirection.y = (signed __int64)(1.0 / v33 * v43 * 65536.0); | |
1527 v41.vDirection.z = (signed __int64)(1.0 / v33 * a4a * 65536.0); | |
1528 v41.uDistance = (signed __int64)v33; | |
1545 | 1529 v41.uDistanceXZ = sqrt(outy2 + outx2); |
0 | 1530 v41.uYawAngle = stru_5C6E00->Atan2((signed __int64)v42, (signed __int64)v43); |
1531 v41.uPitchAngle = stru_5C6E00->Atan2(v41.uDistanceXZ, (signed __int64)a4a); | |
1532 } | |
1533 result = pOut; | |
1336 | 1534 memcpy(pOut, &v41, sizeof(AIDirection)); |
0 | 1535 return result; |
1536 } | |
1537 | |
1538 //----- (00404030) -------------------------------------------------------- | |
1060 | 1539 void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) |
0 | 1540 { |
1541 unsigned int v4; // edi@1 | |
1542 unsigned int v5; // esi@1 | |
322 | 1543 //unsigned int result; // eax@2 |
0 | 1544 AIDirection *v7; // eax@3 |
1545 unsigned int v8; // ecx@3 | |
1546 Actor *v9; // ebx@3 | |
1547 AIDirection *v10; // esi@4 | |
1548 unsigned __int16 v11; // ax@5 | |
1549 AIDirection a3; // [sp+8h] [bp-38h]@4 | |
1550 AIDirection v13; // [sp+24h] [bp-1Ch]@4 | |
1551 | |
1552 v4 = uObjID; | |
1553 v5 = uActorID; | |
1554 if ( rand() % 100 >= 5 ) | |
1555 { | |
1556 v7 = a4; | |
1557 v8 = 0; | |
1558 v9 = &pActors[v5]; | |
1559 if ( !a4 ) | |
1560 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1561 v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v5), v4, &a3, 0); |
0 | 1562 v7 = &v13; |
1563 memcpy(&v13, v10, sizeof(v13)); | |
1564 v8 = 0; | |
1565 } | |
1566 v9->uYawAngle = LOWORD(v7->uYawAngle); | |
1567 v11 = LOWORD(v7->uPitchAngle); | |
1568 v9->uCurrentActionTime = v8; | |
1569 v9->vVelocity.z = v8; | |
1570 v9->vVelocity.y = v8; | |
1571 v9->vVelocity.x = v8; | |
1572 v9->uPitchAngle = v11; | |
1573 v9->uCurrentActionLength = 256; | |
1574 v9->uAIState = Interacting; | |
322 | 1575 v9->UpdateAnimation(); |
0 | 1576 } |
1577 else | |
414 | 1578 Actor::AI_Bored(v5, v4, a4); |
0 | 1579 } |
1580 | |
1581 //----- (00403F58) -------------------------------------------------------- | |
414 | 1582 void Actor::AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4) |
0 | 1583 { |
413 | 1584 if (rand() % 2) |
414 | 1585 AI_Bored(uActorID, uObjID, a4); |
413 | 1586 else |
414 | 1587 AI_Stand(uActorID, uObjID, uActionLength, a4); |
0 | 1588 } |
1589 | |
1590 //----- (00403EB6) -------------------------------------------------------- | |
413 | 1591 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) |
0 | 1592 { |
413 | 1593 assert(uActorID < uNumActors); |
1202 | 1594 auto actor = &pActors[uActorID]; |
413 | 1595 |
1596 AIDirection a3; | |
1597 if (!a4) | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
1598 a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), object_to_face_pid, &a3, 0); |
0 | 1599 |
413 | 1600 actor->uAIState = Standing; |
1601 if (!uActionLength) | |
1602 actor->uCurrentActionLength = rand() % 256 + 256; | |
0 | 1603 else |
413 | 1604 actor->uCurrentActionLength = uActionLength; |
1605 actor->uCurrentActionTime = 0; | |
1606 actor->uYawAngle = a4->uYawAngle; | |
1607 actor->uPitchAngle = a4->uPitchAngle; | |
1608 actor->vVelocity.z = 0; | |
1609 actor->vVelocity.y = 0; | |
1610 actor->vVelocity.x = 0; | |
1611 actor->UpdateAnimation(); | |
0 | 1612 } |
1613 | |
1614 //----- (00403E61) -------------------------------------------------------- | |
1615 void __fastcall Actor::StandAwhile(unsigned int uActorID) | |
1616 { | |
1763 | 1617 pActors[uActorID].uCurrentActionLength = rand() % 128 + 128; |
1618 pActors[uActorID].uCurrentActionTime = 0; | |
1619 pActors[uActorID].uAIState = Standing; | |
1620 pActors[uActorID].vVelocity.z = 0; | |
1621 pActors[uActorID].vVelocity.y = 0; | |
1622 pActors[uActorID].vVelocity.x = 0; | |
1623 pActors[uActorID].UpdateAnimation(); | |
0 | 1624 } |
1625 | |
1626 //----- (00403C6C) -------------------------------------------------------- | |
1060 | 1627 void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0) |
0 | 1628 { |
1629 Actor *v3; // ebx@1 | |
1630 char v4; // zf@1 | |
322 | 1631 //unsigned int result; // eax@3 |
0 | 1632 AIDirection *v6; // esi@6 |
1633 AIDirection *v7; // edi@6 | |
1634 signed int v8; // eax@7 | |
1635 double v9; // st7@9 | |
1636 Vec3_int_ v10; // ST04_12@9 | |
322 | 1637 //int v11; // eax@10 |
0 | 1638 AIDirection *v12; // eax@11 |
1639 unsigned int v13; // esi@11 | |
1640 AIDirection *v14; // esi@12 | |
1641 SpriteFrame *v15; // ecx@13 | |
1642 __int16 v16; // ax@13 | |
1643 unsigned int v17; // ecx@13 | |
1644 signed __int64 v18; // qax@13 | |
1645 AIDirection a3; // [sp+Ch] [bp-48h]@12 | |
1646 AIDirection v20; // [sp+28h] [bp-2Ch]@12 | |
1647 unsigned int v21; // [sp+44h] [bp-10h]@9 | |
848 | 1648 //signed int a2; // [sp+48h] [bp-Ch]@1 |
0 | 1649 int v23; // [sp+4Ch] [bp-8h]@6 |
1650 unsigned int v24; // [sp+50h] [bp-4h]@1 | |
1651 unsigned int v25; // [sp+5Ch] [bp+8h]@13 | |
1652 | |
1653 v3 = &pActors[uActorID]; | |
848 | 1654 //a2 = edx0; |
1456 | 1655 v4 = v3->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY; |
0 | 1656 v24 = uActorID; |
1657 if ( v4 && v3->pMonsterInfo.uAIType == 1 ) | |
1658 { | |
848 | 1659 Actor::AI_Stand(uActorID, sTargetPid, 0, arg0); |
322 | 1660 return; |
0 | 1661 } |
322 | 1662 |
848 | 1663 if ( PID_TYPE(sTargetPid) == OBJECT_Actor) |
849 | 1664 { |
1665 v8 = PID_ID(sTargetPid); | |
1666 v6 = (AIDirection *)pActors[v8].vPosition.x; | |
1667 v7 = (AIDirection *)pActors[v8].vPosition.y; | |
1668 v23 = (signed __int64)((double)pActors[v8].uActorHeight * 0.75 + (double)pActors[v8].vPosition.z); | |
1669 } | |
1670 else if ( PID_TYPE(sTargetPid) == OBJECT_Player) | |
1671 { | |
1672 v6 = (AIDirection *)pParty->vPosition.x; | |
1673 v7 = (AIDirection *)pParty->vPosition.y; | |
1674 v23 = pParty->vPosition.z + pParty->sEyelevel; | |
1675 } | |
1676 else | |
1677 { | |
1678 v6 = arg0; | |
1679 v7 = arg0; | |
1680 } | |
1681 v21 = v3->uActorHeight; | |
1682 v9 = (double)(signed int)v21 * 0.75; | |
1683 v21 = v3->vPosition.z; | |
1684 v10.z = (signed __int64)(v9 + (double)(signed int)v21); | |
1685 v10.y = v3->vPosition.y; | |
1686 v10.x = v3->vPosition.x; | |
1687 if ( sub_407A1C((int)v6, (int)v7, v23, v10) ) | |
1688 { | |
1689 v12 = arg0; | |
1690 v13 = 0; | |
1691 if ( !arg0 ) | |
0 | 1692 { |
849 | 1693 v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), sTargetPid, &a3, 0); |
0 | 1694 v12 = &v20; |
1695 memcpy(&v20, v14, sizeof(v20)); | |
1696 v13 = 0; | |
849 | 1697 } |
1698 v15 = pSpriteFrameTable->pSpriteSFrames; | |
1699 v3->uYawAngle = LOWORD(v12->uYawAngle); | |
1700 v16 = v15[v3->pSpriteIDs[ANIM_AtkMelee]].uAnimLength; | |
1701 v17 = v24; | |
1702 v3->uCurrentActionLength = 8 * v16; | |
1703 v3->uCurrentActionTime = v13; | |
1704 v3->uAIState = AttackingMelee; | |
1705 Actor::PlaySound(v17, 0); | |
1706 LODWORD(v18) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
1707 v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
1708 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v13 | |
1709 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v13 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v13) ) | |
1710 { | |
1711 LODWORD(v18) = 2 * v18; | |
0 | 1712 v25 = v18; |
849 | 1713 } |
1714 if ( pParty->bTurnBasedModeOn != 1 ) | |
0 | 1715 v18 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)v25 * 2.133333333333333); |
849 | 1716 v3->pMonsterInfo.uRecoveryTime = v18; |
1717 v3->vVelocity.z = v13; | |
1718 v3->vVelocity.y = v13; | |
1719 v3->vVelocity.x = v13; | |
1720 v3->UpdateAnimation(); | |
1721 } | |
1722 else | |
1060 | 1723 Actor::AI_Pursue1(v24, sTargetPid, rand() % 2, 64, arg0); |
0 | 1724 } |
1725 | |
1726 //----- (00438CF3) -------------------------------------------------------- | |
322 | 1727 void Actor::ApplyFineForKillingPeasant(unsigned int uActorID) |
0 | 1728 { |
1729 unsigned int v1; // esi@1 | |
1730 unsigned int v2; // edi@2 | |
1731 char v3; // bl@3 | |
322 | 1732 //char *v4; // ecx@16 |
1733 //signed int v5; // eax@18 | |
0 | 1734 Player **ppPlayers; // esi@20 |
1735 | |
1736 v1 = uLevelMapStatsID; | |
322 | 1737 if ( !uLevelMapStatsID || !pActors[uActorID].IsPeasant()) |
0 | 1738 return; |
322 | 1739 |
1740 v2 = uActorID; | |
0 | 1741 v3 = 1; |
1742 if ( v1 != 5 ) | |
1743 { | |
1744 if ( v1 == 6 || v1 == 7 ) | |
1745 { | |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1746 pParty->IsPartyGood(); //the binary file contains this call. if someone finds out whether it's supposed to be here or not, feel free to apply the appropriate change |
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1747 if ( pParty->IsPartyEvil() ) |
0 | 1748 return; |
1749 goto LABEL_12; | |
1750 } | |
1751 if ( v1 != 8 ) | |
1752 goto LABEL_12; | |
1753 } | |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1754 if ( pParty->IsPartyGood() ) |
0 | 1755 v3 = 0; |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
1756 if ( pParty->IsPartyEvil() ) |
0 | 1757 v3 = 1; |
1758 if ( v3 ) | |
1759 { | |
1760 LABEL_12: | |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1817
diff
changeset
|
1761 pParty->uFine += 100 * (pMapStats->pInfos[uLevelMapStatsID]._steal_perm + pActors[v2].pMonsterInfo.uLevel + pParty->GetPartyReputation()); |
0 | 1762 if ( pParty->uFine < 0 ) |
1763 pParty->uFine = 0; | |
1764 if ( pParty->uFine > 4000000 ) | |
1765 pParty->uFine = 4000000; | |
322 | 1766 |
1767 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1768 { | |
1769 if (pOutdoor->ddm.uReputation < 10000) | |
1770 pOutdoor->ddm.uReputation++; | |
1771 } | |
1772 else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1773 { | |
1774 if (pIndoor->dlv.uReputation < 10000) | |
1775 pIndoor->dlv.uReputation++; | |
1776 } | |
1777 else assert(false); | |
1778 | |
0 | 1779 ppPlayers = &pPlayers[1]; |
1780 do | |
1781 { | |
1782 if ( pParty->uFine ) | |
1783 { | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1456
diff
changeset
|
1784 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)(*ppPlayers)->_achieved_awards_bits, 1) ) |
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1456
diff
changeset
|
1785 _449B7E_toggle_bit((unsigned char *)(*ppPlayers)->_achieved_awards_bits, 1, 1u); |
0 | 1786 } |
1787 ++ppPlayers; | |
1788 } | |
1789 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); | |
1790 } | |
1791 } | |
1792 | |
1793 //----- (0043AE80) -------------------------------------------------------- | |
322 | 1794 void Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) |
0 | 1795 { |
1796 int result; // eax@1 | |
1797 unsigned int v4; // esi@1 | |
1798 int v5; // [sp-14h] [bp-18h]@3 | |
1799 unsigned int v6; // [sp-10h] [bp-14h]@3 | |
1800 int v7; // [sp-Ch] [bp-10h]@3 | |
1801 int v8; // [sp-8h] [bp-Ch]@3 | |
1802 __int16 v9; // [sp-4h] [bp-8h]@3 | |
1803 | |
1804 result = a2 - 1; | |
862 | 1805 v4 = PID(OBJECT_Actor,uActorID); |
0 | 1806 switch ( a2 ) |
1807 { | |
1808 case 1: | |
1809 if ( a3 ) | |
1810 { | |
1811 v9 = 0; | |
1812 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); | |
1813 v7 = 0; | |
1814 LOWORD(v6) = v4; | |
1815 v5 = 904; | |
1816 goto LABEL_16; | |
1817 } | |
322 | 1818 return; |
0 | 1819 case 2: |
1820 if ( a3 ) | |
1821 { | |
1822 v9 = 0; | |
1823 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); | |
1824 v7 = 0; | |
1825 LOWORD(v6) = v4; | |
1826 v5 = 905; | |
1827 goto LABEL_16; | |
1828 } | |
322 | 1829 return; |
0 | 1830 case 3: |
1831 if ( a3 ) | |
1832 { | |
1833 v9 = 0; | |
1834 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); | |
1835 v7 = 0; | |
1836 LOWORD(v6) = v4; | |
1837 v5 = 906; | |
1838 goto LABEL_16; | |
1839 } | |
322 | 1840 return; |
0 | 1841 case 4: |
1842 if ( a3 ) | |
1843 { | |
1844 v9 = 0; | |
1845 v8 = (signed __int64)(sub_43AE12(a3) * 65536.0); | |
1846 v7 = 0; | |
1847 LOWORD(v6) = v4; | |
1848 v5 = 907; | |
1849 goto LABEL_16; | |
1850 } | |
322 | 1851 return; |
0 | 1852 case 5: |
1853 v9 = 4; | |
1854 v8 = 65536; | |
1855 v7 = 0; | |
862 | 1856 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1857 v5 = 901; |
1858 goto LABEL_16; | |
1859 case 6: | |
1860 v9 = 4; | |
1861 v8 = 65536; | |
1862 v7 = 0; | |
862 | 1863 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1864 v5 = 902; |
1865 goto LABEL_16; | |
1866 case 7: | |
1867 v9 = 4; | |
1868 v8 = 65536; | |
1869 v7 = 0; | |
862 | 1870 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1871 v5 = 903; |
1872 goto LABEL_16; | |
1873 case 8: | |
1874 v9 = 4; | |
1875 v8 = 65536; | |
1876 v7 = 0; | |
862 | 1877 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1878 v5 = 900; |
1879 goto LABEL_16; | |
1880 case 9: | |
1881 v9 = 4; | |
1882 v8 = 65536; | |
1883 v7 = 0; | |
862 | 1884 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1885 v5 = 909; |
1886 goto LABEL_16; | |
1887 case 10: | |
1888 v9 = 4; | |
1889 v8 = 65536; | |
1890 v7 = 0; | |
862 | 1891 v6 = PID(OBJECT_Actor,uActorID); |
0 | 1892 v5 = 908; |
1893 LABEL_16: | |
1894 result = pOtherOverlayList->_4418B6(v5, v6, v7, v8, v9); | |
1895 break; | |
1896 default: | |
322 | 1897 return; |
0 | 1898 } |
322 | 1899 return; |
0 | 1900 } |
1901 | |
1902 //----- (0043B3E0) -------------------------------------------------------- | |
1903 int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2) | |
1904 { | |
1905 signed int v2; // ebp@1 | |
1906 int v3; // eax@9 | |
1907 signed int v4; // edi@9 | |
1908 int v5; // esi@9 | |
1909 int v6; // ebx@11 | |
1910 unsigned __int16 v8; // si@21 | |
1911 int v9; // edi@21 | |
1912 signed int v10; // eax@23 | |
1913 int v11; // [sp+10h] [bp-4h]@1 | |
1914 | |
1915 v2 = 0; | |
1916 v11 = 0; | |
1917 if ( a2 ) | |
1918 { | |
1919 if ( a2 == 1 ) | |
1920 { | |
1921 v3 = a1->pMonsterInfo.uAttack2DamageDiceRolls; | |
1922 v4 = a1->pMonsterInfo.uAttack2DamageDiceSides; | |
1923 v5 = a1->pMonsterInfo.uAttack2DamageBonus; | |
1924 } | |
1925 else | |
1926 { | |
1927 if ( a2 <= 1 ) | |
1928 return 0; | |
1929 if ( a2 <= 3 ) | |
1930 { | |
1931 if ( a2 == 2 ) | |
1932 { | |
1933 v8 = a1->pMonsterInfo.uSpellSkillAndMastery1; | |
1934 v9 = a1->pMonsterInfo.uSpell1ID; | |
1935 } | |
1936 else | |
1937 { | |
1938 v8 = a1->pMonsterInfo.uSpellSkillAndMastery2; | |
1939 v9 = a1->pMonsterInfo.uSpell2ID; | |
1940 } | |
1941 v10 = SkillToMastery(v8); | |
1942 return _43AFE3_calc_spell_damage(v9, v8 & 0x3F, v10, 0); | |
1943 } | |
1944 if ( a2 != 4 ) | |
1945 return 0; | |
1946 v3 = a1->pMonsterInfo.uSpecialAbilityDamageDiceRolls; | |
1947 v4 = a1->pMonsterInfo.uSpecialAbilityDamageDiceSides; | |
1948 v5 = a1->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | |
1949 } | |
1950 } | |
1951 else | |
1952 { | |
1953 if ( (signed __int64)a1->pActorBuffs[14].uExpireTime > 0 ) | |
1954 v2 = a1->pActorBuffs[14].uPower; | |
1955 if ( (signed __int64)a1->pActorBuffs[18].uExpireTime > 0 && a1->pActorBuffs[18].uPower > v2 ) | |
1956 v2 = a1->pActorBuffs[18].uPower; | |
1957 if ( (signed __int64)a1->pActorBuffs[21].uExpireTime > 0 ) | |
1958 v2 += a1->pActorBuffs[21].uPower; | |
1959 v3 = a1->pMonsterInfo.uAttack1DamageDiceRolls; | |
1960 v4 = a1->pMonsterInfo.uAttack1DamageDiceSides; | |
1961 v5 = a1->pMonsterInfo.uAttack1DamageBonus; | |
1962 } | |
1963 if ( v3 > 0 ) | |
1964 { | |
1965 v6 = v3; | |
1966 do | |
1967 { | |
1968 --v6; | |
1969 v11 += rand() % v4 + 1; | |
1970 } | |
1971 while ( v6 ); | |
1972 } | |
1973 return v11 + v5 + v2; | |
1974 } | |
1975 | |
1976 //----- (00438B9B) -------------------------------------------------------- | |
322 | 1977 bool Actor::IsPeasant() |
0 | 1978 { |
1979 unsigned int v1; // eax@1 | |
1980 | |
1981 v1 = this->uAlly; | |
1982 if ( !v1 ) | |
1983 v1 = (this->pMonsterInfo.uID - 1) / 3 + 1; | |
1984 return (signed int)v1 >= 39 && (signed int)v1 <= 44 | |
1985 || (signed int)v1 >= 45 && (signed int)v1 <= 50 | |
1986 || (signed int)v1 >= 51 && (signed int)v1 <= 62 | |
1987 || (signed int)v1 >= 78 && (signed int)v1 <= 83; | |
1988 } | |
1989 | |
1990 //----- (0042EBEE) -------------------------------------------------------- | |
1991 bool Actor::StealFrom(unsigned int uActorID) | |
1992 { | |
1993 unsigned int v1; // esi@1 | |
1994 Player *pPlayer; // edi@1 | |
1995 bool result; // eax@1 | |
1996 int v4; // ebx@2 | |
1997 unsigned int v5; // eax@2 | |
1998 DDM_DLV_Header *v6; // esi@4 | |
1999 unsigned int v7; // [sp+8h] [bp-4h]@1 | |
2000 int v8; // [sp+8h] [bp-4h]@6 | |
2001 | |
2002 v1 = uActiveCharacter; | |
2003 v7 = uActorID; | |
243 | 2004 pPlayer = &pParty->pPlayers[uActiveCharacter-1]; |
0 | 2005 result = pPlayer->CanAct(); |
2006 if ( result ) | |
2007 { | |
1517 | 2008 CastSpellInfoHelpers::_427D48(); |
0 | 2009 v4 = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
2010 v5 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 2011 if ( v5 ) |
2012 v4 = pMapStats->pInfos[v5]._steal_perm; | |
2013 v6 = &pOutdoor->ddm; | |
2014 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
2015 v6 = &pIndoor->dlv; | |
2016 pPlayer->StealFromActor(v7, v4, v6->uReputation++); | |
2017 v8 = pPlayer->GetAttackRecoveryTime(0); | |
2018 if ( v8 < 30 ) | |
2019 v8 = 30; | |
2020 if ( !pParty->bTurnBasedModeOn ) | |
2021 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v8 * 2.133333333333333)); | |
1448 | 2022 pTurnEngine->ApplyPlayerAction(); |
0 | 2023 result = 1; |
2024 } | |
2025 return result; | |
2026 } | |
2027 | |
2028 //----- (00403A60) -------------------------------------------------------- | |
1060 | 2029 void Actor::AI_SpellAttack2(unsigned int uActorID, signed int edx0, AIDirection *pDir) |
0 | 2030 { |
2031 Actor *v3; // ebx@1 | |
2032 AIDirection *v4; // esi@3 | |
2033 AIDirection *v5; // edi@3 | |
2034 signed int v6; // eax@4 | |
2035 Vec3_int_ v7; // ST04_12@6 | |
322 | 2036 //unsigned int result; // eax@7 |
0 | 2037 AIDirection *v9; // eax@8 |
2038 unsigned int v10; // esi@8 | |
2039 AIDirection *v11; // esi@9 | |
2040 SpriteFrame *v12; // ecx@10 | |
2041 __int16 v13; // ax@10 | |
2042 unsigned int v14; // ecx@10 | |
2043 unsigned int v15; // eax@10 | |
2044 signed int v16; // ecx@17 | |
2045 AIDirection a3; // [sp+Ch] [bp-48h]@9 | |
2046 AIDirection v18; // [sp+28h] [bp-2Ch]@9 | |
2047 int v19; // [sp+44h] [bp-10h]@6 | |
2048 signed int a2; // [sp+48h] [bp-Ch]@1 | |
2049 int v21; // [sp+4Ch] [bp-8h]@3 | |
2050 unsigned int v22; // [sp+50h] [bp-4h]@1 | |
2051 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 | |
2052 | |
2053 v22 = uActorID; | |
2054 v3 = &pActors[uActorID]; | |
2055 a2 = edx0; | |
848 | 2056 if ( PID_TYPE(edx0) == OBJECT_Actor) |
0 | 2057 { |
848 | 2058 v6 = PID_ID(edx0); |
0 | 2059 v4 = (AIDirection *)pActors[v6].vPosition.x; |
2060 v5 = (AIDirection *)pActors[v6].vPosition.y; | |
2061 v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); | |
2062 } | |
2063 else | |
2064 { | |
848 | 2065 if ( PID_TYPE(edx0) == OBJECT_Player) |
0 | 2066 { |
2067 v4 = (AIDirection *)pParty->vPosition.x; | |
2068 v5 = (AIDirection *)pParty->vPosition.y; | |
2069 v21 = pParty->vPosition.z + pParty->sEyelevel; | |
2070 } | |
2071 else | |
2072 { | |
2073 v4 = pDir; | |
2074 v5 = pDir; | |
2075 } | |
2076 } | |
2077 v19 = v3->uActorHeight; | |
2078 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); | |
2079 v7.y = v3->vPosition.y; | |
2080 v7.x = v3->vPosition.x; | |
2081 if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) | |
2082 { | |
2083 v9 = pDir; | |
2084 v10 = 0; | |
2085 if ( !pDir ) | |
2086 { | |
862 | 2087 v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), a2, &a3, 0); |
0 | 2088 v9 = &v18; |
2089 memcpy(&v18, v11, sizeof(v18)); | |
2090 v10 = 0; | |
2091 } | |
2092 v12 = pSpriteFrameTable->pSpriteSFrames; | |
2093 v3->uYawAngle = LOWORD(v9->uYawAngle); | |
319 | 2094 v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
0 | 2095 v14 = v22; |
2096 v3->uCurrentActionLength = 8 * v13; | |
2097 v3->uCurrentActionTime = v10; | |
2098 v3->uAIState = AttackingRanged4; | |
2099 Actor::PlaySound(v14, 0); | |
2100 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2101 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2102 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | |
2103 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | |
2104 { | |
2105 v15 *= 2; | |
2106 pDira = v15; | |
2107 } | |
2108 if ( pParty->bTurnBasedModeOn == 1 ) | |
2109 v3->pMonsterInfo.uRecoveryTime = v15; | |
2110 else | |
2111 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength | |
2112 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 | |
2113 * (double)(signed int)pDira | |
2114 * -2.133333333333333); | |
2115 v16 = v3->pMonsterInfo.uSpell2ID; | |
2116 v3->vVelocity.z = v10; | |
2117 v3->vVelocity.y = v10; | |
2118 v3->vVelocity.x = v10; | |
1458 | 2119 if ( _42FB5C_check_spell(v16) ) |
0 | 2120 { |
2121 v3->uCurrentActionLength = 64; | |
2122 v3->uCurrentActionTime = v10; | |
2123 v3->uAIState = Fidgeting; | |
322 | 2124 v3->UpdateAnimation(); |
0 | 2125 v3->uAIState = AttackingRanged4; |
2126 } | |
2127 else | |
322 | 2128 v3->UpdateAnimation(); |
0 | 2129 } |
2130 else | |
1060 | 2131 Actor::AI_Pursue1(v22, a2, v22, 64, pDir); |
0 | 2132 } |
2133 | |
2134 //----- (00403854) -------------------------------------------------------- | |
1060 | 2135 void Actor::AI_SpellAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) |
0 | 2136 { |
2137 Actor *v3; // ebx@1 | |
2138 AIDirection *v4; // esi@3 | |
2139 AIDirection *v5; // edi@3 | |
2140 signed int v6; // eax@4 | |
2141 Vec3_int_ v7; // ST04_12@6 | |
322 | 2142 //unsigned int result; // eax@7 |
0 | 2143 AIDirection *v9; // eax@8 |
2144 unsigned int v10; // esi@8 | |
2145 AIDirection *v11; // esi@9 | |
2146 SpriteFrame *v12; // ecx@10 | |
2147 __int16 v13; // ax@10 | |
2148 unsigned int v14; // ecx@10 | |
2149 unsigned int v15; // eax@10 | |
2150 signed int v16; // ecx@17 | |
2151 AIDirection a3; // [sp+Ch] [bp-48h]@9 | |
2152 AIDirection v18; // [sp+28h] [bp-2Ch]@9 | |
2153 int v19; // [sp+44h] [bp-10h]@6 | |
848 | 2154 //signed int a2; // [sp+48h] [bp-Ch]@1 |
0 | 2155 int v21; // [sp+4Ch] [bp-8h]@3 |
2156 unsigned int v22; // [sp+50h] [bp-4h]@1 | |
2157 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 | |
2158 | |
2159 v22 = uActorID; | |
2160 v3 = &pActors[uActorID]; | |
848 | 2161 //a2 = edx0; |
2162 if ( PID_TYPE(sTargetPid) == OBJECT_Actor) | |
0 | 2163 { |
848 | 2164 v6 = PID_ID(sTargetPid); |
0 | 2165 v4 = (AIDirection *)pActors[v6].vPosition.x; |
2166 v5 = (AIDirection *)pActors[v6].vPosition.y; | |
2167 v21 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); | |
2168 } | |
2169 else | |
2170 { | |
848 | 2171 if ( PID_TYPE(sTargetPid) == OBJECT_Player) |
0 | 2172 { |
2173 v4 = (AIDirection *)pParty->vPosition.x; | |
2174 v5 = (AIDirection *)pParty->vPosition.y; | |
2175 v21 = pParty->vPosition.z + pParty->sEyelevel; | |
2176 } | |
2177 else | |
2178 { | |
2179 v4 = pDir; | |
2180 v5 = pDir; | |
2181 } | |
2182 } | |
2183 v19 = v3->uActorHeight; | |
2184 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); | |
2185 v7.y = v3->vPosition.y; | |
2186 v7.x = v3->vPosition.x; | |
2187 if ( sub_407A1C((int)v4, (int)v5, v21, v7) ) | |
2188 { | |
2189 v9 = pDir; | |
2190 v10 = 0; | |
2191 if ( !pDir ) | |
2192 { | |
862 | 2193 v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v22), sTargetPid, &a3, 0); |
0 | 2194 v9 = &v18; |
2195 memcpy(&v18, v11, sizeof(v18)); | |
2196 v10 = 0; | |
2197 } | |
2198 v12 = pSpriteFrameTable->pSpriteSFrames; | |
2199 v3->uYawAngle = LOWORD(v9->uYawAngle); | |
319 | 2200 v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
0 | 2201 v14 = v22; |
2202 v3->uCurrentActionLength = 8 * v13; | |
2203 v3->uCurrentActionTime = v10; | |
2204 v3->uAIState = AttackingRanged3; | |
2205 Actor::PlaySound(v14, 0); | |
2206 v15 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2207 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2208 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | |
2209 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | |
2210 { | |
2211 v15 *= 2; | |
2212 pDira = v15; | |
2213 } | |
2214 if ( pParty->bTurnBasedModeOn == 1 ) | |
2215 v3->pMonsterInfo.uRecoveryTime = v15; | |
2216 else | |
2217 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength | |
2218 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 | |
2219 * (double)(signed int)pDira | |
2220 * -2.133333333333333); | |
2221 v16 = v3->pMonsterInfo.uSpell1ID; | |
2222 v3->vVelocity.z = v10; | |
2223 v3->vVelocity.y = v10; | |
2224 v3->vVelocity.x = v10; | |
1458 | 2225 if ( _42FB5C_check_spell(v16) ) |
0 | 2226 { |
2227 v3->uCurrentActionLength = 64; | |
2228 v3->uCurrentActionTime = v10; | |
2229 v3->uAIState = Fidgeting; | |
322 | 2230 v3->UpdateAnimation(); |
0 | 2231 v3->uAIState = AttackingRanged3; |
2232 } | |
2233 else | |
322 | 2234 v3->UpdateAnimation(); |
0 | 2235 } |
2236 else | |
1060 | 2237 Actor::AI_Pursue1(v22, sTargetPid, v22, 64, pDir); |
0 | 2238 } |
2239 | |
2240 //----- (0040368B) -------------------------------------------------------- | |
1060 | 2241 void Actor::AI_MissileAttack2(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) |
0 | 2242 { |
2243 Actor *v3; // ebx@1 | |
2244 AIDirection *v4; // esi@3 | |
2245 AIDirection *v5; // edi@3 | |
2246 signed int v6; // eax@4 | |
2247 Vec3_int_ v7; // ST04_12@6 | |
322 | 2248 //unsigned int result; // eax@7 |
0 | 2249 AIDirection *v9; // eax@8 |
2250 unsigned int v10; // esi@8 | |
2251 AIDirection *v11; // esi@9 | |
2252 SpriteFrame *v12; // ecx@10 | |
2253 __int16 v13; // ax@10 | |
2254 unsigned int v14; // ecx@10 | |
2255 signed __int64 v15; // qax@10 | |
2256 AIDirection a3; // [sp+Ch] [bp-48h]@9 | |
2257 AIDirection v17; // [sp+28h] [bp-2Ch]@9 | |
2258 int v18; // [sp+44h] [bp-10h]@6 | |
848 | 2259 //signed int a2; // [sp+48h] [bp-Ch]@1 |
0 | 2260 int v20; // [sp+4Ch] [bp-8h]@3 |
2261 unsigned int v21; // [sp+50h] [bp-4h]@1 | |
2262 unsigned int pDira; // [sp+5Ch] [bp+8h]@10 | |
2263 | |
2264 v21 = uActorID; | |
2265 v3 = &pActors[uActorID]; | |
848 | 2266 //a2 = edx0; |
2267 if ( PID_TYPE(sTargetPid) == OBJECT_Actor) | |
0 | 2268 { |
848 | 2269 v6 = PID_ID(sTargetPid); |
0 | 2270 v4 = (AIDirection *)pActors[v6].vPosition.x; |
2271 v5 = (AIDirection *)pActors[v6].vPosition.y; | |
2272 v20 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); | |
2273 } | |
2274 else | |
2275 { | |
848 | 2276 if ( PID_TYPE(sTargetPid) == OBJECT_Player) |
0 | 2277 { |
2278 v4 = (AIDirection *)pParty->vPosition.x; | |
2279 v5 = (AIDirection *)pParty->vPosition.y; | |
2280 v20 = pParty->vPosition.z + pParty->sEyelevel; | |
2281 } | |
2282 else | |
2283 { | |
2284 v4 = pDir; | |
2285 v5 = pDir; | |
2286 } | |
2287 } | |
2288 v18 = v3->uActorHeight; | |
2289 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v18 * -0.75); | |
2290 v7.y = v3->vPosition.y; | |
2291 v7.x = v3->vPosition.x; | |
2292 if ( sub_407A1C((int)v4, (int)v5, v20, v7) ) | |
2293 { | |
2294 v9 = pDir; | |
2295 v10 = 0; | |
2296 if ( !pDir ) | |
2297 { | |
862 | 2298 v11 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0); |
0 | 2299 v9 = &v17; |
2300 memcpy(&v17, v11, sizeof(v17)); | |
2301 v10 = 0; | |
2302 } | |
2303 v12 = pSpriteFrameTable->pSpriteSFrames; | |
2304 v3->uYawAngle = LOWORD(v9->uYawAngle); | |
319 | 2305 v13 = v12[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
0 | 2306 v14 = v21; |
2307 v3->uCurrentActionLength = 8 * v13; | |
2308 v3->uCurrentActionTime = v10; | |
2309 v3->uAIState = AttackingRanged2; | |
2310 Actor::PlaySound(v14, 0); | |
2311 LODWORD(v15) = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2312 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2313 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v10 | |
2314 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v10 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v10) ) | |
2315 { | |
2316 LODWORD(v15) = 2 * v15; | |
2317 pDira = v15; | |
2318 } | |
2319 if ( pParty->bTurnBasedModeOn != 1 ) | |
2320 v15 = (signed __int64)(flt_6BE3A8_debug_recmod2 * (double)(signed int)pDira * 2.133333333333333); | |
2321 v3->pMonsterInfo.uRecoveryTime = v15; | |
2322 v3->vVelocity.z = v10; | |
2323 v3->vVelocity.y = v10; | |
2324 v3->vVelocity.x = v10; | |
322 | 2325 v3->UpdateAnimation(); |
0 | 2326 } |
2327 else | |
1060 | 2328 Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); |
0 | 2329 } |
2330 | |
2331 //----- (00403476) -------------------------------------------------------- | |
1060 | 2332 void Actor::AI_MissileAttack1(unsigned int uActorID, signed int sTargetPid, AIDirection *pDir) |
0 | 2333 { |
2334 Actor *v3; // ebx@1 | |
2335 int v4; // esi@3 | |
2336 int v5; // edi@3 | |
2337 signed int v6; // eax@4 | |
2338 Vec3_int_ v7; // ST04_12@6 | |
2339 unsigned char v8[12]; // ST04_12@7 | |
322 | 2340 //unsigned int result; // eax@8 |
0 | 2341 AIDirection *v10; // eax@9 |
2342 unsigned int v11; // esi@9 | |
2343 AIDirection *v12; // esi@10 | |
2344 SpriteFrame *v13; // ecx@11 | |
2345 __int16 v14; // ax@11 | |
2346 unsigned int v15; // ecx@11 | |
2347 unsigned int v16; // eax@11 | |
2348 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
2349 AIDirection v18; // [sp+28h] [bp-2Ch]@10 | |
2350 int v19; // [sp+44h] [bp-10h]@6 | |
848 | 2351 //signed int a2; // [sp+48h] [bp-Ch]@1 |
0 | 2352 unsigned int v21; // [sp+4Ch] [bp-8h]@1 |
2353 int v22; // [sp+50h] [bp-4h]@3 | |
2354 unsigned int pDira; // [sp+5Ch] [bp+8h]@11 | |
2355 | |
2356 v21 = uActorID; | |
2357 v3 = &pActors[uActorID]; | |
848 | 2358 //a2 = edx0; |
2359 if ( PID_TYPE(sTargetPid) == OBJECT_Actor) | |
0 | 2360 { |
848 | 2361 v6 = PID_ID(sTargetPid); |
0 | 2362 v4 = pActors[v6].vPosition.x; |
2363 v5 = pActors[v6].vPosition.y; | |
2364 v22 = (signed __int64)((double)pActors[v6].uActorHeight * 0.75 + (double)pActors[v6].vPosition.z); | |
2365 } | |
2366 else | |
2367 { | |
848 | 2368 if ( PID_TYPE(sTargetPid) == OBJECT_Player) |
0 | 2369 { |
2370 v4 = pParty->vPosition.x; | |
2371 v5 = pParty->vPosition.y; | |
2372 v22 = pParty->vPosition.z + pParty->sEyelevel; | |
2373 } | |
2374 else | |
2375 { | |
2376 v4 = (int)pDir; | |
2377 v5 = (int)pDir; | |
2378 } | |
2379 } | |
2380 v19 = v3->uActorHeight; | |
2381 v7.z = v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75); | |
2382 v7.y = v3->vPosition.y; | |
2383 v7.x = v3->vPosition.x; | |
2384 if ( sub_407A1C(v4, v5, v22, v7) | |
2385 || (*(unsigned int *)&v8[8] = v22, | |
2386 v19 = v3->uActorHeight, | |
2387 *(_QWORD *)v8 = __PAIR__(v5, v4), | |
2388 sub_407A1C( | |
2389 v3->vPosition.x, | |
2390 v3->vPosition.y, | |
2391 v3->vPosition.z - (unsigned int)(signed __int64)((double)v19 * -0.75), | |
2392 *(Vec3_int_ *)v8)) ) | |
2393 { | |
2394 v10 = pDir; | |
2395 v11 = 0; | |
2396 if ( !pDir ) | |
2397 { | |
862 | 2398 v12 = Actor::GetDirectionInfo(PID(OBJECT_Actor,v21), sTargetPid, &a3, 0); |
0 | 2399 v10 = &v18; |
2400 memcpy(&v18, v12, sizeof(v18)); | |
2401 v11 = 0; | |
2402 } | |
2403 v13 = pSpriteFrameTable->pSpriteSFrames; | |
2404 v3->uYawAngle = LOWORD(v10->uYawAngle); | |
319 | 2405 v14 = v13[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength; |
0 | 2406 v15 = v21; |
2407 v3->uCurrentActionLength = 8 * v14; | |
2408 v3->uCurrentActionTime = v11; | |
2409 v3->uAIState = AttackingRanged1; | |
2410 Actor::PlaySound(v15, 0); | |
2411 v16 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2412 pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime; | |
2413 if ( SHIDWORD(v3->pActorBuffs[7].uExpireTime) >= (signed int)v11 | |
2414 && (SHIDWORD(v3->pActorBuffs[7].uExpireTime) > (signed int)v11 || LODWORD(v3->pActorBuffs[7].uExpireTime) > v11) ) | |
2415 { | |
2416 v16 *= 2; | |
2417 pDira = v16; | |
2418 } | |
2419 if ( pParty->bTurnBasedModeOn == 1 ) | |
2420 v3->pMonsterInfo.uRecoveryTime = v16; | |
2421 else | |
2422 v3->pMonsterInfo.uRecoveryTime = v3->uCurrentActionLength | |
2423 - (unsigned int)(signed __int64)(flt_6BE3A8_debug_recmod2 | |
2424 * (double)(signed int)pDira | |
2425 * -2.133333333333333); | |
2426 v3->vVelocity.z = v11; | |
2427 v3->vVelocity.y = v11; | |
2428 v3->vVelocity.x = v11; | |
322 | 2429 v3->UpdateAnimation(); |
0 | 2430 } |
2431 else | |
1060 | 2432 Actor::AI_Pursue1(v21, sTargetPid, v21, 64, pDir); |
0 | 2433 } |
2434 | |
2435 //----- (004032B2) -------------------------------------------------------- | |
1456 | 2436 void Actor::AI_RandomMove( unsigned int uActor_id, unsigned int uTarget_id, int radius, int uActionLength ) |
2437 { | |
0 | 2438 unsigned int v4; // edi@1 |
2439 Actor *v5; // esi@1 | |
2440 int v6; // ebx@1 | |
2441 int v7; // ST08_4@1 | |
2442 int v8; // eax@1 | |
2443 unsigned int v9; // ebx@11 | |
2444 int v10; // ebx@13 | |
2445 signed __int16 v11; // cx@17 | |
2446 unsigned int v12; // [sp-8h] [bp-44h]@10 | |
2447 AIDirection *v13; // [sp-4h] [bp-40h]@10 | |
2448 AIDirection v14; // [sp+Ch] [bp-30h]@7 | |
2449 int v15; // [sp+28h] [bp-14h]@11 | |
2450 unsigned int v16; // [sp+2Ch] [bp-10h]@1 | |
2451 int y; // [sp+30h] [bp-Ch]@1 | |
2452 unsigned int uActorID; // [sp+34h] [bp-8h]@1 | |
2453 int v19; // [sp+38h] [bp-4h]@1 | |
2454 | |
414 | 2455 //v14 never filled, maybe it is passed to function but optimized away as local variable |
2456 | |
1456 | 2457 uActorID = uActor_id; |
2458 v4 = uActor_id; | |
2459 v5 = &pActors[uActor_id]; | |
2460 v16 = uTarget_id; | |
0 | 2461 v6 = v5->vInitialPosition.x - v5->vPosition.x; |
2462 v7 = v5->vInitialPosition.x - v5->vPosition.x; | |
2463 y = v5->vInitialPosition.y - v5->vPosition.y; | |
2464 v19 = abs(v7); | |
2465 v8 = abs(y); | |
2466 if ( v19 <= v8 ) | |
2467 v19 = v8 + (v19 >> 1); | |
2468 else | |
2469 v19 += v8 >> 1; | |
2470 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
2471 { | |
2472 if ( !uActionLength ) | |
2473 uActionLength = 256; | |
414 | 2474 Actor::AI_StandOrBored(uActorID, OBJECT_Player, uActionLength, &v14); |
0 | 2475 return; |
2476 } | |
2477 if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 ) | |
2478 { | |
1456 | 2479 Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); |
0 | 2480 return; |
2481 } | |
2482 v15 = (rand() & 0xF) << 12; | |
1456 | 2483 v19 += (unsigned __int64)(v15 * (signed __int64)radius) >> 16; |
0 | 2484 v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(v6, y); |
2485 if ( rand() % 100 < 25 ) | |
2486 { | |
2487 Actor::StandAwhile(uActorID); | |
2488 return; | |
2489 } | |
2490 v10 = v9 + rand() % 256 - 128; | |
1456 | 2491 if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) ) |
0 | 2492 { |
1456 | 2493 Actor::AI_Stand(uActorID, uTarget_id, 256, &v14); |
245 | 2494 return; |
0 | 2495 } |
2496 v5->uYawAngle = v10; | |
1456 | 2497 if ( v5->uMovementSpeed) |
2498 v5->uCurrentActionLength = 32 * v19 / v5->uMovementSpeed; | |
0 | 2499 else |
2500 v5->uCurrentActionLength = 0; | |
2501 v5->uCurrentActionTime = 0; | |
2502 v5->uAIState = Tethered; | |
2503 if ( rand() % 100 < 2 ) | |
2504 Actor::PlaySound(uActorID, 3u); | |
2505 v5->UpdateAnimation(); | |
2506 } | |
2507 | |
2508 //----- (004031C1) -------------------------------------------------------- | |
2509 char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3) | |
2510 { | |
2511 unsigned int v3; // edi@1 | |
2512 Actor *v4; // esi@1 | |
2513 ActorJob *v5; // eax@1 | |
2514 signed int v6; // edx@2 | |
2515 ActorJob *v7; // eax@2 | |
2516 signed int v8; // edi@2 | |
82 | 2517 ActorJob *v9; // ecx@2 |
0 | 2518 __int16 v10; // cx@15 |
2519 signed int v12; // [sp+8h] [bp-4h]@1 | |
2520 | |
2521 v3 = uActorID; | |
2522 v12 = a2; | |
2523 v4 = &pActors[uActorID]; | |
2524 v5 = (ActorJob *)pActors[uActorID].CanAct(); | |
2525 if ( v5 ) | |
2526 { | |
2527 v6 = 65535; | |
2528 v7 = &v4->pScheduledJobs[v3]; | |
2529 v8 = 7; | |
82 | 2530 v9 = &v7[7];//(char *)&v7[7].uHour; |
2531 while ( !(v9->uAttributes & 1) || v9->uHour > v12 ) | |
0 | 2532 { |
2533 --v8; | |
82 | 2534 --v9; |
0 | 2535 if ( v8 < 0 ) |
82 | 2536 break; |
0 | 2537 } |
82 | 2538 if( v8 >= 0 ) |
2539 v6 = v8; | |
0 | 2540 if ( !v8 && v6 == 65535 ) |
2541 v6 = 7; | |
2542 v5 = &v7[v6]; | |
2543 if ( v4->vInitialPosition.x != v5->vPos.x | |
2544 || v4->vInitialPosition.y != v5->vPos.y | |
2545 || v4->vInitialPosition.z != v5->vPos.z | |
2546 || v4->pMonsterInfo.uMovementType != v5->uAction ) | |
2547 { | |
2548 v4->vInitialPosition.x = v5->vPos.x; | |
2549 v4->vInitialPosition.y = v5->vPos.y; | |
2550 v10 = v5->vPos.z; | |
2551 v4->vInitialPosition.z = v10; | |
2552 LOBYTE(v5) = v5->uAction; | |
1456 | 2553 v4->pMonsterInfo.uMovementType = MONSTER_MOVEMENT_TYPE_STAIONARY; |
0 | 2554 if ( a3 == 1 ) |
2555 { | |
2556 v4->vPosition.x = v4->vInitialPosition.x; | |
2557 v4->vPosition.y = v4->vInitialPosition.y; | |
2558 LOBYTE(v5) = v10; | |
2559 v4->vPosition.z = v10; | |
2560 } | |
2561 } | |
2562 } | |
2563 return (char)v5; | |
2564 } | |
2565 | |
2566 //----- (004030AD) -------------------------------------------------------- | |
1060 | 2567 void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int arg0) |
0 | 2568 { |
2569 unsigned int v3; // edi@1 | |
2570 Actor *v4; // ebx@1 | |
322 | 2571 //__int16 result; // ax@10 |
0 | 2572 SpriteFrame *v6; // ecx@16 |
2573 __int16 v7; // ax@16 | |
2574 unsigned int v8; // ecx@16 | |
2575 AIDirection a3; // [sp+Ch] [bp-40h]@16 | |
2576 AIDirection v10; // [sp+28h] [bp-24h]@16 | |
2577 unsigned int v11; // [sp+44h] [bp-8h]@1 | |
2578 signed int a2; // [sp+48h] [bp-4h]@1 | |
2579 | |
2580 v3 = uActorID; | |
2581 a2 = edx0; | |
2582 v4 = &pActors[uActorID]; | |
2583 v11 = uActorID; | |
2584 if ( v4->uAIState == 7 ) | |
2585 BYTE2(v4->uAttributes) |= 2u; | |
2586 if ( v4->pMonsterInfo.uHostilityType != 4 ) | |
2587 { | |
2588 v4->uAttributes &= 0xFFFFFFFBu; | |
2589 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
2590 } | |
2591 if ( (signed __int64)v4->pActorBuffs[1].uExpireTime > 0 ) | |
2592 v4->pActorBuffs[1].Reset(); | |
2593 if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 ) | |
2594 v4->pActorBuffs[4].Reset(); | |
2595 if ( arg0 | |
322 | 2596 || (v4->uAIState != 8 |
2597 && v4->uAIState != 3 | |
2598 && v4->uAIState != 12 | |
2599 && v4->uAIState != 13 | |
2600 && v4->uAIState != 18 | |
2601 && v4->uAIState != 2)) | |
0 | 2602 { |
862 | 2603 memcpy(&v10, Actor::GetDirectionInfo(PID(OBJECT_Actor,v3), a2, &a3, 0), sizeof(v10)); |
0 | 2604 v6 = pSpriteFrameTable->pSpriteSFrames; |
2605 v4->uYawAngle = LOWORD(v10.uYawAngle); | |
319 | 2606 v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength; |
0 | 2607 v8 = v11; |
2608 v4->uCurrentActionTime = 0; | |
2609 v4->uAIState = Stunned; | |
2610 v4->uCurrentActionLength = 8 * v7; | |
2611 Actor::PlaySound(v8, 2u); | |
322 | 2612 v4->UpdateAnimation(); |
0 | 2613 } |
2614 } | |
2615 | |
2616 //----- (00402F87) -------------------------------------------------------- | |
414 | 2617 void Actor::AI_Bored(unsigned int uActorID, unsigned int uObjID, AIDirection *a4) |
0 | 2618 { |
2619 unsigned int v7; // eax@3 | |
2620 unsigned int v9; // eax@3 | |
1060 | 2621 |
414 | 2622 assert(uActorID < uNumActors); |
1202 | 2623 auto actor = &pActors[uActorID]; |
417 | 2624 |
2625 AIDirection a3; // [sp+Ch] [bp-5Ch]@2 | |
414 | 2626 if (!a4) |
862 | 2627 a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), uObjID, &a3, 0); |
414 | 2628 |
2629 actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength; | |
2630 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2631 v7 = stru_5C6E00->Atan2(actor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); |
414 | 2632 v9 = stru_5C6E00->uIntegerPi + actor->uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7; |
2633 | |
2634 if ( BYTE1(v9) & 7 ) // turned away - just stand | |
2635 Actor::AI_Stand(uActorID, uObjID, actor->uCurrentActionLength, a4); | |
2636 else // facing player - play bored anim | |
0 | 2637 { |
414 | 2638 actor->uAIState = Fidgeting; |
2639 actor->uCurrentActionTime = 0; | |
2640 actor->uYawAngle = a4->uYawAngle; | |
2641 actor->vVelocity.z = 0; | |
2642 actor->vVelocity.y = 0; | |
2643 actor->vVelocity.x = 0; | |
0 | 2644 if ( rand() % 100 < 5 ) |
414 | 2645 Actor::PlaySound(uActorID, 3); |
2646 actor->UpdateAnimation(); | |
0 | 2647 } |
2648 } | |
2649 | |
2650 //----- (00402F27) -------------------------------------------------------- | |
322 | 2651 void Actor::Resurrect(unsigned int uActorID) |
0 | 2652 { |
2653 Actor *pActor; // esi@1 | |
2654 SpriteFrame *v2; // edx@1 | |
2655 int v3; // eax@1 | |
2656 | |
2657 pActor = &pActors[uActorID]; | |
2658 v2 = pSpriteFrameTable->pSpriteSFrames; | |
319 | 2659 v3 = pActor->pSpriteIDs[ANIM_Dying]; |
0 | 2660 pActor->uCurrentActionTime = 0; |
2661 pActor->uAIState = Resurrected; | |
2662 pActor->uCurrentActionAnimation = ANIM_Dying; | |
2663 pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; | |
2664 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); | |
2665 Actor::PlaySound(uActorID, 1u); | |
322 | 2666 pActor->UpdateAnimation(); |
0 | 2667 } |
2668 | |
2669 //----- (00402D6E) -------------------------------------------------------- | |
319 | 2670 void Actor::Die(unsigned int uActorID) |
0 | 2671 { |
319 | 2672 auto actor = &pActors[uActorID]; |
0 | 2673 |
319 | 2674 actor->uCurrentActionTime = 0; |
2675 actor->uAIState = Dying; | |
2676 actor->uCurrentActionAnimation = ANIM_Dying; | |
2677 actor->sCurrentHP = 0; | |
2678 actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Dying]].uAnimLength; | |
2679 actor->pActorBuffs[6].Reset(); | |
2680 actor->pActorBuffs[5].Reset(); | |
2681 Actor::PlaySound(uActorID, 1); | |
2682 actor->UpdateAnimation(); | |
2683 | |
2684 for (uint i = 0; i < 5; ++i) | |
1529 | 2685 if (pParty->monster_id_for_hunting[i] == actor->pMonsterInfo.uID) |
2686 pParty->monster_for_hunting_killed[i] = true; | |
319 | 2687 |
2688 for (uint i = 0; i < 22; ++i) | |
2689 actor->pActorBuffs[i].Reset(); | |
2690 | |
2691 ItemGen drop; | |
1012 | 2692 drop.Reset(); |
319 | 2693 switch (actor->pMonsterInfo.uID) |
0 | 2694 { |
319 | 2695 case MONSTER_HARPY_1: case MONSTER_HARPY_2: case MONSTER_HARPY_3: |
2696 drop.uItemID = ITEM_HARPY_FEATHER; | |
2697 break; | |
2698 | |
2699 case MONSTER_OOZE_1: case MONSTER_OOZE_2: case MONSTER_OOZE_3: | |
2700 drop.uItemID = ITEM_OOZE_ECTOPLASM_BOTTLE; | |
2701 break; | |
2702 | |
2703 case MONSTER_TROLL_1: case MONSTER_TROLL_2: case MONSTER_TROLL_3: | |
2704 drop.uItemID = ITEM_TROLL_BLOOD; | |
2705 break; | |
2706 | |
2707 case MONSTER_DEVIL_1: case MONSTER_DEVIL_2: case MONSTER_DEVIL_3: | |
2708 drop.uItemID = ITEM_DEVIL_ICHOR; | |
2709 break; | |
2710 | |
2711 case MONSTER_DRAGON_1: case MONSTER_DRAGON_2: case MONSTER_DRAGON_3: | |
2712 drop.uItemID = ITEM_DRAGON_EYE; | |
321 | 2713 break; |
0 | 2714 } |
319 | 2715 |
1759 | 2716 if (rand() % 100 < 20 && drop.uItemID != 0) |
0 | 2717 { |
319 | 2718 sub_42F7EB_DropItemAt(pItemsTable->pItems[drop.uItemID].uSpriteID, |
2719 actor->vPosition.x, | |
2720 actor->vPosition.y, | |
2721 actor->vPosition.z + 16, | |
2722 rand() % 200 + 200, | |
0 | 2723 1, |
2724 1, | |
2725 0, | |
319 | 2726 &drop); |
0 | 2727 } |
319 | 2728 |
2729 if (actor->pMonsterInfo.uSpecialAbilityType == MONSTER_SPECIAL_ABILITY_EXPLODE) | |
2730 Actor::Explode(uActorID); | |
0 | 2731 } |
2732 | |
2733 //----- (00402CED) -------------------------------------------------------- | |
322 | 2734 void Actor::PlaySound(unsigned int uActorID, unsigned int uSoundID) |
0 | 2735 { |
1408 | 2736 //Actor *v2; // eax@1 |
0 | 2737 unsigned __int16 v3; // dx@1 |
2738 int v4; // eax@3 | |
2739 int v5; // eax@4 | |
2740 unsigned int v6; // eax@6 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
2741 //signed int v7; // eax@12 |
0 | 2742 signed int v8; // [sp-18h] [bp-1Ch]@10 |
2743 signed int v9; // [sp-14h] [bp-18h]@10 | |
2744 int v10; // [sp-10h] [bp-14h]@10 | |
2745 unsigned int v11; // [sp-Ch] [bp-10h]@10 | |
2746 int v12; // [sp-8h] [bp-Ch]@10 | |
2747 | |
1408 | 2748 //v2 = &pActors[uActorID]; |
2749 v3 = pActors[uActorID].pSoundSampleIDs[uSoundID]; | |
0 | 2750 if ( v3 ) |
2751 { | |
1408 | 2752 if ( (signed __int64)pActors[uActorID].pActorBuffs[3].uExpireTime <= 0 ) |
0 | 2753 { |
2754 v12 = 0; | |
2755 v8 = -1; | |
2756 } | |
2757 else | |
2758 { | |
1408 | 2759 v4 = pActors[uActorID].pActorBuffs[3].uPower - 2; |
0 | 2760 if ( v4 ) |
2761 { | |
2762 v5 = v4 - 1; | |
2763 if ( v5 ) | |
2764 { | |
2765 if ( v5 == 1 ) | |
2766 v6 = 55125; | |
2767 else | |
2768 v6 = uActorID; | |
2769 } | |
2770 else | |
2771 { | |
2772 v6 = 44100; | |
2773 } | |
2774 } | |
2775 else | |
2776 { | |
2777 v6 = 33075; | |
2778 } | |
2779 v12 = v6; | |
2780 v8 = 0; | |
2781 } | |
1036 | 2782 pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, 0, 0, 0, v12); |
0 | 2783 } |
2784 } | |
2785 | |
2786 //----- (00402AD7) -------------------------------------------------------- | |
1060 | 2787 void Actor::AI_Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir) |
0 | 2788 { |
2789 unsigned int v5; // edi@1 | |
2790 int v6; // eax@1 | |
2791 Actor *v7; // ebx@1 | |
2792 unsigned int v8; // ecx@1 | |
2793 char v9; // zf@1 | |
2794 AIDirection *v10; // esi@6 | |
1052 | 2795 //int v12; // ecx@19 |
2796 //unsigned int v13; // eax@19 | |
0 | 2797 AIDirection a3; // [sp+Ch] [bp-5Ch]@7 |
1052 | 2798 //AIDirection v15; // [sp+28h] [bp-40h]@7 |
0 | 2799 AIDirection v16; // [sp+44h] [bp-24h]@7 |
1052 | 2800 //unsigned int v17; // [sp+60h] [bp-8h]@1 |
0 | 2801 unsigned int v18; // [sp+64h] [bp-4h]@1 |
1052 | 2802 //int v19; // [sp+70h] [bp+8h]@19 |
0 | 2803 |
2804 v5 = uActorID; | |
2805 v6 = 0; | |
2806 v7 = &pActors[uActorID]; | |
2807 v18 = a2; | |
862 | 2808 v8 = PID(OBJECT_Actor,uActorID); |
0 | 2809 v9 = v7->pMonsterInfo.uFlying == 0; |
2810 if ( !v9 && !pParty->bFlying ) | |
2811 { | |
2812 if ( v7->pMonsterInfo.uMissleAttack1Type ) | |
2813 v6 = v7->uActorRadius + 512; | |
2814 else | |
2815 v6 = pParty->uPartyHeight; | |
2816 } | |
1052 | 2817 |
0 | 2818 v10 = pDir; |
2819 if ( !pDir ) | |
2820 { | |
1052 | 2821 memcpy(&v16, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v16)); |
0 | 2822 v10 = &v16; |
2823 } | |
2824 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
2825 { | |
2826 if ( !uActionLength ) | |
2827 uActionLength = 256; | |
414 | 2828 Actor::AI_StandOrBored(v5, 4, uActionLength, v10); |
322 | 2829 return; |
0 | 2830 } |
2831 if ( (double)(signed int)v10->uDistance < 307.2 ) | |
2832 { | |
2833 if ( !uActionLength ) | |
2834 uActionLength = 256; | |
413 | 2835 Actor::AI_Stand(v5, v18, uActionLength, v10); |
322 | 2836 return; |
0 | 2837 } |
2838 if ( !v7->uMovementSpeed ) | |
322 | 2839 { |
413 | 2840 Actor::AI_Stand(v5, v18, uActionLength, v10); |
322 | 2841 return; |
2842 } | |
0 | 2843 v18 = 16; |
2844 if ( arg0 % 2 ) | |
2845 v18 = -16; | |
1052 | 2846 |
0 | 2847 v7->uYawAngle = stru_5C6E00->Atan2( |
1643 | 2848 pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, |
2849 pParty->vPosition.y + fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); | |
0 | 2850 if ( uActionLength ) |
2851 v7->uCurrentActionLength = uActionLength; | |
2852 else | |
2853 v7->uCurrentActionLength = 128; | |
2854 v7->uPitchAngle = LOWORD(v10->uPitchAngle); | |
2855 v7->uAIState = Pursuing; | |
322 | 2856 v7->UpdateAnimation(); |
0 | 2857 } |
2858 | |
2859 //----- (00402968) -------------------------------------------------------- | |
1060 | 2860 void Actor::AI_Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4) |
0 | 2861 { |
2862 unsigned int v4; // esi@1 | |
2863 Actor *v5; // ebx@1 | |
322 | 2864 //unsigned int result; // eax@1 |
0 | 2865 int v7; // ecx@2 |
2866 signed __int16 v8; // cx@10 | |
2867 unsigned __int16 v9; // ax@15 | |
2868 AIDirection v10; // [sp+8h] [bp-7Ch]@4 | |
2869 AIDirection a3; // [sp+24h] [bp-60h]@3 | |
2870 AIDirection v12; // [sp+40h] [bp-44h]@3 | |
2871 AIDirection v13; // [sp+5Ch] [bp-28h]@4 | |
2872 signed int a1; // [sp+78h] [bp-Ch]@2 | |
2873 unsigned int v15; // [sp+7Ch] [bp-8h]@1 | |
848 | 2874 //signed int a2; // [sp+80h] [bp-4h]@1 |
0 | 2875 |
2876 v4 = uActorID; | |
848 | 2877 //a2 = edx0; |
0 | 2878 v15 = uActorID; |
2879 v5 = &pActors[uActorID]; | |
322 | 2880 //result = pActors[uActorID].CanAct(); |
2881 if ( pActors[uActorID].CanAct() ) | |
0 | 2882 { |
862 | 2883 v7 = PID(OBJECT_Actor,v4); |
2884 a1 = PID(OBJECT_Actor,v4); | |
0 | 2885 if ( !a4 ) |
2886 { | |
2887 a4 = &v12; | |
848 | 2888 memcpy(&v12, Actor::GetDirectionInfo(v7, sTargetPid, &a3, v5->pMonsterInfo.uFlying), sizeof(v12)); |
0 | 2889 v7 = a1; |
2890 } | |
2891 memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3)); | |
2892 memcpy(&v13, &a3, sizeof(v13)); | |
2893 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) | |
848 | 2894 || PID_TYPE(sTargetPid) == OBJECT_Actor && (double)(signed int)v13.uDistance < 307.2 ) |
0 | 2895 { |
2896 if ( !uActionLength ) | |
2897 uActionLength = 256; | |
414 | 2898 Actor::AI_StandOrBored(v15, 4, uActionLength, &v13); |
0 | 2899 } |
2900 else | |
2901 { | |
2902 v8 = v5->uMovementSpeed; | |
2903 if ( v8 ) | |
2904 v5->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v8; | |
2905 else | |
2906 v5->uCurrentActionLength = 0; | |
2907 if ( v5->uCurrentActionLength > 256 ) | |
2908 v5->uCurrentActionLength = 256; | |
2909 v5->uYawAngle = LOWORD(stru_5C6E00->uIntegerHalfPi) + LOWORD(a4->uYawAngle); | |
2910 v5->uYawAngle = LOWORD(stru_5C6E00->uDoublePiMask) & (v5->uYawAngle + rand() % (signed int)stru_5C6E00->uIntegerPi); | |
2911 v9 = LOWORD(a4->uPitchAngle); | |
2912 v5->uCurrentActionTime = 0; | |
2913 v5->uPitchAngle = v9; | |
2914 v5->uAIState = Fleeing; | |
322 | 2915 v5->UpdateAnimation(); |
0 | 2916 } |
2917 } | |
2918 } | |
2919 | |
2920 //----- (0040281C) -------------------------------------------------------- | |
1060 | 2921 void Actor::AI_Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) |
0 | 2922 { |
2923 unsigned int v5; // edi@1 | |
2924 int v6; // eax@1 | |
2925 Actor *v7; // ebx@1 | |
2926 unsigned int v8; // ecx@1 | |
2927 char v9; // zf@1 | |
2928 AIDirection *v10; // esi@7 | |
2929 signed int v11; // edx@12 | |
2930 signed __int16 v13; // cx@19 | |
2931 unsigned __int16 v14; // ax@25 | |
2932 int v15; // [sp-8h] [bp-54h]@12 | |
2933 AIDirection *v16; // [sp-4h] [bp-50h]@12 | |
2934 AIDirection a3; // [sp+Ch] [bp-40h]@8 | |
2935 AIDirection v18; // [sp+28h] [bp-24h]@8 | |
2936 unsigned int v19; // [sp+44h] [bp-8h]@1 | |
2937 unsigned int v20; // [sp+48h] [bp-4h]@1 | |
2938 | |
2939 v5 = uActorID; | |
2940 v6 = 0; | |
2941 v7 = &pActors[uActorID]; | |
2942 v19 = a2; | |
862 | 2943 v8 = PID(OBJECT_Actor,uActorID); |
0 | 2944 v9 = v7->pMonsterInfo.uFlying == 0; |
2945 v20 = v5; | |
2946 if ( !v9 && !pParty->bFlying ) | |
2947 { | |
2948 if ( v7->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2949 v6 = v7->uActorRadius + 512; | |
2950 else | |
2951 v6 = pParty->uPartyHeight; | |
2952 } | |
2953 v10 = pDir; | |
2954 if ( !pDir ) | |
2955 { | |
2956 memcpy(&v18, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v18)); | |
2957 memcpy(0, &v18, 0x1Cu); | |
2958 v10 = 0; | |
2959 v5 = v20; | |
2960 } | |
2961 if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
2962 { | |
2963 if ( !uActionLength ) | |
2964 uActionLength = 256; | |
2965 v16 = v10; | |
2966 v15 = uActionLength; | |
2967 v11 = 4; | |
414 | 2968 Actor::AI_StandOrBored(v5, v11, v15, v16); |
322 | 2969 return; |
0 | 2970 } |
2971 if ( (signed int)v10->uDistance < a5 ) | |
2972 { | |
2973 if ( !uActionLength ) | |
2974 uActionLength = 256; | |
2975 v11 = v19; | |
2976 v16 = v10; | |
2977 v15 = uActionLength; | |
414 | 2978 Actor::AI_StandOrBored(v5, v11, v15, v16); |
322 | 2979 return; |
0 | 2980 } |
2981 if ( uActionLength ) | |
2982 { | |
2983 v7->uCurrentActionLength = uActionLength; | |
2984 } | |
2985 else | |
2986 { | |
2987 v13 = v7->uMovementSpeed; | |
2988 if ( v13 ) | |
2989 v7->uCurrentActionLength = (signed int)(v10->uDistanceXZ << 7) / v13; | |
2990 else | |
2991 v7->uCurrentActionLength = 0; | |
2992 if ( v7->uCurrentActionLength > 32 ) | |
2993 v7->uCurrentActionLength = 32; | |
2994 } | |
2995 v7->uYawAngle = LOWORD(v10->uYawAngle); | |
2996 v14 = LOWORD(v10->uPitchAngle); | |
2997 v7->uCurrentActionTime = 0; | |
2998 v7->uPitchAngle = v14; | |
2999 v7->uAIState = Pursuing; | |
322 | 3000 v7->UpdateAnimation(); |
0 | 3001 } |
3002 | |
3003 //----- (00402686) -------------------------------------------------------- | |
1060 | 3004 void Actor::AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) |
0 | 3005 { |
860 | 3006 //unsigned int v4; // edi@1 |
0 | 3007 int v5; // eax@1 |
3008 Actor *v6; // ebx@1 | |
3009 int v7; // ecx@1 | |
3010 char v8; // zf@1 | |
860 | 3011 //AIDirection *v9; // esi@7 |
0 | 3012 signed int v10; // edx@12 |
3013 signed __int16 v12; // cx@19 | |
3014 int v13; // edx@25 | |
3015 __int16 v14; // ax@25 | |
3016 unsigned __int16 v15; // ax@26 | |
3017 unsigned __int16 v16; // ax@28 | |
3018 int v17; // [sp-8h] [bp-54h]@12 | |
860 | 3019 //AIDirection *v18; // [sp-4h] [bp-50h]@12 |
0 | 3020 AIDirection a3; // [sp+Ch] [bp-40h]@8 |
3021 AIDirection v20; // [sp+28h] [bp-24h]@8 | |
3022 int v21; // [sp+44h] [bp-8h]@1 | |
860 | 3023 //unsigned int v22; // [sp+48h] [bp-4h]@1 |
0 | 3024 |
3025 v5 = 0; | |
3026 v6 = &pActors[uActorID]; | |
3027 v21 = a2; | |
862 | 3028 v7 = PID(OBJECT_Actor,uActorID); |
0 | 3029 v8 = v6->pMonsterInfo.uFlying == 0; |
3030 if ( !v8 && !pParty->bFlying ) | |
3031 { | |
3032 if ( v6->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
3033 v5 = v6->uActorRadius + 512; | |
3034 else | |
3035 v5 = pParty->uPartyHeight; | |
3036 } | |
3037 if ( !a4 ) | |
3038 { | |
3039 memcpy(&v20, Actor::GetDirectionInfo(v7, a2, &a3, v5), sizeof(v20)); | |
3040 } | |
3041 if ( MonsterStats::BelongsToSupertype(v6->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
3042 { | |
3043 if ( !uActionLength ) | |
3044 uActionLength = 256; | |
860 | 3045 return Actor::AI_StandOrBored(uActorID, 4, uActionLength, a4); |
0 | 3046 } |
860 | 3047 if ( (double)(signed int)a4->uDistance < 307.2 ) |
0 | 3048 { |
3049 if ( !uActionLength ) | |
3050 uActionLength = 256; | |
860 | 3051 return Actor::AI_StandOrBored(uActorID, v21, uActionLength, a4); |
0 | 3052 } |
3053 if ( uActionLength ) | |
3054 { | |
3055 v6->uCurrentActionLength = uActionLength + rand() % uActionLength; | |
3056 } | |
3057 else | |
3058 { | |
3059 v12 = v6->uMovementSpeed; | |
3060 if ( v12 ) | |
860 | 3061 v6->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v12; |
0 | 3062 else |
3063 v6->uCurrentActionLength = 0; | |
3064 if ( v6->uCurrentActionLength > 128 ) | |
3065 v6->uCurrentActionLength = 128; | |
3066 } | |
3067 v13 = rand() % 2; | |
860 | 3068 v14 = LOWORD(a4->uYawAngle); |
0 | 3069 if ( v13 ) |
3070 v15 = v14 + 256; | |
3071 else | |
3072 v15 = v14 - 256; | |
3073 v6->uYawAngle = v15; | |
860 | 3074 v16 = LOWORD(a4->uPitchAngle); |
0 | 3075 v6->uCurrentActionTime = 0; |
3076 v6->uPitchAngle = v16; | |
3077 v6->uAIState = Pursuing; | |
3078 if ( rand() % 100 < 2 ) | |
860 | 3079 Actor::PlaySound(uActorID, 2u); |
322 | 3080 v6->UpdateAnimation(); |
0 | 3081 } |
3082 | |
417 | 3083 //----- (00SelectTarget) -------------------------------------------------------- |
3084 void Actor::_SelectTarget(unsigned int uActorID, int *a2, bool can_target_party) | |
0 | 3085 { |
417 | 3086 //Actor *v3; // esi@1 |
3087 //unsigned int v4; // ebx@1 | |
0 | 3088 int v5; // ecx@1 |
417 | 3089 //unsigned int v6; // eax@1 |
3090 //Actor *v7; // edi@2 | |
3091 //__int16 v8; // ax@3 | |
0 | 3092 int v9; // eax@10 |
3093 signed int v10; // eax@13 | |
3094 int v11; // ebx@16 | |
3095 int v12; // eax@16 | |
417 | 3096 //int v13; // eax@25 |
0 | 3097 signed int v14; // eax@31 |
3098 int v15; // edi@43 | |
3099 int v16; // ebx@45 | |
3100 int v17; // eax@45 | |
417 | 3101 //int v18; // eax@51 |
0 | 3102 int v19; // [sp+Ch] [bp-24h]@16 |
417 | 3103 //int *v20; // [sp+10h] [bp-20h]@1 |
0 | 3104 signed int v21; // [sp+14h] [bp-1Ch]@1 |
417 | 3105 //unsigned int v22; // [sp+18h] [bp-18h]@1 |
0 | 3106 int v23; // [sp+1Ch] [bp-14h]@16 |
417 | 3107 //unsigned int v24; // [sp+20h] [bp-10h]@1 |
0 | 3108 int v25; // [sp+24h] [bp-Ch]@1 |
417 | 3109 //signed int v26; // [sp+28h] [bp-8h]@1 |
0 | 3110 int v27; // [sp+2Ch] [bp-4h]@16 |
3111 int v28; // [sp+2Ch] [bp-4h]@45 | |
3112 | |
3113 v25 = -1; | |
417 | 3114 //v22 = uActorID; |
3115 //v3 = &pActors[uActorID]; | |
3116 //v4 = 0; | |
0 | 3117 v5 = 0; |
417 | 3118 //v6 = v3->uLastCharacterIDToHit; |
0 | 3119 *a2 = 0; |
417 | 3120 //v20 = a2; |
0 | 3121 v21 = 0; |
417 | 3122 //v24 = v3->uLastCharacterIDToHit; |
3123 //v26 = 0; | |
3124 assert(uActorID < uNumActors); | |
1202 | 3125 auto _this = &pActors[uActorID]; |
417 | 3126 |
3127 for (uint i = 0; i < uNumActors; ++i) | |
0 | 3128 { |
1202 | 3129 auto actor = &pActors[i]; |
417 | 3130 //v7 = pActors; |
3131 //do | |
3132 //{ | |
3133 //v8 = v7->uAIState; | |
3134 if (actor->uAIState == Dead || actor->uAIState == Dying || | |
3135 actor->uAIState == Removed || actor->uAIState == Summoned || actor->uAIState == Disabled || uActorID == i ) | |
3136 continue; | |
3137 | |
862 | 3138 if (_this->uLastCharacterIDToHit == 0 || (v9 = 8 * v5, LOBYTE(v9) = PID(OBJECT_Actor,v5), _this->uLastCharacterIDToHit != v9) ) |
245 | 3139 { |
417 | 3140 v10 = _this->GetActorsRelation(actor); |
3141 if ( v10 == 0 ) | |
245 | 3142 continue; |
3143 } | |
417 | 3144 else if (_this->IsNotAlive()) |
245 | 3145 { |
417 | 3146 _this->uLastCharacterIDToHit = 0; |
3147 v10 = _this->GetActorsRelation(actor); | |
3148 if ( v10 == 0 ) | |
245 | 3149 continue; |
3150 } | |
3151 else | |
3152 { | |
417 | 3153 //v18 = actor->uGroup; |
3154 if ( (actor->uGroup != 0 || _this->uGroup != 0) && actor->uGroup == _this->uGroup ) | |
245 | 3155 continue; |
3156 v10 = 4; | |
3157 } | |
417 | 3158 if ( _this->pMonsterInfo.uHostilityType ) |
3159 v10 = pMonsterStats->pInfos[_this->pMonsterInfo.uID].uHostilityType; | |
245 | 3160 v11 = dword_4DF380[v10]; |
417 | 3161 v23 = abs(_this->vPosition.x - actor->vPosition.x); |
3162 v27 = abs(_this->vPosition.y - actor->vPosition.y); | |
3163 v12 = abs(_this->vPosition.z - actor->vPosition.z); | |
245 | 3164 v19 = v12; |
3165 if ( v23 <= v11 | |
3166 && v27 <= v11 | |
3167 && v12 <= v11 | |
1493 | 3168 && sub_4070EF_prolly_detect_player(PID(OBJECT_Actor, i), PID(OBJECT_Actor, uActorID)) |
245 | 3169 && v23 * v23 + v27 * v27 + v19 * v19 < (unsigned int)v25 ) |
3170 { | |
3171 v25 = v23 * v23 + v27 * v27 + v19 * v19; | |
417 | 3172 v21 = i; |
245 | 3173 } |
417 | 3174 //v4 = 0; |
3175 //++v7; | |
3176 //v5 = v26++ + 1; | |
3177 //} | |
3178 //while ( v26 < (signed int)uNumActors ); | |
3179 | |
0 | 3180 } |
417 | 3181 if ( v25 != -1 ) |
3182 { | |
3183 //v13 = 8 * v21; | |
862 | 3184 //LOBYTE(v13) = PID(OBJECT_Actor,v21); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
823
diff
changeset
|
3185 *a2 = PID(OBJECT_Actor, v21); |
417 | 3186 } |
3187 | |
3188 if (pParty->Invisible()) | |
3189 can_target_party = false; | |
3190 | |
3191 if (can_target_party) | |
0 | 3192 { |
417 | 3193 v14 = _this->GetActorsRelation(0); |
3194 if ( BYTE2(_this->uAttributes) & 8 | |
3195 && SHIDWORD(_this->pActorBuffs[12].uExpireTime) <= (signed int)0 | |
3196 && (SHIDWORD(_this->pActorBuffs[12].uExpireTime) < (signed int)0 || LODWORD(_this->pActorBuffs[12].uExpireTime) <= 0) | |
3197 && SHIDWORD(_this->pActorBuffs[1].uExpireTime) <= (signed int)0 | |
3198 && (SHIDWORD(_this->pActorBuffs[1].uExpireTime) < (signed int)0 || LODWORD(_this->pActorBuffs[1].uExpireTime) <= 0) | |
3199 && SHIDWORD(_this->pActorBuffs[2].uExpireTime) <= (signed int)0 | |
3200 && (SHIDWORD(_this->pActorBuffs[2].uExpireTime) < (signed int)0 || LODWORD(_this->pActorBuffs[2].uExpireTime) <= 0) ) | |
0 | 3201 v14 = 4; |
417 | 3202 if ( v14 != 0 ) |
0 | 3203 { |
848 | 3204 v15 = dword_4DF380[4]; |
417 | 3205 if ( !_this->pMonsterInfo.uHostilityType ) |
0 | 3206 v15 = dword_4DF380[v14]; |
417 | 3207 v16 = abs(_this->vPosition.x - pParty->vPosition.x); |
3208 v28 = abs(_this->vPosition.y - pParty->vPosition.y); | |
3209 v17 = abs(_this->vPosition.z - pParty->vPosition.z); | |
0 | 3210 if ( v16 <= v15 && v28 <= v15 && v17 <= v15 ) |
3211 { | |
3212 if ( v16 * v16 + v28 * v28 + v17 * v17 < (unsigned int)v25 ) | |
417 | 3213 *a2 = OBJECT_Player; |
0 | 3214 } |
3215 } | |
3216 } | |
3217 } | |
3218 // 4DF380: using guessed type int dword_4DF380[]; | |
3219 // 4DF390: using guessed type int dword_4DF390; | |
3220 | |
3221 //----- (0040104C) -------------------------------------------------------- | |
3222 signed int Actor::GetActorsRelation(Actor *a2) | |
3223 { | |
3224 Actor *v2; // esi@1 | |
3225 int v3; // ebp@5 | |
3226 int v4; // edi@11 | |
3227 unsigned int v5; // edx@15 | |
3228 unsigned int v6; // eax@16 | |
3229 unsigned int v7; // ebp@19 | |
3230 int v8; // eax@22 | |
3231 unsigned int v9; // edx@25 | |
3232 unsigned int v10; // edx@33 | |
3233 | |
3234 auto a1 = this; | |
3235 v2 = a2; | |
3236 if ( a1 ) | |
3237 { | |
3238 if ( SHIDWORD(a1->pActorBuffs[9].uExpireTime) >= 0 | |
3239 && (SHIDWORD(a1->pActorBuffs[9].uExpireTime) > 0 || LODWORD(a1->pActorBuffs[9].uExpireTime) > 0) ) | |
3240 return 4; | |
3241 v3 = a1->pMonsterInfo.uID; | |
3242 } | |
3243 else | |
3244 { | |
3245 v3 = 0; | |
3246 } | |
3247 if ( a2 ) | |
3248 { | |
3249 if ( SHIDWORD(a2->pActorBuffs[9].uExpireTime) >= 0 | |
3250 && (SHIDWORD(a2->pActorBuffs[9].uExpireTime) > 0 || LODWORD(a2->pActorBuffs[9].uExpireTime) > 0) ) | |
3251 return 4; | |
3252 v4 = a2->pMonsterInfo.uID; | |
3253 } | |
3254 else | |
3255 { | |
3256 v4 = 0; | |
3257 } | |
3258 if ( a2 ) | |
3259 { | |
3260 if ( a1 ) | |
3261 { | |
3262 v5 = a2->uGroup; | |
3263 if ( v5 ) | |
3264 { | |
3265 v6 = a1->uGroup; | |
3266 if ( v6 ) | |
3267 { | |
3268 if ( v5 == v6 ) | |
3269 return 0; | |
3270 } | |
3271 } | |
3272 } | |
3273 } | |
3274 if ( v3 ) | |
3275 v7 = (v3 - 1) / 3 + 1; | |
3276 else | |
3277 v7 = 0; | |
3278 if ( v4 ) | |
3279 v8 = (v4 - 1) / 3 + 1; | |
3280 else | |
3281 v8 = 0; | |
3282 if ( a1 ) | |
3283 { | |
3284 v9 = a1->uAlly; | |
245 | 3285 if ( (signed int)v9 > 0 ) |
0 | 3286 { |
3287 if ( v9 != 9999 ) | |
3288 { | |
3289 v7 = a1->uAlly; | |
3290 } | |
3291 } | |
245 | 3292 if(v9==9999) |
3293 v7 = 0; | |
0 | 3294 if ( (signed __int64)a1->pActorBuffs[12].uExpireTime > 0 ) |
3295 v7 = 0; | |
3296 } | |
245 | 3297 if ( v2 ) |
0 | 3298 { |
245 | 3299 v10 = v2->uAlly; |
3300 if ( (signed int)v10 > 0 ) | |
3301 { | |
3302 if ( v10 != 9999 ) | |
3303 { | |
3304 v8 = v2->uAlly; | |
3305 } | |
3306 } | |
3307 if(v10==9999) | |
3308 v8 = 0; | |
3309 if ( (signed __int64)v2->pActorBuffs[12].uExpireTime > 0 ) | |
3310 v8 = 0; | |
0 | 3311 } |
3312 if ( a1 && (signed __int64)a1->pActorBuffs[1].uExpireTime > 0 && !v8 | |
3313 || v2 && (signed __int64)v2->pActorBuffs[1].uExpireTime > 0 && !v7 ) | |
3314 return 0; | |
3315 if ( a1 && (signed __int64)a1->pActorBuffs[12].uExpireTime <= 0 && a1->uAttributes & 0x80000 && !v8 ) | |
3316 return 4; | |
3317 if ( v2 && a1 && (signed __int64)a1->pActorBuffs[12].uExpireTime <= 0 && v2->uAttributes & 0x80000 ) | |
3318 { | |
3319 if ( v7 ) | |
245 | 3320 { |
3321 if ( (signed int)v7 < 89 ) | |
3322 { | |
3323 if ( v8 < 89 ) | |
3324 return pFactionTable->relations[v7][v8]; | |
3325 return 0; | |
3326 } | |
3327 return 0; | |
3328 } | |
0 | 3329 return 4; |
3330 } | |
3331 if ( !v7 ) | |
3332 { | |
3333 if ( (!v2 || (signed __int64)v2->pActorBuffs[12].uExpireTime > 0 || !(v2->uAttributes & 0x80000)) | |
100 | 3334 && !pFactionTable->relations[v8][0]) |
0 | 3335 { |
3336 if ( v8 < 89 ) | |
100 | 3337 return pFactionTable->relations[v7][v8]; |
0 | 3338 return 0; |
3339 } | |
3340 return 4; | |
3341 } | |
3342 if ( (signed int)v7 < 89 ) | |
245 | 3343 { |
3344 if ( v8 < 89 ) | |
3345 return pFactionTable->relations[v7][v8]; | |
3346 return 0; | |
3347 } | |
0 | 3348 return 0; |
3349 } | |
3350 | |
3351 //----- (0045976D) -------------------------------------------------------- | |
322 | 3352 void Actor::UpdateAnimation() |
0 | 3353 { |
322 | 3354 //AIState state; // edx@1 |
3355 //unsigned int result; // eax@1 | |
0 | 3356 |
322 | 3357 //state = (AIState)this->; |
3358 uAttributes &= 0xFFDFFFFF; | |
3359 //result = this->uAttributes; | |
3360 switch (uAIState) | |
0 | 3361 { |
3362 case Tethered: | |
322 | 3363 uCurrentActionAnimation = ANIM_Walking; |
3364 break; | |
3365 | |
0 | 3366 case AttackingMelee: |
322 | 3367 uCurrentActionAnimation = ANIM_AtkMelee; |
3368 uAttributes |= 0x200000u; | |
3369 break; | |
3370 | |
0 | 3371 case AttackingRanged1: |
3372 case AttackingRanged2: | |
3373 case AttackingRanged3: | |
3374 case AttackingRanged4: | |
322 | 3375 uCurrentActionAnimation = ANIM_AtkRanged; |
3376 uAttributes |= 0x200000u; | |
3377 break; | |
3378 | |
0 | 3379 case Dying: |
3380 case Resurrected: | |
322 | 3381 uCurrentActionAnimation = ANIM_Dying; |
3382 uAttributes |= 0x200000u; | |
3383 break; | |
3384 | |
0 | 3385 case Pursuing: |
3386 case Fleeing: | |
322 | 3387 uCurrentActionAnimation = ANIM_Walking; |
3388 uAttributes |= 0x200000u; | |
3389 break; | |
3390 | |
0 | 3391 case Stunned: |
322 | 3392 uCurrentActionAnimation = ANIM_GotHit; |
3393 uAttributes |= 0x200000u; | |
3394 break; | |
3395 | |
0 | 3396 case Fidgeting: |
322 | 3397 uCurrentActionAnimation = ANIM_Bored; |
3398 uAttributes |= 0x200000u; | |
3399 break; | |
3400 | |
0 | 3401 case Standing: |
3402 case Interacting: | |
3403 case Summoned: | |
322 | 3404 uCurrentActionAnimation = ANIM_Standing; |
3405 uAttributes |= 0x200000u; | |
3406 break; | |
3407 | |
0 | 3408 case Dead: |
322 | 3409 if (pSpriteFrameTable->pSpriteSFrames[pSpriteIDs[ANIM_Dead]].pHwSpriteIDs[0] <= 0) |
3410 uAIState = Removed; | |
0 | 3411 else |
322 | 3412 uCurrentActionAnimation = ANIM_Dead; |
3413 break; | |
3414 | |
551 | 3415 case Removed: |
652 | 3416 case Disabled: |
551 | 3417 return; |
3418 | |
0 | 3419 default: |
322 | 3420 assert(false); |
0 | 3421 } |
3422 } | |
3423 | |
3424 //----- (00459671) -------------------------------------------------------- | |
3425 void Actor::Reset() | |
3426 { | |
3427 this->pActorName[0] = 0; | |
3428 this->word_000086_some_monster_id = 0; | |
602 | 3429 this->sNPC_ID = 0; |
0 | 3430 this->vPosition.z = 0; |
3431 this->vPosition.y = 0; | |
3432 this->vPosition.x = 0; | |
3433 this->vVelocity.z = 0; | |
3434 this->vVelocity.y = 0; | |
3435 this->vVelocity.x = 0; | |
3436 this->uYawAngle = 0; | |
3437 this->uPitchAngle = 0; | |
3438 this->uAttributes = 0; | |
3439 this->uSectorID = 0; | |
3440 this->uCurrentActionTime = 0; | |
3441 this->vInitialPosition.z = 0; | |
3442 this->vInitialPosition.y = 0; | |
3443 this->vInitialPosition.x = 0; | |
3444 this->vGuardingPosition.z = 0; | |
3445 this->vGuardingPosition.y = 0; | |
3446 this->vGuardingPosition.x = 0; | |
3447 this->uTetherDistance = 256; | |
3448 this->uActorRadius = 32; | |
3449 this->uActorHeight = 128; | |
3450 this->uAIState = Standing; | |
305 | 3451 this->uCurrentActionAnimation = ANIM_Standing; |
0 | 3452 this->uMovementSpeed = 200; |
3453 this->uCarriedItemID = 0; | |
3454 this->uGroup = 0; | |
3455 this->uAlly = 0; | |
3456 this->uSummonerID = 0; | |
3457 this->uLastCharacterIDToHit = 0; | |
3458 this->dword_000334_unique_name = 0; | |
3459 memset(this->pSpriteIDs, 0, sizeof(pSpriteIDs)); | |
3460 memset(this->pActorBuffs, 0, 0x160u); | |
3461 } | |
3462 | |
3463 //----- (0045959A) -------------------------------------------------------- | |
3464 void Actor::PrepareSprites(char load_sounds_if_bit1_set) | |
3465 { | |
694 | 3466 |
3467 MonsterDesc *v3; // esi@1 | |
0 | 3468 MonsterInfo *v9; // [sp+84h] [bp-10h]@1 |
694 | 3469 |
0 | 3470 v3 = &pMonsterList->pMonsters[pMonsterInfo.uID - 1]; |
3471 v9 = &pMonsterStats->pInfos[pMonsterInfo.uID - 1 + 1]; | |
3472 //v12 = pSpriteIDs; | |
3473 //Source = (char *)v3->pSpriteNames; | |
3474 //do | |
3475 for (uint i = 0; i < 8; ++i) | |
3476 { | |
3477 //strcpy(pSpriteName, v3->pSpriteNames[i]); | |
3478 pSpriteIDs[i] = pSpriteFrameTable->FastFindSprite(v3->pSpriteNames[i]); | |
3479 pSpriteFrameTable->InitializeSprite(pSpriteIDs[i]); | |
3480 } | |
3481 uActorHeight = v3->uMonsterHeight; | |
3482 uActorRadius = v3->uMonsterRadius; | |
33 | 3483 uMovementSpeed = v9->uBaseSpeed; |
0 | 3484 if ( !(load_sounds_if_bit1_set & 1) ) |
3485 { | |
694 | 3486 for (int i=0;i<4;++i ) |
3487 pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; | |
0 | 3488 } |
3489 } | |
3490 | |
3491 //----- (00459667) -------------------------------------------------------- | |
3492 void Actor::Remove() | |
3493 { | |
3494 this->uAIState = Removed; | |
3495 } | |
3496 | |
3497 //----- (0044FD29) -------------------------------------------------------- | |
3498 int Actor::_44FD29(int a2) | |
3499 { | |
3500 Actor *v2; // edi@1 | |
3501 unsigned __int8 v3; // al@1 | |
3502 int v4; // esi@1 | |
3503 int v5; // edx@2 | |
3504 int v6; // eax@8 | |
3505 int v7; // edi@10 | |
3506 Actor *v8; // esi@10 | |
3507 MonsterInfo *v9; // ebx@10 | |
3508 MonsterDesc *v10; // edi@10 | |
3509 unsigned __int16 v11; // ax@10 | |
3510 int v12; // eax@10 | |
3511 int v13; // ebx@10 | |
3512 int v14; // eax@10 | |
3513 int v15; // edi@10 | |
3514 int v16; // eax@10 | |
3515 int v17; // ebx@10 | |
3516 Actor *v18; // ecx@10 | |
3517 signed __int64 v19; // qax@10 | |
3518 unsigned int v20; // eax@12 | |
3519 int v21; // eax@13 | |
3520 int result; // eax@13 | |
3521 Actor *v23; // eax@16 | |
3522 int v24; // [sp+Ch] [bp-1Ch]@1 | |
3523 unsigned int uFaceID; // [sp+10h] [bp-18h]@8 | |
3524 int v26; // [sp+14h] [bp-14h]@10 | |
3525 int v27; // [sp+18h] [bp-10h]@10 | |
3526 int v28; // [sp+1Ch] [bp-Ch]@8 | |
3527 int v29; // [sp+20h] [bp-8h]@10 | |
3528 Actor *v30; // [sp+24h] [bp-4h]@1 | |
3529 | |
3530 v2 = this; | |
3531 v24 = a2; | |
3532 v30 = this; | |
3533 v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls; | |
3534 v4 = this->pMonsterInfo.field_3C_some_special_attack; | |
3535 if ( v3 ) | |
3536 { | |
3537 if ( v3 >= 1u && v3 <= 3u ) | |
3538 v4 = v4 + v3 - 1; | |
3539 } | |
3540 else | |
3541 { | |
3542 v5 = rand() % 100; | |
3543 if ( v5 >= 60 ) | |
3544 { | |
3545 ++v4; | |
3546 if ( v5 >= 90 ) | |
3547 ++v4; | |
3548 } | |
3549 } | |
3550 v6 = v2->vPosition.z; | |
3551 v28 = 0; | |
3552 uFaceID = v6; | |
3553 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
3554 v28 = pIndoor->GetSector(v2->vPosition.x, v2->vPosition.y, v6); | |
3555 v7 = v4 - 1; | |
3556 v8 = &pActors[uNumActors]; | |
3557 v27 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | |
3558 v29 = v7; | |
3559 v9 = &pMonsterStats->pInfos[v7 + 1]; | |
3560 pActors[uNumActors].Reset(); | |
3561 v10 = &pMonsterList->pMonsters[v7]; | |
3562 strcpy(v8->pActorName, v9->pName); | |
3563 v8->sCurrentHP = LOWORD(v9->uHP); | |
3564 memcpy(&v8->pMonsterInfo, v9, 0x58u); | |
3565 v8->word_000086_some_monster_id = v29 + 1; | |
3566 v8->uActorRadius = v10->uMonsterRadius; | |
3567 v8->uActorHeight = v10->uMonsterHeight; | |
3568 v11 = v10->uMovementSpeed; | |
3569 v8->pMonsterInfo.uTreasureDiceRolls = 0; | |
3570 v8->pMonsterInfo.uTreasureType = 0; | |
3571 v8->pMonsterInfo.uExp = 0; | |
3572 v8->uMovementSpeed = v11; | |
3573 v12 = rand(); | |
3574 v13 = v12 % 2048; | |
323 | 3575 v14 = stru_5C6E00->Cos(v12 % 2048); |
0 | 3576 v26 = v14; |
3577 v15 = ((unsigned __int64)(v14 * (signed __int64)v27) >> 16) + v30->vPosition.x; | |
323 | 3578 v16 = stru_5C6E00->Sin(v13); |
0 | 3579 v26 = v16; |
3580 v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16; | |
3581 LOWORD(v16) = uFaceID; | |
3582 v17 = v29 + v30->vPosition.y; | |
3583 v8->vInitialPosition.z = uFaceID; | |
3584 v8->vPosition.z = v16; | |
3585 LOWORD(v16) = v28; | |
3586 v8->vInitialPosition.x = v15; | |
3587 v8->vPosition.x = v15; | |
3588 v8->vInitialPosition.y = v17; | |
3589 v8->vPosition.y = v17; | |
3590 v8->uTetherDistance = 256; | |
3591 v8->uSectorID = v16; | |
3592 v8->PrepareSprites(0); | |
3593 v18 = v30; | |
3594 v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
3595 LODWORD(v19) = v18->uAlly; | |
3596 if ( !(uint)v19 ) | |
3597 { | |
3598 uFaceID = v18->pMonsterInfo.uID - 1; | |
3599 v19 = (signed __int64)((double)uFaceID * 0.33333334); | |
3600 v18 = v30; | |
3601 } | |
3602 v8->uAlly = v19; | |
3603 v20 = v18->uGroup; | |
3604 v8->uCurrentActionTime = 0; | |
3605 v8->uGroup = v20; | |
3606 v8->uAIState = Summoned; | |
3607 v8->uCurrentActionLength = 256; | |
3608 v8->UpdateAnimation(); | |
3609 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor | |
3610 || (v21 = v30->vPosition.z, | |
3611 v27 = v30->vPosition.z, | |
3612 result = pIndoor->GetSector(v15, v17, v21), | |
3613 result == v28) | |
723 | 3614 && (result = BLV_GetFloorLevel(v15, v17, v27, result, &uFaceID), result != -30000) |
0 | 3615 && (result = abs(result - v27), result <= 1024) ) |
3616 { | |
3617 v23 = v30; | |
3618 ++uNumActors; | |
3619 ++v23->pMonsterInfo.uSpecialAbilityDamageDiceBonus; | |
3620 if ( v23->uAttributes & 0x80000 ) | |
3621 v8->uAttributes |= 0x80000u; | |
3622 result = 8 * v24; | |
862 | 3623 LOBYTE(result) = PID(OBJECT_Actor,v24); |
0 | 3624 v8->uSummonerID = result; |
3625 } | |
3626 return result; | |
781 | 3627 } |
1295 | 3628 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); |
3629 //----- (0046DF1A) -------------------------------------------------------- | |
3630 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) | |
3631 { | |
3632 Actor *v2; // edi@1 | |
3633 unsigned __int16 v3; // ax@1 | |
3634 int v4; // esi@6 | |
3635 int v5; // ecx@8 | |
3636 int v6; // eax@10 | |
3637 int v7; // edx@12 | |
3638 int v8; // ecx@14 | |
3639 int v9; // eax@14 | |
3640 int v10; // ebx@14 | |
3641 int v11; // esi@14 | |
3642 int v12; // ebx@15 | |
3643 int v13; // ebx@17 | |
3644 unsigned int v14; // eax@20 | |
3645 signed int result; // eax@21 | |
3646 int v16; // [sp+Ch] [bp-10h]@1 | |
3647 int v17; // [sp+10h] [bp-Ch]@14 | |
3648 int v18; // [sp+14h] [bp-8h]@14 | |
3649 int v19; // [sp+18h] [bp-4h]@14 | |
3650 | |
3651 v16 = a1; | |
3652 v2 = &pActors[a1]; | |
3653 v3 = v2->uAIState; | |
3654 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) | |
3655 goto LABEL_25; | |
3656 v4 = v2->uActorRadius; | |
3657 if ( a2 ) | |
3658 v4 = a2; | |
3659 v5 = v2->vPosition.x; | |
3660 if ( stru_721530.sMaxX > v5 + v4 | |
3661 || stru_721530.sMinX < v5 - v4 | |
3662 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) | |
3663 || stru_721530.sMinY < v6 - v4 | |
3664 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) | |
3665 || stru_721530.sMinZ < v7 | |
3666 || (v8 = v5 - stru_721530.normal.x, | |
3667 v9 = v6 - stru_721530.normal.y, | |
3668 v10 = stru_721530.prolly_normal_d + v4, | |
3669 v17 = stru_721530.prolly_normal_d + v4, | |
1546 | 3670 v11 = (v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16, |
1295 | 3671 v18 = v8, |
3672 v19 = v9, | |
1546 | 3673 abs((v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16) > v10) |
3674 || (v12 = (v18 * stru_721530.direction.x + v19 * stru_721530.direction.y) >> 16, v12 <= 0) | |
3675 || (signed int)(((unsigned __int64)(stru_721530.direction.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) | |
1295 | 3676 { |
3677 LABEL_25: | |
3678 result = 0; | |
3679 } | |
3680 else | |
3681 { | |
3682 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); | |
3683 if ( v13 < 0 ) | |
3684 v13 = 0; | |
3685 if ( v13 < stru_721530.field_7C ) | |
3686 { | |
3687 stru_721530.field_7C = v13; | |
3688 v14 = 8 * v16; | |
3689 LOBYTE(v14) = PID(OBJECT_Actor,v16); | |
3690 stru_721530.uFaceID = v14; | |
3691 } | |
3692 result = 1; | |
3693 } | |
3694 return result; | |
3695 } | |
3696 //----- (00401A91) -------------------------------------------------------- | |
1458 | 3697 void UpdateActorAI() |
1295 | 3698 { |
3699 //unsigned int v0; // esi@4 | |
3700 int v1; // eax@7 | |
3701 //int v2; // ecx@7 | |
3702 //int v3; // eax@7 | |
3703 signed int v4; // edi@10 | |
3704 Actor *v5; // esi@12 | |
3705 signed int sDmg; // eax@14 | |
3706 __int16 v7; // cx@14 | |
3707 //Player **v8; // esi@20 | |
3708 Player *pPlayer; // ecx@21 | |
3709 Actor *pActor; // esi@34 | |
3710 //__int16 v11; // ax@34 | |
3711 //unsigned int v12; // eax@47 | |
3712 //signed int v13; // edi@47 | |
3713 //SpellBuff *v14; // ebx@47 | |
3714 //unsigned int v15; // edi@67 | |
3715 //char *v16; // eax@67 | |
3716 //unsigned int v17; // edx@67 | |
3717 //unsigned int v18; // ecx@67 | |
3718 //unsigned __int16 v19; // ax@72 | |
3719 //int *v20; // esi@80 | |
3720 //Actor *v21; // ebx@80 | |
3721 unsigned __int16 v22; // ax@86 | |
3722 //signed int v23; // eax@94 | |
3723 //unsigned int v24; // eax@102 | |
3724 //signed int v25; // edi@102 | |
3725 //SpellBuff *v26; // esi@102 | |
3726 unsigned int v27; // ecx@123 | |
3727 unsigned int v28; // eax@123 | |
3728 //unsigned int v29; // eax@127 | |
3729 AIDirection *v30; // eax@129 | |
3730 unsigned __int16 v31; // ax@132 | |
3731 //unsigned int v32; // esi@142 | |
3732 int v33; // eax@144 | |
3733 int v34; // eax@147 | |
3734 char v35; // al@150 | |
3735 unsigned int v36; // edi@152 | |
3736 signed int v37; // eax@154 | |
3737 //unsigned __int8 v38; // sf@158 | |
3738 //unsigned __int8 v39; // of@158 | |
3739 //signed int v40; // edx@166 | |
3740 //unsigned int v41; // ecx@166 | |
3741 double v42; // st7@176 | |
3742 double v43; // st6@176 | |
3743 //bool v44; // eax@189 | |
1450 | 3744 int v45; // eax@192 |
1295 | 3745 unsigned __int8 v46; // cl@197 |
3746 double v47; // st7@206 | |
3747 //double v48; // st7@207 | |
3748 //char v49; // zf@208 | |
3749 //char v50; // zf@214 | |
3750 //signed int v51; // edx@219 | |
3751 //unsigned int v52; // ecx@219 | |
3752 __int16 v53; // fps@224 | |
3753 //unsigned __int8 v54; // c0@224 | |
3754 //unsigned __int8 v55; // c3@224 | |
3755 //double v56; // st7@226 | |
3756 AIDirection *v57; // eax@246 | |
3757 double v58; // st7@246 | |
3758 //signed int v59; // [sp-18h] [bp-C8h]@213 | |
3759 //int v60; // [sp-14h] [bp-C4h]@144 | |
3760 //int v61; // [sp-14h] [bp-C4h]@168 | |
3761 //AIDirection *v62; // [sp-14h] [bp-C4h]@213 | |
3762 //signed int v63; // [sp-14h] [bp-C4h]@216 | |
1545 | 3763 //unsigned int v64; // [sp-14h] [bp-C4h]@219 |
1295 | 3764 unsigned int v65; // [sp-10h] [bp-C0h]@144 |
3765 char v66; // [sp-10h] [bp-C0h]@147 | |
3766 //AIDirection *v67; // [sp-10h] [bp-C0h]@167 | |
3767 //int v68; // [sp-10h] [bp-C0h]@168 | |
3768 //AIDirection *v69; // [sp-10h] [bp-C0h]@206 | |
3769 int v70; // [sp-10h] [bp-C0h]@213 | |
3770 //AIDirection *v71; // [sp-10h] [bp-C0h]@216 | |
3771 AIDirection v72; // [sp+0h] [bp-B0h]@246 | |
3772 AIDirection a3; // [sp+1Ch] [bp-94h]@129 | |
3773 AIDirection v74; // [sp+38h] [bp-78h]@246 | |
3774 AIDirection v75; // [sp+54h] [bp-5Ch]@129 | |
3775 int target_pid_type; // [sp+70h] [bp-40h]@83 | |
3776 signed int a1; // [sp+74h] [bp-3Ch]@129 | |
3777 int v78; // [sp+78h] [bp-38h]@79 | |
3778 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 | |
3779 float v80; // [sp+98h] [bp-18h]@33 | |
3780 int v81; // [sp+9Ch] [bp-14h]@100 | |
3781 //int v82; // [sp+A0h] [bp-10h]@45 | |
3782 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 | |
3783 unsigned int v84; // [sp+A8h] [bp-8h]@11 | |
3784 signed int target_pid; // [sp+ACh] [bp-4h]@83 | |
3785 AIState uAIState; | |
3786 int v38; | |
3787 | |
3788 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3789 MakeActorAIList_ODM(); | |
3790 else | |
3791 MakeActorAIList_BLV(); | |
3792 | |
3793 //v0 = 0; | |
3794 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) | |
3795 { | |
3796 if ( pParty->armageddon_timer > 417 ) | |
3797 { | |
3798 pParty->armageddon_timer = 0; | |
3799 } | |
3800 else | |
3801 { | |
3802 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); | |
3803 pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8; | |
3804 if ( pParty->sRotationX > 128) | |
3805 pParty->sRotationX = 128; | |
3806 else if ( pParty->sRotationX < -128 ) | |
3807 pParty->sRotationX = -128; | |
3808 | |
3809 pParty->uFlags |= 2u; | |
3810 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | |
3811 v4 = pParty->field_16140 + 50; | |
3812 if ( pParty->armageddon_timer <= 0 ) | |
3813 { | |
3814 pParty->armageddon_timer = 0; | |
3815 for(int i = 0; i < uNumActors; i++) | |
3816 { | |
3817 pActor=&pActors[i]; | |
3818 if ( pActor->CanAct() ) | |
3819 { | |
3820 sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); | |
3821 pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); | |
3822 if ( sDmg ) | |
3823 { | |
3824 if ( pActor->sCurrentHP >= 0 ) | |
3825 { | |
3826 Actor::AI_Stun(i, 4, 0); | |
3827 } | |
3828 else | |
3829 { | |
3830 Actor::Die(i); | |
3831 if ( pActor->pMonsterInfo.uExp ) | |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1817
diff
changeset
|
3832 pParty->GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp); |
1295 | 3833 } |
3834 } | |
3835 } | |
3836 } | |
3837 for(int i = 1; i <= 4; i++) | |
3838 { | |
3839 pPlayer = pPlayers[i]; | |
3840 if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | |
3841 pPlayer->ReceiveDamage(v4, DMGT_5); | |
3842 } | |
3843 } | |
1450 | 3844 if (pTurnEngine->pending_actions) |
3845 --pTurnEngine->pending_actions; | |
1295 | 3846 } |
3847 } | |
3848 | |
3849 if (pParty->bTurnBasedModeOn) | |
3850 { | |
1448 | 3851 pTurnEngine->AITurnBasedAction(); |
1295 | 3852 return; |
3853 } | |
3854 | |
3855 | |
3856 //uActorID = v0; | |
3857 for (uint i = 0; i < uNumActors; ++i) | |
3858 { | |
3859 pActor = &pActors[i]; | |
3860 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState | |
3861 //do | |
3862 //{ | |
3863 //pActor = (Actor *)(LODWORD(v80) - 176); | |
3864 //v11 = *(unsigned int *)LODWORD(v80); | |
3865 //v49 = *(unsigned int *)LODWORD(v80) == 5; | |
3866 ai_near_actors_targets_pid[i] = OBJECT_Player; | |
3867 if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) | |
3868 continue; | |
3869 | |
3870 if (!pActor->sCurrentHP && pActor->uAIState != Dying) | |
3871 Actor::Die(i); | |
3872 | |
3873 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | |
3874 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | |
3875 //v12 = 0; | |
3876 //v13 = 0; | |
3877 //v14 = (SpellBuff *)(LODWORD(v80) + 36); | |
3878 for (uint j = 0; j < 22; ++j) | |
3879 { | |
3880 if (j != 10) | |
1340 | 3881 pActor->pActorBuffs[j].IsBuffExpiredToTime(pParty->uTimePlayed); |
1295 | 3882 } |
3883 /*do | |
3884 { | |
3885 if ( v13 != 10 ) | |
3886 { | |
3887 v14->_4585CA(pParty->uTimePlayed); | |
3888 v12 = 0; | |
3889 } | |
3890 ++v13; | |
3891 ++v14; | |
3892 } | |
3893 while ( v13 < 22 );*/ | |
1545 | 3894 if (pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0) |
1295 | 3895 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 |
3896 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | |
3897 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; | |
1545 | 3898 if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0) |
1295 | 3899 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
3900 // not sure | |
1545 | 3901 else if (pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0) |
1295 | 3902 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; |
3903 | |
1545 | 3904 if (pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 || |
3905 pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) | |
3906 continue; | |
1295 | 3907 |
3908 //v15 = pMiscTimer->uTimeElapsed; | |
3909 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | |
3910 //v17 = pActor->uCurrentActionTime; | |
3911 //v18 = pActor->pMonsterInfo.uRecoveryTime; | |
3912 if (pActor->pMonsterInfo.uRecoveryTime) | |
3913 { | |
3914 if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | |
3915 pActor->pMonsterInfo.uRecoveryTime = 0; | |
3916 else | |
3917 pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | |
3918 } | |
3919 | |
3920 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
3921 if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) | |
3922 continue; | |
3923 | |
3924 //v19 = actor->uAIState; | |
3925 if (pActor->uAIState == Dying) | |
3926 pActor->uAIState = Dead; | |
3927 else | |
3928 { | |
3929 if (pActor->uAIState != Summoned) | |
3930 { | |
3931 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | |
3932 continue; | |
3933 } | |
3934 pActor->uAIState = Standing; | |
3935 } | |
3936 | |
3937 pActor->uCurrentActionTime = 0; | |
3938 pActor->uCurrentActionLength = 0; | |
3939 pActor->UpdateAnimation(); | |
3940 //LABEL_78: | |
3941 //++uActorID; | |
3942 //LODWORD(v80) += 836; | |
3943 //} | |
3944 //while ( (signed int)uActorID < (signed int)uNumActors ); | |
3945 } | |
3946 | |
3947 | |
3948 v78 = 0; | |
3949 int actor_id = -1; | |
3950 if ( ai_arrays_size > 0 ) | |
3951 { | |
3952 //while ( 1 ) | |
3953 for(v78 = 0; v78 < ai_arrays_size; ++v78) | |
3954 { | |
3955 actor_id = ai_near_actors_ids[v78]; | |
3956 assert(actor_id < uNumActors); | |
3957 | |
3958 //v20 = &ai_near_actors_targets_pid[actor_id]; | |
3959 pActor = &pActors[actor_id]; | |
3960 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | |
3961 if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | |
3962 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
3963 target_pid = ai_near_actors_targets_pid[actor_id]; | |
3964 target_pid_type = PID_TYPE(target_pid); | |
3965 if ( target_pid_type == OBJECT_Actor) | |
3966 v80 = 0.5; | |
3967 else | |
3968 v80 = 1.0; | |
3969 v22 = pActor->uAIState; | |
3970 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | |
3971 { | |
3972 continue; | |
3973 } | |
3974 if ( !pActor->sCurrentHP ) | |
3975 Actor::Die(actor_id); | |
3976 for(int i=0;i<22;i++) | |
3977 { | |
3978 if ( i != 10 ) | |
3979 { | |
1340 | 3980 pActor->pActorBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed); |
1295 | 3981 } |
3982 } | |
3983 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | |
3984 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; | |
3985 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | |
3986 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
3987 // not sure | |
3988 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | |
3989 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; | |
3990 if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 ) | |
3991 { | |
3992 pActor->uAIState = Removed; | |
3993 continue; | |
3994 } | |
3995 if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 | |
3996 || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) | |
3997 { | |
3998 continue; | |
3999 } | |
4000 v27 = pMiscTimer->uTimeElapsed; | |
4001 v28 = pActor->pMonsterInfo.uRecoveryTime; | |
4002 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
4003 if ( (signed int)v28 > 0 ) | |
4004 pActor->pMonsterInfo.uRecoveryTime = v28 - v27; | |
4005 if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) | |
4006 pActor->pMonsterInfo.uRecoveryTime = 0; | |
4007 if ( !(pActor->uAttributes & 0x8000) ) | |
4008 pActor->uAttributes |= 0x8000; | |
4009 a1 = PID(OBJECT_Actor,actor_id); | |
4010 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); | |
4011 memcpy(&v75, v30, sizeof(v75)); | |
4012 memcpy(&pDir, &v75, sizeof(pDir)); | |
4013 uAIState = pActor->uAIState; | |
4014 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly | |
4015 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 | |
4016 && v80 * 307.2 >= (double)(signed int)v75.uDistance | |
4017 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) | |
4018 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) | |
4019 { | |
4020 v32 = actor_id; | |
4021 } | |
4022 else | |
4023 */ | |
4024 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly | |
4025 || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 | |
4026 || v80 * 307.2 < (double)(signed int)v75.uDistance | |
4027 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting | |
4028 && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) | |
4029 { | |
4030 if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) | |
4031 { | |
4032 continue; | |
4033 } | |
4034 else if ( pActor->uAIState == AttackingMelee ) | |
4035 { | |
4036 v35 = stru_50C198.special_ability_use_check(pActor, actor_id); | |
4037 stru_50FE08.Add( | |
4038 a1, | |
4039 5120, | |
4040 pActor->vPosition.x, | |
4041 pActor->vPosition.y, | |
4042 pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), | |
4043 v35, | |
4044 1 | |
4045 ); | |
4046 } | |
4047 else if ( pActor->uAIState == AttackingRanged1 ) | |
4048 { | |
4049 v34 = pActor->pMonsterInfo.uMissleAttack1Type; | |
4050 Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); | |
4051 } | |
4052 else if ( pActor->uAIState == AttackingRanged2 ) | |
4053 { | |
4054 v34 = pActor->pMonsterInfo.uMissleAttack2Type; | |
4055 Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); | |
4056 } | |
4057 else if ( pActor->uAIState == AttackingRanged3 ) | |
4058 { | |
4059 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; | |
4060 v33 = pActor->pMonsterInfo.uSpell1ID; | |
4061 Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); | |
4062 } | |
4063 else if ( pActor->uAIState == AttackingRanged4 ) | |
4064 { | |
4065 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; | |
4066 v33 = pActor->pMonsterInfo.uSpell2ID; | |
4067 Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); | |
4068 } | |
4069 } | |
4070 | |
4071 v36 = v75.uDistance; | |
4072 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) | |
4073 { | |
4074 if ( target_pid_type == OBJECT_Actor ) | |
4075 { | |
4076 v36 = v75.uDistance; | |
4077 //v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] | |
4078 // + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); | |
4079 v37 =pFactionTable->relations[(pActor->pMonsterInfo.uID-1) / 3 + 1][(pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3 + 1]; | |
4080 } | |
4081 else | |
4082 { | |
4083 v37 = 4; | |
4084 } | |
4085 v38=0; | |
4086 if ( v37 == 2 ) | |
4087 { | |
4088 //v39 = __OFSUB__(v36, 1024); | |
4089 //v38 = ((v36 - 1024) & 0x80000000u) != 0; | |
4090 v38 = 1024; | |
4091 } | |
4092 else if ( v37 == 3 ) | |
4093 { | |
4094 //v39 = __OFSUB__(v36, 2560); | |
4095 //v38 = ((v36 - 2560) & 0x80000000u) != 0; | |
4096 v38 = 2560; | |
4097 } | |
4098 else if ( v37 == 4 ) | |
4099 { | |
4100 //v39 = __OFSUB__(v36, 5120); | |
4101 //v38 = ((v36 - 5120) & 0x80000000u) != 0; | |
4102 v38 = 5120; | |
4103 } | |
4104 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) | |
4105 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
4106 } | |
4107 | |
1545 | 4108 if (pActor->pActorBuffs[4].uExpireTime > 0) |
1295 | 4109 { |
4110 if ( (signed int)v36 >= 10240 ) | |
4111 { | |
1456 | 4112 Actor::AI_RandomMove(actor_id, target_pid, 1024, 0); |
1295 | 4113 } |
4114 else | |
4115 { | |
4116 //peasents after attacked | |
4117 //guard after attacked | |
4118 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
4119 } | |
4120 continue; | |
4121 } | |
4122 | |
4123 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) | |
4124 { | |
4125 | |
4126 if ( pActor->pMonsterInfo.uAIType == 1 ) | |
4127 { | |
1456 | 4128 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4129 { |
1545 | 4130 Actor::AI_Stand(actor_id, target_pid, pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333, &pDir); |
1295 | 4131 } |
4132 else | |
4133 { | |
4134 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
4135 continue; | |
4136 } | |
4137 | |
4138 } | |
4139 if ( !(pActor->uAttributes & 0x020000) ) | |
4140 { | |
4141 if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) | |
4142 { | |
4143 if ( pActor->pMonsterInfo.uAIType == 2 ) | |
4144 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; | |
4145 if ( pActor->pMonsterInfo.uAIType == 3 ) | |
4146 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; | |
4147 v84 = pActor->sCurrentHP; | |
4148 v42 = (double)(signed int)v84; | |
4149 if ( v43 > v42 && (signed int)v36 < 10240 ) | |
4150 { | |
4151 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
4152 continue; | |
4153 } | |
4154 } | |
4155 } | |
4156 | |
4157 v81 = v36 - pActor->uActorRadius; | |
4158 if ( target_pid_type == OBJECT_Actor ) | |
4159 v81 -= pActors[PID_ID(target_pid)].uActorRadius; | |
4160 if ( v81 < 0 ) | |
4161 v81 = 0; | |
4162 rand(); | |
4163 pActor->uAttributes &= 0xFFFBFFFF; | |
4164 if ( v81 < 5120 ) | |
4165 { | |
4166 v45 = stru_50C198.special_ability_use_check(pActor, actor_id); | |
4167 if ( v45 == 0 ) | |
4168 { | |
4169 if ( pActor->pMonsterInfo.uMissleAttack1Type ) | |
4170 { | |
4171 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) | |
4172 { | |
4173 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); | |
4174 } | |
1456 | 4175 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4176 { |
1545 | 4177 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4178 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4179 } |
4180 else | |
4181 { | |
1545 | 4182 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
1295 | 4183 if ( v80 * 307.2 > (double)v81 ) |
4184 { | |
1545 | 4185 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); |
1295 | 4186 } |
4187 else | |
4188 { | |
1545 | 4189 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); |
1295 | 4190 } |
4191 } | |
4192 } | |
4193 else | |
4194 { | |
4195 if ( (double)v81 >= v80 * 307.2 ) | |
4196 { | |
4197 if ( v81 >= 1024 ) | |
4198 { | |
1456 | 4199 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4200 { |
1545 | 4201 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4202 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4203 } |
4204 else | |
4205 { | |
4206 //monsters | |
4207 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); | |
4208 } | |
4209 } | |
1456 | 4210 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4211 { |
1545 | 4212 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4213 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4214 } |
4215 else | |
4216 { | |
4217 v70 = (signed __int64)v80 * 307.2; | |
4218 //monsters | |
4219 //guard after player runs away | |
4220 // follow player | |
4221 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
4222 } | |
4223 } | |
4224 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
4225 { | |
1545 | 4226 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4227 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4228 } |
4229 else | |
4230 { | |
4231 //monsters | |
4232 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
4233 } | |
4234 } | |
4235 continue; | |
4236 } | |
4237 else if ( v45 == 2 || v45 == 3 ) | |
4238 { | |
4239 if ( v45 == 2 ) | |
4240 v46 = pActor->pMonsterInfo.uSpell1ID; | |
4241 else | |
4242 v46 = pActor->pMonsterInfo.uSpell2ID; | |
4243 if ( v46 ) | |
4244 { | |
4245 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) | |
4246 { | |
4247 if ( v45 == 2 ) | |
4248 Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); | |
4249 else | |
4250 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); | |
4251 } | |
1456 | 4252 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4253 { |
1545 | 4254 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4255 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4256 } |
4257 else | |
4258 { | |
1545 | 4259 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4260 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); | |
1295 | 4261 } |
4262 } | |
4263 else | |
4264 { | |
4265 if ( (double)v81 >= v80 * 307.2 ) | |
4266 { | |
4267 if ( v81 >= 1024 ) | |
4268 { | |
1456 | 4269 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4270 { |
1545 | 4271 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4272 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4273 } |
4274 else | |
4275 { | |
4276 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); | |
4277 } | |
4278 } | |
1456 | 4279 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4280 { |
1545 | 4281 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4282 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4283 } |
4284 else | |
4285 { | |
4286 v70 = (signed __int64)v80 * 307.2; | |
4287 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
4288 } | |
4289 } | |
4290 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
4291 { | |
1545 | 4292 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4293 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4294 } |
4295 else | |
4296 { | |
4297 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
4298 } | |
4299 } | |
4300 continue; | |
4301 } | |
4302 } | |
4303 } | |
4304 | |
4305 if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) | |
4306 { | |
1456 | 4307 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_SHORT ) |
1295 | 4308 { |
1456 | 4309 Actor::AI_RandomMove(actor_id, 4, 1024, 0); |
1295 | 4310 } |
4311 else if ( pActor->pMonsterInfo.uMovementType == 1 ) | |
4312 { | |
1456 | 4313 Actor::AI_RandomMove(actor_id, 4, 2560, 0); |
1295 | 4314 } |
4315 else if ( pActor->pMonsterInfo.uMovementType == 2 ) | |
4316 { | |
1456 | 4317 Actor::AI_RandomMove(actor_id, 4, 5120, 0); |
1295 | 4318 } |
4319 else if ( pActor->pMonsterInfo.uMovementType == 4 ) | |
4320 { | |
1456 | 4321 Actor::AI_RandomMove(actor_id, 4, 10240, 0); |
1295 | 4322 } |
1456 | 4323 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4324 { |
4325 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | |
4326 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
4327 memcpy(&v74, v57, sizeof(v74)); | |
4328 memcpy(&pDir, &v74, sizeof(pDir)); | |
1545 | 4329 Actor::AI_Stand(actor_id, 4, v58, &pDir); |
1295 | 4330 } |
4331 } | |
4332 else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) | |
4333 { | |
4334 if ( (double)v81 >= v80 * 307.2 ) | |
4335 { | |
4336 if ( v81 >= 1024 ) | |
4337 { | |
1456 | 4338 if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4339 { |
1545 | 4340 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4341 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4342 } |
4343 else | |
4344 { | |
4345 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); | |
4346 } | |
4347 } | |
1456 | 4348 else if ( pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1295 | 4349 { |
1545 | 4350 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4351 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4352 } |
4353 else | |
4354 { | |
4355 v70 = (signed __int64)v80 * 307.2; | |
4356 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
4357 } | |
4358 } | |
4359 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
4360 { | |
1545 | 4361 v47 = pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
4362 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); | |
1295 | 4363 } |
4364 else | |
4365 { | |
4366 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
4367 } | |
4368 } | |
4369 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
4370 { | |
4371 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
1456 | 4372 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY ) |
1545 | 4373 Actor::AI_Stand(actor_id, target_pid, v47, &pDir); |
1295 | 4374 else |
1545 | 4375 Actor::AI_Pursue1(actor_id, target_pid, actor_id, v47, &pDir); |
1295 | 4376 } |
4377 else | |
4378 { | |
4379 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); | |
4380 } | |
4381 } | |
4382 } | |
4383 } | |
4384 //----- (0044665D) -------------------------------------------------------- | |
4385 // uType: 0 -> any monster | |
4386 // 1 -> uParam is GroupID | |
4387 // 2 -> uParam is MonsterID | |
4388 // 3 -> uParam is ActorID | |
4389 // uNumAlive: 0 -> all must be alive | |
4390 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive) | |
4391 { | |
4392 unsigned int uAliveActors; // eax@6 | |
4393 unsigned int uTotalActors; // [sp+0h] [bp-4h]@1 | |
4394 | |
4395 uTotalActors = 0; | |
4396 if ( uType ) | |
4397 { | |
4398 if ( uType == 1 ) | |
4399 { | |
4400 uAliveActors = SearchActorByGroup(&uTotalActors, uParam); | |
4401 } | |
4402 else | |
4403 { | |
4404 if ( uType == 2 ) | |
4405 { | |
4406 uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam); | |
4407 } | |
4408 else | |
4409 { | |
4410 if ( uType != 3 ) | |
4411 return 0; | |
4412 uAliveActors = SearchActorByID(&uTotalActors, uParam); | |
4413 } | |
4414 } | |
4415 } | |
4416 else | |
4417 { | |
4418 uAliveActors = SearchAliveActors(&uTotalActors); | |
4419 } | |
1545 | 4420 |
4421 if (uNumAlive) | |
4422 return uAliveActors >= uNumAlive; | |
1295 | 4423 else |
1545 | 4424 return uTotalActors == uAliveActors; |
1297 | 4425 } |
4426 //----- (00408B54) -------------------------------------------------------- | |
1458 | 4427 unsigned int SearchActorByID(unsigned int *pTotalActors, unsigned int a2) |
1297 | 4428 { |
4429 unsigned int v2; // edi@1 | |
4430 unsigned int *v3; // esi@1 | |
4431 int v4; // eax@1 | |
4432 unsigned int v5; // ebx@1 | |
4433 unsigned int v6; // edx@1 | |
4434 | |
4435 v2 = a2; | |
4436 v3 = pTotalActors; | |
4437 v4 = GetAlertStatus(); | |
4438 v5 = 0; | |
4439 *v3 = 0; | |
4440 v6 = pActors[v2].uAttributes; | |
4441 if ( (v6 & 0x100000) == v4 ) | |
4442 { | |
4443 *v3 = 1; | |
4444 if ( pActors[v2].IsNotAlive() == 1 ) | |
4445 v5 = 1; | |
4446 } | |
4447 return v5; | |
4448 } | |
4449 //----- (00408AE7) -------------------------------------------------------- | |
1458 | 4450 unsigned int SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) |
1297 | 4451 { |
4452 unsigned int *v2; // esi@1 | |
4453 signed int v3; // ebx@1 | |
4454 Actor *v4; // edi@2 | |
4455 int v5; // eax@3 | |
4456 unsigned int v7; // [sp+8h] [bp-Ch]@1 | |
4457 int v8; // [sp+Ch] [bp-8h]@1 | |
4458 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
4459 | |
4460 v7 = uGroup; | |
4461 v2 = pTotalActors; | |
4462 v3 = 0; | |
4463 v8 = GetAlertStatus(); | |
4464 *v2 = 0; | |
4465 v9 = 0; | |
4466 if ( (signed int)uNumActors > 0 ) | |
4467 { | |
4468 v4 = pActors.data();//[0].uGroup; | |
4469 do | |
4470 { | |
4471 v5 = v4->uAttributes; | |
4472 if ( (v5 & 0x100000) == v8 ) | |
4473 { | |
4474 if ( v4->uGroup == v7 ) | |
4475 { | |
4476 ++*v2; | |
4477 if ( v4->IsNotAlive() == 1 ) | |
4478 ++v9; | |
4479 } | |
4480 } | |
4481 ++v3; | |
4482 ++v4; | |
4483 } | |
4484 while ( v3 < (signed int)uNumActors ); | |
4485 } | |
4486 return v9; | |
4487 } | |
4488 //----- (00408A7E) -------------------------------------------------------- | |
1458 | 4489 unsigned int SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) |
1297 | 4490 { |
4491 unsigned int *v2; // esi@1 | |
4492 signed int v3; // ebx@1 | |
4493 Actor *v4; // edi@2 | |
4494 int v5; // eax@3 | |
4495 int v7; // [sp+8h] [bp-Ch]@1 | |
4496 int v8; // [sp+Ch] [bp-8h]@1 | |
4497 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
4498 | |
4499 v7 = uMonsterID; | |
4500 v2 = pTotalActors; | |
4501 v3 = 0; | |
4502 v8 = GetAlertStatus(); | |
4503 *v2 = 0; | |
4504 v9 = 0; | |
4505 if ( (signed int)uNumActors > 0 ) | |
4506 { | |
4507 v4 = pActors.data();//[0].pMonsterInfo.uID; | |
4508 do | |
4509 { | |
4510 v5 = v4->uAttributes; // actor::attributes | |
4511 if ( (v5 & 0x100000) == v8 ) | |
4512 { | |
4513 if ( v4->pMonsterInfo.field_33 == v7 ) | |
4514 { | |
4515 ++*v2; | |
4516 if ( v4->IsNotAlive() == 1 ) | |
4517 ++v9; | |
4518 } | |
4519 } | |
4520 ++v3; | |
4521 ++v4; | |
4522 } | |
4523 while ( v3 < (signed int)uNumActors ); | |
4524 } | |
4525 return v9; | |
4526 } | |
4527 //----- (00408A27) -------------------------------------------------------- | |
1458 | 4528 unsigned int SearchAliveActors(unsigned int *pTotalActors) |
1297 | 4529 { |
4530 unsigned int *v1; // esi@1 | |
4531 int v2; // eax@1 | |
4532 unsigned int v3; // ebp@1 | |
4533 signed int v4; // ebx@1 | |
4534 Actor *v5; // edi@2 | |
4535 unsigned int v6; // eax@3 | |
4536 int v8; // [sp+Ch] [bp-4h]@1 | |
4537 | |
4538 v1 = pTotalActors; | |
4539 v2 = GetAlertStatus(); | |
4540 v3 = 0; | |
4541 v4 = 0; | |
4542 *v1 = 0; | |
4543 v8 = v2; | |
4544 if ( (signed int)uNumActors > 0 ) | |
4545 { | |
4546 v5 = pActors.data(); | |
4547 do | |
4548 { | |
4549 v6 = v5->uAttributes; | |
4550 if ( (v6 & 0x100000) == v8 ) | |
4551 { | |
4552 ++*v1; | |
4553 if ( v5->IsNotAlive() == 1 ) | |
4554 ++v3; | |
4555 } | |
4556 ++v4; | |
4557 ++v5; | |
4558 } | |
4559 while ( v4 < (signed int)uNumActors ); | |
4560 } | |
4561 return v3; | |
4562 } | |
4563 //----- (00408768) -------------------------------------------------------- | |
4564 void InitializeActors() | |
4565 { | |
4566 signed int v5; // [sp+Ch] [bp-10h]@1 | |
4567 signed int v6; // [sp+10h] [bp-Ch]@1 | |
4568 signed int v7; // [sp+14h] [bp-8h]@1 | |
4569 signed int v8; // [sp+18h] [bp-4h]@1 | |
4570 | |
4571 v8 = 0; | |
4572 v6 = 0; | |
4573 v7 = 0; | |
4574 v5 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
4575 if ( !_stricmp(pCurrentMapName, "d25.blv") ) |
1297 | 4576 v8 = 1; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1461
diff
changeset
|
4577 if ( !_stricmp(pCurrentMapName, "d26.blv") ) |
1297 | 4578 v6 = 1; |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
4579 if (pParty->IsPartyGood()) |
1297 | 4580 v7 = 1; |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1340
diff
changeset
|
4581 if (pParty->IsPartyEvil()) |
1297 | 4582 v5 = 1; |
4583 | |
4584 Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0; original code behaviour is identical | |
4585 for (uint i = 0; i < uNumActors; ++i) | |
4586 { | |
4587 auto actor = &pActors[i]; | |
4588 | |
4589 if (actor->CanAct() || actor->uAIState == Disabled) | |
4590 { | |
4591 actor->vPosition.x = actor->vInitialPosition.x; | |
4592 actor->vPosition.y = actor->vInitialPosition.y; | |
4593 actor->vPosition.z = actor->vInitialPosition.z; | |
4594 actor->sCurrentHP = actor->pMonsterInfo.uHP; | |
4595 if (actor->uAIState != Disabled) | |
4596 { | |
4597 Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0); | |
4598 } | |
4599 } | |
4600 | |
4601 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
4602 | |
4603 if (!v8 || v7) | |
4604 if (!v6 || v5) | |
4605 if (actor->IsPeasant()) | |
4606 BYTE2(actor->uAttributes) &= 0xF7u; | |
4607 | |
4608 BYTE2(actor->uAttributes) &= 0x7Fu; | |
4609 if (BYTE2(actor->uAttributes) & 0x40) | |
4610 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); | |
4611 } | |
4612 } | |
4613 //----- (00439474) -------------------------------------------------------- | |
4614 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) | |
4615 { | |
4616 //signed int v3; // eax@1 | |
4617 SpriteObject *v4; // ebx@1 | |
4618 //int v5; // edx@3 | |
4619 //bool uPlayerID; // eax@3 | |
4620 //Player *pPlayer; // edi@4 | |
4621 Actor *pMonster; // esi@7 | |
4622 //SpriteObject *v9; // ebx@12 | |
4623 int v10; // eax@12 | |
4624 int v11; // ebx@12 | |
4625 unsigned int v12; // ecx@12 | |
4626 int v13; // edx@15 | |
4627 int v14; // edx@17 | |
4628 int v15; // eax@24 | |
4629 unsigned __int16 v16; // cx@25 | |
4630 int v17; // eax@29 | |
4631 int v18; // eax@38 | |
4632 unsigned __int8 v19; // zf@38 | |
4633 unsigned __int8 v20; // sf@38 | |
4634 int v21; // edx@44 | |
4635 int v22; // eax@44 | |
4636 unsigned __int8 v23; // zf@44 | |
4637 unsigned __int8 v24; // sf@44 | |
4638 int v25; // edx@51 | |
4639 int v26; // ecx@51 | |
4640 //signed int v27; // eax@51 | |
4641 //int v28; // eax@53 | |
4642 signed int v29; // eax@76 | |
4643 signed int v30; // eax@84 | |
4644 signed int v31; // eax@92 | |
4645 int v32; // eax@94 | |
4646 int v33; // eax@100 | |
4647 int v34; // eax@104 | |
4648 signed int v35; // eax@104 | |
4649 double v36; // st7@104 | |
4650 float v37; // ST08_4@104 | |
4651 float v38; // ST04_4@104 | |
4652 float v39; // ST00_4@104 | |
4653 int v40; // ebx@107 | |
4654 unsigned int v41; // ebx@109 | |
4655 signed __int64 v42; // qax@125 | |
4656 unsigned __int16 v43; // ax@132 | |
4657 char v44; // bl@132 | |
4658 unsigned __int16 v45; // ax@132 | |
4659 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 | |
4660 const char *v47; // [sp+14h] [bp-58h]@104 | |
4661 char *pPlayerName; // [sp+18h] [bp-54h]@12 | |
4662 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 | |
4663 int v50; // [sp+20h] [bp-4Ch]@6 | |
4664 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 | |
4665 int v52; // [sp+34h] [bp-38h]@12 | |
4666 //int v53; // [sp+38h] [bp-34h]@10 | |
4667 //int v54; // [sp+3Ch] [bp-30h]@1 | |
4668 //int v55; // [sp+40h] [bp-2Ch]@12 | |
4669 signed int a4; // [sp+44h] [bp-28h]@1 | |
4670 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 | |
4671 //int v58; // [sp+4Ch] [bp-20h]@10 | |
4672 int v59; // [sp+50h] [bp-1Ch]@1 | |
4673 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 | |
4674 int v61; // [sp+58h] [bp-14h]@1 | |
4675 bool v62; // [sp+5Ch] [bp-10h]@1 | |
4676 int uDamageAmount; // [sp+60h] [bp-Ch]@1 | |
4677 int a2; // [sp+64h] [bp-8h]@27 | |
4678 int a3; // [sp+6Bh] [bp-1h]@6 | |
4679 | |
4680 //v3 = a1; | |
4681 v4 = 0; | |
4682 uActorID_Monster_ = uActorID_Monster; | |
4683 //v54 = a1; | |
4684 uDamageAmount = 0; | |
4685 a4 = 0; | |
4686 v61 = 0; | |
4687 v59 = 0; | |
4688 v62 = 0; | |
4689 if ( PID_TYPE(a1) == OBJECT_Item) | |
4690 { | |
4691 v4 = &pSpriteObjects[PID_ID(a1)]; | |
4692 //uDamageAmount = (int)v4; | |
4693 v61 = v4->field_60_distance_related_prolly_lod; | |
4694 a1 = v4->spell_caster_pid; | |
4695 //v54 = v4->field_58_pid; | |
4696 } | |
4697 //v5 = a1 & 7; | |
4698 //uPlayerID = a1 >> 3; | |
4699 if (PID_TYPE(a1) != OBJECT_Player) | |
4700 return; | |
4701 | |
4702 assert(PID_ID(abs(a1)) < 4); | |
4703 auto player = &pParty->pPlayers[PID_ID(a1)]; | |
4704 pMonster = &pActors[uActorID_Monster_]; | |
4705 //uPlayerID = pMonster->IsAlive(); | |
4706 if (pMonster->IsNotAlive()) | |
4707 return; | |
4708 | |
1545 | 4709 pMonster->uAttributes |= 0xC000; |
1297 | 4710 if ( pMonster->uAIState == Fleeing ) |
4711 pMonster->uAttributes |= 0x20000u; | |
4712 //v57 = 0; | |
4713 //v53 = 0; | |
4714 //v58 = 0; | |
4715 bool hit_will_stun = false, | |
4716 hit_will_paralyze = false; | |
4717 if ( !v4 ) | |
4718 { | |
4719 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; | |
4720 int main_hand_idx = player->pEquipment.uMainHand; | |
4721 v59 = 1; | |
4722 if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) | |
4723 { | |
1817
0f1543750bf8
Changing itemlist accesses to helper functions + getting rid of some pPlayers array accesses
Grumpy7
parents:
1764
diff
changeset
|
4724 auto main_hand_skill = player->GetMainHandItem()->GetPlayerSkillType(); |
1297 | 4725 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; |
4726 //v28 = SkillToMastery(player->pActiveSkills[v55]); | |
4727 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); | |
4728 //uDamageAmount = v28; | |
4729 switch (main_hand_skill) | |
4730 { | |
4731 case PLAYER_SKILL_STAFF: | |
4732 if (main_hand_mastery >= 3) | |
4733 { | |
4734 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F)) // stun chance when mastery >= 3 | |
4735 hit_will_stun = true; | |
4736 } | |
4737 break; | |
4738 | |
4739 case PLAYER_SKILL_MACE: | |
4740 if (main_hand_mastery >= 3) | |
4741 { | |
4742 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)) | |
4743 hit_will_stun = true; | |
4744 } | |
4745 if (main_hand_mastery >= 4) | |
4746 { | |
4747 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)) | |
4748 hit_will_paralyze = true; | |
4749 } | |
4750 break; | |
4751 } | |
4752 } | |
4753 v50 = pMonster->pMonsterInfo.uID; | |
4754 a2 = 4; | |
4755 //v27 = player->CalculateMeleeDamageTo(0, 0, v50); | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1529
diff
changeset
|
4756 uDamageAmount = player->CalculateMeleeDamageTo(false, false, v50); |
1297 | 4757 //if ( !v57 ) |
4758 goto LABEL_67; | |
4759 //goto LABEL_69; | |
4760 } | |
4761 | |
4762 | |
4763 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER; | |
4764 v61 = v4->field_60_distance_related_prolly_lod; | |
4765 if ( !v19 ) | |
4766 { | |
4767 //v9 = (SpriteObject *)uDamageAmount; | |
4768 v50 = pParty->vPosition.x - v4->vPosition.x; | |
4769 //v55 = abs(v50); | |
4770 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y); | |
4771 //v51 = (unsigned __int64 *)abs((int)pMonsterName); | |
4772 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z); | |
4773 v52 = abs((int)pPlayerName); | |
4774 v61 = abs(v50); | |
4775 v10 = abs(v50); | |
4776 v11 = (int)abs((int)pMonsterName); | |
4777 v12 = v52; | |
4778 if ( v10 < v11) | |
4779 { | |
4780 v10 = (int)v11; | |
4781 v11 = v10; | |
4782 } | |
4783 if ( v10 < v52 ) | |
4784 { | |
4785 v13 = v10; | |
4786 v10 = v52; | |
4787 v12 = v13; | |
4788 } | |
4789 if ( v11 < (signed int)v12 ) | |
4790 { | |
4791 v14 = v12; | |
4792 v12 = v11; | |
4793 v11 = v14; | |
4794 } | |
4795 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; | |
4796 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; | |
4797 if ( v61 >= 2560 ) | |
4798 { | |
4799 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) | |
4800 return; | |
4801 v61 = 2; | |
4802 } | |
4803 else | |
4804 { | |
4805 v61 = 1; | |
4806 } | |
4807 //v4 = (SpriteObject *)uDamageAmount; | |
4808 } | |
4809 | |
4810 v15 = v4->spell_id; | |
4811 if ( v15 == SPELL_LASER_PROJECTILE ) | |
4812 { | |
4813 v16 = player->pActiveSkills[7]; | |
4814 v61 = 1; | |
4815 if ( (signed int)SkillToMastery(v16) >= 3 ) | |
4816 a4 = player->pActiveSkills[7] & 0x3F; | |
4817 a2 = 4; | |
1550
cdb7fafede0c
Player::CalculateMeleeDamageTo extracted 2 almost identical sections to a separate function, variable cleanup, changed parameter types
Grumpy7
parents:
1529
diff
changeset
|
4818 uDamageAmount = player->CalculateMeleeDamageTo(true, true, 0); |
1297 | 4819 goto LABEL_67; |
4820 } | |
4821 if ( v15 != SPELL_BOW_ARROW ) | |
4822 { | |
4823 if ( v15 == SPELL_101 ) | |
4824 { | |
4825 a2 = 0; | |
4826 v18 = player->CalculateRangedDamageTo(0); | |
4827 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; | |
4828 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4829 uDamageAmount = v18; | |
4830 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4831 uDamageAmount >>= 1; | |
4832 v59 = 1; | |
4833 goto LABEL_67; | |
4834 } | |
4835 if ( v15 == SPELL_EARTH_BLADES ) | |
4836 { | |
4837 a4 = 5 * v4->spell_level; | |
4838 a2 = player->GetSpellSchool(0x27u); | |
4839 v21 = v4->spell_level; | |
4840 v50 = pMonster->sCurrentHP; | |
4841 pMonsterName = (char *)v4->spell_skill; | |
4842 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50); | |
4843 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; | |
4844 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4845 uDamageAmount = v22; | |
4846 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4847 uDamageAmount >>= 1; | |
4848 v59 = 0; | |
4849 LABEL_67: | |
4850 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) | |
4851 { | |
4852 //LABEL_68: | |
4853 player->PlaySound(SPEECH_52, 0); | |
4854 return; | |
4855 } | |
4856 goto LABEL_69; | |
4857 } | |
4858 if ( v15 == SPELL_EARTH_STUN ) | |
4859 { | |
4860 uDamageAmount = 0; | |
4861 a2 = 4; | |
4862 hit_will_stun = 1; | |
4863 goto LABEL_67; | |
4864 } | |
4865 a2 = player->GetSpellSchool(v4->spell_id); | |
4866 v25 = v4->spell_level; | |
4867 v26 = v4->spell_id; | |
4868 v50 = pMonster->sCurrentHP; | |
4869 pMonsterName = (char *)v4->spell_skill; | |
4870 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); | |
4871 v59 = 0; | |
4872 //v57 = (PlayerEquipment *)1; | |
4873 //LABEL_65: | |
4874 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50); | |
4875 //if ( !v57 ) | |
4876 // goto LABEL_67; | |
4877 goto LABEL_69; | |
4878 } | |
4879 v50 = pMonster->word_000086_some_monster_id; | |
4880 a2 = 4; | |
4881 v17 = player->CalculateRangedDamageTo(v50); | |
4882 v19 = v4->stru_24.uItemID == 0; | |
4883 uDamageAmount = v17; | |
4884 v57 = 0; | |
4885 if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 ) | |
4886 { | |
4887 a2 = 0; | |
4888 v57 = (PlayerEquipment *)1; | |
4889 } | |
4890 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0 | |
4891 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4892 uDamageAmount >>= 1; | |
4893 v59 = 1; | |
4894 //LABEL_66: | |
4895 if ( !v57 ) | |
4896 goto LABEL_67; | |
4897 LABEL_69: | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1359
diff
changeset
|
4898 if (player->IsWeak()) |
1297 | 4899 uDamageAmount /= 1; |
4900 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) | |
4901 uDamageAmount = 0; | |
4902 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); | |
4903 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) | |
4904 { | |
4905 v50 = player->pPlayerBuffs[6].uPower; | |
4906 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); | |
4907 v61 += v29; | |
4908 } | |
4909 uDamageAmount = v61; | |
4910 if ( v59 ) | |
4911 { | |
4912 if ( v4 ) | |
4913 { | |
4914 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); | |
4915 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4916 { | |
4917 player->sHealth += v61 / 5; | |
4918 if ( player->sHealth > player->GetMaxHealth() ) | |
4919 player->sHealth = player->GetMaxHealth(); | |
4920 v62 = 0; | |
4921 } | |
4922 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4923 uDamageAmount = v61 + v30; | |
4924 } | |
4925 else | |
4926 { | |
4927 v59 = 0; | |
4928 v57 = &player->pEquipment; | |
4929 do | |
4930 { | |
4931 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) | |
4932 { | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1362
diff
changeset
|
4933 auto _s = (ItemGen *)&player->pInventoryItemList[v57->uShield - 1]; |
1297 | 4934 a4 = _s->_439DF3_get_additional_damage(&a2, &v62); |
4935 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4936 { | |
4937 player->sHealth += v61 / 5; | |
4938 if ( player->sHealth > player->GetMaxHealth() ) | |
4939 player->sHealth = player->GetMaxHealth(); | |
4940 v62 = 0; | |
4941 } | |
4942 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4943 uDamageAmount += v31; | |
4944 } | |
4945 ++v59; | |
4946 v57 = (PlayerEquipment *)((char *)v57 + 4); | |
4947 } | |
4948 while ( v59 <= 1 ); | |
4949 } | |
4950 } | |
4951 v32 = uDamageAmount; | |
4952 pMonster->sCurrentHP -= uDamageAmount; | |
4953 if ( !v32 && !hit_will_stun ) | |
4954 { | |
4955 player->PlaySound(SPEECH_52, 0); | |
4956 return; | |
4957 } | |
4958 if ( pMonster->sCurrentHP > 0 ) | |
4959 { | |
4960 Actor::AI_Stun(uActorID_Monster_, a1, 0); | |
4961 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); | |
4962 if ( bShowDamage ) | |
4963 { | |
4964 v50 = uDamageAmount; | |
4965 pMonsterName = (char *)pMonster; | |
4966 pPlayerName = player->pName; | |
4967 if ( v4 ) | |
4968 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" | |
4969 else | |
4970 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" | |
4971 sprintfex(pTmpBuf.data(), v47, pPlayerName, pMonsterName, v50); | |
4972 ShowStatusBarString(pTmpBuf.data(), 2u); | |
4973 } | |
4974 v41 = 0; | |
4975 } | |
4976 else | |
4977 { | |
4978 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) | |
4979 { | |
4980 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; | |
4981 //v55 = v33; | |
4982 if ( pRenderer->pRenderD3D ) | |
4983 { | |
4984 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) | |
4985 { | |
4986 v50 = 0; | |
4987 pMonsterName = 0; | |
4988 v34 = pMonster->vPosition.z; | |
4989 *(float *)&pPlayerName = (double)v33; | |
4990 //v51 = (unsigned __int64 *)v34; | |
4991 *(float *)&v47 = 0.0; | |
4992 v35 = pMonster->vPosition.y; | |
4993 *((float *)&v46 + 1) = 0.0; | |
4994 *(float *)&v46 = 1.0; | |
4995 v36 = (double)(signed int)pMonster->vPosition.z; | |
4996 //v51 = (unsigned __int64 *)v35; | |
4997 v37 = v36; | |
4998 //v51 = (unsigned __int64 *)pMonster->vPosition.x; | |
4999 v38 = (double)v35; | |
5000 v39 = (double)(signed int)pMonster->vPosition.x; | |
5001 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); | |
5002 } | |
5003 } | |
5004 } | |
5005 Actor::Die(uActorID_Monster_); | |
5006 Actor::ApplyFineForKillingPeasant(uActorID_Monster_); | |
5007 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); | |
5008 if ( pMonster->pMonsterInfo.uExp ) | |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1817
diff
changeset
|
5009 pParty->GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); |
1297 | 5010 v40 = SPEECH_51; |
5011 if ( rand() % 100 < 20 ) | |
5012 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; | |
5013 player->PlaySound((PlayerSpeech)v40, 0); | |
5014 v41 = 0; | |
5015 if ( bShowDamage ) | |
5016 { | |
5017 v50 = (int)pMonster; | |
5018 pMonsterName = (char *)uDamageAmount; | |
5019 pPlayerName = player->pName; // "%s inflicts %lu points killing %s" | |
5020 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); | |
5021 ShowStatusBarString(pTmpBuf.data(), 2u); | |
5022 } | |
5023 } | |
5024 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 | |
5025 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 | |
5026 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) | |
5027 && uDamageAmount != v41 ) | |
5028 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2); | |
5029 v50 = 24; | |
5030 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; | |
1598
11bb463837b1
_48EA46_calc_special_bonus_by_items renamed to GetSpecialItemBonus, forgot to commit actor.cpp
Grumpy7
parents:
1554
diff
changeset
|
5031 if ( (player->GetSpecialItemBonus(24) || hit_will_stun != v41) |
1297 | 5032 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) |
5033 { | |
5034 LODWORD(v42) = 20; | |
5035 v59 = 10; | |
5036 if ( pParty->bTurnBasedModeOn == v41 ) | |
5037 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); | |
5038 pMonster->pMonsterInfo.uRecoveryTime += v42; | |
5039 if ( bShowDamage != v41 ) | |
5040 { | |
5041 v50 = (int)pMonster; | |
5042 pMonsterName = player->pName; // "%s stuns %s" | |
5043 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); | |
5044 ShowStatusBarString(pTmpBuf.data(), 2u); | |
5045 } | |
5046 } | |
5047 if ( hit_will_paralyze != v41 ) | |
5048 { | |
5049 if ( pMonster->CanAct() ) | |
5050 { | |
5051 if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) | |
5052 { | |
5053 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); | |
5054 v44 = v43; | |
5055 v45 = SkillToMastery(v43); | |
5056 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); | |
5057 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); | |
5058 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); | |
5059 if ( bShowDamage ) | |
5060 { | |
5061 v50 = (int)pMonster; | |
5062 pMonsterName = player->pName; // "%s paralyzes %s" | |
5063 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); | |
5064 ShowStatusBarString(pTmpBuf.data(), 2u); | |
5065 } | |
5066 } | |
5067 } | |
5068 } | |
5069 if ( v59 > 10 ) | |
5070 v59 = 10; | |
5071 if ( !MonsterStats::BelongsToSupertype(pMonster->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5072 { | |
5073 pVelocity->x = (unsigned __int64)(v59 * (signed __int64)pVelocity->x) >> 16; | |
5074 pVelocity->y = (unsigned __int64)(v59 * (signed __int64)pVelocity->y) >> 16; | |
5075 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16; | |
5076 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5077 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5078 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5079 } | |
5080 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); | |
5081 } | |
5082 //----- (004BBF61) -------------------------------------------------------- | |
5083 void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z) | |
5084 { | |
5085 size_t v4; // esi@1 | |
5086 int monster_id; // edi@1 | |
5087 __int16 v6; // ax@4 | |
5088 Actor *v7; // esi@5 | |
5089 int v8; // eax@5 | |
5090 MonsterInfo *v9; // edi@5 | |
5091 MonsterDesc *v10; // ebx@5 | |
5092 unsigned __int16 *v11; // ebx@5 | |
5093 int v12; // ebx@7 | |
5094 int v13; // eax@8 | |
5095 __int16 x_; // [sp+8h] [bp-Ch]@1 | |
5096 __int16 v15; // [sp+Ch] [bp-8h]@1 | |
5097 __int16 v16; // [sp+10h] [bp-4h]@3 | |
5098 signed int ya; // [sp+1Ch] [bp+8h]@5 | |
5099 | |
5100 v4 = uNumActors; | |
5101 monster_id = a1; | |
5102 x_ = x; | |
5103 v15 = a1; | |
1583 | 5104 if (uNumActors < 500) |
1297 | 5105 { |
5106 v16 = 0; | |
5107 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
5108 { | |
5109 v6 = pIndoor->GetSector(x, y, z); | |
5110 v4 = uNumActors; | |
5111 v16 = v6; | |
5112 } | |
5113 v7 = &pActors[v4]; | |
5114 v7->Reset(); | |
5115 v8 = monster_id; | |
5116 v9 = &pMonsterStats->pInfos[monster_id]; | |
5117 v10 = &pMonsterList->pMonsters[v8 - 1]; | |
5118 strcpy(v7->pActorName, v9->pName); | |
5119 v7->sCurrentHP = LOWORD(v9->uHP); | |
5120 memcpy(&v7->pMonsterInfo, v9, 0x58u); | |
5121 v7->word_000086_some_monster_id = v15; | |
5122 v7->uActorRadius = v10->uMonsterRadius; | |
5123 v7->uActorHeight = v10->uMonsterHeight; | |
5124 v7->uMovementSpeed = v10->uMovementSpeed; | |
5125 v7->vInitialPosition.x = x_; | |
5126 v7->vPosition.x = x_; | |
5127 BYTE2(v7->uAttributes) |= 8u; | |
5128 v7->pMonsterInfo.uTreasureType = 0; | |
5129 v7->pMonsterInfo.uTreasureLevel = 0; | |
5130 v7->pMonsterInfo.uTreasureDiceSides = 0; | |
5131 v7->pMonsterInfo.uTreasureDiceRolls = 0; | |
5132 v7->pMonsterInfo.uTreasureDropChance = 0; | |
5133 v7->vInitialPosition.y = y; | |
5134 v7->vPosition.y = y; | |
5135 v7->vInitialPosition.z = z; | |
5136 v7->vPosition.z = z; | |
5137 v7->uTetherDistance = 256; | |
5138 v7->uSectorID = v16; | |
5139 v7->uGroup = 1; | |
5140 v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5141 v7->PrepareSprites(0); | |
5142 v11 = v10->pSoundSampleIDs; | |
5143 ya = 4; | |
5144 do | |
5145 { | |
5146 pSoundList->LoadSound((signed __int16)*v11, 0); | |
5147 ++v11; | |
5148 --ya; | |
5149 } | |
5150 while ( ya ); | |
5151 v12 = 0; | |
5152 do | |
5153 LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); | |
5154 while ( v13 ); | |
5155 ++uNumActors; | |
5156 } | |
1295 | 5157 } |