[Super-tux-commit] supertux/src gameloop.cpp,1.185,1.186 gameloop.h,1.61,1.62
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-20 19:02:56
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10052/src Modified Files: gameloop.cpp gameloop.h Log Message: When swap keep statistics so far. (not tested - I'd appreaciate if someone would test this) Also, when you go to some swap, you'll always stay there, even if you die before it - requested by various players. Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- gameloop.h 15 Sep 2004 21:59:30 -0000 1.61 +++ gameloop.h 20 Sep 2004 19:02:46 -0000 1.62 @@ -25,6 +25,7 @@ #include "special/timer.h" #include "special/base.h" #include "special/frame_rate.h" +#include "statistics.h" using namespace SuperTux; @@ -122,6 +123,12 @@ // for fire works Timer random_timer; + // swap points + Vector last_swap_point; + Statistics last_swap_stats; + + Statistics* best_level_statistics; + void restart_level(); void check_end_conditions(); @@ -135,8 +142,6 @@ void on_escape_press(); void process_menu(); - - Statistics* best_level_statistics; }; std::string slotinfo(int slot); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.185 retrieving revision 1.186 diff -u -d -r1.185 -r1.186 --- gameloop.cpp 17 Sep 2004 12:22:40 -0000 1.185 +++ gameloop.cpp 20 Sep 2004 19:02:46 -0000 1.186 @@ -99,6 +99,9 @@ if(flip_levels_mode) flip_level = true; + last_swap_point = Vector(-1, -1); + last_swap_stats.reset(); + restart_level(); } @@ -143,9 +146,19 @@ if(tux_pos.x != -1) { tux_pos = currentsector->get_best_spawn_point(tux_pos); + + if(last_swap_point.x > tux_pos.x) + tux_pos = last_swap_point; + else // new swap point + { + last_swap_point = tux_pos; + + last_swap_stats += global_stats; + } + currentsector->player->base.x = tux_pos.x; currentsector->player->base.y = tux_pos.y; - + // has to reset camera on swapping currentsector->camera->reset(Vector(currentsector->player->base.x, currentsector->player->base.y)); @@ -543,6 +556,7 @@ if(end_sequence && !endsequence_timer.check()) { exit_status = ES_LEVEL_FINISHED; + global_stats += last_swap_stats; // add swap points stats return; } else if(end_sequence == ENDSEQUENCE_RUNNING && endtile && endtile->data >= 1) |