Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10772/src
Modified Files:
gameloop.cpp gameloop.h
Log Message:
Added fire works at the end sequence.
To do: add sound and tweak it a bit.
Index: gameloop.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- gameloop.h 11 Sep 2004 14:22:01 -0000 1.58
+++ gameloop.h 13 Sep 2004 22:48:50 -0000 1.59
@@ -117,6 +117,8 @@
// for cheating
std::string last_keys;
+ // for fire works
+ Timer random_timer;
void restart_level();
Index: gameloop.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- gameloop.cpp 13 Sep 2004 18:50:46 -0000 1.171
+++ gameloop.cpp 13 Sep 2004 22:48:50 -0000 1.172
@@ -87,8 +87,9 @@
game_pause = false;
fps_fps = 0;
- fps_timer.init(true);
+ fps_timer.init(true);
frame_timer.init(true);
+ random_timer.init(true);
frame_rate.set_fps(100);
context = new DrawingContext();
@@ -108,6 +109,7 @@
fps_timer.init(true);
frame_timer.init(true);
+ random_timer.init(true);
last_keys.clear();
@@ -513,6 +515,7 @@
else if(!end_sequence && endtile && endtile->data == 0)
{
end_sequence = ENDSEQUENCE_RUNNING;
+ random_timer.start(200); // start 1st fire work
last_x_pos = -1;
SoundManager::get()->play_music(level_end_song, 0);
endsequence_timer.start(7000); // 5 seconds until we finish the map
@@ -552,6 +555,20 @@
currentsector->play_music(LEVEL_MUSIC);
newsector = newspawnpoint = "";
}
+
+ // on end sequence make a few fire works
+ if(end_sequence == ENDSEQUENCE_RUNNING && !random_timer.check())
+ {
+ Vector epicenter = currentsector->camera->get_translation();
+ epicenter.x += screen->w * ((float)rand() / RAND_MAX);
+ epicenter.y += (screen->h/2) * ((float)rand() / RAND_MAX);
+
+ int red = rand() % 255; // calculate fire work color
+ int green = rand() % red;
+ currentsector->add_particles(epicenter, 45, Color(red,green,0), 3, 1.4, 1300);
+
+ random_timer.start(rand() % 400 + 600); // next fire work
+ }
}
void
|