World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
SpriteObject.cpp
См. документацию.
2 
3 #include <utility>
4 
5 #include "Engine/Engine.h"
7 #include "Engine/Time.h"
8 #include "Engine/Events.h"
9 #include "Engine/LOD.h"
10 #include "Engine/OurMath.h"
11 #include "Engine/Party.h"
12 #include "Engine/Random.h"
14 #include "Engine/stru298.h"
15 
16 #include "Engine/Objects/Actor.h"
18 
24 
26 
28 
29 // should be injected in SpriteObject but struct size cant be changed
32 
34 std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects;
35 
36 //----- (00404828) --------------------------------------------------------
39  uSoundID = 0;
40  uFacing = 0;
41  vVelocity.z = 0;
42  vVelocity.y = 0;
43  vVelocity.x = 0;
45  uObjectDescID = 0;
46  field_61 = 0;
48  field_20 = 0;
49  uSpriteFrameID = 0;
50  spell_skill = 0;
51  spell_level = 0;
52  spell_id = 0;
53  field_54 = 0;
54 }
55 
56 int SpriteObject::Create(int yaw, int pitch, int speed, int which_char) {
57  // check for valid sprite object
58  if (!uObjectDescID) {
59  return -1;
60  }
61 
62  // find free sprite slot
63  int sprite_slot = 1000;
64  for (unsigned int i = 0; i < MAX_SPRITE_OBJECTS; ++i) {
65  if (!pSpriteObjects[i].uObjectDescID) {
66  sprite_slot = i;
67  break;
68  }
69  }
70 
71  // return if too many sprties already
72  if (sprite_slot >= MAX_SPRITE_OBJECTS) {
73  return -1;
74  }
75 
76  // set initial position
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  // move sprite so it looks like it originates from char portrait
84  switch (which_char) {
85  case 0:
86  break; // do nothing
87  case 1:
88  Vec3_int_::Rotate((24<<16), 2048 - uFacing, 0, vPosition, &vPosition.x, &vPosition.y, &vPosition.z);
89  break;
90  case 2:
91  Vec3_int_::Rotate((8<<16), 2048 - uFacing, 0, vPosition, &vPosition.x, &vPosition.y, &vPosition.z);
92  break;
93  case 3:
94  Vec3_int_::Rotate((8<<16), 1024 - uFacing, 0, vPosition, &vPosition.x, &vPosition.y, &vPosition.z);
95  break;
96  case 4:
97  Vec3_int_::Rotate((24<<16), 1024 - uFacing, 0, vPosition, &vPosition.x, &vPosition.y, &vPosition.z);
98  break;
99  default:
100  assert(false);
101  return 0;
102  break;
103  }
104 
105  // set blank velocity
106  vVelocity.y = 0;
107  vVelocity.x = 0;
108  vVelocity.z = 0;
109 
110  // calcualte angle velocity - could use rotate func here as above
111  if (speed) {
112  long long v13 =
113  fixpoint_mul(stru_5C6E00->Cos(yaw), stru_5C6E00->Cos(pitch));
114  long long a5a =
115  fixpoint_mul(stru_5C6E00->Sin(yaw), stru_5C6E00->Cos(pitch));
116  vVelocity.x = fixpoint_mul(v13, speed);
117  vVelocity.y = fixpoint_mul(a5a, speed);
118  vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), speed);
119  }
120 
121  // copy sprite object into slot
122  memcpy(&pSpriteObjects[sprite_slot], this, sizeof(*this));
123  if (sprite_slot >= (int)uNumSpriteObjects) {
124  uNumSpriteObjects = sprite_slot + 1;
125  }
126  return sprite_slot;
127 }
128 
129 //----- (00471C03) --------------------------------------------------------
130 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID) {
131  int v6; // eax@1
132  int v7; // ecx@1
133  int v8; // edi@1
134  int v9; // eax@4
135  int v21; // eax@41
136  int i; // edi@50
137  int v26; // edi@52
138  int v27; // eax@52
139  __int16 v28; // cx@55
140  int v29; // eax@55
141  // signed int v30; // edi@59
142  BSPModel *bmodel; // ecx@61
143  ODMFace *face; // edi@61
144  int v36; // ecx@67
145  __int16 v37; // ax@67
146  int v38; // eax@72
147  int v44; // eax@77
148  int v50; // [sp+10h] [bp-98h]@52
149  Vec3_int_ v51; // [sp+14h] [bp-94h]@11
150  Particle_sw Dst; // [sp+20h] [bp-88h]@45
151  int v54; // [sp+8Ch] [bp-1Ch]@1
152  int v55; // [sp+90h] [bp-18h]@1
153  int v56; // [sp+94h] [bp-14h]@11
154  int v57; // [sp+98h] [bp-10h]@1
155  int v58; // [sp+9Ch] [bp-Ch]@1
156  int v60; // [sp+A4h] [bp-4h]@11
157 
158  v58 = 0;
159  ObjectDesc *object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
160  v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x,
161  pSpriteObjects[uLayingItemID].vPosition.y);
162  v55 = 0;
163  bool on_water = false;
164  v6 = ODM_GetFloorLevel(pSpriteObjects[uLayingItemID].vPosition.x,
165  pSpriteObjects[uLayingItemID].vPosition.y,
166  pSpriteObjects[uLayingItemID].vPosition.z,
167  object->uHeight, &on_water, &v55, 0);
168  v7 = v6;
169  v54 = v6;
170  v8 = v6 + 1;
171  if (pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1) {
172  if (on_water) {
173  v9 = v6 + 60;
174  if (v55) v9 = v6 + 30;
176  pSpriteObjects[uLayingItemID].vPosition.y,
177  v9);
178  SpriteObject::OnInteraction(uLayingItemID);
179  }
180  } else {
181  v58 = 1;
182  }
183  if (!(object->uFlags & OBJECT_DESC_NO_GRAVITY)) {
184  if (v58) {
185  pSpriteObjects[uLayingItemID].vVelocity.z -=
187  goto LABEL_13;
188  }
189  if (v57) {
190  pSpriteObjects[uLayingItemID].vPosition.z = v8;
192  pSpriteObjects[uLayingItemID].vPosition.y,
193  &v51);
194  pSpriteObjects[uLayingItemID].vVelocity.z -=
196  v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y +
197  v51.z * pSpriteObjects[uLayingItemID].vVelocity.z +
198  v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >>
199  16;
200  // v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
201  pSpriteObjects[uLayingItemID].vVelocity.x +=
202  fixpoint_mul(v56, v51.x);
203  // v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
204  pSpriteObjects[uLayingItemID].vVelocity.y +=
205  fixpoint_mul(v56, v51.y);
206  // v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
207  pSpriteObjects[uLayingItemID].vVelocity.z +=
208  fixpoint_mul(v56, v51.z);
209  v7 = v54;
210  goto LABEL_13;
211  }
212  if (object->uFlags & OBJECT_DESC_INTERACTABLE) {
213  if (pSpriteObjects[uLayingItemID].vPosition.z < v7)
214  pSpriteObjects[uLayingItemID].vPosition.z = v8;
215  if (!_46BFFA_update_spell_fx(uLayingItemID, 0)) return;
216  }
217  pSpriteObjects[uLayingItemID].vPosition.z = v8;
218  if (!(object->uFlags & OBJECT_DESC_BOUNCE) ||
219  (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1,
220  pSpriteObjects[uLayingItemID].vVelocity.z = v21,
221  (signed __int16)v21 < 10))
222  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
223 
224  pSpriteObjects[uLayingItemID].vVelocity.x =
225  fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
226  pSpriteObjects[uLayingItemID].vVelocity.y =
227  fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
228  pSpriteObjects[uLayingItemID].vVelocity.z =
229  fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
230  if ((pSpriteObjects[uLayingItemID].vVelocity.y *
231  pSpriteObjects[uLayingItemID].vVelocity.y +
232  pSpriteObjects[uLayingItemID].vVelocity.x *
233  pSpriteObjects[uLayingItemID].vVelocity.x) < 400) {
234  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
235  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
236  memset(&Dst, 0, 0x68u);
237  Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
238  Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
239  Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
240  Dst.r = 0.0;
241  Dst.g = 0.0;
242  Dst.b = 0.0;
243  if (object->uFlags & OBJECT_DESC_TRIAL_FIRE) {
246  Dst.uDiffuse = 0xFF3C1E;
247  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
249  Dst.particle_size = 1.0f;
251  } else if (object->uFlags & OBJECT_DESC_TRIAL_LINE) {
252  Dst.type = ParticleType_Line;
253  Dst.uDiffuse = rand();
254  Dst.timeToLive = 64;
255  Dst.texture = nullptr;
256  Dst.particle_size = 1.0f;
258  } else if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) {
260  Dst.uDiffuse = rand();
261  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
263  Dst.particle_size = 1.0f;
265  }
266  return;
267  }
268  }
269 LABEL_13:
270  if (pSpriteObjects[uLayingItemID].vPosition.x >= -0x8000 &&
271  pSpriteObjects[uLayingItemID].vPosition.x <= 0x8000 &&
272  pSpriteObjects[uLayingItemID].vPosition.y >= -0x8000 &&
273  pSpriteObjects[uLayingItemID].vPosition.y <= 0x8000 &&
274  pSpriteObjects[uLayingItemID].vPosition.z > v7 &&
275  pSpriteObjects[uLayingItemID].vPosition.z <= 13000 ||
276  !(object->uFlags & OBJECT_DESC_INTERACTABLE))
277  goto LABEL_92;
278  if (pSpriteObjects[uLayingItemID].vPosition.z < v7)
279  pSpriteObjects[uLayingItemID].vPosition.z = v8;
280  if (_46BFFA_update_spell_fx(uLayingItemID, 0)) {
281  LABEL_92:
282  stru_721530.field_0 = 0;
283  stru_721530.prolly_normal_d = object->uRadius;
284  stru_721530.height = object->uHeight;
286  stru_721530.field_70 = 0;
287  for (v55 = 0; v55 < 100; ++v55) {
288  stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
291  stru_721530.position.y = pSpriteObjects[uLayingItemID].vPosition.y;
292  stru_721530.normal.y = pSpriteObjects[uLayingItemID].vPosition.y;
293  stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z +
296  stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
297  stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
298  stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z;
299  if (stru_721530.CalcMovementExtents(0)) return;
302  WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x),
303  WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y));
304  if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) !=
307  if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) ==
308  OBJECT_Actor) {
309  if ((PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) >=
310  0) &&
311  (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) <
312  (signed int)(uNumActors - 1))) {
313  for (v56 = 0; v56 < uNumActors; ++v56) {
314  if (pActors[PID_ID(pSpriteObjects[uLayingItemID]
316  .GetActorsRelation(&pActors[v56]))
318  }
319  }
320  } else {
321  for (i = 0; i < (signed int)uNumActors; ++i)
323  }
325  bool v49 = false;
326  v27 = ODM_GetFloorLevel(
329  object->uHeight, &v49, &v50, 0);
330  if (on_water && v26 < v27 + 60) {
331  if (v50)
332  v44 = v27 + 30;
333  else
334  v44 = v54 + 60;
335  Create_Splash_Object( // splash
336  pSpriteObjects[uLayingItemID].vPosition.x,
337  pSpriteObjects[uLayingItemID].vPosition.y, v44);
338  SpriteObject::OnInteraction(uLayingItemID);
339  return;
340  }
342  pSpriteObjects[uLayingItemID].vPosition.x =
344  pSpriteObjects[uLayingItemID].vPosition.y =
346  pSpriteObjects[uLayingItemID].vPosition.z =
348  pSpriteObjects[uLayingItemID].uSectorID =
349  (short)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) {
360  Dst.uDiffuse = 0xFF3C1E;
361  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
363  Dst.particle_size = 1.0f;
365  return;
366  } else if (object->uFlags & OBJECT_DESC_TRIAL_LINE) {
367  Dst.type = ParticleType_Line;
368  Dst.texture = nullptr;
369  Dst.uDiffuse = rand();
370  Dst.timeToLive = 64;
371  Dst.particle_size = 1.0f;
373  return;
374  } else if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) {
376  Dst.uDiffuse = rand();
377  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
379  Dst.particle_size = 1.0f;
381  }
382  return;
383  }
384  // v60 = ((unsigned __int64)(stru_721530.field_7C * (signed
385  // __int64)stru_721530.direction.x) >> 16);
386  pSpriteObjects[uLayingItemID].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
387  // v60 = ((unsigned __int64)(stru_721530.field_7C * (signed
388  // __int64)stru_721530.direction.y) >> 16);
389  pSpriteObjects[uLayingItemID].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
390  // v60 = ((unsigned __int64)(stru_721530.field_7C * (signed
391  // __int64)stru_721530.direction.z) >> 16);
392  v28 = (short)stru_721530.uSectorID;
393  pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
394  v29 = pSpriteObjects[uLayingItemID].vPosition.z;
395  pSpriteObjects[uLayingItemID].uSectorID = v28;
397  if (object->uFlags & OBJECT_DESC_INTERACTABLE) {
398  if (v29 < v54)
399  pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
400  if (!_46BFFA_update_spell_fx(uLayingItemID, stru_721530.pid))
401  return;
402  }
403  if (PID_TYPE(stru_721530.pid) == OBJECT_Decoration) break;
404  if (PID_TYPE(stru_721530.pid) == OBJECT_BModel) {
405  bmodel = &pOutdoor->pBModels[(signed int)stru_721530.pid >> 9];
406  face = &bmodel->pFaces[PID_ID(stru_721530.pid) & 0x3F];
407  if (face->uPolygonType == POLYGON_Floor) {
408  pSpriteObjects[uLayingItemID].vPosition.z =
409  bmodel->pVertices.pVertices[face->pVertexIDs[0]].z + 1;
410  if (pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x +
411  pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y >= 400) {
412  if (face->uAttributes & FACE_UNKNOW2)
413  EventProcessor(face->sCogTriggeredID, 0, 1);
414  } else {
415  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
416  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
417  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
418  }
419  } else {
420  v56 = abs(face->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x +
421  face->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y +
422  face->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z) >>
423  16;
424  if ((stru_721530.speed >> 3) > v56)
425  v56 = stru_721530.speed >> 3;
426  // v57 = fixpoint_mul(v56, face->pFacePlane.vNormal.x);
427  // v58 = fixpoint_mul(v56, face->pFacePlane.vNormal.y);
428  v60 = fixpoint_mul(v56, face->pFacePlane.vNormal.z);
429  pSpriteObjects[uLayingItemID].vVelocity.x += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.x);
430  pSpriteObjects[uLayingItemID].vVelocity.y += 2 * fixpoint_mul(v56, face->pFacePlane.vNormal.y);
431  if (face->pFacePlane.vNormal.z <= 32000) {
432  v37 = 2 * (short)v60;
433  } else {
434  v36 = v60;
435  pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
436  v58 = fixpoint_mul(0x7D00, v36);
437  v37 = fixpoint_mul(32000, v36);
438  }
439  pSpriteObjects[uLayingItemID].vVelocity.z += v37;
440  if (face->uAttributes & FACE_UNKNOW2)
441  EventProcessor(face->sCogTriggeredID, 0, 1);
442  }
443  }
444  LABEL_74:
445  pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
446  pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
447  pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
448  }
449  v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x +
450  pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y);
451  v38 = stru_5C6E00->Atan2(
452  pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[PID_ID(stru_721530.pid)].vPosition.x,
453  pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[PID_ID(stru_721530.pid)].vPosition.y);
454  pSpriteObjects[uLayingItemID].vVelocity.x =
455  fixpoint_mul(stru_5C6E00->Cos(v38), v57);
456  pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(
457  stru_5C6E00->Sin(v38 - stru_5C6E00->uIntegerHalfPi), v57);
458  goto LABEL_74;
459  }
460 }
461 
462 //----- (0047136C) --------------------------------------------------------
463 void SpriteObject::UpdateObject_fn0_BLV(unsigned int uLayingItemID) {
464  SpriteObject *pSpriteObject = &pSpriteObjects[uLayingItemID];
465  ObjectDesc *pObject = &pObjectList->pObjects[pSpriteObject->uObjectDescID];
466 
467  pSpriteObject->uSectorID = pIndoor->GetSector(pSpriteObject->vPosition.x,
468  pSpriteObject->vPosition.y,
469  pSpriteObject->vPosition.z);
470 
471  unsigned int uFaceID;
472 
473  int floor_lvl = BLV_GetFloorLevel(
474  pSpriteObject->vPosition.x, pSpriteObject->vPosition.y,
475  pSpriteObject->vPosition.z, pSpriteObject->uSectorID, &uFaceID);
476 
477  // object out of bounds
478  if (abs(pSpriteObject->vPosition.x) > 32767 ||
479  abs(pSpriteObject->vPosition.y) > 32767 ||
480  abs(pSpriteObject->vPosition.z) > 20000 ||
481  floor_lvl <= -30000 && (pSpriteObject->uSectorID == 0)) {
482  SpriteObject::OnInteraction(uLayingItemID);
483  return;
484  }
485 
486  int v15; // ebx@46
487  int v17; // eax@50
488  __int16 v22; // ax@57
489  int v23; // edi@62
490  Particle_sw Dst; // [sp+Ch] [bp-84h]@18
491 
492  int v39; // [sp+80h] [bp-10h]@33
493  int v40; // [sp+84h] [bp-Ch]@28
494 
495 
496  if (pObject->uFlags & OBJECT_DESC_NO_GRAVITY) { //не падающие объекты
497 LABEL_25:
498  stru_721530.field_0 = 0;
500  stru_721530.field_84 = -1;
501  stru_721530.height = pObject->uHeight;
503  stru_721530.field_70 = 0;
504  for (int loop = 0; loop < 100; loop++) {
505  stru_721530.position.x = pSpriteObject->vPosition.x;
506  stru_721530.position.y = pSpriteObject->vPosition.y;
508  stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
509 
513 
514  stru_721530.velocity.x = pSpriteObject->vVelocity.x;
515  stru_721530.velocity.y = pSpriteObject->vVelocity.y;
516  stru_721530.velocity.z = pSpriteObject->vVelocity.z;
517 
518  stru_721530.uSectorID = pSpriteObject->uSectorID;
519  if (stru_721530.CalcMovementExtents(0)) return;
520 
521  for (int loop2 = 0; loop2 < 100; ++loop2) {
524 
525  if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player)
527 
528  for (int actloop = 0; actloop < (signed int)uNumActors; ++actloop) {
529  // dont collide against self
530  if (PID_TYPE(pSpriteObject->spell_caster_pid) == OBJECT_Actor) {
531  if (PID_ID(pSpriteObject->spell_caster_pid) == actloop) continue;
532  }
533 
534  // not sure:
535  // pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
536  int radius = 0;
537  if (pActors[actloop].word_000086_some_monster_id) { // not always filled in from scripted monsters
538  radius = pMonsterList->pMonsters[pActors[actloop].word_000086_some_monster_id - 1].uToHitRadius;
539  }
540  Actor::_46DF1A_collide_against_actor(actloop, radius);
541  }
542 
543  if (_46F04E_collide_against_portals()) break;
544  }
545  // end loop2
546 
548  pSpriteObject->vPosition.x = stru_721530.normal2.x;
549  pSpriteObject->vPosition.y = stru_721530.normal2.y;
550  pSpriteObject->vPosition.z =
552  pSpriteObject->uSectorID = (short)stru_721530.uSectorID;
553  if (!(pObject->uFlags & 0x100)) return;
554  memset(&Dst, 0, 0x68u);
555  Dst.x = (double)pSpriteObject->vPosition.x;
556  Dst.y = (double)pSpriteObject->vPosition.y;
557  Dst.z = (double)pSpriteObject->vPosition.z;
558  Dst.r = 0.0;
559  Dst.g = 0.0;
560  Dst.b = 0.0;
561  if (pObject->uFlags & OBJECT_DESC_TRIAL_FIRE) {
564  Dst.uDiffuse = 0xFF3C1E;
565  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
567  Dst.particle_size = 1.0f;
569  return;
570  } else if (pObject->uFlags & OBJECT_DESC_TRIAL_LINE) {
571  Dst.type = ParticleType_Line;
572  Dst.uDiffuse = rand();
573  Dst.timeToLive = 64;
574  Dst.texture = 0;
575  Dst.particle_size = 1.0f;
577  return;
578  } else if (pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE) {
580  Dst.uDiffuse = rand();
581  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
583  Dst.particle_size = 1.0f;
585  }
586  return;
587  }
588  // v40 = (unsigned __int64)(stru_721530.field_7C * (signed
589  // __int64)stru_721530.direction.x) >> 16;
590 
591  pSpriteObject->vPosition.x +=
593 
594  // v40 = (unsigned __int64)(stru_721530.field_7C * (signed
595  // __int64)stru_721530.direction.y) >> 16;
596 
597  pSpriteObject->vPosition.y +=
599 
600  // v40 = (unsigned __int64)(stru_721530.field_7C * (signed
601  // __int64)stru_721530.direction.z) >> 16;
602 
603  pSpriteObject->vPosition.z +=
605 
606  pSpriteObject->uSectorID = stru_721530.uSectorID;
608 
609  // if weve collided but dont need to react return
610  if (pObject->uFlags & OBJECT_DESC_INTERACTABLE &&
611  !_46BFFA_update_spell_fx(uLayingItemID, stru_721530.pid))
612  return;
613 
614  v15 = (signed int)stru_721530.pid >> 3;
615  if (PID_TYPE(stru_721530.pid) == OBJECT_Decoration) {
616  v40 = integer_sqrt(
617  pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x +
618  pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
619  v23 =
620  stru_5C6E00->Atan2(pSpriteObject->vPosition.x -
621  pLevelDecorations[v15].vPosition.x,
622  pSpriteObject->vPosition.y -
623  pLevelDecorations[v15].vPosition.y);
624  pSpriteObject->vVelocity.x =
625  fixpoint_mul(stru_5C6E00->Cos(v23), v40);
626  pSpriteObject->vVelocity.y =
627  fixpoint_mul(stru_5C6E00->Sin(v23), v40);
628  }
629  if (PID_TYPE(stru_721530.pid) == OBJECT_BModel) {
630  stru_721530.field_84 = (signed int)PID_ID(stru_721530.pid);
631  if (pIndoor->pFaces[v15].uPolygonType != POLYGON_Floor) {
632  floor_lvl = abs(pIndoor->pFaces[v15].pFacePlane_old.vNormal.x *
633  pSpriteObject->vVelocity.x +
635  pSpriteObject->vVelocity.y +
637  pSpriteObject->vVelocity.z) >>
638  16;
639  if ((stru_721530.speed >> 3) > floor_lvl)
640  floor_lvl = stru_721530.speed >> 3;
641  pSpriteObject->vVelocity.x +=
642  2 *
643  fixpoint_mul(
644  floor_lvl, pIndoor->pFaces[v15].pFacePlane_old.vNormal.x);
645  pSpriteObject->vVelocity.y +=
646  2 *
647  fixpoint_mul(
648  floor_lvl, pIndoor->pFaces[v15].pFacePlane_old.vNormal.y);
649  v39 = fixpoint_mul(
650  floor_lvl, pIndoor->pFaces[v15].pFacePlane_old.vNormal.z);
651  if (pIndoor->pFaces[v15].pFacePlane_old.vNormal.z <= 32000) {
652  v22 = 2 * v39;
653  } else {
654  pSpriteObject->vVelocity.z += v39;
655  v22 = fixpoint_mul(32000, v39);
656  }
657  pSpriteObject->vVelocity.z += v22;
658  if (pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2)
660  pIndoor
661  ->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID]
662  .uEventID,
663  0, 1);
664  pSpriteObject->vVelocity.x =
665  fixpoint_mul(58500, pSpriteObject->vVelocity.x);
666  pSpriteObject->vVelocity.y =
667  fixpoint_mul(58500, pSpriteObject->vVelocity.y);
668  pSpriteObject->vVelocity.z =
669  fixpoint_mul(58500, pSpriteObject->vVelocity.z);
670  continue;
671  }
672  if (pObject->uFlags & OBJECT_DESC_BOUNCE) {
673  v17 = -pSpriteObject->vVelocity.z / 2;
674  pSpriteObject->vVelocity.z = v17;
675  if ((signed __int16)v17 < 10)
676  pSpriteObject->vVelocity.z = 0;
677  if (pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2)
679  pIndoor
680  ->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID]
681  .uEventID,
682  0, 1);
683  pSpriteObject->vVelocity.x =
684  fixpoint_mul(58500, pSpriteObject->vVelocity.x);
685  pSpriteObject->vVelocity.y =
686  fixpoint_mul(58500, pSpriteObject->vVelocity.y);
687  pSpriteObject->vVelocity.z =
688  fixpoint_mul(58500, pSpriteObject->vVelocity.z);
689  continue;
690  }
691  pSpriteObject->vVelocity.z = 0;
692  if (pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x +
693  pSpriteObject->vVelocity.y *
694  pSpriteObject->vVelocity.y >=
695  400) {
696  if (pIndoor->pFaces[v15].uAttributes & FACE_UNKNOW2)
698  pIndoor
699  ->pFaceExtras[pIndoor->pFaces[v15].uFaceExtraID]
700  .uEventID,
701  0, 1);
702  pSpriteObject->vVelocity.x =
703  fixpoint_mul(58500, pSpriteObject->vVelocity.x);
704  pSpriteObject->vVelocity.y =
705  fixpoint_mul(58500, pSpriteObject->vVelocity.y);
706  pSpriteObject->vVelocity.z =
707  fixpoint_mul(58500, pSpriteObject->vVelocity.z);
708  continue;
709  }
710  pSpriteObject->vVelocity.z = 0;
711  pSpriteObject->vVelocity.y = 0;
712  pSpriteObject->vVelocity.x = 0;
713  pSpriteObject->vPosition.z =
714  pIndoor->pVertices[*pIndoor->pFaces[v15].pVertexIDs].z + 1;
715  }
716  pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
717  pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
718  pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
719  }
720  // end loop
721  }
722  //для падающих объектов(для примера выброс вещи из инвентаря)
723  // fallen objects, eg thrown out of inventory
724  if (floor_lvl <= pSpriteObject->vPosition.z - 3) {
725  pSpriteObject->vVelocity.z -=
727  goto LABEL_25;
728  }
729 
730  if (!(pObject->uFlags & OBJECT_DESC_INTERACTABLE) ||
731  _46BFFA_update_spell_fx(uLayingItemID, 0)) {
732  pSpriteObject->vPosition.z = floor_lvl + 1;
733  if (pIndoor->pFaces[uFaceID].uPolygonType == POLYGON_Floor) {
734  pSpriteObject->vVelocity.z = 0;
735  } else {
736  if (pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 45000)
737  pSpriteObject->vVelocity.z -=
739  }
740  pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
741  pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
742  pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
743  if (pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x +
744  pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y <
745  400) {
746  pSpriteObject->vVelocity.x = 0;
747  pSpriteObject->vVelocity.y = 0;
748  pSpriteObject->vVelocity.z = 0;
749  if (!(pObject->uFlags & OBJECT_DESC_NO_SPRITE)) return;
750  memset(&Dst, 0, 0x68u);
751  Dst.x = (double)pSpriteObject->vPosition.x;
752  Dst.y = (double)pSpriteObject->vPosition.y;
753  Dst.z = (double)pSpriteObject->vPosition.z;
754  Dst.r = 0.0;
755  Dst.g = 0.0;
756  Dst.b = 0.0;
757  if (pObject->uFlags & OBJECT_DESC_TRIAL_FIRE) {
760  Dst.uDiffuse = 0xFF3C1E;
761  Dst.particle_size = 1.0f;
762  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
765  return;
766  } else if (pObject->uFlags & OBJECT_DESC_TRIAL_LINE) {
767  Dst.type = ParticleType_Line;
768  Dst.uDiffuse = rand();
769  Dst.timeToLive = 64;
770  Dst.texture = nullptr;
771  Dst.particle_size = 1.0f;
773  return;
774  } else if (pObject->uFlags & OBJECT_DESC_TRIAL_PARTICLE) {
776  Dst.uDiffuse = rand();
777  Dst.particle_size = 1.0f;
778  Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
781  }
782  return;
783  }
784  goto LABEL_25;
785  }
786 }
787 
790  int dir_x = abs(pParty->vPosition.x - this->vPosition.x);
791  int dir_y = abs(pParty->vPosition.y - this->vPosition.y);
792  int dir_z = abs(pParty->vPosition.z + pParty->sEyelevel - this->vPosition.z);
793  if (dir_x < dir_y) {
794  std::swap(dir_x, dir_y);
795  }
796  if (dir_x < dir_z) {
797  std::swap(dir_x, dir_z);
798  }
799  if (dir_y < dir_z) {
800  std::swap(dir_y, dir_z);
801  }
802  unsigned int v10 = ((unsigned int)(11 * dir_y) >> 5) + (dir_z / 4) + dir_x;
803  if (v10 <= 768) {
804  int v11 = 5;
805  if (pMapInfo->Trap_D20) {
806  for (uint i = 0; i < pMapInfo->Trap_D20; ++i) {
807  v11 += rand() % 20 + 1;
808  }
809  }
810  DAMAGE_TYPE pDamageType;
811  switch (this->uType) {
812  case 811:
813  pDamageType = DMGT_FIRE;
814  break;
815  case 812:
816  pDamageType = DMGT_ELECTR;
817  break;
818  case 813:
819  pDamageType = DMGT_COLD;
820  break;
821  case 814:
822  pDamageType = DMGT_BODY;
823  break;
824  default:
825  return;
826  }
827  for (unsigned int i = 1; i <= 4; ++i) {
828  int v13 = pPlayers[i]->GetPerception() + 20;
829  if (pPlayers[i]->CanAct() && (rand() % v13 > 20))
830  pPlayers[i]->PlaySound(SPEECH_6, 0);
831  else
832  pPlayers[i]->ReceiveDamage(v11, pDamageType);
833  }
834  }
835 }
836 
838  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
839  return pObjectDesc->uLifetime;
840 }
841 
843  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
844  return pSpriteFrameTable->GetFrame(pObjectDesc->uSpriteID, uSpriteFrameID);
845 }
846 
848  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
849  return ((pObjectDesc->uFlags & OBJECT_DESC_UNPICKABLE) == OBJECT_DESC_UNPICKABLE);
850 }
851 
853  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
854  return !pObjectDesc->NoSprite();
855 }
856 
858  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
859  return pObjectDesc->uParticleTrailColorR;
860 }
861 
863  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
864  return pObjectDesc->uParticleTrailColorG;
865 }
866 
868  ObjectDesc *pObjectDesc = &pObjectList->pObjects[uObjectDescID];
869  return pObjectDesc->uParticleTrailColorB;
870 }
871 
872 void SpriteObject::OnInteraction(unsigned int uLayingItemID) {
873  pSpriteObjects[uLayingItemID].uObjectDescID = 0;
874  if (pParty->bTurnBasedModeOn) {
875  if (pSpriteObjects[uLayingItemID].uAttributes & 4) {
876  pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; // ~0x00000004
878  }
879  }
880 }
881 
883  int new_obj_pos = 0;
884 
885  for (int i = 0; i < MAX_SPRITE_OBJECTS; ++i) {
886  if (pSpriteObjects[i].uObjectDescID) {
887  if (i != new_obj_pos) {
888  memcpy(&pSpriteObjects[new_obj_pos], &pSpriteObjects[i],
889  sizeof(SpriteObject));
890  pSpriteObjects[i].uObjectDescID = 0;
891  }
892  new_obj_pos++;
893  }
894  }
895  uNumSpriteObjects = new_obj_pos;
896 }
897 
899  for (size_t i = 0; i < uNumSpriteObjects; ++i) {
900  SpriteObject *item = &pSpriteObjects[i];
901  if (item->uType &&
902  (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags &
905  }
906  }
907 }
908 
910  __debugbreak(); // Ritor1
911 
912  if (uNumActors > 0) {
913  for (size_t i = 0; i < uNumActors; ++i) {
914  if (pActors[i].CanAct()) {
915  int v7 = pActors[i].vPosition.x - this->vPosition.x;
916  int v9 = pActors[i].vPosition.y - this->vPosition.y;
917  int v10 = pActors[i].uActorHeight / 2 + pActors[i].vPosition.z -
918  this->vVelocity.y;
919 
920  int v11 = this->vVelocity.x * this->vVelocity.x;
921 
922  if (v11 >= v7 * v7 + v9 * v9 + v10 * v10) {
923  if (pActors[i].DoesDmgTypeDoDamage(DMGT_DARK)) {
924  pActors[i].pActorBuffs[this->spell_id].Apply(
926  GameTime::FromSeconds(this->spell_level)),
927  this->spell_skill, 4, 0, 0);
928  pActors[i].uAttributes |= 0x80000;
929  }
930  }
931  }
932  }
933  }
934 }
935 
936 //----- (0042F7EB) --------------------------------------------------------
938  int y, int z, int a4, int count,
939  int a7, unsigned __int16 attributes,
940  ItemGen *a9) {
941  SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
942 
943  pSpellObject.containing_item.Reset();
944  if (a9)
945  memcpy(&pSpellObject.containing_item, a9,
946  sizeof(pSpellObject.containing_item));
947  pSpellObject.spell_skill = 0;
948  pSpellObject.spell_level = 0;
949  pSpellObject.spell_id = 0;
950  pSpellObject.field_54 = 0;
951  pSpellObject.uType = sprite;
952  pSpellObject.uObjectDescID = pObjectList->ObjectIDByItemID(sprite);
953  pSpellObject.vPosition.x = x;
954  pSpellObject.vPosition.y = y;
955  pSpellObject.vPosition.z = z;
956  pSpellObject.uSoundID = 0;
957  pSpellObject.uAttributes = attributes;
958  pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
959  pSpellObject.uSpriteFrameID = 0;
960  pSpellObject.spell_caster_pid = 0;
961  pSpellObject.spell_target_pid = 0;
962  if (!(pSpellObject.uAttributes & 0x10)) {
964  for (uint i = 1; i < pItemsTable->uAllItemsCount; ++i) {
965  if (pItemsTable->pItems[i].uSpriteID == sprite)
966  pSpellObject.containing_item.uItemID = i;
967  }
968  }
969  }
970  if (a7) {
971  if (count > 0) {
972  for (uint i = count; i; --i) {
973  pSpellObject.uFacing = rand() % (int)stru_5C6E00->uIntegerDoublePi;
974  pSpellObject.Create(
975  (int16_t)pSpellObject.uFacing,
976  ((int)stru_5C6E00->uIntegerHalfPi / 2) +
977  (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)),
978  a4, 0);
979  }
980  }
981  } else {
982  pSpellObject.uFacing = 0;
983  if (count > 0) {
984  for (uint i = count; i; --i) {
985  pSpellObject.Create((int16_t)pSpellObject.uFacing,
986  stru_5C6E00->uIntegerHalfPi, a4, 0);
987  }
988  }
989  }
990  return true;
991 }
992 
993 void SpriteObject::Create_Splash_Object(int x, int y, int z) { // splash on water
994  SpriteObject a1;
995  a1.containing_item.Reset();
996  a1.spell_skill = 0;
997  a1.spell_level = 0;
998  a1.spell_id = 0;
999  a1.field_54 = 0;
1002  a1.vPosition.x = x;
1003  a1.vPosition.y = y;
1004  a1.vPosition.z = z;
1005  a1.uSoundID = 0;
1006  a1.uAttributes = 0;
1007  a1.uSectorID = pIndoor->GetSector(x, y, z);
1008  a1.uSpriteFrameID = 0;
1009  a1.spell_caster_pid = 0;
1010  a1.spell_target_pid = 0;
1011  int objID = a1.Create(0, 0, 0, 0);
1012  if (objID != -1) {
1013  pAudioPlayer->PlaySound((SoundID)SOUND_splash, PID(OBJECT_Item, objID), 0, 0, 0, 0);
1014  }
1015 }
1016 
1017 bool _46BFFA_update_spell_fx(unsigned int uLayingItemID, int a2) {
1018  int v90; // ST34_4@159
1019  int v91; // eax@159
1020  unsigned int v107 = 0; // edx@220
1021  int v108; // ebx@225
1022  // int v110; // ebx@234
1023  int v114; // eax@242
1024  int v135 = 0; // [sp-4h] [bp-30h]@217
1025  int v136; // [sp+Ch] [bp-20h]@208
1026  int v137; // [sp+10h] [bp-1Ch]@208
1027  int v138; // [sp+14h] [bp-18h]@207
1028  // int v141; // [sp+1Ch] [bp-10h]@117
1029  uint16_t v150; // [sp+20h] [bp-Ch]@208
1030  int v152; // [sp+24h] [bp-8h]@208
1031 
1032  ObjectDesc *object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
1033  if (PID_TYPE(a2) == OBJECT_Actor) {
1034  if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor &&
1035  !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]))
1036  return 1;
1037  } else {
1038  if (PID_TYPE(a2) == OBJECT_Player &&
1039  PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player)
1040  return 1;
1041  }
1042  if (pParty->bTurnBasedModeOn) {
1043  if (pSpriteObjects[uLayingItemID].uAttributes & 4) {
1045  pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; // ~0x00000004
1046  }
1047  }
1048  if (PID_TYPE(a2) == OBJECT_BModel &&
1049  PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) {
1050  if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) // bugfix PID_ID(v2->spell_caster_pid)==1000
1051  pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= ACTOR_UNKNOW5;
1052  }
1053 
1054  switch (pSpriteObjects[uLayingItemID].uType) {
1058  if (PID_TYPE(a2) == OBJECT_BModel
1059  || PID_TYPE(a2) == OBJECT_Decoration
1060  || PID_TYPE(a2) == OBJECT_Any) {
1061  return 1;
1062  }
1063  if (PID_TYPE(a2) != OBJECT_Item) {
1064  sub_43A97E(uLayingItemID, a2);
1065  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1066  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1067  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1068  SpriteObject::OnInteraction(uLayingItemID);
1069  }
1070  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1071  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1072  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1073  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1074  int v97 = 0;
1075  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1076  v97 = (int16_t)pSpriteObjects[uLayingItemID].uSoundID + 4;
1077  }
1078  // v125 =
1079  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1080  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125,
1081  // v124, 0, -1, 0, v97, 0, 0);
1082  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id - 1,
1083  PID(OBJECT_Item, uLayingItemID));
1084  return 0;
1085  }
1086  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1087  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1088  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1089  SpriteObject::OnInteraction(uLayingItemID);
1090  }
1091  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1092  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1093  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1094  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1095  pAudioPlayer->PlaySound(SOUND_fireBall, PID(OBJECT_Item, uLayingItemID), 0, -1, 0, 0);
1096  return 0;
1097  }
1098 
1099  case SPRITE_PROJECTILE_500:
1100  case SPRITE_PROJECTILE_505:
1101  case SPRITE_PROJECTILE_510:
1102  case SPRITE_PROJECTILE_515:
1103  case SPRITE_PROJECTILE_520:
1104  case SPRITE_PROJECTILE_525:
1105  case SPRITE_PROJECTILE_530:
1106  case SPRITE_PROJECTILE_535:
1107  case SPRITE_PROJECTILE_540: {
1108  sub_43A97E(uLayingItemID, a2);
1109  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1110  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1111  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1112  SpriteObject::OnInteraction(uLayingItemID);
1113  }
1114  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1115  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1116  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1117  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1118  if (pSpriteObjects[uLayingItemID].uType == SPRITE_BLASTER_PROJECTILE) {
1119  pAudioPlayer->PlaySound(SOUND_fireBall, PID(OBJECT_Item, uLayingItemID), 0, -1, 0, 0);
1120  }
1121  return 0;
1122  }
1123 
1125  case SPRITE_PROJECTILE_550: {
1126  if (pSpriteObjects[uLayingItemID].containing_item.uItemID != 405 &&
1127  pSpriteObjects[uLayingItemID].containing_item.special_enchantment != 3) {
1128  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1129  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1130  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1131  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1132  sub_43A97E(uLayingItemID, a2);
1133  SpriteObject::OnInteraction(uLayingItemID);
1134  int v16 = 0;
1135  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1136  v16 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1137  }
1138  // v124 = 8 * uLayingItemID;
1139  // v124 |= 2;
1140  // v125 =
1141  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id]
1142  // + 1; pAudioPlayer->PlaySound((SoundID)v125, v124,
1143  // 0, -1, 0, v16, 0, 0);
1144  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1145  PID(OBJECT_Item, uLayingItemID));
1146  return 0;
1147  }
1148  pSpriteObjects[uLayingItemID].uType = SPRITE_OBJECT_EXPLODE;
1149  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(SPRITE_OBJECT_EXPLODE);
1150  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1151  SpriteObject::OnInteraction(uLayingItemID);
1152  }
1153  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1154  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1155  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1156  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1157  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1158  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1159  SpriteObject::OnInteraction(uLayingItemID);
1160  }
1161  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1162  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1163  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1164  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1165  if (pSpriteObjects[uLayingItemID].uType != 555) {
1166  pAudioPlayer->PlaySound(SOUND_fireBall, PID(OBJECT_Item, uLayingItemID), 0, -1, 0, 0);
1167  return 0;
1168  }
1169  return 0;
1170  }
1171 
1172  case SPRITE_OBJECT_EXPLODE: { // actor death explode
1173  pSpriteObjects[uLayingItemID].uType = SPRITE_OBJECT_EXPLODE_IMPACT;
1175  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1176  SpriteObject::OnInteraction(uLayingItemID);
1177  }
1178  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1179  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1180  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1181  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1182  AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512,
1183  pSpriteObjects[uLayingItemID].vPosition.x,
1184  pSpriteObjects[uLayingItemID].vPosition.y,
1185  pSpriteObjects[uLayingItemID].vPosition.z,
1186  0, 0);
1187  if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) {
1189  pSpriteObjects[uLayingItemID].vPosition.y,
1190  pSpriteObjects[uLayingItemID].vPosition.z,
1191  object->uParticleTrailColor);
1192  }
1193  pAudioPlayer->PlaySound(SOUND_fireBall, PID(OBJECT_Item, uLayingItemID), 0, -1, 0, 0);
1194  return 0;
1195  }
1196 
1209  sub_43A97E(uLayingItemID, a2);
1210  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1211  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1212  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1213  SpriteObject::OnInteraction(uLayingItemID);
1214  }
1215  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1216  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1217  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1218  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1219  int v97 = 0;
1220  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1221  v97 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1222  }
1223  // v124 = 8 * uLayingItemID;
1224  // v124 |= v124 | 2;
1225  // v125 =
1226  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1227  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1228  // -1, 0, v97, 0, 0);
1229  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1230  PID(OBJECT_Item, uLayingItemID));
1231  return 0;
1232  }
1233 
1235  sub_43A97E(uLayingItemID, a2);
1236  pSpriteObjects[uLayingItemID].uType = SPRITE_BLASTER_IMPACT;
1237  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(SPRITE_BLASTER_IMPACT);
1238  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1239  SpriteObject::OnInteraction(uLayingItemID);
1240  }
1241  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1242  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1243  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1244  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1245  return 0;
1246  }
1247 
1251  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1252  SpriteObject::OnInteraction(uLayingItemID);
1253  }
1254  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1255  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1256  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1257  int v65 = 7;
1258  if (pSpriteObjects[uLayingItemID].spell_skill == 4) {
1259  v65 = 9;
1260  }
1261  int v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
1262  for (int i = 0; i < v65; i++) {
1263  v64 += (int)stru_5C6E00->uIntegerHalfPi / 2;
1264  pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0);
1265  }
1266  SpriteObject::OnInteraction(uLayingItemID);
1267  int v16 = 0;
1268  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1269  v16 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1270  }
1271  // v124 = 8 * uLayingItemID;
1272  // v124 |= v124 | 2;
1273  // v125 =
1274  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1275  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1276  // -1, 0, v16, 0, 0);
1277  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1278  PID(OBJECT_Item, uLayingItemID));
1279  return 0;
1280  }
1281 
1283  pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_WATER_ICE_BLAST_IMPACT;
1285  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1286  SpriteObject::OnInteraction(uLayingItemID);
1287  }
1288  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1289  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1290  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1291  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1292  sub_43A97E(uLayingItemID, a2);
1293  int v16 = 0;
1294  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1295  v16 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1296  }
1297  // v124 = 8 * uLayingItemID;
1298  // v124 |= v124 | 2;
1299  // v125 =
1300  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1301  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1302  // -1, 0, v16, 0, 0);
1303  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1304  PID(OBJECT_Item, uLayingItemID));
1305  return 0;
1306  }
1307 
1309  if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2)) {
1310  return 1;
1311  }
1314  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1315  SpriteObject::OnInteraction(uLayingItemID);
1316  }
1317  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1318  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1319  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1320  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1321  AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512,
1322  pSpriteObjects[uLayingItemID].vPosition.x,
1323  pSpriteObjects[uLayingItemID].vPosition.y,
1324  pSpriteObjects[uLayingItemID].vPosition.z,
1325  0, 0);
1326  int v78 = 0;
1327  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1328  v78 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1329  }
1330  // v125 =
1331  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1332  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125,
1333  // pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78,
1334  // 0, 0);
1335  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1336  PID(OBJECT_Item, uLayingItemID));
1337  return 0;
1338  }
1339 
1343  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1344  SpriteObject::OnInteraction(uLayingItemID);
1345  }
1346  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1347  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1348  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1349  int v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
1350  for (int i = 0; i < 8; i++) {
1351  pRnd->SetRange(-128, 128);
1352  v90 = pRnd->GetInRange();
1353  pRnd->SetRange(5, 500);
1354  v91 = pRnd->GetInRange();
1355  v89 += stru_5C6E00->uIntegerHalfPi / 2;
1356  pSpriteObjects[uLayingItemID].Create(v90 + v89, 0, v91, 0);
1357  }
1358  SpriteObject::OnInteraction(uLayingItemID);
1359  int v16 = 0;
1360  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1361  v16 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1362  }
1363  // v124 = 8 * uLayingItemID;
1364  // v124 |= 2;
1365  // v125 =
1366  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1367  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1368  // -1, 0, v16, 0, 0);
1369  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1370  PID(OBJECT_Item, uLayingItemID));
1371  return 0;
1372  }
1373 
1377  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1378  SpriteObject::OnInteraction(uLayingItemID);
1379  }
1380  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1381  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1382  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1383  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1384  AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512,
1385  pSpriteObjects[uLayingItemID].vPosition.x,
1386  pSpriteObjects[uLayingItemID].vPosition.y,
1387  pSpriteObjects[uLayingItemID].vPosition.z,
1388  pSpriteObjects[uLayingItemID].field_61,
1389  0);
1390  int v78 = 0;
1391  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1392  v78 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1393  }
1394  // v125 =
1395  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1396  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125,
1397  // pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78,
1398  // 0, 0);
1399  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1400  PID(OBJECT_Item, uLayingItemID));
1401  return 0;
1402  }
1403 
1405  if (PID_TYPE(a2) == OBJECT_Actor &&
1406  MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID,
1408  sub_43A97E(uLayingItemID, a2);
1409  }
1410  pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_LIGHT_DESTROY_UNDEAD_1;
1412  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1413  SpriteObject::OnInteraction(uLayingItemID);
1414  }
1415  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1416  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1417  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1418  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1419  int v97 = 0;
1420  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1421  v97 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1422  }
1423  // v92 = uLayingItemID;
1424  // v124 = 8 * v92;
1425  // v124 |= 2;
1426  // v125 =
1427  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1428  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1429  // -1, 0, v97, 0, 0);
1430  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1431  PID(OBJECT_Item, uLayingItemID));
1432  return 0;
1433  }
1434 
1439  sub_43A97E(uLayingItemID, a2);
1440  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1441  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1442  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1443  SpriteObject::OnInteraction(uLayingItemID);
1444  }
1445  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1446  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1447  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1448  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1449  int v97 = 0;
1450  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1451  v97 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1452  }
1453  // v124 = 8 * uLayingItemID;
1454  // v124 |= 2;
1455  // v125 =
1456  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1457  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1458  // -1, 0, v97, 0, 0);
1459  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1460  PID(OBJECT_Item, uLayingItemID));
1461  return 0;
1462  }
1463 
1467  int v143 = 17030;
1468  switch (pSpriteObjects[uLayingItemID].uType) {
1469  case 6040:
1470  v143 = 15040;
1471  break;
1472  case 4010:
1473  v143 = 13010;
1474  break;
1475  case 9030:
1476  v143 = 18030;
1477  break;
1478  }
1479  v138 = 1;
1480  if (PID_TYPE(a2) != OBJECT_Actor) {
1481  if (pSpriteObjects[uLayingItemID].uType != 9030 ||
1482  pSpriteObjects[uLayingItemID].spell_skill != 4) {
1483  SpriteObject::OnInteraction(uLayingItemID);
1484  return 0;
1485  }
1486  pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
1487  if (!v138) {
1488  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(
1489  pSpriteObjects[uLayingItemID].uType + 1);
1490  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1491  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1492  SpriteObject::OnInteraction(uLayingItemID);
1493  }
1494  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1495  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1496  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1497  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1498  int v114 = 0;
1499  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1500  v114 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1501  }
1502  // v115 = 8 * uLayingItemID;
1503  // v115 |= PID(OBJECT_Item, uLayingItemID);
1504  // v125 = v143 + 1;
1505  // pAudioPlayer->PlaySound((SoundID)v125,
1506  // v115, 0, -1, 0, v114, 0, 0);
1507  pAudioPlayer->PlaySpellSound(v143 + 1,
1508  PID(OBJECT_Item, uLayingItemID));
1509  } else {
1510  SpriteObject::OnInteraction(uLayingItemID);
1511  }
1512  return 0;
1513  }
1514  v150 = 0;
1515  v137 = pSpriteObjects[uLayingItemID].spell_level;
1516  v152 = pSpriteObjects[uLayingItemID].spell_skill;
1517  v136 = pSpriteObjects[uLayingItemID].spell_id;
1518  if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_DARK_SHRINKING_RAY) {
1519  v150 = 2;
1520  if (v152 == 2) {
1521  v150 = 3;
1522  } else {
1523  if (v152 >= 3) v150 = 4;
1524  }
1525  pActors[PID_ID(a2)].uAttributes |= ACTOR_AGGRESSOR;
1526  v107 = v135;
1527  }
1528  if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_MIND_CHARM) {
1529  v135 = 7;
1530  v107 = v135;
1531  } else {
1532  if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_LIGHT_PARALYZE) {
1533  v135 = 9;
1534  v107 = v135;
1535  } else {
1536  if (pSpriteObjects[uLayingItemID].uType != SPRITE_SPELL_DARK_SHRINKING_RAY) {
1537  v107 = v136;
1538  }
1539  if (pSpriteObjects[uLayingItemID].uType == SPRITE_SPELL_DARK_SHRINKING_RAY) {
1540  v135 = 10;
1541  v107 = v135;
1542  }
1543  }
1544  }
1545  if (pSpriteObjects[uLayingItemID].uType != SPRITE_SPELL_DARK_SHRINKING_RAY ||
1546  v152 != 4) {
1547  v108 = PID_ID(a2);
1548  if (pActors[PID_ID(a2)].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107)) {
1549  v138 = 0;
1550  if (pSpriteObjects[uLayingItemID].uType ==
1552  pActors[v108].uAIState = Standing;
1553  pActors[v108].UpdateAnimation();
1554  }
1555  pActors[v108].pActorBuffs[v136].Apply(
1557  v152, v150, 0, 0);
1558  }
1559  } else {
1560  pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
1561  }
1562  pSpriteObjects[uLayingItemID].spell_level = 0;
1563  pSpriteObjects[uLayingItemID].spell_skill = 0;
1564  pSpriteObjects[uLayingItemID].spell_id = 0;
1565  if (!v138) {
1566  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1567  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1568  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1569  SpriteObject::OnInteraction(uLayingItemID);
1570  }
1571  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1572  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1573  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1574  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1575  v114 = 0;
1576  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1577  v114 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1578  }
1579  // v115 = 8 * uLayingItemID;
1580  // v115 |= PID(OBJECT_Item, uLayingItemID);
1581  // v125 = v143 + 1;
1582  // pAudioPlayer->PlaySound((SoundID)v125, v115, 0,
1583  // -1, 0, v114, 0, 0);
1584  pAudioPlayer->PlaySpellSound(v143 + 1,
1585  PID(OBJECT_Item, uLayingItemID));
1586  } else {
1587  SpriteObject::OnInteraction(uLayingItemID);
1588  }
1589  return 0;
1590  }
1591 
1593  sub_43A97E(uLayingItemID, a2);
1594  pSpriteObjects[uLayingItemID].uType = SPRITE_SPELL_DARK_SHARPMETAL_IMPACT;
1596  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1597  SpriteObject::OnInteraction(uLayingItemID);
1598  }
1599  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1600  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1601  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1602  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1603  int v97 = 0;
1604  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1605  v97 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1606  }
1607  // v124 = 8 * uLayingItemID;
1608  // v124 |= v124 | 2;
1609  // v125 =
1610  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1611  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v124, 0,
1612  // -1, 0, v97, 0, 0);
1613  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1614  PID(OBJECT_Item, uLayingItemID));
1615  return 0;
1616  }
1617 
1618  /*
1619  case 1080:
1620  case 2100:
1621  {
1622  if (PID_TYPE(a2) != 3)
1623  {
1624  //v32 = 0;
1625  pSpriteObjects[uLayingItemID].uType =
1626  pSpriteObjects[uLayingItemID].uType + 1; v46 = 0; for (v146 = 0;
1627  v146 < (signed int)pObjectList->uNumObjects; ++v146)
1628  {
1629  if (pSpriteObjects[uLayingItemID].uType ==
1630  pObjectList->pObjects[v146].uObjectID) v46 = v146;
1631  }
1632  pSpriteObjects[uLayingItemID].uObjectDescID = v46;
1633  if (!v46)
1634  SpriteObject::OnInteraction(uLayingItemID);
1635  v100 = pSpriteObjects[uLayingItemID].field_61;
1636  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1637  v102 = 8 * uLayingItemID;
1638  LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
1639  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1640  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1641  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1642  AttackerInfo.Add(v102, 512,
1643  pSpriteObjects[uLayingItemID].vPosition.x,
1644  pSpriteObjects[uLayingItemID].vPosition.y,
1645  pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); if
1646  (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
1647  trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x,
1648  pSpriteObjects[uLayingItemID].vPosition.y,
1649  pSpriteObjects[uLayingItemID].vPosition.z,
1650  object->uParticleTrailColor); if
1651  (!pSpriteObjects[uLayingItemID].uSoundID) v47 = 0; else v47 =
1652  (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; v125 =
1653  word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] +
1654  1; pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0,
1655  0); return 0;
1656  }
1657  return 1;
1658  }*/
1659 
1662  if (PID_TYPE(a2) == 3) return 1;
1663  // else go to next case
1664  }
1665 
1668  pSpriteObjects[uLayingItemID].uType = (SPRITE_OBJECT_TYPE)(pSpriteObjects[uLayingItemID].uType + 1);
1669  pSpriteObjects[uLayingItemID].uObjectDescID = pObjectList->ObjectIDByItemID(pSpriteObjects[uLayingItemID].uType);
1670  if (pSpriteObjects[uLayingItemID].uObjectDescID == 0) {
1671  SpriteObject::OnInteraction(uLayingItemID);
1672  }
1673  pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
1674  pSpriteObjects[uLayingItemID].vVelocity.x = 0;
1675  pSpriteObjects[uLayingItemID].vVelocity.y = 0;
1676  pSpriteObjects[uLayingItemID].vVelocity.z = 0;
1677  AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512,
1678  pSpriteObjects[uLayingItemID].vPosition.x,
1679  pSpriteObjects[uLayingItemID].vPosition.y,
1680  pSpriteObjects[uLayingItemID].vPosition.z,
1681  pSpriteObjects[uLayingItemID].field_61, 0);
1682  if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
1684  pSpriteObjects[uLayingItemID].vPosition.x,
1685  pSpriteObjects[uLayingItemID].vPosition.y,
1686  pSpriteObjects[uLayingItemID].vPosition.z,
1687  object->uParticleTrailColor);
1688  int v47 = 0;
1689  if (pSpriteObjects[uLayingItemID].uSoundID != 0) {
1690  v47 = pSpriteObjects[uLayingItemID].uSoundID + 4;
1691  }
1692  // v125 =
1693  // word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id
1694  // - 1] + 1; pAudioPlayer->PlaySound((SoundID)v125, v102, 0,
1695  // -1, 0, v47, 0, 0);
1696  pAudioPlayer->PlaySpellSound(pSpriteObjects[uLayingItemID].spell_id,
1697  PID(OBJECT_Item, uLayingItemID));
1698  return 0;
1699  }
1700 
1701  default:
1702  return 0;
1703  }
1704 }
1705 
1706 //----- (0043A97E) --------------------------------------------------------
1707 void sub_43A97E(unsigned int uLayingItemID, int a2) {
1708  if (PID_TYPE(a2) == OBJECT_Player) {
1709  layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
1710  layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
1711  layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
1712 
1713  Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y,
1715  DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID),
1716  pSpriteObjects[uLayingItemID].field_61,
1717  &layingitem_vel_50FDFC, -1);
1718  } else if (PID_TYPE(a2) == OBJECT_Actor) {
1719  layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
1720  layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
1721  layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
1722 
1723  Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y,
1725  switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) {
1726  case OBJECT_Actor:
1728  PID(OBJECT_Item, uLayingItemID), PID_ID(a2),
1730  pSpriteObjects[uLayingItemID].field_61);
1731  break;
1732  case OBJECT_Player:
1733  Actor::DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID),
1734  PID_ID(a2),
1736  break;
1737  case OBJECT_Item:
1738  ItemDamageFromActor(PID(OBJECT_Item, uLayingItemID), PID_ID(a2),
1740  break;
1741  }
1742  }
1743 }
SPRITE_PROJECTILE_530
@ SPRITE_PROJECTILE_530
Definition: SpriteObject.h:22
BLVFace::uPolygonType
PolygonType uPolygonType
Definition: Indoor.h:487
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
SpriteObject::vVelocity
struct Vec3_short_ vVelocity
Definition: SpriteObject.h:219
SpriteObject
Definition: SpriteObject.h:189
MONSTER_SUPERTYPE_UNDEAD
@ MONSTER_SUPERTYPE_UNDEAD
Definition: Monsters.h:70
Particle_sw::z
float z
Definition: ParticleEngine.h:22
OBJECT_DESC_BOUNCE
@ OBJECT_DESC_BOUNCE
Definition: ObjectList.h:13
ParticleEngine.h
uNumActors
size_t uNumActors
Definition: Actor.cpp:39
Party::vPosition
Vec3_int_ vPosition
Definition: Party.h:250
Engine_::IocContainer
Definition: IocContainer.h:15
BSPModel::pVertices
struct BSPVertexBuffer pVertices
Definition: BSPModel.h:189
face
GLenum GLuint GLint GLenum face
Definition: SDL_opengl_glext.h:3022
SPRITE_SPELL_MIND_PSYCHIC_SHOCK
@ SPRITE_SPELL_MIND_PSYCHIC_SHOCK
Definition: SpriteObject.h:132
SPRITE_SPELL_BODY_FLYING_FIST
@ SPRITE_SPELL_BODY_FLYING_FIST
Definition: SpriteObject.h:145
pLevelDecorations
std::array< LevelDecoration, 3000 > pLevelDecorations
Definition: Decoration.cpp:8
stru193_math::uIntegerDoublePi
static const unsigned int uIntegerDoublePi
Definition: OurMath.h:90
DMGT_DARK
@ DMGT_DARK
Definition: Items.h:21
SpriteObject::field_20
__int16 field_20
Definition: SpriteObject.h:225
SPRITE_SPELL_AIR_LIGHNING_BOLT
@ SPRITE_SPELL_AIR_LIGHNING_BOLT
Definition: SpriteObject.h:65
SPRITE_BLASTER_PROJECTILE
@ SPRITE_BLASTER_PROJECTILE
Definition: SpriteObject.h:30
int16_t
signed __int16 int16_t
Definition: SDL_config.h:36
SpriteObject::GetParticleTrailColorB
uint8_t GetParticleTrailColorB()
Definition: SpriteObject.cpp:867
SOUND_fireBall
@ SOUND_fireBall
Definition: AudioPlayer.h:14
Particle_sw::b
float b
Definition: ParticleEngine.h:25
Timer::uTimeElapsed
unsigned int uTimeElapsed
Definition: Time.h:133
SpriteObject::uFacing
unsigned __int16 uFacing
Definition: SpriteObject.h:220
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
stru141_actor_collision_object::field_6C
int field_6C
Definition: Indoor.h:168
SPRITE_SPELL_AIR_SPARKS
@ SPRITE_SPELL_AIR_SPARKS
Definition: SpriteObject.h:62
LOD.h
SPRITE_PROJECTILE_535
@ SPRITE_PROJECTILE_535
Definition: SpriteObject.h:24
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
BLVFace::pFacePlane_old
struct Plane_int_ pFacePlane_old
Definition: Indoor.h:471
pRnd
struct Random * pRnd
Definition: Random.cpp:5
pSpriteFrameTable
struct SpriteFrameTable * pSpriteFrameTable
Definition: Sprites.cpp:22
OutdoorLocation::pBModels
BSPModelList pBModels
Definition: Outdoor.h:119
pSpriteObjects
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
Definition: SpriteObject.cpp:34
stru141_actor_collision_object::speed
int speed
Definition: Indoor.h:166
SPRITE_SPELL_LIGHT_DESTROY_UNDEAD_1
@ SPRITE_SPELL_LIGHT_DESTROY_UNDEAD_1
Definition: SpriteObject.h:152
BLVFace::pVertexIDs
uint16_t * pVertexIDs
Definition: Indoor.h:476
SpriteObject::field_60_distance_related_prolly_lod
char field_60_distance_related_prolly_lod
Definition: SpriteObject.h:234
OBJECT_Item
@ OBJECT_Item
Definition: Actor.h:66
stru141_actor_collision_object::uSectorID
unsigned int uSectorID
Definition: Indoor.h:170
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
layingitem_vel_50FDFC
Vec3_int_ layingitem_vel_50FDFC
Definition: mm7_data.cpp:588
DMGT_FIRE
@ DMGT_FIRE
Definition: Items.h:11
SpriteObject::IsUnpickable
bool IsUnpickable()
Definition: SpriteObject.cpp:847
MapStats::GetMapInfo
MAP_TYPE GetMapInfo(const String &Str2)
Definition: MapInfo.cpp:225
Party::sEyelevel
int sEyelevel
Definition: Party.h:239
SpriteObject::uSectorID
__int16 uSectorID
Definition: SpriteObject.h:223
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
SpriteObject.h
WorldPosToGridCellX
unsigned int WorldPosToGridCellX(int sWorldPosX)
Definition: Outdoor.cpp:3955
ItemDamageFromActor
void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity)
Definition: Actor.cpp:5553
SPRITE_SPELL_DARK_DRAGON_BREATH
@ SPRITE_SPELL_DARK_DRAGON_BREATH
Definition: SpriteObject.h:176
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
stru193_math::uIntegerHalfPi
static const unsigned int uIntegerHalfPi
Definition: OurMath.h:89
SPRITE_BLASTER_IMPACT
@ SPRITE_BLASTER_IMPACT
Definition: SpriteObject.h:31
SPRITE_SPELL_EARTH_MASS_DISTORTION
@ SPRITE_SPELL_EARTH_MASS_DISTORTION
Definition: SpriteObject.h:106
ObjectDesc
Definition: ObjectList.h:20
SPRITE_SPELL_DARK_SHARPMETAL_IMPACT
@ SPRITE_SPELL_DARK_SHARPMETAL_IMPACT
Definition: SpriteObject.h:172
MapInfo::Trap_D20
char Trap_D20
Definition: MapInfo.h:51
SPRITE_SPELL_AIR_STARBURST
@ SPRITE_SPELL_AIR_STARBURST
Definition: SpriteObject.h:71
ObjectList::ObjectIDByItemID
unsigned int ObjectIDByItemID(unsigned int uItemID)
Definition: ObjectList.cpp:7
Standing
@ Standing
Definition: Actor.h:75
stru141_actor_collision_object::normal
Vec3_int_ normal
Definition: Indoor.h:159
SPRITE_SPELL_FIRE_FIRE_BOLT
@ SPRITE_SPELL_FIRE_FIRE_BOLT
Definition: SpriteObject.h:43
SpriteObject::uType
SPRITE_OBJECT_TYPE uType
Definition: SpriteObject.h:215
SpellFxRenderer.h
Particle_sw::r
float r
Definition: ParticleEngine.h:23
SpriteObject::GetParticleTrailColorR
uint8_t GetParticleTrailColorR()
Definition: SpriteObject.cpp:857
POLYGON_Floor
@ POLYGON_Floor
Definition: Indoor.h:220
OBJECT_Decoration
@ OBJECT_Decoration
Definition: Actor.h:69
SPRITE_PROJECTILE_500
@ SPRITE_PROJECTILE_500
Definition: SpriteObject.h:10
WorldPosToGridCellZ
unsigned int WorldPosToGridCellZ(int sWorldPosZ)
Definition: Outdoor.cpp:3962
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
SPRITE_SPELL_EARTH_ROCK_BLAST
@ SPRITE_SPELL_EARTH_ROCK_BLAST
Definition: SpriteObject.h:100
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
TurnEngine.h
SpriteObject::uSpriteFrameID
unsigned __int16 uSpriteFrameID
Definition: SpriteObject.h:224
particle_engine
static ParticleEngine * particle_engine
Definition: SpriteObject.cpp:31
SPRITE_SPELL_MIND_MIND_BLAST
@ SPRITE_SPELL_MIND_MIND_BLAST
Definition: SpriteObject.h:122
ObjectDesc::uRadius
int16_t uRadius
Definition: ObjectList.h:25
OBJECT_DESC_NO_GRAVITY
@ OBJECT_DESC_NO_GRAVITY
Definition: ObjectList.h:11
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
Actor::_46DF1A_collide_against_actor
static bool _46DF1A_collide_against_actor(int a1, int a2)
Definition: Actor.cpp:2699
Engine.h
SPRITE_WATER_SPLASH
@ SPRITE_WATER_SPLASH
Definition: SpriteObject.h:35
Plane_int_::vNormal
Vec3_int_ vNormal
Definition: VectorTypes.h:107
pTurnEngine
struct stru262_TurnBased * pTurnEngine
Definition: TurnEngine.cpp:21
SPRITE_SPELL_DARK_SHARPMETAL
@ SPRITE_SPELL_DARK_SHARPMETAL
Definition: SpriteObject.h:171
OBJECT_DESC_INTERACTABLE
@ OBJECT_DESC_INTERACTABLE
Definition: ObjectList.h:12
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
SpriteObject::uObjectDescID
unsigned __int16 uObjectDescID
Definition: SpriteObject.h:217
OBJECT_Actor
@ OBJECT_Actor
Definition: Actor.h:67
ParticleEngine
Definition: ParticleEngine.h:93
Events.h
trail_particle_generator
TrailParticleGenerator trail_particle_generator
Definition: ParticleEngine.cpp:13
Actor.h
SpriteObject::field_61
char field_61
Definition: SpriteObject.h:235
ObjectDesc::uLifetime
int16_t uLifetime
Definition: ObjectList.h:29
pItemsTable
struct ItemsTable * pItemsTable
Definition: Items.cpp:37
Particle_sw::type
unsigned int type
Definition: ParticleEngine.h:19
SPRITE_PROJECTILE_525
@ SPRITE_PROJECTILE_525
Definition: SpriteObject.h:20
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
SPRITE_SPELL_EARTH_DEATH_BLOSSOM
@ SPRITE_SPELL_EARTH_DEATH_BLOSSOM
Definition: SpriteObject.h:103
stru141_actor_collision_object::field_0
int field_0
Definition: Indoor.h:151
DAMAGE_TYPE
DAMAGE_TYPE
Definition: Items.h:10
SpriteObject::vPosition
struct Vec3_int_ vPosition
Definition: SpriteObject.h:218
pParty
Party * pParty
Definition: Party.cpp:30
Engine_::IocContainer::ResolveParticleEngine
static ParticleEngine * ResolveParticleEngine()
Definition: IocContainer.cpp:103
object
GLuint object
Definition: SDL_opengl_glext.h:6060
stru141_actor_collision_object::field_8_radius
int field_8_radius
Definition: Indoor.h:153
SpriteObject::field_54
int field_54
Definition: SpriteObject.h:231
SPRITE_PROJECTILE_510
@ SPRITE_PROJECTILE_510
Definition: SpriteObject.h:14
SPRITE_SPELL_EARTH_ROCK_BLAST_IMPACT
@ SPRITE_SPELL_EARTH_ROCK_BLAST_IMPACT
Definition: SpriteObject.h:101
GetGravityStrength
unsigned int GetGravityStrength()
Definition: Engine.cpp:1500
stru141_actor_collision_object::normal2
Vec3_int_ normal2
Definition: Indoor.h:161
SPRITE_PROJECTILE_515
@ SPRITE_PROJECTILE_515
Definition: SpriteObject.h:16
stru298.h
OBJECT_BModel
@ OBJECT_BModel
Definition: Actor.h:70
SPRITE_SPELL_BODY_HARM
@ SPRITE_SPELL_BODY_HARM
Definition: SpriteObject.h:138
SpriteObject::UpdateObject_fn0_BLV
static void UpdateObject_fn0_BLV(unsigned int uLayingItemID)
Definition: SpriteObject.cpp:463
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
SPRITE_SPELL_EARTH_DEADLY_SWARM
@ SPRITE_SPELL_EARTH_DEADLY_SWARM
Definition: SpriteObject.h:94
AudioPlayer::PlaySpellSound
void PlaySpellSound(unsigned int spell, unsigned int pid)
Definition: AudioPlayer.cpp:476
ODM_GetTerrainNormalAt
void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
Definition: Outdoor.cpp:2052
Particle_sw::timeToLive
int timeToLive
Definition: ParticleEngine.h:27
stru141_actor_collision_object::field_7C
int field_7C
Definition: Indoor.h:172
SpriteFrameTable::GetFrame
SpriteFrame * GetFrame(unsigned int uSpriteID, unsigned int uTime)
Definition: Sprites.cpp:277
SPRITE_PROJECTILE_520
@ SPRITE_PROJECTILE_520
Definition: SpriteObject.h:18
SpriteObject::ExplosionTraps
void ExplosionTraps()
Definition: SpriteObject.cpp:788
OBJECT_DESC_UNPICKABLE
@ OBJECT_DESC_UNPICKABLE
Definition: ObjectList.h:10
Random::GetInRange
int GetInRange()
Definition: Random.cpp:28
sub_43A97E
void sub_43A97E(unsigned int uLayingItemID, int a2)
Definition: SpriteObject.cpp:1707
ObjectDesc::uSpriteID
uint16_t uSpriteID
Definition: ObjectList.h:28
_46BFFA_update_spell_fx
bool _46BFFA_update_spell_fx(unsigned int uLayingItemID, int a2)
Definition: SpriteObject.cpp:1017
_46E889_collide_against_bmodels
void _46E889_collide_against_bmodels(unsigned int ecx0)
Definition: Render.cpp:4516
ItemGen::uItemID
int uItemID
Definition: Items.h:326
DMGT_COLD
@ DMGT_COLD
Definition: Items.h:13
ObjectDesc::uFlags
int16_t uFlags
Definition: ObjectList.h:27
SpriteObject::spell_id
int spell_id
Definition: SpriteObject.h:228
ObjectDesc::uHeight
int16_t uHeight
Definition: ObjectList.h:26
SPRITE_SPELL_WATER_ACID_BURST
@ SPRITE_SPELL_WATER_ACID_BURST
Definition: SpriteObject.h:82
stru141_actor_collision_object::field_70
int field_70
Definition: Indoor.h:169
SpriteObject::HasSprite
bool HasSprite()
Definition: SpriteObject.cpp:852
ParticleType_Line
@ ParticleType_Line
Definition: ParticleEngine.h:11
fixpoint_mul
__int64 fixpoint_mul(int a1, int a2)
Definition: OurMath.cpp:138
stru141_actor_collision_object::height
int height
Definition: Indoor.h:154
pActors
std::array< Actor, 500 > pActors
Definition: Actor.cpp:38
Party.h
Particle_sw
Definition: ParticleEngine.h:18
SPRITE_OBJECT_EXPLODE_IMPACT
@ SPRITE_OBJECT_EXPLODE_IMPACT
Definition: SpriteObject.h:33
_46EF01_collision_chech_player
int _46EF01_collision_chech_player(int a1)
Definition: Render.cpp:4790
OBJECT_DESC_TRIAL_LINE
@ OBJECT_DESC_TRIAL_LINE
Definition: ObjectList.h:16
ObjectDesc::NoSprite
bool NoSprite() const
Definition: ObjectList.h:21
SPRITE_SPELL_DARK_TOXIC_CLOUD
@ SPRITE_SPELL_DARK_TOXIC_CLOUD
Definition: SpriteObject.h:168
SPRITE_SPELL_FIRE_METEOR_SHOWER
@ SPRITE_SPELL_FIRE_METEOR_SHOWER
Definition: SpriteObject.h:53
Particle_sw::y
float y
Definition: ParticleEngine.h:21
Particle_sw::g
float g
Definition: ParticleEngine.h:24
OBJECT_DESC_NO_SPRITE
@ OBJECT_DESC_NO_SPRITE
Definition: ObjectList.h:6
_46E26D_collide_against_sprites
void _46E26D_collide_against_sprites(int a1, int a2)
Definition: Sprites.cpp:447
MonsterDesc::uToHitRadius
int16_t uToHitRadius
Definition: Monsters.h:217
MapInfo
Definition: MapInfo.h:35
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
SPEECH_6
@ SPEECH_6
Definition: Player.h:52
BSPModel.h
ParticleEngine::AddParticle
void AddParticle(Particle_sw *a2)
Definition: ParticleEngine.cpp:65
DMGT_ELECTR
@ DMGT_ELECTR
Definition: Items.h:12
OBJECT_DESC_TRIAL_PARTICLE
@ OBJECT_DESC_TRIAL_PARTICLE
Definition: ObjectList.h:14
DMGT_BODY
@ DMGT_BODY
Definition: Items.h:19
SpriteObject::InitializeSpriteObjects
static void InitializeSpriteObjects()
Definition: SpriteObject.cpp:898
SpriteObject::GetParticleTrailColorG
uint8_t GetParticleTrailColorG()
Definition: SpriteObject.cpp:862
SpellFxRenderer::effpar03
Texture * effpar03
Definition: SpellFxRenderer.h:168
Outdoor.h
SPRITE_PROJECTILE_505
@ SPRITE_PROJECTILE_505
Definition: SpriteObject.h:12
Actor::ActorDamageFromMonster
static void ActorDamageFromMonster(int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, int a4)
Definition: Actor.cpp:2507
_46E44E_collide_against_faces_and_portals
int _46E44E_collide_against_faces_and_portals(unsigned int b1)
Definition: Render.cpp:4350
SpriteObject::Create
int Create(int yaw, int pitch, int a4, int a5)
Definition: SpriteObject.cpp:56
SpriteObject::containing_item
struct ItemGen containing_item
Definition: SpriteObject.h:227
stru298::Add
void Add(int16_t uID, int16_t a3, int16_t x, int16_t y, int16_t z, char a7, char a8)
Definition: stru298.cpp:4
TrailParticleGenerator::GenerateTrailParticles
void GenerateTrailParticles(int x, int y, int z, int bgr16)
Definition: ParticleEngine.cpp:29
SPRITE_OBJECT_TYPE
SPRITE_OBJECT_TYPE
Definition: SpriteObject.h:5
AudioPlayer.h
OBJECT_Player
@ OBJECT_Player
Definition: Actor.h:68
SpriteObject::field_64
Vec3_int_ field_64
Definition: SpriteObject.h:237
Party::bTurnBasedModeOn
bool bTurnBasedModeOn
Definition: Party.h:305
MonsterStats::BelongsToSupertype
static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
Definition: Monsters.cpp:1200
SpriteObject::uSoundID
unsigned __int16 uSoundID
Definition: SpriteObject.h:221
SPRITE_SPELL_EARTH_DEATH_BLOSSOM_IMPACT
@ SPRITE_SPELL_EARTH_DEATH_BLOSSOM_IMPACT
Definition: SpriteObject.h:104
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
MonsterList::pMonsters
struct MonsterDesc * pMonsters
Definition: Monsters.h:237
ObjectDesc::uParticleTrailColorB
uint8_t uParticleTrailColorB
Definition: ObjectList.h:34
uNumSpriteObjects
size_t uNumSpriteObjects
Definition: SpriteObject.cpp:33
SpellFxRenderer
Definition: SpellFxRenderer.h:97
SPRITE_SPELL_WATER_POISON_SPRAY
@ SPRITE_SPELL_WATER_POISON_SPRAY
Definition: SpriteObject.h:75
SPRITE_SPELL_FIRE_INCINERATE
@ SPRITE_SPELL_FIRE_INCINERATE
Definition: SpriteObject.h:56
stru193_math::Atan2
unsigned int Atan2(int x, int y)
Definition: OurMath.cpp:46
SPRITE_SPELL_LIGHT_DESTROY_UNDEAD
@ SPRITE_SPELL_LIGHT_DESTROY_UNDEAD
Definition: SpriteObject.h:151
SPRITE_NULL
@ SPRITE_NULL
Definition: SpriteObject.h:6
SPRITE_SPELL_EARTH_DEATH_BLOSSOM_FALLOUT
@ SPRITE_SPELL_EARTH_DEATH_BLOSSOM_FALLOUT
Definition: SpriteObject.h:105
stru141_actor_collision_object::field_84
int field_84
Definition: Indoor.h:174
ObjectDesc::uParticleTrailColorG
uint8_t uParticleTrailColorG
Definition: ObjectList.h:33
SpriteObject::spell_level
int spell_level
Definition: SpriteObject.h:229
ParticleType_8
@ ParticleType_8
Definition: ParticleEngine.h:9
SPRITE_SPELL_EARTH_STUN
@ SPRITE_SPELL_EARTH_STUN
Definition: SpriteObject.h:91
stru141_actor_collision_object::prolly_normal_d
int prolly_normal_d
Definition: Indoor.h:152
Particle_sw::texture
Texture * texture
Definition: ParticleEngine.h:28
DamagePlayerFromMonster
void DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, signed int a4)
Definition: Player.cpp:6928
pMonsterList
struct MonsterList * pMonsterList
Definition: Monsters.cpp:9
SpriteObject::spell_target_pid
int spell_target_pid
Definition: SpriteObject.h:233
SpriteFrame
Definition: Sprites.h:39
SPRITE_ARROW_PROJECTILE
@ SPRITE_ARROW_PROJECTILE
Definition: SpriteObject.h:28
SPRITE_SPELL_WATER_ICE_BLAST_FALLOUT
@ SPRITE_SPELL_WATER_ICE_BLAST_FALLOUT
Definition: SpriteObject.h:88
integer_sqrt
int integer_sqrt(int val)
Definition: OurMath.cpp:164
spell_fx_renderer
static SpellFxRenderer * spell_fx_renderer
Definition: SpriteObject.cpp:30
uint
unsigned int uint
Definition: MM7.h:4
__debugbreak
void __cdecl __debugbreak(void)
AttackerInfo
stru298 AttackerInfo
Definition: mm7_data.cpp:24
SPRITE_SPELL_LIGHT_SUNRAY
@ SPRITE_SPELL_LIGHT_SUNRAY
Definition: SpriteObject.h:162
SPRITE_SPELL_WATER_ICE_BLAST_IMPACT
@ SPRITE_SPELL_WATER_ICE_BLAST_IMPACT
Definition: SpriteObject.h:87
SpriteObject::sub_42F7EB_DropItemAt
static bool sub_42F7EB_DropItemAt(SPRITE_OBJECT_TYPE sprite, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
Definition: SpriteObject.cpp:937
BSPModel::pFaces
std::vector< ODMFace > pFaces
Definition: BSPModel.h:190
ODMFace
Definition: BSPModel.h:93
OBJECT_Any
@ OBJECT_Any
Definition: Actor.h:64
stru141_actor_collision_object::direction
Vec3_int_ direction
Definition: Indoor.h:165
SPRITE_OBJECT_EXPLODE
@ SPRITE_OBJECT_EXPLODE
Definition: SpriteObject.h:32
SpriteObject::spell_skill
int spell_skill
Definition: SpriteObject.h:230
SPRITE_SPELL_WATER_ICE_BOLT
@ SPRITE_SPELL_WATER_ICE_BOLT
Definition: SpriteObject.h:78
Particle_sw::particle_size
float particle_size
Definition: ParticleEngine.h:30
ParticleType_Rotating
@ ParticleType_Rotating
Definition: ParticleEngine.h:8
stru193_math::Cos
int Cos(int angle)
Definition: OurMath.cpp:28
Decoration.h
stru_5C6E00
struct stru193_math * stru_5C6E00
Definition: mm7_data.cpp:19
ODM_GetFloorLevel
int ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, bool *pIsOnWater, int *bmodel_pid, int bWaterWalk)
Definition: Outdoor.cpp:1877
Random::SetRange
void SetRange(int min, int max)
Definition: Random.cpp:8
SPRITE_SPELL_LIGHT_PARALYZE
@ SPRITE_SPELL_LIGHT_PARALYZE
Definition: SpriteObject.h:155
BSPVertexBuffer::pVertices
Vec3_int_ * pVertices
Definition: BSPModel.h:53
IndoorLocation::pVertices
struct Vec3_short_ * pVertices
Definition: Indoor.h:628
Particle_sw::x
float x
Definition: ParticleEngine.h:20
SoundID
SoundID
Definition: AudioPlayer.h:10
OurMath.h
SpriteObject::_46BEF1_apply_spells_aoe
void _46BEF1_apply_spells_aoe()
Definition: SpriteObject.cpp:909
EventProcessor
void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
Definition: Events.cpp:260
stru_721530
stru141_actor_collision_object stru_721530
Definition: Indoor.cpp:58
SpriteObject::Create_Splash_Object
static void Create_Splash_Object(int x, int y, int z)
Definition: SpriteObject.cpp:993
IndoorLocation::GetSector
int GetSector(int sX, int sY, int sZ)
Definition: Indoor.cpp:1279
IndoorLocation::pFaces
struct BLVFace * pFaces
Definition: Indoor.h:630
Random.h
OBJECT_DESC_TRIAL_FIRE
@ OBJECT_DESC_TRIAL_FIRE
Definition: ObjectList.h:15
ObjectList::pObjects
struct ObjectDesc * pObjects
Definition: ObjectList.h:54
stru193_math::Sin
int Sin(int angle)
Definition: OurMath.cpp:133
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
SpriteObject::OnInteraction
static void OnInteraction(unsigned int uLayingItemID)
Definition: SpriteObject.cpp:872
stru141_actor_collision_object::CalcMovementExtents
int CalcMovementExtents(int a2)
Definition: Indoor.cpp:5697
BSPModel
Definition: BSPModel.h:163
SPRITE_SPELL_MIND_CHARM
@ SPRITE_SPELL_MIND_CHARM
Definition: SpriteObject.h:126
ItemGen
Definition: Items.h:263
ParticleType_Bitmap
@ ParticleType_Bitmap
Definition: ParticleEngine.h:12
ObjectDesc::uParticleTrailColorR
uint8_t uParticleTrailColorR
Definition: ObjectList.h:32
SPRITE_SPELL_FIRE_FIREBALL
@ SPRITE_SPELL_FIRE_FIREBALL
Definition: SpriteObject.h:48
ObjectList.h
SPRITE_PROJECTILE_540
@ SPRITE_PROJECTILE_540
Definition: SpriteObject.h:26
SPRITE_SPELL_WATER_ICE_BLAST
@ SPRITE_SPELL_WATER_ICE_BLAST
Definition: SpriteObject.h:86
Engine_::IocContainer::ResolveSpellFxRenderer
static SpellFxRenderer * ResolveSpellFxRenderer()
Definition: IocContainer.cpp:74
SpriteObject::GetLifetime
unsigned int GetLifetime()
Definition: SpriteObject.cpp:837
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
SPRITE_PROJECTILE_550
@ SPRITE_PROJECTILE_550
Definition: SpriteObject.h:29
SpriteObject::uAttributes
unsigned __int16 uAttributes
Definition: SpriteObject.h:222
Actor::DamageMonsterFromParty
static void DamageMonsterFromParty(int a1, unsigned int uActorID_Monster, struct Vec3_int_ *pVelocity)
Definition: Actor.cpp:3379
_46E0B2_collide_against_decorations
void _46E0B2_collide_against_decorations()
Definition: Render.cpp:4855
IsTerrainSlopeTooHigh
bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
Definition: Outdoor.cpp:3976
stru141_actor_collision_object::position
Vec3_int_ position
Definition: Indoor.h:160
_46F04E_collide_against_portals
int _46F04E_collide_against_portals()
Definition: Render.cpp:4895
stru262_TurnBased::pending_actions
int pending_actions
Definition: TurnEngine.h:81
SpriteObject::SpriteObject
SpriteObject()
Definition: SpriteObject.cpp:37
stru141_actor_collision_object::velocity
Vec3_int_ velocity
Definition: Indoor.h:158
BLV_GetFloorLevel
int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID)
Definition: Indoor.cpp:2530
SPRITE_SPELL_DARK_SHRINKING_RAY
@ SPRITE_SPELL_DARK_SHRINKING_RAY
Definition: SpriteObject.h:170
SPRITE_SPELL_LIGHT_LIGHT_BOLT
@ SPRITE_SPELL_LIGHT_LIGHT_BOLT
Definition: SpriteObject.h:149
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
BLVFace::uAttributes
unsigned int uAttributes
Definition: Indoor.h:475
Sprites.h
GameTime
Definition: Time.h:14
CompactLayingItemsList
void CompactLayingItemsList()
Definition: SpriteObject.cpp:882
ItemsTable::uAllItemsCount
int uAllItemsCount
Definition: Items.h:459
SpriteObject::GetSpriteFrame
SpriteFrame * GetSpriteFrame()
Definition: SpriteObject.cpp:842
SPRITE_SPELL_EARTH_BLADES
@ SPRITE_SPELL_EARTH_BLADES
Definition: SpriteObject.h:97
pObjectList
struct ObjectList * pObjectList
Definition: ObjectList.cpp:5
GameTime::FromSeconds
static GameTime FromSeconds(int seconds)
Definition: Time.h:83
ItemsTable::pItems
NZIArray< ItemDesc, 800 > pItems
Definition: Items.h:460
SpriteObject::field_22_glow_radius_multiplier
__int16 field_22_glow_radius_multiplier
Definition: SpriteObject.h:226
SpriteObject::spell_caster_pid
int spell_caster_pid
Definition: SpriteObject.h:232
stru141_actor_collision_object::pid
unsigned int pid
Definition: Indoor.h:171
SpriteObject::UpdateObject_fn0_ODM
static void UpdateObject_fn0_ODM(unsigned int uLayingItemID)
Definition: SpriteObject.cpp:130
BLVFace::uFaceExtraID
uint16_t uFaceExtraID
Definition: Indoor.h:482
Time.h
SpellFxRenderer::effpar01
Texture * effpar01
Definition: SpellFxRenderer.h:166
SOUND_splash
@ SOUND_splash
Definition: AudioPlayer.h:86
Particle_sw::uDiffuse
unsigned int uDiffuse
Definition: ParticleEngine.h:26
SPRITE_SPELL_FIRE_FIRE_SPIKE
@ SPRITE_SPELL_FIRE_FIRE_SPIKE
Definition: SpriteObject.h:50