Creates a some sparks that go in random directions
| 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) { |
| 853 | // Make more sparks if Katmai |
| 854 | if (Katmai) |
| 855 | num_sparks *= 2; |
| 856 | |
| 857 | // Create some sparks |
| 858 | for (int i = 0; i < num_sparks; i++) { |
| 859 | int sparknum; |
| 860 | int index; |
| 861 | |
| 862 | if (ps_rand() % 2) |
| 863 | index = HOT_SPARK_INDEX; |
| 864 | else |
| 865 | index = COOL_SPARK_INDEX; |
| 866 | |
| 867 | if (which_index != -1) |
| 868 | index = which_index; |
| 869 | |
| 870 | sparknum = VisEffectCreate(VIS_FIREBALL, index, roomnum, pos); |
| 871 | |
| 872 | if (sparknum >= 0) { |
| 873 | vis_effect *vis = &VisEffects[sparknum]; |
| 874 | |
| 875 | vis->movement_type = MT_PHYSICS; |
| 876 | vis->mass = 100; |
| 877 | vis->drag = .1f; |
| 878 | |
| 879 | vis->phys_flags |= PF_GRAVITY | PF_NO_COLLIDE; |
| 880 | |
| 881 | vis->velocity.x = (ps_rand() % 100) - 50; |
| 882 | vis->velocity.y = (ps_rand() % 100); |
| 883 | vis->velocity.z = (ps_rand() % 100) - 50; |
| 884 | |
| 885 | vm_NormalizeVectorFast(&vis->velocity); |
| 886 | vis->velocity *= 10 + (ps_rand() % 10); |
| 887 | vis->velocity *= force_scalar; |
| 888 | vis->size = .2 + ((ps_rand() % 10) * .01); |
| 889 | vis->flags |= VF_USES_LIFELEFT; |
| 890 | float lifetime = 1 + ((ps_rand() % 10) * .15); |
| 891 | vis->lifeleft = lifetime; |
| 892 | vis->lifetime = lifetime; |
| 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | // Creates a some particles that go in random directions |
| 898 | void CreateRandomParticles(int num_sparks, vector *pos, int roomnum, int bm_handle, float size, float life) { |
no test coverage detected