if(flip_levels_mode)
flip_level = true;
+ last_swap_point = Vector(-1, -1);
+ last_swap_stats.reset();
+
restart_level();
}
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));
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)
#include "special/timer.h"
#include "special/base.h"
#include "special/frame_rate.h"
+#include "statistics.h"
using namespace SuperTux;
// 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();
void on_escape_press();
void process_menu();
-
- Statistics* best_level_statistics;
};
std::string slotinfo(int slot);