}
}
- delete world;
- world = 0;
-
return exit_status;
}
}
/* Duck! */
- if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0)
+ if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0 && on_ground())
{
duck = true;
base.height = 32;
: score(0),
distros(0),
lives(START_LIVES),
- score_multiplier(1)
+ score_multiplier(1),
+ bonus(NO_BONUS)
{
}
+std::string bonus_to_string(PlayerStatus::BonusType b)
+{
+ switch (b)
+ {
+ case PlayerStatus::NO_BONUS:
+ return "none";
+ case PlayerStatus::GROWUP_BONUS:
+ return "growup";
+ case PlayerStatus::FLOWER_BONUS:
+ return "icflower";
+ }
+}
+
+PlayerStatus::BonusType string_to_bonus(const std::string& str)
+{
+ if (str == "none")
+ return PlayerStatus::NO_BONUS;
+ else if (str == "growup")
+ return PlayerStatus::GROWUP_BONUS;
+ else if (str == "iceflower")
+ return PlayerStatus::FLOWER_BONUS;
+ else
+ return PlayerStatus::NO_BONUS;
+}
+
// FIXME: Move this into a view class
float scroll_x;
int score;
int distros;
int lives;
+ enum BonusType { NO_BONUS, GROWUP_BONUS, FLOWER_BONUS };
+ BonusType bonus;
int score_multiplier;
PlayerStatus();
};
+std::string bonus_to_string(PlayerStatus::BonusType b);
+PlayerStatus::BonusType string_to_bonus(const std::string& str);
+
extern PlayerStatus player_status;
extern float scroll_x;
{
case GameSession::LEVEL_FINISHED:
level->solved = true;
+ if (session.get_world()->get_tux()->got_coffee)
+ player_status.bonus = PlayerStatus::FLOWER_BONUS;
+ else if (session.get_world()->get_tux()->size == BIG)
+ player_status.bonus = PlayerStatus::GROWUP_BONUS;
+ else
+ player_status.bonus = PlayerStatus::NO_BONUS;
break;
case GameSession::LEVEL_ABORT:
// Reseting the player_status might be a worthy
<< " (lives " << player_status.lives << ")\n"
<< " (score " << player_status.score << ")\n"
<< " (distros " << player_status.distros << ")\n"
- << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")"
- << " (back \"" << direction_to_string(tux->back_direction) << "\"))\n"
+ << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n"
+ << " (back \"" << direction_to_string(tux->back_direction) << "\")\n"
+ << " (bonus \"" << bonus_to_string(player_status.bonus) << "\"))\n"
<< " (levels\n";
for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)