-GameSession::try_cheats()
-{
- if(currentsector == 0)
- return;
- Player& tux = *currentsector->player;
-
- // Cheating words (the goal of this is really for debugging,
- // but could be used for some cheating, nothing wrong with that)
- if(main_controller->check_cheatcode("grow")) {
- tux.set_bonus(GROWUP_BONUS, false);
- }
- if(main_controller->check_cheatcode("fire")) {
- tux.set_bonus(FIRE_BONUS, false);
- }
- if(main_controller->check_cheatcode("ice")) {
- tux.set_bonus(ICE_BONUS, false);
- }
- if(main_controller->check_cheatcode("lifeup")) {
- player_status->lives++;
- }
- if(main_controller->check_cheatcode("lifedown")) {
- player_status->lives--;
- }
- if(main_controller->check_cheatcode("grease")) {
- tux.physic.set_velocity_x(tux.physic.get_velocity_x()*3);
- }
- if(main_controller->check_cheatcode("invincible")) {
- // be invincle for the rest of the level
- tux.invincible_timer.start(10000);
- }
- if(main_controller->check_cheatcode("mortal")) {
- // give up invincibility
- tux.invincible_timer.stop();
- }
- if(main_controller->check_cheatcode("shrink")) {
- // remove powerups
- tux.kill(tux.SHRINK);
- }
- if(main_controller->check_cheatcode("kill")) {
- // kill Tux, but without losing a life
- player_status->lives++;
- tux.kill(tux.KILL);
- }
- if(main_controller->check_cheatcode("whereami")) {
- msg_info("You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y);
- }
-#if 0
- if(main_controller->check_cheatcode("grid")) {
- // toggle debug grid
- debug_grid = !debug_grid;
- }
-#endif
- if(main_controller->check_cheatcode("gotoend")) {
- // goes to the end of the level
- tux.move(Vector(
- (currentsector->solids->get_width()*32) - (SCREEN_WIDTH*2), 0));
- currentsector->camera->reset(
- Vector(tux.get_pos().x, tux.get_pos().y));
- }
- if(main_controller->check_cheatcode("flip")) {
- FlipLevelTransformer flip_transformer;
- flip_transformer.transform(GameSession::current()->get_current_level());
- }
- if(main_controller->check_cheatcode("finish")) {
- // finish current sector
- exit_status = ES_LEVEL_FINISHED;
- // don't add points to stats though...
- }
- if(main_controller->check_cheatcode("camera")) {
- msg_info("Camera is at "
- << Sector::current()->camera->get_translation().x << ","
- << Sector::current()->camera->get_translation().y);
- }
-}
-
-void