Menu::set_current(settings_menu);
break;
case BT_NEXT_LEVEL:
- if(level_nb < level_subset.get_num_levels())
+ if(level_nb+1 < level_subset.get_num_levels())
load_level(level_nb + 1);
else
{
}
break;
case BT_PREVIOUS_LEVEL:
- if(level_nb > 1)
+ if(level_nb-1 > 0)
load_level(level_nb - 1);
break;
case BT_NEXT_SECTOR:
if(level_name_timer.check())
{
+ context.push_transform();
if(level_name_timer.get_left() < FADING_TIME)
- {
- context.push_transform();
context.set_alpha(level_name_timer.get_left() * 255 / FADING_TIME);
- }
context.draw_text(gold_text, level.name, Vector(screen->w/2, 30), CENTER_ALLIGN, LAYER_GUI);
if(level_nb != -1)
context.draw_text(gold_text, str, Vector(screen->w/2, 50), CENTER_ALLIGN, LAYER_GUI);
}
- if(level_name_timer.get_left() < FADING_TIME)
- context.pop_transform();
+ context.pop_transform();
}
if(sector)
context.draw_text(white_small_text, _("F1 for help"), Vector(5, 510), LEFT_ALLIGN, LAYER_GUI-10);
void LevelEditor::load_level(std::string filename)
{
-if(!level_changed)
- save_level();
+if(level_changed)
+ {
+ if(confirm_dialog(NULL, _("Level not saved. Wanna to?")))
+ save_level();
+ else
+ return;
+ }
level_filename = filename;
level.load(filename);
void LevelEditor::load_level(int nb)
{
-if(!level_changed)
- save_level();
+if(level_changed)
+ {
+ if(confirm_dialog(NULL, _("Level not saved. Wanna to?")))
+ save_level();
+ else
+ return;
+ }
level_nb = nb;
std::cerr << "level_nb: " << level_nb << std::endl;
void LevelEditor::save_level()
{
+std::cerr << "saving level...\n";
level.save(level_filename);
level_changed = false;
}