2498
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
2541
|
6
|
|
7 #include "Engine/Engine.h"
|
|
8
|
2498
|
9 #include "Engine/Graphics/Sprites.h"
|
|
10 #include "Engine/Graphics/BSPModel.h"
|
|
11 #include "SpriteObject.h"
|
2499
|
12 #include "../Party.h"
|
|
13 #include "../TurnEngine/TurnEngine.h"
|
|
14 #include "../OurMath.h"
|
2498
|
15 #include "ObjectList.h"
|
|
16 #include "Engine/Graphics/Outdoor.h"
|
|
17 #include "Engine/Graphics/ParticleEngine.h"
|
2499
|
18 #include "../Timer.h"
|
|
19 #include "../LOD.h"
|
2498
|
20 #include "Actor.h"
|
2499
|
21 #include "../Events.h"
|
2502
|
22 #include "Media/Audio/AudioPlayer.h"
|
2498
|
23 #include "Engine/Graphics/Level/Decoration.h"
|
2499
|
24 #include "../stru298.h"
|
|
25 #include "../Random.h"
|
2498
|
26
|
|
27
|
|
28
|
|
29
|
|
30 size_t uNumSpriteObjects;
|
|
31 std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects;
|
|
32
|
|
33 //----- (00404828) --------------------------------------------------------
|
|
34 SpriteObject::SpriteObject()
|
|
35 {
|
|
36 field_22_glow_radius_multiplier = 1;
|
|
37 uSoundID = 0;
|
|
38 uFacing = 0;
|
|
39 vVelocity.z = 0;
|
|
40 vVelocity.y = 0;
|
|
41 vVelocity.x = 0;
|
2566
|
42 uType = SPRITE_NULL;
|
2498
|
43 uObjectDescID = 0;
|
|
44 field_61 = 0;
|
|
45 field_60_distance_related_prolly_lod = 0;
|
|
46 field_20 = 0;
|
|
47 uSpriteFrameID = 0;
|
|
48 spell_skill = 0;
|
|
49 spell_level = 0;
|
|
50 spell_id = 0;
|
|
51 field_54 = 0;
|
|
52 }
|
|
53
|
|
54 //----- (0042F5ED) --------------------------------------------------------
|
|
55 int SpriteObject::Create(int yaw, int pitch, int a4, int a5)
|
|
56 {
|
|
57 signed int v6; // ebx@2
|
|
58 int v13; // ST2C_4@20
|
|
59 Vec3_int_ v17; // [sp-20h] [bp-30h]@11
|
|
60 int angle; // [sp+Ch] [bp-4h]@1
|
|
61 int a5a; // [sp+20h] [bp+10h]@20
|
|
62
|
|
63 angle = yaw;
|
|
64 if (!uObjectDescID)
|
|
65 return -1;
|
|
66
|
|
67 v6 = 1000;
|
|
68 for (uint i = 0; i < MAX_SPRITE_OBJECTS; ++i)
|
|
69 if (!pSpriteObjects[i].uObjectDescID)
|
|
70 {
|
|
71 v6 = i;
|
|
72 break;
|
|
73 }
|
|
74
|
|
75 if ( v6 >= 1000 )
|
|
76 return -1;
|
|
77 field_64.x = vPosition.x;
|
|
78 field_64.y = vPosition.y;
|
|
79 field_64.z = vPosition.z;
|
|
80
|
|
81 assert(sizeof(SpriteObject) == 0x70);
|
|
82
|
|
83 switch (a5)
|
|
84 {
|
|
85 case 0:
|
|
86 break; //do nothing
|
|
87 case 1:
|
|
88 Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
|
|
89 &vPosition.y, &vPosition.z);
|
|
90 break;
|
|
91 case 2:
|
|
92 Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
|
|
93 &vPosition.y, &vPosition.z);
|
|
94 break;
|
|
95 case 3:
|
|
96 Vec3_int_::Rotate(8, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
|
|
97 &vPosition.y, &vPosition.z);
|
|
98 break;
|
|
99 case 4:
|
|
100 Vec3_int_::Rotate(24, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
|
|
101 &vPosition.y, &vPosition.z);
|
|
102 break;
|
|
103 default:
|
|
104 assert(false);
|
|
105 return 0;
|
|
106 break;
|
|
107 }
|
|
108
|
|
109 if ( a4 )
|
|
110 {
|
|
111 v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
|
|
112 a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
|
|
113 vVelocity.x = fixpoint_mul(v13, a4);
|
|
114 vVelocity.y = fixpoint_mul(a5a, a4);
|
|
115 vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
|
|
116 }
|
|
117 else
|
|
118 {
|
|
119 vVelocity.y = 0;
|
|
120 vVelocity.x = 0;
|
|
121 vVelocity.z = 0;
|
|
122 }
|
|
123
|
|
124 memcpy(&pSpriteObjects[v6], this, sizeof(*this));
|
|
125 if ( v6 >= (signed int)uNumSpriteObjects )
|
|
126 uNumSpriteObjects = v6 + 1;
|
|
127 return v6;
|
|
128 }
|
|
129
|
|
130 //----- (00471C03) --------------------------------------------------------
|
|
131 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID)
|
|
132 {
|
|
133 ObjectDesc *object; // ebx@1
|
|
134 int v6; // eax@1
|
|
135 int v7; // ecx@1
|
|
136 int v8; // edi@1
|
|
137 int v9; // eax@4
|
|
138 // int v17; // ST10_4@25
|
|
139 //signed int v19; // eax@28
|
|
140 //Actor *v20; // edi@31
|
|
141 int v21; // eax@41
|
|
142 // int v22; // ecx@43
|
|
143 // __int16 v23; // bx@45
|
|
144 // char v24; // al@46
|
|
145 signed int i; // edi@50
|
|
146 int v26; // edi@52
|
|
147 int v27; // eax@52
|
|
148 __int16 v28; // cx@55
|
|
149 int v29; // eax@55
|
|
150 //signed int v30; // edi@59
|
|
151 BSPModel *bmodel; // ecx@61
|
|
152 ODMFace *face; // edi@61
|
|
153 // int v33; // eax@62
|
|
154 // int v34; // ecx@62
|
|
155 int v35; // eax@63
|
|
156 int v36; // ecx@67
|
|
157 __int16 v37; // ax@67
|
|
158 int v38; // eax@72
|
|
159 //int v39; // eax@72
|
|
160 // unsigned __int64 v40; // qax@72
|
|
161 // int v41; // eax@72
|
|
162 // unsigned __int8 v42; // sf@74
|
|
163 // unsigned __int8 v43; // of@74
|
|
164 int v44; // eax@77
|
|
165 // __int16 v45; // bx@81
|
|
166 // int v46; // eax@85
|
|
167 // const char *v47; // [sp-8h] [bp-B0h]@83
|
|
168 // enum TEXTURE_TYPE v48; // [sp-4h] [bp-ACh]@46
|
|
169 int v49; // [sp+Ch] [bp-9Ch]@52
|
|
170 int v50; // [sp+10h] [bp-98h]@52
|
|
171 Vec3_int_ v51; // [sp+14h] [bp-94h]@11
|
|
172 Particle_sw Dst; // [sp+20h] [bp-88h]@45
|
|
173 int v54; // [sp+8Ch] [bp-1Ch]@1
|
|
174 int v55; // [sp+90h] [bp-18h]@1
|
|
175 int v56; // [sp+94h] [bp-14h]@11
|
|
176 int v57; // [sp+98h] [bp-10h]@1
|
|
177 int v58; // [sp+9Ch] [bp-Ch]@1
|
|
178 int on_water; // [sp+A0h] [bp-8h]@1
|
|
179 int v60; // [sp+A4h] [bp-4h]@11
|
|
180
|
|
181 v58 = 0;
|
|
182 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
|
|
183 v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y);
|
|
184 v55 = 0;
|
|
185 v6 = ODM_GetFloorLevel(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uHeight, &on_water, &v55, 0);
|
|
186 v7 = v6;
|
|
187 v54 = v6;
|
|
188 v8 = v6 + 1;
|
|
189 if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 )
|
|
190 {
|
|
191 if ( on_water )
|
|
192 {
|
|
193 v9 = v6 + 60;
|
|
194 if ( v55 )
|
|
195 v9 = v6 + 30;
|
|
196 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9);
|
|
197 SpriteObject::OnInteraction(uLayingItemID);
|
|
198 }
|
|
199 }
|
|
200 else
|
|
201 v58 = 1;
|
|
202 if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) )
|
|
203 {
|
|
204 if ( v58 )
|
|
205 {
|
|
206 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
207 goto LABEL_13;
|
|
208 }
|
|
209 if ( v57 )
|
|
210 {
|
|
211 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
212 ODM_GetTerrainNormalAt(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, &v51);
|
|
213 pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
214 v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
|
|
215 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
|
|
216 pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x);
|
|
217 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
|
|
218 pSpriteObjects[uLayingItemID].vVelocity.y += fixpoint_mul(v56, v51.y);
|
|
219 //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
|
|
220 pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z);
|
|
221 v7 = v54;
|
|
222 goto LABEL_13;
|
|
223 }
|
|
224 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
|
|
225 {
|
|
226 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
|
|
227 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
2566
|
228 if ( !_46BFFA_update_spell_fx(uLayingItemID, 0) )
|
2498
|
229 return;
|
|
230 }
|
|
231 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
|
232 if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) )
|
|
233 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
234
|
|
235 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
|
|
236 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
237 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
|
|
238 if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y
|
|
239 + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 )
|
|
240 {
|
|
241 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
242 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
243 memset(&Dst, 0, 0x68u);
|
|
244 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
|
|
245 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
|
|
246 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
|
|
247 Dst.r = 0.0;
|
|
248 Dst.g = 0.0;
|
|
249 Dst.b = 0.0;
|
|
250 if (object->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
251 {
|
|
252 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
253 Dst.uDiffuse = 0xFF3C1E;
|
|
254 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
255 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
256 Dst.flt_28 = 1.0;
|
2541
|
257 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
258 }
|
|
259 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE)
|
|
260 {
|
|
261 Dst.type = ParticleType_Line;
|
|
262 Dst.uDiffuse = rand();
|
|
263 Dst.timeToLive = 64;
|
|
264 Dst.uTextureID = 0;
|
|
265 Dst.flt_28 = 1.0;
|
2541
|
266 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
267 }
|
|
268 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
|
|
269 {
|
|
270 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
271 Dst.uDiffuse = rand();
|
|
272 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
273 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
274 Dst.flt_28 = 1.0;
|
2541
|
275 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
276 }
|
|
277 return;
|
|
278 }
|
|
279 }
|
|
280 LABEL_13:
|
|
281 if ( pSpriteObjects[uLayingItemID].vPosition.x >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.x <= 0x8000
|
|
282 && pSpriteObjects[uLayingItemID].vPosition.y >= -0x8000 && pSpriteObjects[uLayingItemID].vPosition.y <= 0x8000
|
|
283 && pSpriteObjects[uLayingItemID].vPosition.z > v7 && pSpriteObjects[uLayingItemID].vPosition.z <= 13000
|
|
284 || !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
|
|
285 goto LABEL_92;
|
|
286 if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
|
|
287 pSpriteObjects[uLayingItemID].vPosition.z = v8;
|
2566
|
288 if ( _46BFFA_update_spell_fx(uLayingItemID, 0) )
|
2498
|
289 {
|
|
290 LABEL_92:
|
|
291 stru_721530.field_0 = 0;
|
|
292 stru_721530.prolly_normal_d = object->uRadius;
|
|
293 stru_721530.height = object->uHeight;
|
|
294 stru_721530.field_8_radius = 0;
|
|
295 stru_721530.field_70 = 0;
|
|
296 for ( v55 = 0; v55 < 100; ++v55 )
|
|
297 {
|
|
298 stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
|
|
299 stru_721530.normal.x = stru_721530.position.x;
|
|
300 stru_721530.uSectorID = 0;
|
|
301 stru_721530.position.y = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
302 stru_721530.normal.y = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
303 stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1;
|
|
304 stru_721530.normal.z = stru_721530.position.z;
|
|
305 stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
306 stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
307 stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
308 if ( stru_721530._47050A(0) )
|
|
309 return;
|
|
310 _46E889_collide_against_bmodels(0);
|
|
311 _46E26D_collide_against_sprites(WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x), WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y));
|
|
312 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
|
|
313 _46EF01_collision_chech_player(0);
|
|
314 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor)
|
|
315 {
|
|
316 if (( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) >= 0 )
|
|
317 &&( PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < (signed int)(uNumActors - 1) ))
|
|
318 {
|
|
319 for (v56 =0; v56 < uNumActors; ++v56)
|
|
320 {
|
|
321 if ( pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[v56]) )
|
|
322 Actor::_46DF1A_collide_against_actor(v56, 0);
|
|
323 }
|
|
324 }
|
|
325 }
|
|
326 else
|
|
327 {
|
|
328 for ( i = 0; i < (signed int)uNumActors; ++i )
|
|
329 Actor::_46DF1A_collide_against_actor(i, 0);
|
|
330 }
|
|
331 v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
332 v27 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
|
|
333 object->uHeight, &v49, &v50, 0);
|
|
334 if ( on_water && v26 < v27 + 60 )
|
|
335 {
|
|
336 if ( v50 )
|
|
337 v44 = v27 + 30;
|
|
338 else
|
|
339 v44 = v54 + 60;
|
|
340 sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44);
|
|
341 SpriteObject::OnInteraction(uLayingItemID);
|
|
342 return;
|
|
343 }
|
|
344 if ( stru_721530.field_7C >= stru_721530.field_6C )
|
|
345 {
|
|
346 pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x;
|
|
347 pSpriteObjects[uLayingItemID].vPosition.y = stru_721530.normal2.y;
|
|
348 pSpriteObjects[uLayingItemID].vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
349 pSpriteObjects[uLayingItemID].uSectorID = LOWORD(stru_721530.uSectorID);
|
|
350 memset(&Dst, 0, 0x68u);
|
|
351 Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
|
|
352 Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
|
|
353 Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
|
|
354 Dst.r = 0.0;
|
|
355 Dst.g = 0.0;
|
|
356 Dst.b = 0.0;
|
|
357 if ( object->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
358 {
|
|
359 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
360 Dst.uDiffuse = 0xFF3C1E;
|
|
361 Dst.timeToLive = (unsigned __int8)( rand() & 0x80) + 128;
|
|
362 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
363 Dst.flt_28 = 1.0;
|
2541
|
364 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
365 return;
|
|
366 }
|
|
367 else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
368 {
|
|
369 Dst.type = ParticleType_Line;
|
|
370 Dst.uTextureID = 0;
|
|
371 Dst.uDiffuse = rand();
|
|
372 Dst.timeToLive = 64;
|
|
373 Dst.flt_28 = 1.0;
|
2541
|
374 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
375 return;
|
|
376 }
|
|
377 else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
378 {
|
|
379 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
380 Dst.uDiffuse = rand();
|
|
381 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
382 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
383 Dst.flt_28 = 1.0;
|
2541
|
384 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
385 }
|
|
386 return;
|
|
387 }
|
|
388 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
|
|
389 pSpriteObjects[uLayingItemID].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
|
|
390 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
|
|
391 pSpriteObjects[uLayingItemID].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
|
|
392 //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
|
|
393 v28 = LOWORD(stru_721530.uSectorID);
|
|
394 pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
|
|
395 v29 = pSpriteObjects[uLayingItemID].vPosition.z;
|
|
396 pSpriteObjects[uLayingItemID].uSectorID = v28;
|
|
397 stru_721530.field_70 += stru_721530.field_7C;
|
|
398 if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
|
|
399 {
|
|
400 if ( v29 < v54 )
|
|
401 pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
|
2566
|
402 if ( !_46BFFA_update_spell_fx(uLayingItemID, stru_721530.uFaceID) )
|
2498
|
403 return;
|
|
404 }
|
|
405 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
|
|
406 break;
|
|
407 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
|
|
408 {
|
|
409 bmodel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
|
|
410 face = &bmodel->pFaces[PID_ID(stru_721530.uFaceID) & 0x3F];
|
|
411 if ( face->uPolygonType == POLYGON_Floor )
|
|
412 {
|
|
413 pSpriteObjects[uLayingItemID].vPosition.z = bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1;
|
|
414 if ( pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
415 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400 )
|
|
416 {
|
|
417 if ( face->uAttributes & FACE_UNKNOW2 )
|
|
418 EventProcessor(face->sCogTriggeredID, 0, 1);
|
|
419 }
|
|
420 else
|
|
421 {
|
|
422 LOWORD(v35) = 0;
|
|
423 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
424 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
425 pSpriteObjects[uLayingItemID].vVelocity.y = v35;
|
|
426 }
|
|
427 }
|
|
428 else
|
|
429 {
|
|
430 v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
431 + face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y
|
|
432 + face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >> 16;
|
|
433 if ( (stru_721530.speed >> 3) > v56 )
|
|
434 v56 = stru_721530.speed >> 3;
|
|
435 //v57 = fixpoint_mul(v56, face->pFacePlane.vNormal.x);
|
|
436 //v58 = fixpoint_mul(v56, face->pFacePlane.vNormal.y);
|
|
437 v60 = fixpoint_mul(v56, face->pFacePlane.vNormal.z);
|
|
438 pSpriteObjects[uLayingItemID].vVelocity.x += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.x);
|
|
439 pSpriteObjects[uLayingItemID].vVelocity.y += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.y);
|
|
440 if ( face->pFacePlane.vNormal.z <= 32000 )
|
|
441 v37 = 2 * (short)v60;
|
|
442 else
|
|
443 {
|
|
444 v36 = v60;
|
|
445 pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
|
|
446 v58 = fixpoint_mul(0x7D00, v36);
|
|
447 v37 = fixpoint_mul(32000, v36);
|
|
448 }
|
|
449 pSpriteObjects[uLayingItemID].vVelocity.z += v37;
|
|
450 if ( face->uAttributes & FACE_UNKNOW2 )
|
|
451 EventProcessor(face->sCogTriggeredID, 0, 1);
|
|
452 }
|
|
453 }
|
|
454 LABEL_74:
|
|
455 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
|
|
456 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
457 pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
|
|
458 }
|
|
459 v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x
|
|
460 + pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y);
|
|
461 v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.x,
|
|
462 pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.uFaceID)].vPosition.y);
|
|
463 pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v38), v57);
|
|
464 pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi), v57);
|
|
465 goto LABEL_74;
|
|
466 }
|
|
467 }
|
|
468
|
|
469 //----- (0047136C) --------------------------------------------------------
|
|
470 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID)
|
|
471 {
|
|
472 SpriteObject *pSpriteObject; // esi@1
|
|
473 ObjectDesc *pObject; // edi@1
|
|
474 // int v9; // ecx@16
|
|
475 // __int16 v10; // di@18
|
|
476 // int v14; // ebx@34
|
|
477 signed int v15; // ebx@46
|
|
478 int v17; // eax@50
|
|
479 // int v18; // eax@52
|
|
480 // int v19; // ecx@52
|
|
481 // Vec3_short_ *v20; // ecx@53
|
|
482 __int16 v22; // ax@57
|
|
483 int v23; // edi@62
|
|
484 // unsigned __int8 v27; // sf@64
|
|
485 // unsigned __int8 v28; // of@64
|
|
486 // __int16 v29; // di@67
|
|
487 // char v30; // al@68
|
|
488 Particle_sw Dst; // [sp+Ch] [bp-84h]@18
|
|
489 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4
|
|
490 int v39; // [sp+80h] [bp-10h]@33
|
|
491 int v40; // [sp+84h] [bp-Ch]@28
|
|
492 int v42; // [sp+8Ch] [bp-4h]@4
|
|
493
|
|
494 pSpriteObject = &pSpriteObjects[uLayingItemID];
|
|
495 pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
|
|
496 pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z);
|
|
497 v42 = BLV_GetFloorLevel(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID);
|
|
498 if ( abs(pSpriteObject->vPosition.x) > 32767
|
|
499 || abs(pSpriteObject->vPosition.y) > 32767
|
|
500 || abs(pSpriteObject->vPosition.z) > 20000
|
|
501 || v42 <= -30000
|
|
502 && (pSpriteObject->uSectorID == 0))
|
|
503 // || (v42 = _46CEC3_get_floor_level(pSpriteObject->vPosition.x, pSpriteObject->vPosition.y, pSpriteObject->vPosition.z, v4, &uFaceID), v42 == -30000)) )
|
|
504 {
|
|
505 SpriteObject::OnInteraction(uLayingItemID);
|
|
506 return;
|
|
507 }
|
|
508 if ( pObject->uFlags & OBJECT_DESC_NO_GRAVITY )//íå ïàäàþùèå îáúåêòû
|
|
509 {
|
|
510 LABEL_25:
|
|
511 stru_721530.field_0 = 0;
|
|
512 stru_721530.prolly_normal_d = pObject->uRadius;
|
|
513 stru_721530.field_84 = -1;
|
|
514 stru_721530.height = pObject->uHeight;
|
|
515 stru_721530.field_8_radius = 0;
|
|
516 stru_721530.field_70 = 0;
|
|
517 for ( uFaceID = 0; uFaceID < 100; uFaceID++ )
|
|
518 {
|
|
519 stru_721530.position.x = pSpriteObject->vPosition.x;
|
|
520 stru_721530.position.y = pSpriteObject->vPosition.y;
|
|
521 stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
|
|
522
|
|
523 stru_721530.normal.x = stru_721530.position.x;
|
|
524 stru_721530.normal.y = stru_721530.position.y;
|
|
525 stru_721530.normal.z = stru_721530.position.z;
|
|
526
|
|
527 stru_721530.velocity.x = pSpriteObject->vVelocity.x;
|
|
528 stru_721530.velocity.y = pSpriteObject->vVelocity.y;
|
|
529 stru_721530.velocity.z = pSpriteObject->vVelocity.z;
|
|
530
|
|
531 stru_721530.uSectorID = pSpriteObject->uSectorID;
|
|
532 if ( stru_721530._47050A(0) )
|
|
533 return;
|
|
534
|
|
535 for ( v40 = 0; v40 < 100; ++v40 )
|
|
536 {
|
|
537 _46E44E_collide_against_faces_and_portals(0);
|
|
538 _46E0B2_collide_against_decorations();
|
|
539 if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player)
|
|
540 _46EF01_collision_chech_player(1);
|
|
541 if (PID_TYPE(pSpriteObject->spell_caster_pid) == OBJECT_Actor)
|
|
542 {
|
|
543 for ( v42 = 0; v42 < (signed int)uNumActors; ++v42 )
|
|
544 {
|
|
545 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != pActors[v42].pMonsterInfo.uID )
|
|
546 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
|
|
547 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius);
|
|
548 }
|
|
549 }
|
|
550 else
|
|
551 {
|
|
552 for ( v42 = 0; v42 < (signed int)uNumActors; v42++ )
|
|
553 Actor::_46DF1A_collide_against_actor(v42, pMonsterList->pMonsters[pActors[v42].word_000086_some_monster_id-1].uToHitRadius);
|
|
554 }
|
|
555 if ( _46F04E_collide_against_portals() )
|
|
556 break;
|
|
557 }
|
|
558 if ( stru_721530.field_7C >= stru_721530.field_6C )
|
|
559 {
|
|
560 pSpriteObject->vPosition.x = stru_721530.normal2.x;
|
|
561 pSpriteObject->vPosition.y = stru_721530.normal2.y;
|
|
562 pSpriteObject->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
|
|
563 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
|
|
564 if ( !(HIBYTE(pObject->uFlags) & 1) )
|
|
565 return;
|
|
566 memset(&Dst, 0, 0x68u);
|
|
567 Dst.x = (double)pSpriteObject->vPosition.x;
|
|
568 Dst.y = (double)pSpriteObject->vPosition.y;
|
|
569 Dst.z = (double)pSpriteObject->vPosition.z;
|
|
570 Dst.r = 0.0;
|
|
571 Dst.g = 0.0;
|
|
572 Dst.b = 0.0;
|
|
573 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
574 {
|
|
575 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
576 Dst.uDiffuse = 0xFF3C1E;
|
|
577 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
578 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
|
579 Dst.flt_28 = 1.0;
|
2541
|
580 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
581 return;
|
|
582 }
|
|
583 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
584 {
|
|
585 Dst.type = ParticleType_Line;
|
|
586 Dst.uDiffuse = rand();
|
|
587 Dst.timeToLive = 64;
|
|
588 Dst.uTextureID = 0;
|
|
589 Dst.flt_28 = 1.0;
|
2541
|
590 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
591 return;
|
|
592 }
|
|
593 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
594 {
|
|
595 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
596 Dst.uDiffuse = rand();
|
|
597 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
598 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
|
599 Dst.flt_28 = 1.0;
|
2541
|
600 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
601 }
|
|
602 return;
|
|
603 }
|
|
604 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
|
|
605 pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
|
|
606 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
|
|
607 pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
|
|
608 //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
|
|
609 pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
|
|
610 pSpriteObject->uSectorID = stru_721530.uSectorID;
|
|
611 stru_721530.field_70 += stru_721530.field_7C;
|
2566
|
612 if ( pObject->uFlags & OBJECT_DESC_INTERACTABLE && !_46BFFA_update_spell_fx(uLayingItemID, stru_721530.uFaceID) )
|
2498
|
613 return;
|
|
614 v15 = (signed int)stru_721530.uFaceID >> 3;
|
|
615 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
|
|
616 {
|
|
617 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
|
|
618 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x,
|
|
619 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y);
|
|
620 pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40);
|
|
621 pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40);
|
|
622 }
|
|
623 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
|
|
624 {
|
|
625 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID);
|
|
626 if ( pIndoor->pFaces[v15].uPolygonType != POLYGON_Floor )
|
|
627 {
|
|
628 v42 = abs(pIndoor->pFaces[v15].pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x
|
|
629 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y
|
|
630 + pIndoor->pFaces[v15].pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z) >> 16;
|
|
631 if ( (stru_721530.speed >> 3) > v42 )
|
|
632 v42 = stru_721530.speed >> 3;
|
|
633 pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.x);
|
|
634 pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.y);
|
|
635 v39 = fixpoint_mul(v42, pIndoor->pFaces[v15].pFacePlane_old.vNormal.z);
|
|
636 if ( pIndoor->pFaces[v15].pFacePlane_old.vNormal.z <= 32000 )
|
|
637 v22 = 2 * v39;
|
|
638 else
|
|
639 {
|
|
640 pSpriteObject->vVelocity.z += v39;
|
|
641 v22 = fixpoint_mul(32000, v39);
|
|
642 }
|
|
643 pSpriteObject->vVelocity.z += v22;
|
|
644 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
645 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
646 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
647 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
648 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
649 continue;
|
|
650 }
|
|
651 if ( pObject->uFlags & OBJECT_DESC_BOUNCE )
|
|
652 {
|
|
653 v17 = -pSpriteObject->vVelocity.z / 2;
|
|
654 pSpriteObject->vVelocity.z = v17;
|
|
655 if ( (signed __int16)v17 < 10 )
|
|
656 pSpriteObject->vVelocity.z = 0;
|
|
657 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
658 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
659 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
660 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
661 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
662 continue;
|
|
663 }
|
|
664 pSpriteObject->vVelocity.z = 0;
|
|
665 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y >= 400 )
|
|
666 {
|
|
667 if ( pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2 )
|
|
668 EventProcessor(pIndoor->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID].uEventID, 0, 1);
|
|
669 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
670 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
671 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
672 continue;
|
|
673 }
|
|
674 pSpriteObject->vVelocity.z = 0;
|
|
675 pSpriteObject->vVelocity.y = 0;
|
|
676 pSpriteObject->vVelocity.x = 0;
|
|
677 pSpriteObject->vPosition.z = pIndoor->pVertices[*pIndoor->pFaces[v15].pVertexIDs].z + 1;
|
|
678 }
|
|
679 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
680 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
681 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
682 }
|
|
683 }
|
|
684 //äëÿ ïàäàþùèõ îáúåêòîâ(äëÿ ïðèìåðà âûáðîñ âåùè èç èíâåíòàðÿ)
|
|
685 if ( v42 <= pSpriteObject->vPosition.z - 3 )
|
|
686 {
|
|
687 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
688 goto LABEL_25;
|
|
689 }
|
2566
|
690 if ( !(pObject->uFlags & OBJECT_DESC_INTERACTABLE) || _46BFFA_update_spell_fx(uLayingItemID, 0) )
|
2498
|
691 {
|
|
692 pSpriteObject->vPosition.z = v42 + 1;
|
|
693 if ( pIndoor->pFaces[uFaceID].uPolygonType == POLYGON_Floor )
|
|
694 pSpriteObject->vVelocity.z = 0;
|
|
695 else
|
|
696 {
|
|
697 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 45000 )
|
|
698 pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
|
|
699 }
|
|
700 pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
|
|
701 pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
|
|
702 pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
|
|
703 if ( pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 )
|
|
704 {
|
|
705 pSpriteObject->vVelocity.x = 0;
|
|
706 pSpriteObject->vVelocity.y = 0;
|
|
707 pSpriteObject->vVelocity.z = 0;
|
|
708 if ( !(pObject->uFlags & OBJECT_DESC_NO_SPRITE) )
|
|
709 return;
|
|
710 memset(&Dst, 0, 0x68u);
|
|
711 Dst.x = (double)pSpriteObject->vPosition.x;
|
|
712 Dst.y = (double)pSpriteObject->vPosition.y;
|
|
713 Dst.z = (double)pSpriteObject->vPosition.z;
|
|
714 Dst.r = 0.0;
|
|
715 Dst.g = 0.0;
|
|
716 Dst.b = 0.0;
|
|
717 if ( pObject->uFlags & OBJECT_DESC_TRIAL_FIRE )
|
|
718 {
|
|
719 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
|
|
720 Dst.uDiffuse = 0xFF3C1E;
|
|
721 Dst.flt_28 = 1.0;
|
|
722 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
723 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT);
|
2541
|
724 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
725 return;
|
|
726 }
|
|
727 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_LINE )
|
|
728 {
|
|
729 Dst.type = ParticleType_Line;
|
|
730 Dst.uDiffuse = rand();
|
|
731 Dst.timeToLive = 64;
|
|
732 Dst.uTextureID = 0;
|
|
733 Dst.flt_28 = 1.0;
|
2541
|
734 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
735 return;
|
|
736 }
|
|
737 else if ( pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
738 {
|
|
739 Dst.type = ParticleType_Bitmap | ParticleType_8;
|
|
740 Dst.uDiffuse = rand();
|
|
741 Dst.flt_28 = 1.0;
|
|
742 Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
|
|
743 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
|
2541
|
744 pEngine->pParticleEngine->AddParticle(&Dst);
|
2498
|
745 }
|
|
746 return;
|
|
747 }
|
|
748 goto LABEL_25;
|
|
749 }
|
|
750 }
|
|
751 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
|
|
752
|
|
753 //----- (00438E35) --------------------------------------------------------
|
|
754 void SpriteObject::ExplosionTraps()
|
|
755 {
|
|
756 MapInfo *pMapInfo; // esi@1
|
|
757 int dir_x; // ebx@1
|
|
758 int v7; // edx@2
|
|
759 unsigned int v10; // eax@7
|
|
760 signed int v11; // ebx@8
|
|
761 signed int v13; // edi@20
|
|
762 int dir_y; // [sp+Ch] [bp-Ch]@1
|
|
763 int dir_z; // [sp+10h] [bp-8h]@1
|
|
764 DAMAGE_TYPE pDamageType; // [sp+14h] [bp-4h]@14
|
|
765
|
|
766 pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
|
|
767 dir_x = abs(pParty->vPosition.x - this->vPosition.x);
|
|
768 dir_y = abs(pParty->vPosition.y - this->vPosition.y);
|
|
769 dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
|
|
770 if ( dir_x < dir_y )
|
|
771 {
|
|
772 v7 = dir_x;
|
|
773 dir_x = dir_y;
|
|
774 dir_y = v7;
|
|
775 }
|
|
776 if ( dir_x < dir_z )
|
|
777 {
|
|
778 v7 = dir_x;
|
|
779 dir_x = dir_z;
|
|
780 dir_z = v7;
|
|
781 }
|
|
782 if ( dir_y < dir_z )
|
|
783 {
|
|
784 v7 = dir_z;
|
|
785 dir_z = dir_y;
|
|
786 dir_y = v7;
|
|
787 }
|
|
788 v10 = ((unsigned int)(11 * dir_y) >> 5) + (dir_z / 4) + dir_x;
|
|
789 if ( (signed int)v10 <= 768 )
|
|
790 {
|
|
791 v11 = 5;
|
|
792 if ( pMapInfo->Trap_D20 )
|
|
793 {
|
|
794 for ( uint i = 0; i < pMapInfo->Trap_D20; ++i )
|
|
795 v11 += rand() % 20 + 1;
|
|
796 }
|
|
797 switch ( this->uType )
|
|
798 {
|
|
799 case 811:
|
|
800 pDamageType = DMGT_FIRE;
|
|
801 break;
|
|
802 case 812:
|
|
803 pDamageType = DMGT_ELECTR;
|
|
804 break;
|
|
805 case 813:
|
|
806 pDamageType = DMGT_COLD;
|
|
807 break;
|
|
808 case 814:
|
|
809 pDamageType = DMGT_BODY;
|
|
810 break;
|
|
811 default:
|
|
812 return;
|
|
813 }
|
|
814 for ( uint i = 1; i <= 4; ++i )
|
|
815 {
|
|
816 if ( pPlayers[i]->CanAct() && (v13 = pPlayers[i]->GetPerception() + 20, rand() % v13 > 20) )
|
|
817 pPlayers[i]->PlaySound(SPEECH_6, 0);
|
|
818 else
|
|
819 pPlayers[i]->ReceiveDamage(v11, pDamageType);
|
|
820 }
|
|
821 }
|
|
822 }
|
|
823
|
|
824 //----- (0042F933) --------------------------------------------------------
|
|
825 void SpriteObject::OnInteraction(unsigned int uLayingItemID)
|
|
826 {
|
|
827 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
|
|
828 if ( pParty->bTurnBasedModeOn == 1 )
|
|
829 {
|
|
830 if (pSpriteObjects[uLayingItemID].uAttributes & 4 )
|
|
831 {
|
|
832 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;//~0x00000004
|
|
833 --pTurnEngine->pending_actions;
|
|
834 }
|
|
835 }
|
|
836 }
|
|
837
|
|
838
|
|
839 //----- (0042FA22) --------------------------------------------------------
|
|
840 void CompactLayingItemsList()
|
|
841 {
|
|
842 int new_obj_pos = 0;
|
|
843
|
|
844 for ( int i = 0; i < MAX_SPRITE_OBJECTS; ++i )
|
|
845 {
|
|
846 if ( pSpriteObjects[i].uObjectDescID )
|
|
847 {
|
|
848 if ( i != new_obj_pos )//
|
|
849 {
|
|
850 memcpy(&pSpriteObjects[new_obj_pos], &pSpriteObjects[i],sizeof(SpriteObject));
|
|
851 pSpriteObjects[i].uObjectDescID = 0;
|
|
852 }
|
|
853 new_obj_pos++;
|
|
854 }
|
|
855 }
|
|
856 uNumSpriteObjects = new_obj_pos;
|
|
857 }
|
|
858 //----- (00408896) --------------------------------------------------------
|
|
859 void SpriteObject::InitializeSpriteObjects()
|
|
860 {
|
|
861 for (uint i = 0; i < uNumSpriteObjects; ++i)
|
|
862 {
|
|
863 SpriteObject* item = &pSpriteObjects[i];
|
|
864
|
|
865 if (item->uType && (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & OBJECT_DESC_UNPICKABLE))
|
|
866 SpriteObject::OnInteraction(i);
|
|
867 }
|
|
868 }
|
|
869 //----- (0046BEF1) --------------------------------------------------------
|
|
870 void SpriteObject::_46BEF1_apply_spells_aoe()
|
|
871 {
|
|
872 //SpriteObject *v1; // edi@1
|
|
873 //Actor *v2; // esi@2
|
|
874 //__int16 v3; // fps@4
|
|
875 //unsigned __int8 v4; // c0@4
|
|
876 //unsigned __int8 v5; // c3@4
|
|
877 //signed int v6; // [sp+8h] [bp-4h]@1
|
|
878
|
|
879 int v7,v9,v10,v11;
|
|
880 __debugbreak();//Ritor1
|
|
881 if ( (signed int)uNumActors > 0 )
|
|
882 {
|
|
883 for ( uint i = 0; i < uNumActors; ++i )
|
|
884 {
|
|
885 if ( pActors[i].CanAct() )
|
|
886 {
|
|
887 //UNDEF(v3);
|
|
888 //.text:0046BF26 movsx eax, word ptr [esi-2]
|
|
889 //.text:0046BF2A sub eax, [edi+4]
|
|
890 //.text:0046BF31 mov [ebp+var_8], eax
|
|
891 //.text:0046BF37 fild [ebp+var_8]
|
|
892 // v7 pushed to stack
|
|
893 v7 = pActors[i].vPosition.x - this->vPosition.x;
|
|
894
|
|
895 //.text:0046BF2D movsx ecx, word ptr [esi+2]
|
|
896 //v8 = pActors[i].vPosition.z;
|
|
897
|
|
898 //.text:0046BF34 movsx eax, word ptr [esi]
|
|
899 //.text:0046BF3A sub eax, [edi+8]
|
|
900 //.text:0046BF3D mov [ebp+var_8], eax
|
|
901 //.text:0046BF44 fild [ebp+var_8]
|
|
902 // v9 pushed to stack
|
|
903 v9 = pActors[i].vPosition.y - this->vPosition.y;
|
|
904
|
|
905 //.text:0046BF40 movsx eax, word ptr [esi-6]
|
|
906 //.text:0046BF47 sar eax, 1
|
|
907 //.text:0046BF49 add eax, ecx
|
|
908 //.text:0046BF4B sub eax, [edi+0Ch]
|
|
909 //.text:0046BF4E mov [ebp+var_8], eax
|
|
910 //.text:0046BF51 fild [ebp+var_8]
|
|
911 //.text:0046BF58 fld st
|
|
912 // v10 pushed to stack, two times
|
|
913 v10 = pActors[i].uActorHeight / 2 + pActors[i].vPosition.z - this->vVelocity.y;
|
|
914
|
|
915 //.text:0046BF54 movsx eax, word ptr [esi-8]
|
|
916 //.text:0046BF5A add eax, 100h
|
|
917 //.text:0046BF63 mov ecx, eax
|
|
918 //v11 = this->vVelocity.x;
|
|
919
|
|
920 //.text:0046BF5F fmul st, st(1)
|
|
921 // stack: v10*v10, v10, v9, v7
|
|
922 //.text:0046BF61 fld st(2)
|
|
923 // stack: v7, v10*v10, v10, v9, v7
|
|
924
|
|
925
|
|
926 //.text:0046BF65 fmul st, st(3)
|
|
927 // stack: v7*v9, v10*v10, v10, v9, v7
|
|
928
|
|
929 //.text:0046BF67 imul ecx, eax
|
|
930 v11 = this->vVelocity.x * this->vVelocity.x;
|
|
931
|
|
932 //.text:0046BF6A faddp st(1), st
|
|
933 // stack: v10*v10+v7*v9, v10, v9, v7
|
|
934 //.text:0046BF6C fld st(3)
|
|
935 // stack: v7, v10*v10+v7*v9, v10, v9, v7
|
|
936 //.text:0046BF6E fmul st, st(4)
|
|
937 // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7
|
|
938 //.text:0046BF70 faddp st(1), st
|
|
939 // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7
|
|
940
|
|
941 //.text:0046BF72 mov [ebp+var_8], ecx
|
|
942 //.text:0046BF75 fild [ebp+var_8]
|
|
943 // v11 pushed to stack
|
|
944
|
|
945 //.text:0046BF78 fcompp
|
|
946 // if ( v11 > v10*v10+v7*v9+v7*v7 )
|
|
947 // stack: v10, v9, v7
|
|
948
|
|
949 //.text:0046BF7A fstp st
|
|
950 // stack: v9, v7
|
|
951
|
|
952 //.text:0046BF7C fnstsw ax
|
|
953 //.text:0046BF7E fstp st
|
|
954 // stack: v7
|
|
955
|
|
956 //.text:0046BF80 test ah, 41h
|
|
957 //.text:0046BF83 fstp st
|
|
958 //.text:0046BF85 jnz short loc_46BFDD
|
|
959
|
|
960 if ( v11 >= v7 * v7 + v9 * v9 + v10 * v10 )
|
|
961 {
|
|
962 if ( pActors[i].DoesDmgTypeDoDamage((DAMAGE_TYPE)0xAu) )
|
|
963 {
|
|
964 pActors[i].pActorBuffs[this->spell_id].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(this->spell_level << 7) * 0.033333335),
|
|
965 this->spell_skill, 4, 0, 0);
|
|
966 HIWORD(pActors[i].uAttributes) |= 8;
|
|
967 }
|
|
968 }
|
|
969 }
|
|
970 }
|
|
971 }
|
|
972 }
|
|
973
|
|
974
|
|
975 //----- (0042F7EB) --------------------------------------------------------
|
2566
|
976 bool SpriteObject::sub_42F7EB_DropItemAt(SPRITE_OBJECT_TYPE sprite, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
|
2498
|
977 {
|
|
978 unsigned __int16 pObjectDescID; // ax@7
|
|
979 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
|
|
980
|
2566
|
981 pSpellObject.containing_item.Reset();
|
2498
|
982 if ( a9 )
|
2566
|
983 memcpy(&pSpellObject.containing_item, a9, sizeof(pSpellObject.containing_item));
|
2498
|
984 pSpellObject.spell_skill = 0;
|
|
985 pSpellObject.spell_level = 0;
|
|
986 pSpellObject.spell_id = 0;
|
|
987 pSpellObject.field_54 = 0;
|
2566
|
988 pSpellObject.uType = sprite;
|
2498
|
989 pObjectDescID = 0;
|
|
990 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
|
|
991 {
|
2566
|
992 if (sprite == pObjectList->pObjects[i].uObjectID)
|
|
993 pObjectDescID = i;
|
2498
|
994 }
|
|
995 pSpellObject.uObjectDescID = pObjectDescID;
|
|
996 pSpellObject.vPosition.x = x;
|
|
997 pSpellObject.vPosition.y = y;
|
|
998 pSpellObject.vPosition.z = z;
|
|
999 pSpellObject.uSoundID = 0;
|
|
1000 pSpellObject.uAttributes = attributes;
|
|
1001 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
|
|
1002 pSpellObject.uSpriteFrameID = 0;
|
|
1003 pSpellObject.spell_caster_pid = 0;
|
|
1004 pSpellObject.spell_target_pid = 0;
|
|
1005 if ( !(pSpellObject.uAttributes & 0x10) )
|
|
1006 {
|
|
1007 if ( pItemsTable->uAllItemsCount )
|
|
1008 {
|
|
1009 for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i )
|
|
1010 {
|
2566
|
1011 if (pItemsTable->pItems[i].uSpriteID == sprite)
|
|
1012 pSpellObject.containing_item.uItemID = i;
|
2498
|
1013 }
|
|
1014 }
|
|
1015 }
|
|
1016 if ( a7 )
|
|
1017 {
|
|
1018 if ( count > 0 )
|
|
1019 {
|
|
1020 for ( uint i = count; i; --i )
|
|
1021 {
|
|
1022 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
|
|
1023 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
|
|
1024 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
|
|
1025
|
|
1026 }
|
|
1027 }
|
|
1028 }
|
|
1029 else
|
|
1030 {
|
|
1031 pSpellObject.uFacing = 0;
|
|
1032 if ( count > 0 )
|
|
1033 {
|
|
1034 for ( uint i = count; i; --i )
|
|
1035 {
|
|
1036 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
|
|
1037 }
|
|
1038 }
|
|
1039 }
|
|
1040 return true;
|
|
1041 }
|
|
1042
|
|
1043 //----- (0042F960) --------------------------------------------------------
|
|
1044 void SpriteObject::sub_42F960_create_object(int x, int y, int z)
|
|
1045 {
|
|
1046 unsigned __int16 v7; // ax@5
|
|
1047 signed int v8; // eax@6
|
|
1048 signed int v9; // eax@7
|
|
1049
|
|
1050 SpriteObject a1; // [sp+Ch] [bp-70h]@1
|
|
1051 //SpriteObject::SpriteObject(&a1);
|
2566
|
1052 a1.containing_item.Reset();
|
2498
|
1053
|
|
1054 a1.spell_skill = 0;
|
|
1055 a1.spell_level = 0;
|
|
1056 a1.spell_id = 0;
|
|
1057 a1.field_54 = 0;
|
2566
|
1058 a1.uType = SPRITE_800;
|
2498
|
1059 v7 = 0;
|
|
1060 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
|
|
1061 {
|
|
1062 if ( a1.uType == pObjectList->pObjects[i].uObjectID )
|
|
1063 v7 = i;
|
|
1064 }
|
|
1065 a1.uObjectDescID = v7;
|
|
1066 a1.vPosition.x = x;
|
|
1067 a1.vPosition.y = y;
|
|
1068 a1.vPosition.z = z;
|
|
1069 a1.uSoundID = 0;
|
|
1070 a1.uAttributes = 0;
|
|
1071 a1.uSectorID = pIndoor->GetSector(x, y, z);
|
|
1072 a1.uSpriteFrameID = 0;
|
|
1073 a1.spell_caster_pid = 0;
|
|
1074 a1.spell_target_pid = 0;
|
|
1075 v8 = a1.Create(0, 0, 0, 0);
|
|
1076 if ( v8 != -1 )
|
|
1077 {
|
|
1078 v9 = 8 * v8;
|
|
1079 LOBYTE(v9) = v9 | 2;
|
2534
|
1080 pAudioPlayer->PlaySound((SoundID)SOUND_splash, v9, 0, -1, 0, 0, 0, 0);
|
2498
|
1081 }
|
|
1082 }
|
|
1083
|
2566
|
1084
|
|
1085
|
2498
|
1086 //----- (0046BFFA) --------------------------------------------------------
|
2566
|
1087 bool __fastcall _46BFFA_update_spell_fx(unsigned int uLayingItemID, signed int a2)
|
2498
|
1088 {
|
|
1089 ObjectDesc *object; // ebx@1
|
|
1090 unsigned int v8; // eax@19
|
|
1091 signed int v10; // ebx@19
|
|
1092 char *v11; // edx@20
|
|
1093 unsigned __int16 v12; // ax@23
|
|
1094 int v13; // eax@27
|
|
1095 int v16; // eax@36
|
|
1096 __int16 v18; // di@37
|
|
1097 signed int v19; // edx@37
|
|
1098 unsigned __int16 v22; // ax@41
|
|
1099 signed int v24; // ebx@46
|
|
1100 char *v25; // edx@47
|
|
1101 signed int v34; // edx@65
|
|
1102 unsigned __int16 v36; // ax@69
|
|
1103 int v37; // ST14_4@72
|
|
1104 int v38; // eax@72
|
|
1105 int v39; // ST10_4@72
|
|
1106 int v40; // ST0C_4@72
|
|
1107 unsigned __int8 v44; // zf@79
|
|
1108 int v47; // eax@81
|
|
1109 signed int v52; // ebx@93
|
|
1110 signed int v56; // ebx@98
|
|
1111 unsigned __int16 v58; // ax@102
|
|
1112 unsigned __int16 v59; // ax@107
|
|
1113 signed int v61; // ebx@107
|
|
1114 unsigned __int16 v63; // ax@111
|
|
1115 int v64; // ebx@114
|
|
1116 signed int v65; // eax@114
|
|
1117 signed int v69; // ebx@124
|
|
1118 unsigned __int16 v71; // ax@128
|
|
1119 unsigned int v72; // ebx@131
|
|
1120 int v78; // eax@133
|
|
1121 signed int v81; // edx@140
|
|
1122 unsigned __int16 v83; // ax@144
|
|
1123 signed int v86; // ebx@151
|
|
1124 unsigned __int16 v88; // ax@155
|
|
1125 unsigned int v89; // eax@158
|
|
1126 int v90; // ST34_4@159
|
|
1127 int v91; // eax@159
|
|
1128 unsigned int v92; // eax@163
|
|
1129 unsigned __int16 v95; // ax@181
|
|
1130 unsigned __int16 v96; // ax@184
|
|
1131 int v97; // eax@185
|
|
1132 char v100; // ST18_1@198
|
|
1133 int v102; // eax@198
|
|
1134 signed int v106; // eax@208
|
|
1135 unsigned int v107; // edx@220
|
|
1136 signed int v108; // ebx@225
|
|
1137 signed int v110; // ebx@234
|
|
1138 unsigned __int16 v112; // ax@238
|
|
1139 unsigned __int16 v113; // si@241
|
|
1140 int v114; // eax@242
|
|
1141 int v115; // eax@245
|
|
1142 signed int v119; // ebx@251
|
|
1143 unsigned __int16 v121; // ax@255
|
|
1144 int v124; // eax@267
|
|
1145 int v125; // [sp-20h] [bp-4Ch]@28
|
|
1146 char v132; // [sp-8h] [bp-34h]@131
|
|
1147 char v134; // [sp-4h] [bp-30h]@131
|
|
1148 signed int v135; // [sp-4h] [bp-30h]@217
|
|
1149 int v136; // [sp+Ch] [bp-20h]@208
|
|
1150 int v137; // [sp+10h] [bp-1Ch]@208
|
|
1151 signed int v138; // [sp+14h] [bp-18h]@207
|
|
1152 signed int v139; // [sp+18h] [bp-14h]@208
|
|
1153 signed int v141; // [sp+1Ch] [bp-10h]@117
|
|
1154 unsigned int v142; // [sp+1Ch] [bp-10h]@158
|
|
1155 signed int v143; // [sp+1Ch] [bp-10h]@172
|
|
1156 signed int v146; // [sp+20h] [bp-Ch]@60
|
|
1157 int v147; // [sp+20h] [bp-Ch]@72
|
|
1158 signed int v148; // [sp+20h] [bp-Ch]@158
|
|
1159 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208
|
|
1160 signed int v152; // [sp+24h] [bp-8h]@208
|
|
1161
|
|
1162 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
|
|
1163 //v151 = PID_TYPE(a2);
|
|
1164 if (PID_TYPE(a2) == OBJECT_Actor)
|
|
1165 {
|
|
1166 if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor
|
|
1167 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]))
|
|
1168 return 1;
|
|
1169 }
|
|
1170 else
|
|
1171 {
|
|
1172 if (PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player)
|
|
1173 return 1;
|
|
1174 }
|
|
1175 if (pParty->bTurnBasedModeOn == 1)
|
|
1176 {
|
|
1177 if (pSpriteObjects[uLayingItemID].uAttributes & 4)
|
|
1178 {
|
|
1179 --pTurnEngine->pending_actions;
|
|
1180 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;//~0x00000004
|
|
1181 }
|
|
1182 }
|
|
1183 if (PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
|
|
1184 {
|
|
1185 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000
|
|
1186 pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= ACTOR_UNKNOW5;
|
|
1187 }
|
|
1188
|
|
1189 //v6 = v2->uType;
|
|
1190 //v7 = v2->uType;
|
|
1191
|
|
1192 switch (pSpriteObjects[uLayingItemID].uType)
|
|
1193 {
|
|
1194
|
2566
|
1195 case SPRITE_SPELL_FIRE_FIRE_SPIKE:
|
|
1196 case SPRITE_SPELL_AIR_SPARKS:
|
|
1197 case SPRITE_SPELL_DARK_TOXIC_CLOUD:
|
2498
|
1198 {
|
|
1199 //v9 = 0;
|
|
1200 if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2))
|
|
1201 return 1;
|
|
1202 if (PID_TYPE(a2) != 2)
|
|
1203 {
|
|
1204 sub_43A97E(uLayingItemID, a2);
|
2566
|
1205 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1206 v95 = 0;
|
|
1207 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1208 {
|
|
1209 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1210 v95 = v52;
|
|
1211 }
|
|
1212 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1213 if (!v95)
|
|
1214 SpriteObject::OnInteraction(uLayingItemID);
|
|
1215 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1216 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1217 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1218 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1219 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1220 v97 = 0;
|
|
1221 else
|
|
1222 v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1223 v124 = 8 * uLayingItemID;
|
|
1224 LOBYTE(v124) = v124 | 2;
|
|
1225 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1226 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1227 return 0;
|
|
1228 }
|
2566
|
1229 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1230 v121 = 0;
|
|
1231 for (v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119)
|
|
1232 {
|
|
1233 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID)
|
|
1234 v121 = v119;
|
|
1235 }
|
|
1236 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
|
|
1237 if (!v121)
|
|
1238 SpriteObject::OnInteraction(uLayingItemID);
|
|
1239 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1240 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1241 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1242 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1243 v13 = 8 * uLayingItemID;
|
|
1244 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2534
|
1245 pAudioPlayer->PlaySound(SOUND_fireBall, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1246 return 0;
|
|
1247 }
|
|
1248
|
|
1249
|
2566
|
1250 case SPRITE_PROJECTILE_500:
|
|
1251 case SPRITE_PROJECTILE_505:
|
|
1252 case SPRITE_PROJECTILE_510:
|
|
1253 case SPRITE_PROJECTILE_515:
|
|
1254 case SPRITE_PROJECTILE_520:
|
|
1255 case SPRITE_PROJECTILE_525:
|
|
1256 case SPRITE_PROJECTILE_530:
|
|
1257 case SPRITE_PROJECTILE_535:
|
|
1258 case SPRITE_PROJECTILE_540:
|
2498
|
1259 {
|
|
1260 sub_43A97E(uLayingItemID, a2);
|
2566
|
1261 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1262 v12 = 0;
|
|
1263 for (v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10)
|
|
1264 {
|
|
1265 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID)
|
|
1266 v12 = v10;
|
|
1267 }
|
|
1268 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
|
|
1269 if (!v12)
|
|
1270 SpriteObject::OnInteraction(uLayingItemID);
|
|
1271 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1272 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1273 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1274 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1275 if (pSpriteObjects[uLayingItemID].uType == 555)
|
|
1276 {
|
|
1277 v13 = 8 * uLayingItemID;
|
|
1278 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2534
|
1279 pAudioPlayer->PlaySound(SOUND_fireBall, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1280 }
|
|
1281 return 0;
|
|
1282 }
|
|
1283
|
2566
|
1284 case SPRITE_PROJECTILE_545:
|
|
1285 case SPRITE_PROJECTILE_550:
|
2498
|
1286 {
|
2567
|
1287 if (pSpriteObjects[uLayingItemID].containing_item.uItemID != 405 && pSpriteObjects[uLayingItemID].containing_item.special_enchantment != 3)
|
2498
|
1288 {
|
|
1289 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1290 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1291 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1292 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1293 sub_43A97E(uLayingItemID, a2);
|
|
1294 SpriteObject::OnInteraction(uLayingItemID);
|
|
1295 if (pSpriteObjects[uLayingItemID].uSoundID == 0)
|
|
1296 v16 = 0;
|
|
1297 else
|
|
1298 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1299 v124 = 8 * uLayingItemID;
|
|
1300 LOBYTE(v124) = v124 | 2;
|
|
1301 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
|
|
1302 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1303 return 0;
|
|
1304 }
|
|
1305 v18 = 0;
|
2566
|
1306 pSpriteObjects[uLayingItemID].uType = SPRITE_600;
|
2498
|
1307 v22 = 0;
|
|
1308 for (v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19)
|
|
1309 {
|
|
1310 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID)
|
|
1311 v22 = v19;
|
|
1312 }
|
|
1313 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
|
|
1314 if (!v22)
|
|
1315 SpriteObject::OnInteraction(uLayingItemID);
|
|
1316 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
|
|
1317 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
|
|
1318 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
|
|
1319 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
|
|
1320 v12 = 0;
|
|
1321 for (v10; v10 < (signed int)v8; ++v10)
|
|
1322 {
|
|
1323 v11 += 56;
|
|
1324 if (pSpriteObjects[uLayingItemID].uType != *(short *)v11)
|
|
1325 v12 = v10;
|
|
1326 }
|
|
1327 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
|
|
1328 if (!v12)
|
|
1329 SpriteObject::OnInteraction(uLayingItemID);
|
|
1330 v44 = pSpriteObjects[uLayingItemID].uType == 555;
|
|
1331 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1332 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1333 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1334 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1335 if (!v44)
|
|
1336 {
|
|
1337 v13 = 8 * uLayingItemID;
|
|
1338 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
|
2534
|
1339 pAudioPlayer->PlaySound(SOUND_fireBall, v13, 0, -1, 0, 0, 0, 0);
|
2498
|
1340 return 0;
|
|
1341 }
|
|
1342 return 0;
|
|
1343 }
|
|
1344
|
2566
|
1345 case SPRITE_600:
|
2498
|
1346 {
|
2566
|
1347 pSpriteObjects[uLayingItemID].uType = SPRITE_601;
|
2498
|
1348 v36 = 0;
|
|
1349 for (v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34)
|
|
1350 {
|
|
1351 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID)
|
|
1352 v36 = v34;
|
|
1353 }
|
|
1354 pSpriteObjects[uLayingItemID].uObjectDescID = v36;
|
|
1355 if (!v36)
|
|
1356 SpriteObject::OnInteraction(uLayingItemID);
|
|
1357 v37 = pSpriteObjects[uLayingItemID].vPosition.z;
|
|
1358 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1359 v38 = 8 * uLayingItemID;
|
|
1360 v39 = pSpriteObjects[uLayingItemID].vPosition.y;
|
|
1361 LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID);
|
|
1362 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1363 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1364 v40 = pSpriteObjects[uLayingItemID].vPosition.x;
|
|
1365 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1366 v147 = v38;
|
|
1367 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0);
|
|
1368 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1369 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
2534
|
1370 pAudioPlayer->PlaySound(SOUND_fireBall, v147, 0, -1, 0, 0, 0, 0);
|
2498
|
1371 return 0;
|
|
1372 }
|
|
1373
|
2566
|
1374 case SPRITE_SPELL_FIRE_FIRE_BOLT:
|
|
1375 case SPRITE_SPELL_FIRE_INCINERATE:
|
|
1376 case SPRITE_SPELL_AIR_LIGHNING_BOLT:
|
|
1377 case SPRITE_SPELL_WATER_POISON_SPRAY:
|
|
1378 case SPRITE_SPELL_WATER_ICE_BOLT:
|
|
1379 case SPRITE_SPELL_WATER_ACID_BURST:
|
|
1380 case SPRITE_SPELL_EARTH_STUN:
|
|
1381 case SPRITE_SPELL_EARTH_DEADLY_SWARM:
|
|
1382 case SPRITE_SPELL_EARTH_BLADES:
|
|
1383 case SPRITE_SPELL_EARTH_MASS_DISTORTION:
|
|
1384 case SPRITE_SPELL_MIND_MIND_BLAST:
|
|
1385 case SPRITE_SPELL_MIND_PSYCHIC_SHOCK:
|
2498
|
1386 {
|
|
1387 sub_43A97E(uLayingItemID, a2);
|
2566
|
1388 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1389 v95 = 0;
|
|
1390 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1391 {
|
|
1392 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1393 v95 = v52;
|
|
1394 }
|
|
1395 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1396 if (!v95)
|
|
1397 SpriteObject::OnInteraction(uLayingItemID);
|
|
1398 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1399 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1400 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1401 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1402 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1403 if (!v96)
|
|
1404 v97 = 0;
|
|
1405 else
|
|
1406 v97 = (signed __int16)v96 + 4;
|
|
1407 v124 = 8 * uLayingItemID;
|
|
1408 LOBYTE(v124) = v124 | 2;
|
|
1409 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1410 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1411 return 0;
|
|
1412 }
|
|
1413
|
|
1414
|
2566
|
1415 case SPRITE_PROJECTILE_555:
|
2498
|
1416 {
|
2566
|
1417 sub_43A97E(uLayingItemID, a2);
|
|
1418 pSpriteObjects[uLayingItemID].uType = SPRITE_556;
|
2498
|
1419 v18 = 0;
|
|
1420 v22 = 0;
|
|
1421 v25 = (char *)&pObjectList->pObjects->uObjectID;
|
|
1422 for (v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24)
|
|
1423 {
|
|
1424 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID)
|
|
1425 v22 = v24;
|
|
1426 }
|
|
1427 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
|
|
1428 if (v22 == v18)
|
|
1429 SpriteObject::OnInteraction(uLayingItemID);
|
|
1430 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
|
|
1431 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
|
|
1432 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
|
|
1433 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
|
|
1434 return 0;
|
|
1435 }
|
|
1436
|
2566
|
1437 case SPRITE_SPELL_WATER_ICE_BLAST:
|
2498
|
1438 {
|
|
1439 //v9 = 0;
|
2566
|
1440 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_WATER_ICE_BLAST_FALLOUT;
|
2498
|
1441 v63 = 0;
|
|
1442 for (v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61)
|
|
1443 {
|
|
1444 if (v59 == pObjectList->pObjects[v61].uObjectID)
|
|
1445 v63 = v61;
|
|
1446 }
|
|
1447 pSpriteObjects[uLayingItemID].uObjectDescID = v63;
|
|
1448 if (!v63)
|
|
1449 SpriteObject::OnInteraction(uLayingItemID);
|
|
1450 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
|
|
1451 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4;
|
|
1452 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1453 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1454 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1455 v65 = 7;
|
|
1456 if (v44)
|
|
1457 v65 = 9;
|
|
1458 if (v65 > 0)
|
|
1459 {
|
|
1460 v141 = v65;
|
|
1461 do
|
|
1462 {
|
|
1463 v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2;
|
|
1464 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0);
|
|
1465 --v141;
|
|
1466 } while (v141);
|
|
1467 }
|
|
1468 SpriteObject::OnInteraction(uLayingItemID);
|
|
1469 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1470 v16 = 0;
|
|
1471 else
|
|
1472 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1473 v124 = 8 * uLayingItemID;
|
|
1474 LOBYTE(v124) = v124 | 2;
|
|
1475 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1476 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1477 return 0;
|
|
1478 }
|
|
1479
|
2566
|
1480 case SPRITE_SPELL_WATER_ICE_BLAST_FALLOUT:
|
|
1481 {
|
|
1482 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_WATER_ICE_BLAST_IMPACT;
|
2498
|
1483 v58 = 0;
|
|
1484 for (v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56)
|
|
1485 {
|
|
1486 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID)
|
|
1487 v58 = v56;
|
|
1488 }
|
|
1489 pSpriteObjects[uLayingItemID].uObjectDescID = v58;
|
|
1490 if (!v58)
|
|
1491 SpriteObject::OnInteraction(uLayingItemID);
|
|
1492 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1493 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1494 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1495 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1496 sub_43A97E(uLayingItemID, a2);
|
|
1497 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1498 v16 = 0;
|
|
1499 else
|
|
1500 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1501 v124 = 8 * uLayingItemID;
|
|
1502 LOBYTE(v124) = v124 | 2;
|
|
1503 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1504 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1505 return 0;
|
|
1506 }
|
|
1507
|
2566
|
1508 case SPRITE_SPELL_EARTH_ROCK_BLAST:
|
2498
|
1509 {
|
|
1510 if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2))
|
2566
|
1511 return 1;
|
|
1512 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_EARTH_ROCK_BLAST_IMPACT;
|
2498
|
1513 v71 = 0;
|
|
1514 for (v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69)
|
|
1515 {
|
|
1516 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID)
|
|
1517 v71 = v69;
|
|
1518 }
|
|
1519 pSpriteObjects[uLayingItemID].uObjectDescID = v71;
|
|
1520 if (!v71)
|
|
1521 SpriteObject::OnInteraction(uLayingItemID);
|
|
1522 v134 = 0;
|
|
1523 v72 = uLayingItemID;
|
|
1524 v132 = 0;
|
|
1525 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1526 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1527 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1528 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1529 AttackerInfo.Add(PID(OBJECT_Item, v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
|
|
1530 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1531 v78 = 0;
|
|
1532 else
|
|
1533 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1534 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1535 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0);
|
|
1536 return 0;
|
|
1537 }
|
|
1538
|
2566
|
1539 case SPRITE_SPELL_EARTH_DEATH_BLOSSOM:
|
2498
|
1540 {
|
|
1541 //v9 = 0;
|
2566
|
1542 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_EARTH_DEATH_BLOSSOM_FALLOUT;
|
2498
|
1543 v88 = 0;
|
|
1544 for (v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86)
|
|
1545 {
|
|
1546 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID)
|
|
1547 v88 = v86;
|
|
1548 }
|
|
1549 pSpriteObjects[uLayingItemID].uObjectDescID = v88;
|
|
1550 if (!v88)
|
|
1551 SpriteObject::OnInteraction(uLayingItemID);
|
|
1552 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
|
|
1553 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1554 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1555 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1556 v142 = v89;
|
|
1557 v148 = 7;
|
|
1558 do
|
|
1559 {
|
|
1560 pRnd->SetRange(-128, 128);
|
|
1561 v90 = pRnd->GetInRange();
|
|
1562 pRnd->SetRange(5, 500);
|
|
1563 v91 = pRnd->GetInRange();
|
|
1564 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1;
|
|
1565 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0);
|
|
1566 --v148;
|
|
1567 } while (v148);
|
|
1568 SpriteObject::OnInteraction(uLayingItemID);
|
|
1569 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1570 v16 = 0;
|
|
1571 else
|
|
1572 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1573 v124 = 8 * uLayingItemID;
|
|
1574 LOBYTE(v124) = v124 | 2;
|
|
1575 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1576 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
|
|
1577 return 0;
|
|
1578 }
|
|
1579
|
2566
|
1580 case SPRITE_SPELL_EARTH_DEATH_BLOSSOM_FALLOUT:
|
2498
|
1581 {
|
2566
|
1582 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_EARTH_DEATH_BLOSSOM_IMPACT;
|
2498
|
1583 v83 = 0;
|
|
1584 for (v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81)
|
|
1585 {
|
|
1586 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID)
|
|
1587 v83 = v81;
|
|
1588 }
|
|
1589 pSpriteObjects[uLayingItemID].uObjectDescID = v83;
|
|
1590 if (!v83)
|
|
1591 SpriteObject::OnInteraction(uLayingItemID);
|
|
1592 v134 = 0;
|
|
1593 //v72 = uLayingItemID;
|
|
1594 v132 = pSpriteObjects[uLayingItemID].field_61;
|
|
1595 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1596 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1597 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1598 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1599 AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
|
|
1600 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1601 v78 = 0;
|
|
1602 else
|
|
1603 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1604 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1605 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0);
|
|
1606 return 0;
|
|
1607 }
|
|
1608
|
2566
|
1609 case SPRITE_SPELL_LIGHT_DESTROY_UNDEAD:
|
2498
|
1610 {
|
|
1611 if (PID_TYPE(a2) == 3
|
|
1612 && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
|
|
1613 sub_43A97E(uLayingItemID, a2);
|
2566
|
1614 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_LIGHT_DESTROY_UNDEAD_1;
|
2498
|
1615 //v9 = 0;
|
|
1616 v95 = 0;
|
|
1617 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1618 {
|
|
1619 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1620 v95 = v52;
|
|
1621 }
|
|
1622 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1623 if (!v95)
|
|
1624 SpriteObject::OnInteraction(uLayingItemID);
|
|
1625 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1626 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1627 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1628 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1629 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1630 if (!v96)
|
|
1631 v97 = 0;
|
|
1632 else
|
|
1633 v97 = (signed __int16)v96 + 4;
|
|
1634 v92 = uLayingItemID;
|
|
1635 v124 = 8 * v92;
|
|
1636 LOBYTE(v124) = v124 | 2;
|
|
1637 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1638 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1639 return 0;
|
|
1640 }
|
|
1641
|
2566
|
1642 case SPRITE_SPELL_BODY_HARM:
|
|
1643 case SPRITE_SPELL_BODY_FLYING_FIST:
|
|
1644 case SPRITE_SPELL_LIGHT_LIGHT_BOLT:
|
|
1645 case SPRITE_SPELL_LIGHT_SUNRAY:
|
2498
|
1646 {
|
|
1647 sub_43A97E(uLayingItemID, a2);
|
2566
|
1648 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1649 v95 = 0;
|
|
1650 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1651 {
|
|
1652 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1653 v95 = v52;
|
|
1654 }
|
|
1655 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1656 if (!v95)
|
|
1657 SpriteObject::OnInteraction(uLayingItemID);
|
|
1658 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1659 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1660 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1661 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1662 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1663 if (!v96)
|
|
1664 v97 = 0;
|
|
1665 else
|
|
1666 v97 = (signed __int16)v96 + 4;
|
|
1667 v124 = 8 * uLayingItemID;
|
|
1668 LOBYTE(v124) = v124 | 2;
|
|
1669 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1670 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1671 return 0;
|
|
1672 }
|
|
1673
|
2566
|
1674 case SPRITE_SPELL_MIND_CHARM:
|
|
1675 case SPRITE_SPELL_LIGHT_PARALYZE:
|
|
1676 case SPRITE_SPELL_DARK_SHRINKING_RAY:
|
2498
|
1677 {
|
|
1678 v143 = 17030;
|
|
1679 switch (pSpriteObjects[uLayingItemID].uType)
|
|
1680 {
|
|
1681 case 0x1798u:
|
|
1682 v143 = 15040;
|
|
1683 break;
|
|
1684 case 0xFAAu:
|
|
1685 v143 = 13010;
|
|
1686 break;
|
|
1687 case 0x2346u:
|
|
1688 v143 = 18030;
|
|
1689 break;
|
|
1690 }
|
|
1691 v138 = 1;
|
|
1692 if (PID_TYPE(a2) != OBJECT_Actor)
|
|
1693 {
|
|
1694 if (pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4)
|
|
1695 {
|
|
1696 SpriteObject::OnInteraction(uLayingItemID);
|
|
1697 return 0;
|
|
1698 }
|
|
1699 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
|
|
1700 if (!v138)
|
2566
|
1701 {
|
|
1702 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1703 v112 = 0;
|
|
1704 for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110)
|
|
1705 {
|
|
1706 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID)
|
|
1707 v112 = v110;
|
|
1708 }
|
|
1709 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
|
|
1710 if (!v112)
|
|
1711 SpriteObject::OnInteraction(uLayingItemID);
|
|
1712 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1713 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1714 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1715 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1716 v113 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1717 if (v113)
|
|
1718 v114 = (signed __int16)v113 + 4;
|
|
1719 else
|
|
1720 v114 = 0;
|
|
1721 v115 = 8 * uLayingItemID;
|
|
1722 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID);
|
|
1723 v125 = v143 + 1;
|
|
1724 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
|
|
1725 }
|
|
1726 else
|
|
1727 SpriteObject::OnInteraction(uLayingItemID);
|
|
1728 return 0;
|
|
1729 }
|
|
1730 v106 = a2;
|
|
1731 v150 = 0;
|
|
1732 v139 = PID_ID(v106);
|
|
1733 v137 = pSpriteObjects[uLayingItemID].spell_level;
|
|
1734 v152 = pSpriteObjects[uLayingItemID].spell_skill;
|
|
1735 v136 = pSpriteObjects[uLayingItemID].spell_id;
|
2566
|
1736 if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_DARK_SHRINKING_RAY)
|
2498
|
1737 {
|
|
1738 v150 = 2;
|
|
1739 if (v152 == 2)
|
|
1740 v150 = 3;
|
|
1741 else
|
|
1742 {
|
|
1743 if (v152 >= 3)
|
|
1744 v150 = 4;
|
|
1745 }
|
|
1746 pActors[v139].uAttributes |= ACTOR_AGGRESSOR;
|
|
1747 v107 = v135;
|
|
1748 }
|
2566
|
1749 if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_MIND_CHARM)
|
2498
|
1750 {
|
|
1751 v135 = 7;
|
|
1752 v107 = v135;
|
|
1753 }
|
|
1754 else
|
|
1755 {
|
2566
|
1756 if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_LIGHT_PARALYZE)
|
2498
|
1757 {
|
|
1758 v135 = 9;
|
|
1759 v107 = v135;
|
|
1760 }
|
|
1761 else
|
|
1762 {
|
2566
|
1763 if (pSpriteObjects[uLayingItemID].uType != SPRITE_SPELL_DARK_SHRINKING_RAY)
|
2498
|
1764 {
|
|
1765 v107 = v136;
|
|
1766 }
|
2566
|
1767 if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_DARK_SHRINKING_RAY)
|
2498
|
1768 {
|
|
1769 v135 = 10;
|
|
1770 v107 = v135;
|
|
1771 }
|
|
1772 }
|
|
1773 }
|
2566
|
1774 if (pSpriteObjects[uLayingItemID].uType != SPRITE_SPELL_DARK_SHRINKING_RAY || v152 != 4)
|
2498
|
1775 {
|
|
1776 v108 = v139;
|
|
1777 if (pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107))
|
|
1778 {
|
|
1779 v138 = 0;
|
2566
|
1780 if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_LIGHT_PARALYZE)
|
2498
|
1781 {
|
|
1782 pActors[v108].uAIState = Standing;
|
|
1783 pActors[v108].UpdateAnimation();
|
|
1784 }
|
|
1785 pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335),
|
|
1786 v152, v150, 0, 0);
|
|
1787 }
|
|
1788 }
|
|
1789 else
|
|
1790 {
|
|
1791 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
|
|
1792 }
|
|
1793 pSpriteObjects[uLayingItemID].spell_level = 0;
|
|
1794 pSpriteObjects[uLayingItemID].spell_skill = 0;
|
|
1795 pSpriteObjects[uLayingItemID].spell_id = 0;
|
|
1796 if (!v138)
|
2566
|
1797 {
|
|
1798 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1799 v112 = 0;
|
|
1800 for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110)
|
|
1801 {
|
|
1802 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID)
|
|
1803 v112 = v110;
|
|
1804 }
|
|
1805 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
|
|
1806 if (!v112)
|
|
1807 SpriteObject::OnInteraction(uLayingItemID);
|
|
1808 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1809 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1810 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1811 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1812 v113 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1813 if (v113)
|
|
1814 v114 = (signed __int16)v113 + 4;
|
|
1815 else
|
|
1816 v114 = 0;
|
|
1817 v115 = 8 * uLayingItemID;
|
|
1818 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID);
|
|
1819 v125 = v143 + 1;
|
|
1820 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
|
|
1821 }
|
|
1822 else
|
|
1823 SpriteObject::OnInteraction(uLayingItemID);
|
|
1824 return 0;
|
|
1825 }
|
|
1826
|
2566
|
1827 case SPRITE_SPELL_DARK_SHARPMETAL:
|
2498
|
1828 {
|
|
1829 sub_43A97E(uLayingItemID, a2);
|
2566
|
1830 pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_DARK_SHARPMETAL_IMPACT;
|
2498
|
1831 v95 = 0;
|
|
1832 for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52)
|
|
1833 {
|
|
1834 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID)
|
|
1835 v95 = v52;
|
|
1836 }
|
|
1837 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1838 if (!v95)
|
|
1839 SpriteObject::OnInteraction(uLayingItemID);
|
|
1840 v96 = pSpriteObjects[uLayingItemID].uSoundID;
|
|
1841 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1842 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1843 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1844 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1845 if (!v96)
|
|
1846 v97 = 0;
|
|
1847 else
|
|
1848 v97 = (signed __int16)v96 + 4;
|
|
1849 v124 = 8 * uLayingItemID;
|
|
1850 LOBYTE(v124) = v124 | 2;
|
|
1851 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1852 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
|
|
1853 return 0;
|
|
1854 }
|
|
1855
|
|
1856 /*
|
|
1857 case 1080:
|
|
1858 case 2100:
|
|
1859 {
|
|
1860 if (PID_TYPE(a2) != 3)
|
|
1861 {
|
|
1862 //v32 = 0;
|
|
1863 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
|
|
1864 v46 = 0;
|
|
1865 for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146)
|
|
1866 {
|
|
1867 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID)
|
|
1868 v46 = v146;
|
|
1869 }
|
|
1870 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
|
|
1871 if (!v46)
|
|
1872 SpriteObject::OnInteraction(uLayingItemID);
|
|
1873 v100 = pSpriteObjects[uLayingItemID].field_61;
|
|
1874 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1875 v102 = 8 * uLayingItemID;
|
|
1876 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
|
|
1877 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1878 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1879 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1880 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
|
|
1881 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1882 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
|
1883 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1884 v47 = 0;
|
|
1885 else
|
|
1886 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1887 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1888 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
|
|
1889 return 0;
|
|
1890 }
|
|
1891 return 1;
|
|
1892 }*/
|
|
1893
|
2566
|
1894 case SPRITE_SPELL_FIRE_METEOR_SHOWER:
|
|
1895 case SPRITE_SPELL_AIR_STARBURST:
|
2498
|
1896 {
|
|
1897 if (PID_TYPE(a2) == 3)
|
|
1898 return 1;
|
|
1899 //else go to next case
|
|
1900 }
|
|
1901
|
2566
|
1902 case SPRITE_SPELL_FIRE_FIREBALL:
|
|
1903 case SPRITE_SPELL_DARK_DRAGON_BREATH:
|
2498
|
1904 {
|
|
1905 v95 = 0;
|
2566
|
1906 pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
|
2498
|
1907 for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146)
|
|
1908 {
|
|
1909 if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID)
|
|
1910 v95 = v146;
|
|
1911 }
|
|
1912 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
|
|
1913 if (!v95)
|
|
1914 SpriteObject::OnInteraction(uLayingItemID);
|
|
1915 v100 = pSpriteObjects[uLayingItemID].field_61;
|
|
1916 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
|
|
1917 v102 = 8 * uLayingItemID;
|
|
1918 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
|
|
1919 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
|
|
1920 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
|
|
1921 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
|
|
1922 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
|
|
1923 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
|
|
1924 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
|
|
1925 if (!pSpriteObjects[uLayingItemID].uSoundID)
|
|
1926 v47 = 0;
|
|
1927 else
|
|
1928 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
|
|
1929 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
|
|
1930 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
|
|
1931 return 0;
|
|
1932 }
|
|
1933
|
|
1934 default:
|
|
1935 return 0;
|
|
1936 }
|
|
1937
|
|
1938 }
|
|
1939
|
|
1940 //----- (0043A97E) --------------------------------------------------------
|
|
1941 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
|
|
1942 {
|
|
1943 if (PID_TYPE(a2) == OBJECT_Player)
|
|
1944 {
|
|
1945 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
1946 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
1947 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
1948
|
|
1949 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
|
|
1950 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, -1);
|
|
1951 }
|
|
1952 else if (PID_TYPE(a2) == OBJECT_Actor)
|
|
1953 {
|
|
1954 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
|
|
1955 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
|
|
1956 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
|
|
1957
|
|
1958 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
|
|
1959 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid))
|
|
1960 {
|
|
1961 case OBJECT_Actor:
|
|
1962 Actor::ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61);
|
|
1963 break;
|
|
1964 case OBJECT_Player:
|
|
1965 Actor::DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
|
|
1966 break;
|
|
1967 case OBJECT_Item:
|
|
1968 ItemDamageFromActor(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
|
|
1969 break;
|
|
1970 }
|
|
1971 }
|
|
1972 }
|