[Super-tux-commit] supertux/src sector.h,1.19,1.20 sector.cpp,1.35,1.36 gameobjs.h,1.39,1.40 gameobj
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-10-31 12:08:54
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26349/src Modified Files: sector.h sector.cpp gameobjs.h gameobjs.cpp gameloop.cpp player.cpp Log Message: Added a parameter for Particles to set the drawing layer, instead of using a fixed one. Asked by Iknos. Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- sector.h 29 Oct 2004 22:49:07 -0000 1.19 +++ sector.h 31 Oct 2004 12:08:44 -0000 1.20 @@ -114,7 +114,7 @@ void add_upgrade(const Vector& pos, Direction dir, UpgradeKind kind); bool add_bullet(const Vector& pos, float xm, Direction dir); bool add_smoke_cloud(const Vector& pos); - bool add_particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color, int size, int life_time); + bool add_particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color, int size, int life_time, int drawing_layer); void add_floating_text(const Vector& pos, const std::string& text); /** Try to grab the coin at the given coordinates */ Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- sector.cpp 29 Oct 2004 22:49:07 -0000 1.35 +++ sector.cpp 31 Oct 2004 12:08:44 -0000 1.36 @@ -769,9 +769,9 @@ } bool -Sector::add_particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color, int size, int life_time) +Sector::add_particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color, int size, int life_time, int drawing_layer) { - add_object(new Particles(epicenter, min_angle, max_angle, initial_velocity, acceleration, number, color, size, life_time)); + add_object(new Particles(epicenter, min_angle, max_angle, initial_velocity, acceleration, number, color, size, life_time, drawing_layer)); return true; } Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.192 retrieving revision 1.193 diff -u -d -r1.192 -r1.193 --- player.cpp 30 Oct 2004 11:45:44 -0000 1.192 +++ player.cpp 31 Oct 2004 12:08:44 -0000 1.193 @@ -505,7 +505,8 @@ Sector::current()->add_particles( Vector(base.x + (dir == RIGHT ? base.width : 0), base.y+base.height), dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20, - Vector(2.8,-2.6), Vector(0,0.030), 3, Color(100,100,100), 3, 800); + Vector(2.8,-2.6), Vector(0,0.030), 3, Color(100,100,100), 3, 800, + LAYER_OBJECTS+1); ax *= 2.5; } Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- gameobjs.cpp 29 Oct 2004 22:49:07 -0000 1.55 +++ gameobjs.cpp 31 Oct 2004 12:08:44 -0000 1.56 @@ -465,8 +465,8 @@ img_smoke_cloud->draw(context, position, LAYER_OBJECTS+1); } -Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color_, int size_, int life_time) - : color(color_), size(size_), accel(acceleration) +Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, int number, Color color_, int size_, int life_time, int drawing_layer_) + : color(color_), size(size_), accel(acceleration), drawing_layer(drawing_layer_) { if(life_time == 0) { @@ -537,7 +537,7 @@ // draw particles for(std::vector<Particle*>::iterator i = particles.begin(); i < particles.end(); i++) { - context.draw_filled_rect((*i)->pos, Vector(size,size), color, LAYER_OBJECTS+10); + context.draw_filled_rect((*i)->pos, Vector(size,size), color, drawing_layer); } } Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- gameobjs.h 29 Oct 2004 22:49:07 -0000 1.39 +++ gameobjs.h 31 Oct 2004 12:08:44 -0000 1.40 @@ -182,19 +182,21 @@ public: Particles(const Vector& epicenter, int min_angle, int max_angle, const Vector& initial_velocity, const Vector& acceleration, - int number, Color color, int size, int life_time); + int number, Color color, int size, int life_time, int drawing_layer); ~Particles(); virtual void action(float elapsed_time); virtual void draw(DrawingContext& context); private: - Color color; - float size; Vector accel; Timer timer; bool live_forever; + Color color; + float size; + int drawing_layer; + struct Particle { Vector pos, vel; // float angle; Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.192 retrieving revision 1.193 diff -u -d -r1.192 -r1.193 --- gameloop.cpp 30 Oct 2004 11:45:44 -0000 1.192 +++ gameloop.cpp 31 Oct 2004 12:08:44 -0000 1.193 @@ -655,7 +655,8 @@ int red = rand() % 255; // calculate firework color int green = rand() % red; currentsector->add_particles(epicenter, 0, 360, Vector(1.4,1.4), - Vector(0,0), 45, Color(red,green,0), 3, 1300); + Vector(0,0), 45, Color(red,green,0), 3, 1300, + LAYER_FOREGROUND1+1); SoundManager::get()->play_sound(IDToSound(SND_FIREWORKS)); random_timer.start(rand() % 400 + 600); // next firework |