dispenser can now drop random badguys
[supertux.git] / src / object / fireworks.cpp
index e6369e1..d4f83ea 100644 (file)
@@ -4,6 +4,7 @@
 #include "resources.h"
 #include "sector.h"
 #include "camera.h"
+#include "gameobjs.h"
 #include "app/globals.h"
 #include "video/drawing_context.h"
 #include "audio/sound_manager.h"
@@ -25,14 +26,14 @@ Fireworks::action(float )
     if(timer.check()) {
         Sector* sector = Sector::current();
         Vector pos = sector->camera->get_translation();
-        pos += Vector(screen->w * ((float) rand() / RAND_MAX),
-                      screen->h/2 * ((float) rand() / RAND_MAX));
+        pos += Vector(SCREEN_WIDTH * ((float) rand() / RAND_MAX),
+                      SCREEN_HEIGHT/2 * ((float) rand() / RAND_MAX));
 
         int red = rand() % 255;
         int green = rand() % red;
-        sector->add_particles(pos, 0, 360, Vector(140, 140),
-                Vector(0, 0), 45, Color(red, green, 0), 3, 1300,
-                LAYER_FOREGROUND1+1);
+        sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
+                Vector(0, 0), 45, Color(red, green, 0), 3, 1.3,
+                LAYER_FOREGROUND1+1));
         SoundManager::get()->play_sound(IDToSound(SND_FIREWORKS));
         timer.start(((float) rand() / RAND_MAX) + .5);
     }