[Super-tux-commit] supertux/src gameloop.cpp,1.182,1.183 sector.cpp,1.26,1.27 sector.h,1.13,1.14
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-16 18:56:19
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7444/src Modified Files: gameloop.cpp sector.cpp sector.h Log Message: Added support for setting up end sequence animations on levels. Tag: (end-sequence-animation "fireworks") fireworks is only supported currently. Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sector.h 14 Sep 2004 10:27:05 -0000 1.13 +++ sector.h 16 Sep 2004 18:56:09 -0000 1.14 @@ -56,6 +56,11 @@ Vector pos; }; +enum { + NONE_ENDSEQ_ANIM, + FIREWORKS_ENDSEQ_ANIM + }; + /** This class holds a sector (a part of a level) and all the game objects * (badguys, player, background, tilemap, ...) */ @@ -126,6 +131,10 @@ player to play the same level in a different way :) */ void do_vertical_flip(); + /** Get end sequence animation */ + int end_sequence_animation() + { return end_sequence_animation_type; } + /** @evil@ */ static Sector* current() { return _current; } @@ -140,6 +149,8 @@ MusicRef level_song; MusicRef level_song_fast; + int end_sequence_animation_type; + public: std::string song_title; float gravity; Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- sector.cpp 15 Sep 2004 11:50:31 -0000 1.26 +++ sector.cpp 16 Sep 2004 18:56:09 -0000 1.27 @@ -46,7 +46,7 @@ Sector::Sector() : gravity(10), player(0), solids(0), background(0), camera(0), - currentmusic(LEVEL_MUSIC) + currentmusic(LEVEL_MUSIC), end_sequence_animation_type(NONE_ENDSEQ_ANIM) { song_title = "Mortimers_chipdisko.mod"; player = new Player(); @@ -86,6 +86,10 @@ } else if(token == "music") { song_title = lisp_string(data); load_music(); + } else if(token == "end-sequence-animation") { + std::string end_seq_anim = lisp_string(data); + if(end_seq_anim == "fireworks") + end_sequence_animation_type = FIREWORKS_ENDSEQ_ANIM; } else if(token == "camera") { if(camera) { std::cerr << "Warning: More than 1 camera defined in sector.\n"; @@ -184,6 +188,13 @@ add_object(background); } + std::string end_seq_anim; + reader.read_string("end-sequence-animation", end_seq_anim); + if(end_seq_anim == "fireworks") + end_sequence_animation_type = FIREWORKS_ENDSEQ_ANIM; +// else +// end_sequence_animation = NONE_ENDSEQ_ANIM; + std::string particlesystem; reader.read_string("particle_system", particlesystem); if(particlesystem == "clouds") Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.182 retrieving revision 1.183 diff -u -d -r1.182 -r1.183 --- gameloop.cpp 16 Sep 2004 15:04:16 -0000 1.182 +++ gameloop.cpp 16 Sep 2004 18:56:01 -0000 1.183 @@ -548,14 +548,15 @@ else if(!end_sequence && endtile && endtile->data == 0) { end_sequence = ENDSEQUENCE_RUNNING; - random_timer.start(200); // start 1st firework + endsequence_timer.start(7000); // 5 seconds until we finish the map last_x_pos = -1; SoundManager::get()->play_music(level_end_song, 0); - endsequence_timer.start(7000); // 5 seconds until we finish the map tux->invincible_timer.start(7000); //FIXME: Implement a winning timer for the end sequence (with special winning animation etc.) // add left time to stats global_stats.set_points(TIME_NEEDED_STAT, time_left.get_gone() / 1000); + + random_timer.start(200); // start 1st firework } else if (!end_sequence && tux->is_dead()) { @@ -593,7 +594,8 @@ } // on end sequence make a few fireworks - if(end_sequence == ENDSEQUENCE_RUNNING && !random_timer.check()) + if(end_sequence == ENDSEQUENCE_RUNNING && !random_timer.check() && + currentsector->end_sequence_animation() == FIREWORKS_ENDSEQ_ANIM) { Vector epicenter = currentsector->camera->get_translation(); epicenter.x += screen->w * ((float)rand() / RAND_MAX); |