X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscene.cpp;h=a2350355f22889b9aa77a204826ea015c3c58e9a;hb=546364c9567ef212ea9276201facf73f5ada696a;hp=681500f4dace0bbee3efefe68469c63a8b49b9c0;hpb=997685a947eaa0b269873e5956908b734cde1d76;p=supertux.git diff --git a/src/scene.cpp b/src/scene.cpp index 681500f4d..a2350355f 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,29 +1,73 @@ +// $Id$ // -// C Implementation: scene +// SuperTux - A Jump'n Run +// Copyright (C) 2003 Tobias Glaesser // -// Description: -// -// -// Author: Tobias Glaesser , (C) 2004 -// -// Copyright: See COPYING file that comes with this distribution +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. // +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include -#include #include "scene.h" +#include "defines.h" PlayerStatus player_status; PlayerStatus::PlayerStatus() - : score(0), - distros(0), - lives(3) + : distros(0), + lives(START_LIVES), + bonus(NO_BONUS), + score_multiplier(1), + max_score_multiplier(1) +{ +} + +void PlayerStatus::reset() +{ + distros = 0; + lives = START_LIVES; + bonus = NO_BONUS; + score_multiplier = 1; + max_score_multiplier = 1; +} + +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 "iceflower"; + default: + return "none"; + } } -// FIXME: Move this into a view class -float scroll_x; +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; +} unsigned int global_frame_counter;