X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplayer_status.hpp;h=bf5cc272d365e3ef9b214656680945338b3ec6c5;hb=30f0f1d78e3f0bbbaf0b8d9d80fcbb579059941e;hp=4ad7a680039918d6f76b3616d586bb64eb256a9e;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/player_status.hpp b/src/player_status.hpp index 4ad7a6800..bf5cc272d 100644 --- a/src/player_status.hpp +++ b/src/player_status.hpp @@ -1,7 +1,8 @@ // $Id$ // -// SuperTux - A Jump'n Run +// SuperTux // Copyright (C) 2003 Tobias Glaesser +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -19,41 +20,60 @@ #ifndef SUPERTUX_PLAYERSTATUS_H #define SUPERTUX_PLAYERSTATUS_H +#include +#include #include "lisp/lisp.hpp" #include "timer.hpp" #include "serializable.hpp" +#include "sprite/sprite.hpp" +#include "console.hpp" +#include "video/surface.hpp" + +static const float BORDER_X = 10; +static const float BORDER_Y = 10; enum BonusType { NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS }; class DrawingContext; -/** +/** * This class memorizes player status between different game sessions (for * example when switching maps in the worldmap) */ -class PlayerStatus : public Serializable +class PlayerStatus : public Serializable, public ConsoleCommandReceiver { public: PlayerStatus(); - void reset(); - void incLives(); - void incCoins(); + ~PlayerStatus(); + void reset(); + void add_coins(int count, bool play_sound = true); void write(lisp::Writer& writer); void read(const lisp::Lisp& lisp); void draw(DrawingContext& context); + bool consoleCommand(std::string command, std::vector arguments); /**< callback from Console; return false if command was unknown, true otherwise */ + int coins; - int lives; BonusType bonus; + int max_fire_bullets; /**< maximum number of fire bullets in play */ + int max_ice_bullets; /**< maximum number of ice bullets in play */ int score_multiplier; int max_score_multiplier; + + void operator= (const PlayerStatus& other); + +private: + // don't use this + PlayerStatus(const PlayerStatus& other); + + std::auto_ptr coin_surface; }; // global player state -extern PlayerStatus player_status; +extern PlayerStatus* player_status; #endif