X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Fparticlesystem_interactive.cpp;h=0a9228abc4a078aca837ecaeb552c73de75dd18b;hb=7b6e4c78fe9366f3beff03acdd8310d979d8b2a5;hp=b2f55ca360f3297991052d9c88a5faabf6987eaa;hpb=1ff837fd2c166214bfec2b573424ddfc03cce8c1;p=supertux.git diff --git a/src/object/particlesystem_interactive.cpp b/src/object/particlesystem_interactive.cpp index b2f55ca36..0a9228abc 100644 --- a/src/object/particlesystem_interactive.cpp +++ b/src/object/particlesystem_interactive.cpp @@ -38,6 +38,7 @@ #include "object/camera.hpp" #include "object/rainsplash.hpp" #include "badguy/bomb.hpp" +#include "random_generator.hpp" //TODO: Find a way to make rain collide with objects like bonus blocks // Add an option to set rain strength @@ -152,12 +153,12 @@ RainParticleSystem::RainParticleSystem() size_t raindropcount = size_t(virtual_width/6.0); for(size_t i=0; ipos.x = rand() % int(virtual_width); - particle->pos.y = rand() % int(virtual_height); - int rainsize = rand() % 2; + particle->pos.x = systemRandom.rand(int(virtual_width)); + particle->pos.y = systemRandom.rand(int(virtual_height)); + int rainsize = systemRandom.rand(2); particle->texture = rainimages[rainsize]; do { - particle->speed = (rainsize+1)*45 + (float(rand()%10)*.4); + particle->speed = (rainsize+1)*45 + systemRandom.randf(3.6); } while(particle->speed < 1); particle->speed *= 10; // gravity @@ -214,7 +215,7 @@ void RainParticleSystem::update(float elapsed_time) Sector::current()->add_object(new RainSplash(Vector(splash_x, splash_y),vertical)); } */ } - int new_x = (rand() % int(virtual_width)) + int(abs_x); + int new_x = systemRandom.rand(int(virtual_width)) + int(abs_x); int new_y = 0; //FIXME: Don't move particles over solid tiles particle->pos.x = new_x; @@ -234,12 +235,12 @@ CometParticleSystem::CometParticleSystem() size_t cometcount = 2; for(size_t i=0; ipos.x = rand() % int(virtual_width); - particle->pos.y = rand() % int(virtual_height); - int cometsize = rand() % 2; + particle->pos.x = systemRandom.rand(int(virtual_width)); + particle->pos.y = systemRandom.rand(int(virtual_height)); + int cometsize = systemRandom.rand(2); particle->texture = cometimages[cometsize]; do { - particle->speed = (cometsize+1)*30 + (float(rand()%10)*.4); + particle->speed = (cometsize+1)*30 + systemRandom.randf(3.6); } while(particle->speed < 1); particle->speed *= 10; // gravity @@ -283,7 +284,7 @@ void CometParticleSystem::update(float elapsed_time) if ((particle->pos.y <= SCREEN_HEIGHT + abs_y) && (col >= 1)) { Sector::current()->add_object(new Bomb(particle->pos, LEFT)); } - int new_x = (rand() % int(virtual_width)) + int(abs_x); + int new_x = systemRandom.rand(int(virtual_width)) + int(abs_x); int new_y = 0; //FIXME: Don't move particles over solid tiles particle->pos.x = new_x;