Creates a some sparks that go in random directions
| 811 | |
| 812 | // Creates a some sparks that go in random directions |
| 813 | void CreateRandomLineSparks(int num_sparks, vector *pos, int roomnum, uint16_t color, float force_scalar) { |
| 814 | // Make more sparks if Katmai |
| 815 | if (Katmai) |
| 816 | num_sparks *= 2; |
| 817 | |
| 818 | // Create some sparks |
| 819 | for (int i = 0; i < num_sparks; i++) { |
| 820 | int visnum = VisEffectCreate(VIS_FIREBALL, FADING_LINE_INDEX, roomnum, pos); |
| 821 | if (visnum >= 0) { |
| 822 | vis_effect *vis = &VisEffects[visnum]; |
| 823 | |
| 824 | vis->movement_type = MT_PHYSICS; |
| 825 | vis->mass = 500; |
| 826 | vis->drag = .001f; |
| 827 | vis->phys_flags |= PF_GRAVITY | PF_NO_COLLIDE; |
| 828 | |
| 829 | vis->velocity.x = (ps_rand() % 100) - 50; |
| 830 | vis->velocity.y = (ps_rand() % 100); |
| 831 | vis->velocity.z = (ps_rand() % 100) - 50; |
| 832 | |
| 833 | vm_NormalizeVectorFast(&vis->velocity); |
| 834 | |
| 835 | vis->velocity *= 20 + (ps_rand() % 10); |
| 836 | vis->velocity *= force_scalar; |
| 837 | vis->size = .7 + ((ps_rand() % 10) * .04); |
| 838 | vis->flags |= VF_USES_LIFELEFT; |
| 839 | float lifetime = 1 + ((ps_rand() % 10) * .15); |
| 840 | vis->lifeleft = lifetime; |
| 841 | vis->lifetime = lifetime; |
| 842 | |
| 843 | if (color == 0) |
| 844 | vis->lighting_color = GR_RGB16(200 + (ps_rand() % 50), 150 + (ps_rand() % 50), ps_rand() % 50); |
| 845 | else |
| 846 | vis->lighting_color = color; |
| 847 | } |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | // Creates a some sparks that go in random directions |
| 852 | void CreateRandomSparks(int num_sparks, vector *pos, int roomnum, int which_index, float force_scalar) { |
no test coverage detected