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