X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fstatistics.h;h=2bd87745e151579a6425f27b3a83ad0203f69e05;hb=1d16dc1efae67a26d41f302e9681e567492327c5;hp=d22c77349d13e89c944c043bee71aa8d23dde45c;hpb=2f0b7399772742750fde12c194ee9beef0a472dc;p=supertux.git diff --git a/src/statistics.h b/src/statistics.h index d22c77349..2bd87745e 100644 --- a/src/statistics.h +++ b/src/statistics.h @@ -1,5 +1,6 @@ -// SuperTux -// Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details +// +// SuperTux - A Jump'n Run +// Copyright (C) 2004 Ricardo Cruz // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -19,16 +20,25 @@ #ifndef SUPERTUX_STATISTICS_H #define SUPERTUX_STATISTICS_H +#include "timer.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" + using namespace SuperTux; namespace SuperTux { -class LispReader; -class LispWriter; +class DrawingContext; } +#define SPLAYER 0 +#define STOTAL 1 + enum { SCORE_STAT, - MAX_STATS + COINS_COLLECTED_STAT, + BADGUYS_KILLED_STAT, + TIME_NEEDED_STAT, + NUM_STATS }; /** This class is a layer between level and worldmap to keep @@ -38,19 +48,28 @@ enum { class Statistics { public: + // don't forget to call reset() to init stat Statistics(); ~Statistics(); /// read statistics from lisp file - void parse(LispReader& reader); + void parse(const lisp::Lisp& lisp); /// write statistics to lisp file - void write(LispWriter& writer); + void write(lisp::Writer& writer); - // TODO: add drawing functions to draw stats on WorldMap + /* Draw to the worldmap or a game message */ + // TODO: make this functions working + void draw_worldmap_info(DrawingContext& context); + void draw_message_info(DrawingContext& context, std::string title); + /* Add / Set / Get points to/from one of the stats this can keep track of */ void add_points(int stat, int points); + void set_points(int stat, int points); int get_points(int stat); + void set_total_points(int stat, int points); + + /* Reset statistics */ void reset(); /* Give another Statistics object, find the best of each one */ @@ -60,7 +79,10 @@ public: void operator+=(const Statistics& o); private: - int stats[MAX_STATS]; + int stats[NUM_STATS][2]; + + Timer2 timer; + int display_stat; }; extern Statistics global_stats;