X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Fwind.cpp;h=b3af59f4472e04961dcb34cfdaf74237d3cf46b3;hb=f2ffe3ee4a4955232ac311c661f98e11d2daa155;hp=5a392c26f2ecbc9b8b3940ba6cbd7a6f88f72fa8;hpb=4a486d92343d1824b311c234e9321e08f280fe68;p=supertux.git diff --git a/src/object/wind.cpp b/src/object/wind.cpp index 5a392c26f..b3af59f44 100644 --- a/src/object/wind.cpp +++ b/src/object/wind.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux - Wind // Copyright (C) 2006 Christoph Sommer // -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,23 +12,25 @@ // 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. +// along with this program. If not, see . -#include +#include "object/wind.hpp" -#include "wind.hpp" -#include "video/drawing_context.hpp" +#include "math/random_generator.hpp" +#include "object/particles.hpp" #include "object/player.hpp" -#include "object_factory.hpp" -#include "random_generator.hpp" -#include "sector.hpp" -#include "particles.hpp" -#include "scripting/wind.hpp" #include "scripting/squirrel_util.hpp" +#include "scripting/wind.hpp" +#include "supertux/object_factory.hpp" +#include "supertux/sector.hpp" +#include "util/reader.hpp" +#include "video/drawing_context.hpp" -Wind::Wind(const lisp::Lisp& reader) - : blowing(true), acceleration(100), elapsed_time(0) +Wind::Wind(const Reader& reader) : + blowing(true), + speed(), + acceleration(100), + elapsed_time(0) { reader.get("name", name); reader.get("x", bbox.p1.x); @@ -60,11 +60,12 @@ Wind::update(float elapsed_time) if (!blowing) return; // TODO: nicer, configurable particles for wind? - if (systemRandom.rand(0, 100) < 20) { + if (graphicsRandom.rand(0, 100) < 20) { // emit a particle - Vector ppos = Vector(systemRandom.randf(bbox.p1.x+8, bbox.p2.x-8), systemRandom.randf(bbox.p1.y+8, bbox.p2.y-8)); + Vector ppos = Vector(graphicsRandom.randf(bbox.p1.x+8, bbox.p2.x-8), graphicsRandom.randf(bbox.p1.y+8, bbox.p2.y-8)); Vector pspeed = Vector(speed.x, speed.y); - Sector::current()->add_object(new Particles(ppos, 44, 46, pspeed, Vector(0,0), 1, Color(.4, .4, .4), 3, .1, LAYER_BACKGROUNDTILES+1)); + Sector::current()->add_object(new Particles(ppos, 44, 46, pspeed, Vector(0,0), 1, Color(.4f, .4f, .4f), 3, .1f, + LAYER_BACKGROUNDTILES+1)); } } @@ -94,8 +95,8 @@ Wind::expose(HSQUIRRELVM vm, SQInteger table_idx) if (name == "") return; - Scripting::Wind* interface = new Scripting::Wind(this); - expose_object(vm, table_idx, interface, name, true); + scripting::Wind* _this = new scripting::Wind(this); + expose_object(vm, table_idx, _this, name, true); } void @@ -104,7 +105,7 @@ Wind::unexpose(HSQUIRRELVM vm, SQInteger table_idx) if (name == "") return; - Scripting::unexpose_object(vm, table_idx, name); + scripting::unexpose_object(vm, table_idx, name); } void @@ -119,4 +120,4 @@ Wind::stop() blowing = false; } -IMPLEMENT_FACTORY(Wind, "wind"); +/* EOF */