TRICKS.CPP 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include "actor.h"
  2. #include "db.h"
  3. #include "debug4g.h"
  4. #include "engine.h"
  5. #include "eventq.h"
  6. #include "misc.h"
  7. #include "trig.h"
  8. #include "tricks.h"
  9. void InitGenerator( int nSprite )
  10. {
  11. dassert(nSprite < kMaxSprites);
  12. SPRITE *pSprite = &sprite[nSprite];
  13. dassert(pSprite->statnum != kMaxStatus);
  14. int nXSprite = pSprite->extra;
  15. dassert(nXSprite > 0);
  16. XSPRITE *pXSprite = &xsprite[nXSprite];
  17. switch ( sprite[nSprite].type )
  18. {
  19. case kGenTrigger:
  20. pSprite->cstat &= ~kSpriteBlocking;
  21. pSprite->cstat |= kSpriteInvisible;
  22. break;
  23. default:
  24. break; //return;
  25. }
  26. pXSprite->data3 = FALSE;
  27. if ( pXSprite->state != pXSprite->restState && pXSprite->data1 > 0 )
  28. {
  29. pXSprite->data3 = TRUE;
  30. evPost(nSprite, SS_SPRITE, (pXSprite->data1 + BiRandom(pXSprite->data2)) * kTimerRate / 10);
  31. }
  32. }
  33. void ActivateGenerator( int nSprite )
  34. {
  35. dassert(nSprite < kMaxSprites);
  36. SPRITE *pSprite = &sprite[nSprite];
  37. dassert(pSprite->statnum != kMaxStatus);
  38. int nXSprite = pSprite->extra;
  39. dassert(nXSprite > 0);
  40. XSPRITE *pXSprite = &xsprite[nXSprite];
  41. switch ( pSprite->type )
  42. {
  43. case kGenWaterDrip:
  44. case kGenBloodDrip:
  45. // spawn a drip sprite that drops to the ground and turns to a splash
  46. break;
  47. case kGenFireball:
  48. dprintf("kGenFireball calling actFireMissile\n");
  49. actFireMissile( nSprite, pSprite->z, Cos(pSprite->ang) >> 16, Sin(pSprite->ang) >> 16, 0, kMissileFireball);
  50. break;
  51. case kGenEctoSkull:
  52. case kGenDart:
  53. // spawn a missile that moves and damages accordingly
  54. break;
  55. default:
  56. break;
  57. }
  58. }