Advertisement
Benji23245

Untitled

Jul 3rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. void ShadowCBparticles(EntityData1 *a1, CharObj2 *a2)
  2. {
  3. if (GameState != 21 && is_shadow)
  4. {
  5. if (CB_lv2 || CB_lv3)
  6. {
  7. //Actual Sparkles
  8. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  9. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_DESTALPHA);
  10. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  11. //Big ones
  12. ParticleDepthOverride = 0.0f;
  13. EntityData1 *co1 = EntityData1Ptrs[0];
  14. for (auto it = sparklesgems.begin(); it != sparklesgems.end(); )
  15. {
  16. NJS_VECTOR pos = { 0, it->radius, 0 };
  17. njPushMatrix(nullptr);
  18. njRotateX(nullptr, it->rotation.x);
  19. njRotateY(nullptr, it->rotation.y);
  20. njRotateZ(nullptr, it->rotation.z);
  21. njCalcVector(nullptr, &pos, &sparklegemssprite.p);
  22. njPopMatrix(1);
  23. sparklegemssprite.p.x += it->pos.x;
  24. sparklegemssprite.p.y += it->pos.y;
  25. sparklegemssprite.p.z += it->pos.z;
  26. if (it->framegems < 11)
  27. {
  28. SetMaterialAndSpriteColor_Float((11 - it->framegems) / 11.0f, 1, 1, 1);
  29. sparklegemssprite.sx = ((22 - it->framegems) / 22.0f) * 0.6f * 1.3f * HorizontalResolution / 1680.0f;
  30. sparklegemssprite.sy = ((22 - it->framegems) / 22.0f) * 0.6f * 1.3f * VerticalResolution / 1050.0f;
  31. if (Gauge > 0 && a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparklegemssprite, 2, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  32. }
  33. it->framegems++;
  34. if (it->framegems >= 11)
  35. it = sparklesgems.erase(it);
  36. else
  37. {
  38. it->radius += 0.15f;
  39. ++it;
  40. }
  41. }
  42. if (++sparklegemstimer == 8)
  43. {
  44. sparklegemsdata sp = {};
  45. //sp.radius = ((float)rand() / RAND_MAX) * 8.0;//if I wanted them to spawn in the center
  46. sp.radius = (((float)rand() / RAND_MAX) * 3.0) + 4.0;//sp.radius = (((float)rand() / RAND_MAX) * max_radius) + min_radius; //if min_radius is 2, and max_radius is 3, then the sparkles will spawn between 2 and 5 (2+3) away
  47. sp.rotation.x = rand() & 0xFFFF;
  48. sp.rotation.y = rand() & 0xFFFF;
  49. sp.rotation.z = rand() & 0xFFFF;
  50. sp.pos = co1->CollisionInfo->CollisionArray->origin;
  51. sparklesgems.push_back(sp);
  52. sparklegemstimer = 0;
  53. }
  54. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  55.  
  56. //Small ones
  57. ParticleDepthOverride = 0.0f;
  58. for (auto it = sparklesgems_tiny.begin(); it != sparklesgems_tiny.end(); )
  59. {
  60. NJS_VECTOR pos = { 0, it->radius, 0 };
  61. njPushMatrix(nullptr);
  62. njRotateX(nullptr, it->rotation.x);
  63. njRotateY(nullptr, it->rotation.y);
  64. njRotateZ(nullptr, it->rotation.z);
  65. njCalcVector(nullptr, &pos, &sparklegemssprite.p);
  66. njPopMatrix(1);
  67. sparklegemssprite.p.x += it->pos.x;
  68. sparklegemssprite.p.y += it->pos.y;
  69. sparklegemssprite.p.z += it->pos.z;
  70. if (it->framegems_tiny < 11)
  71. {
  72. SetMaterialAndSpriteColor_Float((11 - it->framegems_tiny) / 11.0f, 1, 1, 1);
  73. sparklegemssprite.sx = ((22 - it->framegems_tiny) / 22.0f) * 0.0375f * 3.0f * 1.3f * HorizontalResolution / 1680.0f;
  74. sparklegemssprite.sy = ((22 - it->framegems_tiny) / 22.0f) * 0.0375f * 3.0f * 1.3f * VerticalResolution / 1050.0f;
  75. if (Gauge > 0 && a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparklegemssprite, 6, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  76. }
  77. it->framegems_tiny++;
  78. if (it->framegems_tiny >= 15)
  79. it = sparklesgems_tiny.erase(it);
  80. else
  81. {
  82. it->radius += 0.075f;
  83. ++it;
  84. }
  85. }
  86. if (++sparklegems_tiny_timer == 3)
  87. {
  88. sparklegemsdata sp = {};
  89. sp.radius = (((float)rand() / RAND_MAX) * 2.0) + 2.5;
  90. sp.rotation.x = rand() & 0xFFFF;
  91. sp.rotation.y = rand() & 0xFFFF;
  92. sp.rotation.z = rand() & 0xFFFF;
  93. sp.pos = co1->CollisionInfo->CollisionArray->origin;
  94. sparklesgems_tiny.push_back(sp);
  95. sparklegems_tiny_timer = 0;
  96. }
  97. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  98. }
  99. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  100. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  101. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement