projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SDL: Implement lightmaps smaller than the screen size. LIGHTMAP_DIV is calculated...
[supertux.git]
/
src
/
object
/
fireworks.cpp
diff --git
a/src/object/fireworks.cpp
b/src/object/fireworks.cpp
index
acfa881
..
d3037ea
100644
(file)
--- a/
src/object/fireworks.cpp
+++ b/
src/object/fireworks.cpp
@@
-27,10
+27,12
@@
#include "main.hpp"
#include "video/drawing_context.hpp"
#include "audio/sound_manager.hpp"
#include "main.hpp"
#include "video/drawing_context.hpp"
#include "audio/sound_manager.hpp"
+#include "random_generator.hpp"
Fireworks::Fireworks()
{
Fireworks::Fireworks()
{
- timer.start(.2);
+ timer.start(.2f);
+ sound_manager->preload("sounds/fireworks.wav");
}
Fireworks::~Fireworks()
}
Fireworks::~Fireworks()
@@
-43,22
+45,20
@@
Fireworks::update(float )
if(timer.check()) {
Sector* sector = Sector::current();
Vector pos = sector->camera->get_translation();
if(timer.check()) {
Sector* sector = Sector::current();
Vector pos = sector->camera->get_translation();
- pos += Vector(
SCREEN_WIDTH * ((float) rand() / RAND_MAX
),
-
SCREEN_HEIGHT/2 * ((float) rand() / RAND_MAX
));
+ pos += Vector(
systemRandom.randf(SCREEN_WIDTH
),
+
systemRandom.randf(SCREEN_HEIGHT/2
));
- int r = rand() % 255;
- int g = rand() % 255;
- float red = r / 255.0;
- float green = g / 255.0;
+ float red = systemRandom.randf(1.0);
+ float green = systemRandom.randf(1.0);
//float red = 0.7;
//float green = 0.9;
(void) red;
(void) green;
sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
//float red = 0.7;
//float green = 0.9;
(void) red;
(void) green;
sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
- Vector(0, 0), 45, Color(red, green, 0), 3, 1.3,
+ Vector(0, 0), 45, Color(red, green, 0), 3, 1.3
f
,
LAYER_FOREGROUND1+1));
sound_manager->play("sounds/fireworks.wav");
LAYER_FOREGROUND1+1));
sound_manager->play("sounds/fireworks.wav");
- timer.start(
((float) rand() / RAND_MAX) + .5
);
+ timer.start(
systemRandom.randf(1.0, 1.5)
);
}
}
}
}