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