"foo",
"whereami",
"camera",
- "grow",
- "fire",
- "ice",
- "coins",
- "numberofthebeast",
"grease",
"invincible",
"mortal",
Console::registerCommand(consoleCommands[i], this);
}
+ statistics_backdrop = new Surface("images/engine/menu/score-backdrop.png");
+
restart_level(true);
}
delete end_sequence_controller;
delete level;
- for (uint16_t i=0; i < sizeof(::consoleCommands)/sizeof(typeof(consoleCommands[0])); i++) {
- Console::unregisterCommand(consoleCommands[i], this);
- }
+
+ delete statistics_backdrop;
current_ = NULL;
}
}
bool
-GameSession::consoleCommand(std::string command, std::vector<std::string> arguments)
+GameSession::consoleCommand(std::string command, std::vector<std::string>)
{
if (command == "foo") {
msg_info << "bar" << std::endl;
// Cheating words (the goal of this is really for debugging,
// but could be used for some cheating, nothing wrong with that)
- if (command == "grow") {
- tux.set_bonus(GROWUP_BONUS, false);
- return true;
- }
- if (command == "fire") {
- tux.set_bonus(FIRE_BONUS, false);
- return true;
- }
- if (command == "ice") {
- tux.set_bonus(ICE_BONUS, false);
- return true;
- }
- if (command == "coins") {
- if ((arguments.size() < 1) || (!Console::string_is<int>(arguments[0]))) {
- msg_info << "Usage: coins <number>" << std::endl;
- } else {
- player_status->coins = Console::string_to<int>(arguments[0]);
- }
- return true;
- }
- if (command == "numberofthebeast") {
- player_status->coins += 55;
- return true;
- }
if (command == "grease") {
tux.physic.set_velocity_x(tux.physic.get_velocity_x()*3);
return true;
/* End of level? */
if(end_sequence && endsequence_timer.check()) {
finish(true);
-
- // add time spent to statistics
- int tottime = 0, remtime = 0;
- for(std::vector<Sector*>::iterator i = level->sectors.begin(); i != level->sectors.end(); ++i)
- {
- Sector* sec = *i;
-
- for(std::vector<GameObject*>::iterator j = sec->gameobjects.begin();
- j != sec->gameobjects.end(); ++j)
- {
- GameObject* obj = *j;
-
- LevelTime* lt = dynamic_cast<LevelTime*> (obj);
- if(lt)
- {
- tottime += int(lt->get_level_time());
- remtime += int(lt->get_remaining_time());
- }
- }
- }
- global_stats.set_points(TIME_NEEDED_STAT, (tottime == 0 ? -1 : (tottime-remtime)));
-
return;
} else if (!end_sequence && tux->is_dead()) {
if (player_status->coins < 0) {
lt->stop();
}
+ // add time spent to statistics
+ int tottime = 0, remtime = 0;
+ for(std::vector<Sector*>::iterator i = level->sectors.begin(); i != level->sectors.end(); ++i)
+ {
+ Sector* sec = *i;
+
+ for(std::vector<GameObject*>::iterator j = sec->gameobjects.begin();
+ j != sec->gameobjects.end(); ++j)
+ {
+ GameObject* obj = *j;
+
+ LevelTime* lt = dynamic_cast<LevelTime*> (obj);
+ if(lt)
+ {
+ tottime += int(lt->get_level_time());
+ remtime += int(lt->get_remaining_time());
+ }
+ }
+ }
+ global_stats.set_points(TIME_NEEDED_STAT, (tottime == 0 ? -1 : (tottime-remtime)));
+
if(sequencename == "fireworks") {
currentsector->add_object(new Fireworks());
}
context.draw_text(white_text, fpstext, Vector(SCREEN_WIDTH - white_text->get_text_width(fpstext) - gold_text->get_text_width(" 99999") - BORDER_X, BORDER_Y + 20), LEFT_ALLIGN, LAYER_FOREGROUND1);
context.draw_text(gold_text, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), RIGHT_ALLIGN, LAYER_FOREGROUND1);
}
+
+ // draw level stats while end_sequence is running
+ if (end_sequence) {
+ global_stats.draw_endseq_panel(context, best_level_statistics, statistics_backdrop);
+ }
}