X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fparticles.cpp;h=f6f066b361b8c808e3485c161a477f0e7f3a7c30;hb=7e15c4f871809033278711a6e9327616da00c4c9;hp=86cf466bc7063ba622f1fd649bc4fb8e0849b824;hpb=da3301ebf60baf7e39dffd3bca35af5298fe9724;p=supertux.git diff --git a/src/object/particles.cpp b/src/object/particles.cpp index 86cf466bc..f6f066b36 100644 --- a/src/object/particles.cpp +++ b/src/object/particles.cpp @@ -1,8 +1,7 @@ // $Id$ -// +// // SuperTux -// Copyright (C) 2000 Bill Kendrick -// Copyright (C) 2004 Tobias Glaesser +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -13,11 +12,11 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + #include #include @@ -26,6 +25,7 @@ #include "sector.hpp" #include "camera.hpp" #include "main.hpp" +#include "random_generator.hpp" Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, @@ -45,8 +45,8 @@ Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, Particle* particle = new Particle; particle->pos = epicenter; - float angle = ((rand() % (max_angle-min_angle))+min_angle) - * (M_PI / 180); // convert to radius + float angle = systemRandom.rand(min_angle, max_angle) + * (M_PI / 180); // convert to radius (radians?) particle->vel.x = /*fabs*/(sin(angle)) * initial_velocity.x; // if(angle >= M_PI && angle < M_PI*2) // particle->vel.x *= -1; // work around to fix signal @@ -102,4 +102,3 @@ Particles::draw(DrawingContext& context) context.draw_filled_rect((*i)->pos, Vector(size,size), color,drawing_layer); } } -