GIB.CPP 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. int actSpawnEffect( short nSector, int x, int y, int z, int nStatus, int nEffectType )
  2. {
  3. int nSpawned = actSpawnSprite( nSector, x, y, z, kStatThing, TRUE );
  4. switch( nType )
  5. {
  6. case kEffectBloodSquib:
  7. break;
  8. case kEffectWaterSquib:
  9. break;
  10. case kEffectSparkSquib:
  11. break;
  12. case kEffectSmokeSquib:
  13. break;
  14. case kEffectWoodSquib:
  15. break;
  16. case kEffectPlantSquib:
  17. break;
  18. case kEffectDirtSquib:
  19. break;
  20. case kEffectSnowSquib:
  21. break;
  22. }
  23. }
  24. enum {
  25. kBlossom0 = 0,
  26. };
  27. struct GIB
  28. {
  29. ushort chance; // likelihood (out of 256)
  30. ushort tile; // tile number
  31. ushort gibType; //
  32. // sequences? short sequenceID;
  33. };
  34. struct DEBRIS
  35. {
  36. ushort min;
  37. ushort range;
  38. ushort picnum;
  39. schar shade;
  40. uchar pal;
  41. uchar xrepeat;
  42. uchar yrepeat;
  43. };
  44. struct GIBTABLE
  45. {
  46. GIB gib[8];
  47. DEBRIS debris[8];
  48. };
  49. enum {
  50. kGibGlassShards,
  51. kGibWoodShards,
  52. kGibMetalShards,
  53. kGibTommyCultist,
  54. kGibShotgunCultist,
  55. kGibAxeZombie,
  56. kGibFatZombie,
  57. kGibEarthZombie,
  58. kGibFleshGargoyle,
  59. kGibStoneGargoyle,
  60. kGibFleshStatue,
  61. kGibStoneStatue,
  62. kGibPhantasm,
  63. kGibHound,
  64. kGibHand,
  65. kGibBrownSpider,
  66. kGibRedSpider,
  67. kGibBlackSpider,
  68. kGibMotherSpider,
  69. kGibGillBeast,
  70. kGibEel,
  71. kGibBat,
  72. kGibRat,
  73. kGibGreenPod,
  74. kGibGreenTentacle,
  75. kGibFirePod,
  76. kGibFireTentacle,
  77. kGibMotherPod,
  78. kGibMotherTentacle,
  79. kGibCerberus,
  80. kGibCerberus2,
  81. kGibTchernobog,
  82. kGibRachel,
  83. };
  84. extern int actGenerateGibs( GIB *pGibList, short nSector, int x, int y, int z, int nBlossom=0 );
  85. int actGenerateGibs( GIB *pGibList, short nSector, int x, int y, int z, int nBlossom )
  86. {
  87. dassert(pGibList != NULL);
  88. int angle, velocity = 120;
  89. for (int i = 0; i < kGibMax && pGibList[i].chance > 0; i++)
  90. {
  91. if ( Random(256) < pGibList[i].chance )
  92. {
  93. int nGib = actSpawnSprite( nSector, x, y, z, kStatThing, FALSE );
  94. SPRITE *pGib = &sprite[nGib];
  95. angle = Random(kAngle360);
  96. pGib->type = kThingGibSmall;
  97. pGib->picnum = pGibList[i].tile;
  98. pGib->xvel += mulscale30(velocity, Cos(angle));
  99. pGib->yvel += mulscale30(velocity, Sin(angle));
  100. pGib->zvel -= 128; // toss it in the air a bit
  101. pGib->cstat &= ~kSpriteBlocking & ~kSpriteHitscan;
  102. pGib->flags = kAttrMove | kAttrGravity;
  103. pGib->pal = kPLUNormal;
  104. }
  105. }
  106. }